/* Generated from vldb.xg */
#ifndef _VLDB_
#define _VLDB_

#include <atypes.h>

#include <config.h>
#include <roken.h>
#include <fs_errors.h>
#ifndef _COMMON_
#define _COMMON_
#define LockRead 0

#define LockWrite 1

#define LockExtend 2

#define LockRelease 3

#define AFSNAMEMAX 256

struct AFSFid {
     u_int32_t Volume;
     u_int32_t Vnode;
     u_int32_t Unique;
};
typedef struct AFSFid AFSFid;

#define AFSFID_SIZE 12
char *ydr_encode_AFSFid(AFSFid *o, char *ptr, size_t *total_len);
char *ydr_decode_AFSFid(AFSFid *o, char *ptr, size_t *total_len);
void ydr_print_AFSFid(AFSFid *o);
struct VenusFid {
     int32_t Cell;
     struct AFSFid fid;
};
typedef struct VenusFid VenusFid;

#define VENUSFID_SIZE 16
char *ydr_encode_VenusFid(VenusFid *o, char *ptr, size_t *total_len);
char *ydr_decode_VenusFid(VenusFid *o, char *ptr, size_t *total_len);
void ydr_print_VenusFid(VenusFid *o);
struct AFSCallBack {
     u_int32_t CallBackVersion;
     u_int32_t ExpirationTime;
     u_int32_t CallBackType;
};
typedef struct AFSCallBack AFSCallBack;

#define AFSCALLBACK_SIZE 12
char *ydr_encode_AFSCallBack(AFSCallBack *o, char *ptr, size_t *total_len);
char *ydr_decode_AFSCallBack(AFSCallBack *o, char *ptr, size_t *total_len);
void ydr_print_AFSCallBack(AFSCallBack *o);
enum CallBackType {
     CBEXCLUSIVE = 1,
     CBSHARED = 2,
     CBDROPPED = 3
};
typedef enum CallBackType CallBackType;

#define CALLBACKTYPE_SIZE 4
char *ydr_encode_CallBackType(CallBackType *o, char *ptr, size_t *total_len);
char *ydr_decode_CallBackType(CallBackType *o, char *ptr, size_t *total_len);
void ydr_print_CallBackType(CallBackType *o);
struct AFSVolSync {
     u_int32_t spare1;
     u_int32_t spare2;
     u_int32_t spare3;
     u_int32_t spare4;
     u_int32_t spare5;
     u_int32_t spare6;
};
typedef struct AFSVolSync AFSVolSync;

#define AFSVOLSYNC_SIZE 24
char *ydr_encode_AFSVolSync(AFSVolSync *o, char *ptr, size_t *total_len);
char *ydr_decode_AFSVolSync(AFSVolSync *o, char *ptr, size_t *total_len);
void ydr_print_AFSVolSync(AFSVolSync *o);
#define TYPE_FILE 1

#define TYPE_DIR 2

#define TYPE_LINK 3

struct AFSFetchStatus {
     u_int32_t InterfaceVersion;
     u_int32_t FileType;
     u_int32_t LinkCount;
     u_int32_t Length;
     u_int32_t DataVersion;
     u_int32_t Author;
     u_int32_t Owner;
     u_int32_t CallerAccess;
     u_int32_t AnonymousAccess;
     u_int32_t UnixModeBits;
     u_int32_t ParentVnode;
     u_int32_t ParentUnique;
     u_int32_t SegSize;
     u_int32_t ClientModTime;
     u_int32_t ServerModTime;
     u_int32_t Group;
     u_int32_t SyncCount;
     u_int32_t spare1;
     u_int32_t spare2;
     u_int32_t spare3;
     u_int32_t spare4;
};
typedef struct AFSFetchStatus AFSFetchStatus;

#define AFSFETCHSTATUS_SIZE 84
char *ydr_encode_AFSFetchStatus(AFSFetchStatus *o, char *ptr, size_t *total_len);
char *ydr_decode_AFSFetchStatus(AFSFetchStatus *o, char *ptr, size_t *total_len);
void ydr_print_AFSFetchStatus(AFSFetchStatus *o);
#define SS_MODTIME 1

