Sophie

Sophie

distrib > Mandriva > 2011.0 > i586 > media > contrib-release-debug > by-pkgid > e8c67b4c1444a4044acc3263d013a914 > files > 15

dolly_plus-debug-0.93-7mdv2011.0.i586.rpm

#ifndef Disk_h
#define Disk_h
#include "Buffer.h"

#define NOT_EOF    1
#define EOF_DETECT 2

enum FileStat {S_FREE,S_BEGIN,S_MIDDLE,S_EOF};
class Disk {
 public:
  Disk() {aFD=(-1);fStat=S_FREE;}
  virtual ~Disk() {}
  void close() { ::close(aFD); }
 protected:
  int aFD;
  enum FileStat fStat; // for the moment, it is only 
                       //used in FromDisk@server side
};

class ToDisk : public Disk {
 public:
  ToDisk() { Disk(); }
  ~ToDisk() {}
  int open(const char *path, const int flag);
  int write_frombuff(Buffer *buff);
 private: 
  int pipes_forks(const int fd, const int flag, const int level);
};

class FromDisk : public Disk {
 public:
  FromDisk() { Disk(); }
  ~FromDisk() {}
  int open(const char *filename);
  int read_tobuff(Buffer *buff);
 private:
  int seqNo;   // Count file chunk seq no.
};
#endif