1 // -*- mode: cpp; mode: fold -*-
3 // $Id: filelist.h,v 1.10 1999/12/26 06:59:00 jgg Exp $
4 /* ######################################################################
8 These structures represent the uncompacted binary records from the
9 file list file. Functions are provided to compact and decompact these
10 structures for reading and writing.
12 The dsFList class can be instantiated to get get a general 'all records'
13 storage. It also has a member to read the next record from the IO and
14 to print out a record summary.
16 Be sure to read filelist.sgml which contains the precise meaning of
17 the feilds and the compaction technique used.
19 ##################################################################### */
21 #ifndef DSYNC_FILELIST
22 #define DSYNC_FILELIST
25 #pragma interface "dsync/filelist.h"
40 unsigned long Signature;
41 unsigned long MajorVersion;
42 unsigned long MinorVersion;
45 unsigned long FlagCount;
46 unsigned long Flags[15];
58 unsigned long Permissions;
63 enum EntFlags {FlPerm = (1<<0), FlOwner = (1<<1)};
65 /* You know what? egcs-2.91.60 will not call the destructor for Name
66 if this in not here. I can't reproduce this in a simpler context
67 either. - Jgg [time passes] serious egcs bug, it was mislinking
68 the string classes :< */
72 struct Directory : public DirEntity
78 struct NormalFile : public DirEntity
81 unsigned char MD5[16];
83 enum Flags {FlMD5 = (1<<2)};
89 struct Symlink : public DirEntity
91 unsigned long Compress;
98 struct DeviceSpecial : public DirEntity
112 enum Types {Include=1, Exclude=2};
121 unsigned long FileID;
122 unsigned long RealID;
125 enum Flags {FlRealID = (1<<0)};
131 struct HardLink : public NormalFile
133 unsigned long Serial;
142 unsigned long Signature;
152 unsigned long BlockSize;
153 unsigned long FileSize;
155 // Array of 160 bit values (20 bytes) stored in Network byte order
174 enum Types {tHeader=0, tDirMarker=1, tDirStart=2, tDirEnd=3, tNormalFile=4,
175 tSymlink=5, tDeviceSpecial=6, tDirectory=7, tFilter=8,
176 tUidMap=9, tGidMap=10, tHardLink=11, tTrailer=12, tRSyncChecksum=13,
177 tAggregateFile=14, tRSyncEnd=15};
184 DeviceSpecial DevSpecial;
192 AggregateFile AgFile;
195 bool Print(ostream &out);
203 dsFList::Header Header;
206 virtual bool Read(void *Buf,unsigned long Len) = 0;
207 virtual bool Write(const void *Buf,unsigned long Len) = 0;
208 virtual bool Seek(unsigned long Bytes) = 0;
209 virtual unsigned long Tell() = 0;
211 bool ReadNum(unsigned long &Number);
212 bool WriteNum(unsigned long Number);
213 bool ReadInt(unsigned long &Number,unsigned char Count);
214 bool WriteInt(unsigned long Number,unsigned char Count);
215 bool ReadInt(signed long &Number,unsigned char Count);
216 bool WriteInt(signed long Number,unsigned char Count);
217 bool ReadString(string &Foo);
218 bool WriteString(string const &Foo);