#define SS_OWNER 2

#define SS_GROUP 4

#define SS_MODEBITS 8

#define SS_SEGSIZE 16

#define SS_FSYNC 1024

struct AFSStoreStatus {
     u_int32_t Mask;
     u_int32_t ClientModTime;
     u_int32_t Owner;
     u_int32_t Group;
     u_int32_t UnixModeBits;
     u_int32_t SegSize;
};
typedef struct AFSStoreStatus AFSStoreStatus;

#define AFSSTORESTATUS_SIZE 24
char *ydr_encode_AFSStoreStatus(AFSStoreStatus *o, char *ptr, size_t *total_len);
char *ydr_decode_AFSStoreStatus(AFSStoreStatus *o, char *ptr, size_t *total_len);
void ydr_print_AFSStoreStatus(AFSStoreStatus *o);
struct AFSFetchVolumeStatus {
     int32_t Vid;
     int32_t ParentId;
     char Online;
     char InService;
     char Blessed;
     char NeedsSalvage;
     int32_t Type;
     int32_t MinQuota;
     int32_t MaxQuota;
     int32_t BlocksInUse;
     int32_t PartBlocksAvail;
     int32_t PartMaxBlocks;
};
typedef struct AFSFetchVolumeStatus AFSFetchVolumeStatus;

#define AFSFETCHVOLUMESTATUS_SIZE 48
char *ydr_encode_AFSFetchVolumeStatus(AFSFetchVolumeStatus *o, char *ptr, size_t *total_len);
char *ydr_decode_AFSFetchVolumeStatus(AFSFetchVolumeStatus *o, char *ptr, size_t *total_len);
void ydr_print_AFSFetchVolumeStatus(AFSFetchVolumeStatus *o);
struct AFSStoreVolumeStatus {
     int32_t Mask;
     int32_t MinQuota;
     int32_t MaxQuota;
};
typedef struct AFSStoreVolumeStatus AFSStoreVolumeStatus;

#define AFSSTOREVOLUMESTATUS_SIZE 12
char *ydr_encode_AFSStoreVolumeStatus(AFSStoreVolumeStatus *o, char *ptr, size_t *total_len);
char *ydr_decode_AFSStoreVolumeStatus(AFSStoreVolumeStatus *o, char *ptr, size_t *total_len);
void ydr_print_AFSStoreVolumeStatus(AFSStoreVolumeStatus *o);
#define AFSOPAQUEMAX 1024

typedef struct {
unsigned len;
char *val;
} AFSOpaque;

char *ydr_encode_AFSOpaque(AFSOpaque *o, char *ptr, size_t *total_len);
char *ydr_decode_AFSOpaque(AFSOpaque *o, char *ptr, size_t *total_len);
void ydr_print_AFSOpaque(AFSOpaque *o);
typedef int32_t ViceLockType;

#define VICELOCKTYPE_SIZE 4
char *ydr_encode_ViceLockType(ViceLockType *o, char *ptr, size_t *total_len);
char *ydr_decode_ViceLockType(ViceLockType *o, char *ptr, size_t *total_len);
void ydr_print_ViceLockType(ViceLockType *o);
#define AFSCBMAX 50

typedef struct {
unsigned len;
struct AFSCallBack *val;
} AFSCBs;

char *ydr_encode_AFSCBs(AFSCBs *o, char *ptr, size_t *total_len);
char *ydr_decode_AFSCBs(AFSCBs *o, char *ptr, size_t *total_len);
void ydr_print_AFSCBs(AFSCBs *o);
typedef struct {
unsigned len;
struct AFSFetchStatus *val;
} AFSBulkStats;

char *ydr_encode_AFSBulkStats(AFSBulkStats *o, char *ptr, size_t *total_len);
char *ydr_decode_AFSBulkStats(AFSBulkStats *o, char *ptr, size_t *total_len);
void ydr_print_AFSBulkStats(AFSBulkStats *o);
typedef struct {
unsigned len;
struct AFSFid *val;
} AFSCBFids;

char *ydr_encode_AFSCBFids(AFSCBFids *o, char *ptr, size_t *total_len);
char *ydr_decode_AFSCBFids(AFSCBFids *o, char *ptr, size_t *total_len);
void ydr_print_AFSCBFids(AFSCBFids *o);
#define PRSFS_READ 1

#define PRSFS_WRITE 2

#define PRSFS_INSERT 4

#define PRSFS_LOOKUP 8

#define PRSFS_DELETE 16

#define PRSFS_LOCK 32

#define PRSFS_ADMINISTER 64

struct AFSVolumeInfo {
     u_int32_t Vid;
     int32_t Type;
     u_int32_t Type0;
     u_int32_t Type1;
     u_int32_t Type2;
     u_int32_t Type3;
     u_int32_t Type4;
     u_int32_t ServerCount;
     u_int32_t Server0;
     u_int32_t Server1;
     u_int32_t Server2;
     u_int32_t Server3;
     u_int32_t Server4;
     u_int32_t Server5;
     u_int32_t Server6;
     u_int32_t Server7;
     u_int16_t Port0;
     u_int16_t Port1;
     u_int16_t Port2;
     u_int16_t Port3;
     u_int16_t Port4;
     u_int16_t Port5;
     u_int16_t Port6;
     u_int16_t Port7;
};
typedef struct AFSVolumeInfo AFSVolumeInfo;

#define AFSVOLUMEINFO_SIZE 96
char *ydr_encode_AFSVolumeInfo(AFSVolumeInfo *o, char *ptr, size_t *total_len);
char *ydr_decode_AFSVolumeInfo(AFSVolumeInfo *o, char *ptr, size_t *total_len);
void ydr_print_AFSVolumeInfo(AFSVolumeInfo *o);
struct afsUUID {
     u_int32_t time_low;
     u_int16_t time_mid;
     u_int16_t time_hi_and_version;
     char clock_seq_hi_and_reserved;
     char clock_seq_low;
     char node[ 6 ];
};
typedef struct afsUUID afsUUID;

#define AFSUUID_SIZE 44
char *ydr_encode_afsUUID(afsUUID *o, char *ptr, size_t *total_len);
char *ydr_decode_afsUUID(afsUUID *o, char *ptr, size_t *total_len);
void ydr_print_afsUUID(afsUUID *o);
#endif  
#define VLDB_MAXNAMELEN 65

#define MAXNSERVERS 8

#define NMAXNSERVERS 13

#define MAX_NUMBER_OPCODES 30

#define MAXTYPES 3

#define MAXSERVERID 30

#define HASHSIZE 8191

#define DEFAULTBULK 10000

typedef struct {
unsigned len;
char *val;
} bulk;

char *ydr_encode_bulk(bulk *o, char *ptr, size_t *total_len);
char *ydr_decode_bulk(bulk *o, char *ptr, size_t *total_len);
void ydr_print_bulk(bulk *o);
#define VLLIST_SERVER 1

#define VLLIST_PARTITION 2

#define VLLIST_VOLUMETYPE 4

#define VLLIST_VOLUMEID 8

#define VLLIST_FLAG 16

#define RWVOL 0

#define ROVOL 1

#define BACKVOL 2

#define VLSF_NEWREPSITE 1

#define VLSF_ROVOL 2

#define VLSF_RWVOL 4

#define VLSF_BACKVOL 8

#define VLSF_UUID 16

#define VLSF_DONTUSE 32

#define VLF_RWEXISTS 4096

#define VLF_ROEXISTS 8192

#define VLF_BOEXISTS 16384

#define VLF_BACKEXISTS 16384

#define VLF_DFSFILESET 32768

#define VL_IDEXIST 363520

#define VL_IO 363521

#define VL_NAMEEXIST 363522

#define VL_CREATEFAIL 363523

#define VL_NOENT 363524

#define VL_EMPTY 363525

#define VL_ENTDELETED 363526

#define VL_BADNAME 363527

#define VL_BADINDEX 363528

#define VL_BADVOLTYPE 363529

#define VL_BADPARTITION 363530

#define VL_BADSERVER 363531

#define VL_REPSFULL 363532

#define VL_NOREPSERVER 363533

#define VL_DUPREPSERVER 363534

#define VL_RWNOTFOUND 363535

#define VL_BADREFCOUNT 363536

#define VL_SIZEEXCEEDED 363537

#define VL_BADENTRY 363538

#define VL_BADVOLIDBUMP 363539

#define VL_IDALREADHASED 363540

#define VL_ENTRYLOCKED 363541

#define VL_BADVOLOPER 363542

#define VL_BADRELLOCKTYPE 363543

#define VL_RERELEASE 363544

#define VL_BADSERVERFLAG 363545

#define VL_PERM 363546

#define VL_NOMEM 363547

#define VLFREE 1

#define VLDELETED 2

#define VLLOCKED 4

#define VLOP_MOVE 16

#define VLOP_RELEASE 32

#define VLOP_BACKUP 64

#define VLOP_DELETE 128

#define VLOP_DUMP 256

#define LOCKREL_TIMESTAMP 1

#define LOCKREL_OPCODE 2

#define LOCKREL_AFSID 4

struct vldbentry {
     char name[ 65 ];
     int32_t volumeType;
     int32_t nServers;
     int32_t serverNumber[ 8 ];
     int32_t serverPartition[ 8 ];
     int32_t serverFlags[ 8 ];
     u_int32_t volumeId[ 3 ];
     int32_t cloneId;
     int32_t flags;
};
typedef struct vldbentry vldbentry;

#define VLDBENTRY_SIZE 384
char *ydr_encode_vldbentry(vldbentry *o, char *ptr, size_t *total_len);
char *ydr_decode_vldbentry(vldbentry *o, char *ptr, size_t *total_len);
void ydr_print_vldbentry(vldbentry *o);
struct nvldbentry {
     char name[ 65 ];
     int32_t nServers;
     int32_t serverNumber[ 13 ];
     int32_t serverPartition[ 13 ];
     int32_t serverFlags[ 13 ];
     u_int32_t volumeId[ 3 ];
     int32_t cloneId;
     int32_t flags;
     int32_t spares1;
     int32_t spares2;
     int32_t spares3;
     int32_t spares4;
     int32_t spares5;
     int32_t spares6;
     int32_t spares7;
     int32_t spares8;
     int32_t spares9;
};
typedef struct nvldbentry nvldbentry;

#define NVLDBENTRY_SIZE 476
char *ydr_encode_nvldbentry(nvldbentry *o, char *ptr, size_t *total_len);
char *ydr_decode_nvldbentry(nvldbentry *o, char *ptr, size_t *total_len);
void ydr_print_nvldbentry(nvldbentry *o);
struct vlentry {
     u_int32_t volumeId[ 3 ];
     int32_t flags;
     int32_t LockAfsId;
     int32_t LockTimestamp;
     int32_t cloneId;
     int32_t AssociatedChain;
     int32_t nextIdHash[ 3 ];
     int32_t nextNameHash;
     int32_t spares1[ 2 ];
     char name[ 65 ];
     unsigned char volumeType;
     unsigned char serverNumber[ 8 ];
     unsigned char serverPartition[ 8 ];
     unsigned char serverFlags[ 8 ];
     unsigned char RefCount;
     char spares2[ 1 ];
};
typedef struct vlentry vlentry;

#define VLENTRY_SIZE 424
char *ydr_encode_vlentry(vlentry *o, char *ptr, size_t *total_len);
char *ydr_decode_vlentry(vlentry *o, char *ptr, size_t *total_len);
void ydr_print_vlentry(vlentry *o);
struct disk_vlentry {
     u_int32_t volumeId[ 3 ];
     int32_t flags;
     int32_t LockAfsId;
     int32_t LockTimestamp;
     int32_t cloneId;
     int32_t AssociatedChain;
     int32_t nextIdHash[ 3 ];
     int32_t nextNameHash;
     int32_t spares1[ 2 ];
     char name[ 65 ];
     unsigned char volumeType;
     int32_t serverNumber[ 8 ];
     unsigned char serverPartition[ 8 ];
     unsigned char serverFlags[ 8 ];
     unsigned char RefCount;
     char spares2[ 1 ];
};
typedef struct disk_vlentry disk_vlentry;

#define DISK_VLENTRY_SIZE 424
char *ydr_encode_disk_vlentry(disk_vlentry *o, char *ptr, size_t *total_len);
char *ydr_decode_disk_vlentry(disk_vlentry *o, char *ptr, size_t *total_len);
void ydr_print_disk_vlentry(disk_vlentry *o);
struct vital_vlheader {
     int32_t vldbversion;
     int32_t headersize;
     int32_t freePtr;
     int32_t eofPtr;
     int32_t allocs;
     int32_t frees;
     int32_t MaxVolumeId;
     int32_t totalEntries[ 3 ];
};
typedef struct vital_vlheader vital_vlheader;

#define VITAL_VLHEADER_SIZE 40
char *ydr_encode_vital_vlheader(vital_vlheader *o, char *ptr, size_t *total_len);
char *ydr_decode_vital_vlheader(vital_vlheader *o, char *ptr, size_t *total_len);
void ydr_print_vital_vlheader(vital_vlheader *o);
typedef int32_t longarray[ 3 ];

#define LONGARRAY_SIZE 12
char *ydr_encode_longarray(longarray *o, char *ptr, size_t *total_len);
char *ydr_decode_longarray(longarray *o, char *ptr, size_t *total_len);
void ydr_print_longarray(longarray *o);
struct vlheader {
     struct vital_vlheader vital_header;
     u_int32_t IpMappedAddr[ 30 ];
     int32_t VolnameHash[ 8191 ];
     longarray VolidHash[ 8191 ];
};
typedef struct vlheader vlheader;

#define VLHEADER_SIZE 131216
char *ydr_encode_vlheader(vlheader *o, char *ptr, size_t *total_len);
char *ydr_decode_vlheader(vlheader *o, char *ptr, size_t *total_len);
void ydr_print_vlheader(vlheader *o);
#define VLUPDATE_VOLUMENAME 1

#define VLUPDATE_FLAGS 4

#define VLUPDATE_READONLYID 8

#define VLUPDATE_BACKUPID 16

#define VLUPDATE_REPSITES 32

#define VLUPDATE_CLONEID 128

#define VLUPDATE_VOLNAMEHASH 256

#define VLUPDATE_RWID 512

#define VLUPDATE_REPS_DELETE 256

#define VLUPDATE_REPS_ADD 512

#define VLUPDATE_REPS_MODSERV 1024

#define VLUPDATE_REPS_MODPART 2048

#define VLUPDATE_REPS_MODFLAG 4096

struct VldbUpdateEntry {
     u_int32_t Mask;
     char name[ 65 ];
     int32_t volumeType;
     int32_t flags;
     u_int32_t ReadOnlyId;
     u_int32_t BackupId;
     int32_t cloneid;
     int32_t nModifiedRepsites;
     u_int32_t RepsitesMask[ 8 ];
     int32_t RepsitesTargetServer[ 8 ];
     int32_t RepsitesTargetPart[ 8 ];
     int32_t RepsitesNewServer[ 8 ];
     int32_t RepsitesNewPart[ 8 ];
     int32_t RepsitesNewFlags[ 8 ];
};
typedef struct VldbUpdateEntry VldbUpdateEntry;

#define VLDBUPDATEENTRY_SIZE 480
char *ydr_encode_VldbUpdateEntry(VldbUpdateEntry *o, char *ptr, size_t *total_len);
char *ydr_decode_VldbUpdateEntry(VldbUpdateEntry *o, char *ptr, size_t *total_len);
void ydr_print_VldbUpdateEntry(VldbUpdateEntry *o);
struct VldbListByAttributes {
     u_int32_t Mask;
     int32_t server;
     int32_t partition;
     int32_t volumetype;
     int32_t volumeid;
     int32_t flag;
};
typedef struct VldbListByAttributes VldbListByAttributes;

#define VLDBLISTBYATTRIBUTES_SIZE 24
char *ydr_encode_VldbListByAttributes(VldbListByAttributes *o, char *ptr, size_t *total_len);
char *ydr_decode_VldbListByAttributes(VldbListByAttributes *o, char *ptr, size_t *total_len);
void ydr_print_VldbListByAttributes(VldbListByAttributes *o);
struct uvldbentry {
     char name[ 65 ];
     int32_t nServers;
     struct afsUUID serverNumber[ 13 ];
     int32_t serverUnique[ 13 ];
     int32_t serverPartition[ 13 ];
     int32_t serverFlags[ 13 ];
     u_int32_t volumeId[ 3 ];
     int32_t cloneId;
     int32_t flags;
     int32_t spares1;
     int32_t spares2;
     int32_t spares3;
     int32_t spares4;
     int32_t spares5;
     int32_t spares6;
     int32_t spares7;
     int32_t spares8;
     int32_t spares9;
};
typedef struct uvldbentry uvldbentry;

#define UVLDBENTRY_SIZE 1048
char *ydr_encode_uvldbentry(uvldbentry *o, char *ptr, size_t *total_len);
char *ydr_decode_uvldbentry(uvldbentry *o, char *ptr, size_t *total_len);
void ydr_print_uvldbentry(uvldbentry *o);
struct vldstats {
     u_int32_t start_time;
     int32_t requests[ 30 ];
     int32_t aborts[ 30 ];
     int32_t reserved[ 5 ];
};
typedef struct vldstats vldstats;

#define VLDSTATS_SIZE 264
char *ydr_encode_vldstats(vldstats *o, char *ptr, size_t *total_len);
char *ydr_decode_vldstats(vldstats *o, char *ptr, size_t *total_len);
void ydr_print_vldstats(vldstats *o);
typedef struct {
unsigned len;
struct vldbentry *val;
} bulkentries;

char *ydr_encode_bulkentries(bulkentries *o, char *ptr, size_t *total_len);
char *ydr_decode_bulkentries(bulkentries *o, char *ptr, size_t *total_len);
void ydr_print_bulkentries(bulkentries *o);
typedef struct {
unsigned len;
struct nvldbentry *val;
} nbulkentries;

char *ydr_encode_nbulkentries(nbulkentries *o, char *ptr, size_t *total_len);
char *ydr_decode_nbulkentries(nbulkentries *o, char *ptr, size_t *total_len);
void ydr_print_nbulkentries(nbulkentries *o);
typedef struct {
unsigned len;
struct uvldbentry *val;
} ubulkentries;

char *ydr_encode_ubulkentries(ubulkentries *o, char *ptr, size_t *total_len);
char *ydr_decode_ubulkentries(ubulkentries *o, char *ptr, size_t *total_len);
void ydr_print_ubulkentries(ubulkentries *o);
#define VLADDR_IPADDR 1

#define VLADDR_INDEX 2

#define VLADDR_UUID 4

struct ListAddrByAttributes {
     int32_t mask;
     u_int32_t ipaddr;
     int32_t index;
     int32_t spare;
     struct afsUUID uuid;
};
typedef struct ListAddrByAttributes ListAddrByAttributes;

#define LISTADDRBYATTRIBUTES_SIZE 60
char *ydr_encode_ListAddrByAttributes(ListAddrByAttributes *o, char *ptr, size_t *total_len);
char *ydr_decode_ListAddrByAttributes(ListAddrByAttributes *o, char *ptr, size_t *total_len);
void ydr_print_ListAddrByAttributes(ListAddrByAttributes *o);
typedef struct {
unsigned len;
int32_t *val;
} bulkaddrs;

char *ydr_encode_bulkaddrs(bulkaddrs *o, char *ptr, size_t *total_len);
char *ydr_decode_bulkaddrs(bulkaddrs *o, char *ptr, size_t *total_len);
void ydr_print_bulkaddrs(bulkaddrs *o);
struct VL_Callback {
     u_int32_t version;
     u_int32_t expiration_time;
     u_int32_t time;
     u_int32_t handle;
};
typedef struct VL_Callback VL_Callback;

#define VL_CALLBACK_SIZE 16
char *ydr_encode_VL_Callback(VL_Callback *o, char *ptr, size_t *total_len);
char *ydr_decode_VL_Callback(VL_Callback *o, char *ptr, size_t *total_len);
void ydr_print_VL_Callback(VL_Callback *o);

#endif /* VLDB */
