/* Generated from vldb.xg */
#include <vldb.h>

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <netinet/in.h>
#ifndef HAVE_BCOPY
#define bcopy(a,b,c) memcpy((b),(a),(c))
#endif /* !HAVE_BCOPY */

char *ydr_encode_bulk(bulk *o, char *ptr)
{
{ int32_t tmp = htonl((*o).len); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{
char zero[4] = {0, 0, 0, 0};
memcpy (ptr, (*o).val, (*o).len);
memcpy (ptr + (*o).len, zero, (4 - ((*o).len % 4)) % 4);
ptr += (*o).len + (4 - ((*o).len % 4)) % 4;
}
return ptr;
}
char *ydr_decode_bulk(bulk *o, char *ptr)
{
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).len = ntohl(tmp); ptr += sizeof(int);}
{
memcpy ((*o).val, ptr, (*o).len);
ptr += (*o).len + (4 - ((*o).len % 4)) % 4;
}
return ptr;
}
char *ydr_encode_vldbentry(vldbentry *o, char *ptr)
{
{
int i0;
for(i0 = 0; i0 < 65;++i0){
{ int32_t tmp = htonl((*o).name[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{ int32_t tmp = htonl((*o).volumeType); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).nServers); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp = htonl((*o).serverNumber[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp = htonl((*o).serverPartition[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp = htonl((*o).serverFlags[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 3;++i0){
{ int32_t tmp = htonl((*o).volumeId[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{ int32_t tmp = htonl((*o).cloneId); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).flags); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
return ptr;
}
char *ydr_decode_vldbentry(vldbentry *o, char *ptr)
{
{
int i0;
for(i0 = 0; i0 < 65;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).name[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).volumeType = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).nServers = ntohl(tmp); ptr += sizeof(int);}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).serverNumber[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).serverPartition[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).serverFlags[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 3;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).volumeId[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).cloneId = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).flags = ntohl(tmp); ptr += sizeof(int);}
return ptr;
}
char *ydr_encode_vital_vlheader(vital_vlheader *o, char *ptr)
{
{ int32_t tmp = htonl((*o).vldbversion); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).headersize); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).feePtr); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).eofPtr); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).allocs); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).frees); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).MaxVolumeId); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{
int i0;
for(i0 = 0; i0 < 3;++i0){
{ int32_t tmp = htonl((*o).totalEntries[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
return ptr;
}
char *ydr_decode_vital_vlheader(vital_vlheader *o, char *ptr)
{
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).vldbversion = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).headersize = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).feePtr = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).eofPtr = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).allocs = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).frees = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).MaxVolumeId = ntohl(tmp); ptr += sizeof(int);}
{
int i0;
for(i0 = 0; i0 < 3;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).totalEntries[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
return ptr;
}
char *ydr_encode_VldbUpdateEntry(VldbUpdateEntry *o, char *ptr)
{
{ int32_t tmp = htonl((*o).Mask); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{
int i0;
for(i0 = 0; i0 < 65;++i0){
{ int32_t tmp = htonl((*o).name[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{ int32_t tmp = htonl((*o).volumeType); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).flags); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).ReadOnlyId); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).BackupId); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).cloneid); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).nModifiedRepsites); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp = htonl((*o).RepsitesMask[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp = htonl((*o).RepsitesTargetServer[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp = htonl((*o).RepsitesTargetPart[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp = htonl((*o).RepsitesNewServer[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp = htonl((*o).RepsitesNewPart[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp = htonl((*o).RepsitesNewFlags[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
return ptr;
}
char *ydr_decode_VldbUpdateEntry(VldbUpdateEntry *o, char *ptr)
{
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).Mask = ntohl(tmp); ptr += sizeof(int);}
{
int i0;
for(i0 = 0; i0 < 65;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).name[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).volumeType = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).flags = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).ReadOnlyId = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).BackupId = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).cloneid = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).nModifiedRepsites = ntohl(tmp); ptr += sizeof(int);}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).RepsitesMask[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).RepsitesTargetServer[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).RepsitesTargetPart[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).RepsitesNewServer[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).RepsitesNewPart[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).RepsitesNewFlags[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
return ptr;
}
char *ydr_encode_VldbListByAttributes(VldbListByAttributes *o, char *ptr)
{
{ int32_t tmp = htonl((*o).Mask); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).server); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).partition); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).volumetype); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).volumeid); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).flag); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
return ptr;
}
char *ydr_decode_VldbListByAttributes(VldbListByAttributes *o, char *ptr)
{
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).Mask = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).server = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).partition = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).volumetype = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).volumeid = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).flag = ntohl(tmp); ptr += sizeof(int);}
return ptr;
}
char *ydr_encode_vldstats(vldstats *o, char *ptr)
{
{ int32_t tmp = htonl((*o).start_time); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{
int i0;
for(i0 = 0; i0 < 30;++i0){
{ int32_t tmp = htonl((*o).requests[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 30;++i0){
{ int32_t tmp = htonl((*o).aborts[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 5;++i0){
{ int32_t tmp = htonl((*o).reserved[i0]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
return ptr;
}
char *ydr_decode_vldstats(vldstats *o, char *ptr)
{
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).start_time = ntohl(tmp); ptr += sizeof(int);}
{
int i0;
for(i0 = 0; i0 < 30;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).requests[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 30;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).aborts[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
{
int i0;
for(i0 = 0; i0 < 5;++i0){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).reserved[i0] = ntohl(tmp); ptr += sizeof(int);}
}
}
return ptr;
}
char *ydr_encode_bulkentries(bulkentries *o, char *ptr)
{
{ int32_t tmp = htonl((*o).len); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{
int i0;
for(i0 = 0; i0 < (*o).len;++i0){
{
int i1;
for(i1 = 0; i1 < 65;++i1){
{ int32_t tmp = htonl((*o).val[i0].name[i1]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{ int32_t tmp = htonl((*o).val[i0].volumeType); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).val[i0].nServers); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{
int i1;
for(i1 = 0; i1 < 8;++i1){
{ int32_t tmp = htonl((*o).val[i0].serverNumber[i1]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{
int i1;
for(i1 = 0; i1 < 8;++i1){
{ int32_t tmp = htonl((*o).val[i0].serverPartition[i1]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{
int i1;
for(i1 = 0; i1 < 8;++i1){
{ int32_t tmp = htonl((*o).val[i0].serverFlags[i1]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{
int i1;
for(i1 = 0; i1 < 3;++i1){
{ int32_t tmp = htonl((*o).val[i0].volumeId[i1]); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
{ int32_t tmp = htonl((*o).val[i0].cloneId); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
{ int32_t tmp = htonl((*o).val[i0].flags); bcopy ((char*)&tmp, ptr, sizeof(int)); ptr += sizeof(int);}
}
}
return ptr;
}
char *ydr_decode_bulkentries(bulkentries *o, char *ptr)
{
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).len = ntohl(tmp); ptr += sizeof(int);}
(*o).val = (struct vldbentry *)malloc(sizeof(struct vldbentry ) * (*o).len);
{
int i0;
for(i0 = 0; i0 < (*o).len;++i0){
{
int i1;
for(i1 = 0; i1 < 65;++i1){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).val[i0].name[i1] = ntohl(tmp); ptr += sizeof(int);}
}
}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).val[i0].volumeType = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).val[i0].nServers = ntohl(tmp); ptr += sizeof(int);}
{
int i1;
for(i1 = 0; i1 < 8;++i1){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).val[i0].serverNumber[i1] = ntohl(tmp); ptr += sizeof(int);}
}
}
{
int i1;
for(i1 = 0; i1 < 8;++i1){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).val[i0].serverPartition[i1] = ntohl(tmp); ptr += sizeof(int);}
}
}
{
int i1;
for(i1 = 0; i1 < 8;++i1){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).val[i0].serverFlags[i1] = ntohl(tmp); ptr += sizeof(int);}
}
}
{
int i1;
for(i1 = 0; i1 < 3;++i1){
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).val[i0].volumeId[i1] = ntohl(tmp); ptr += sizeof(int);}
}
}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).val[i0].cloneId = ntohl(tmp); ptr += sizeof(int);}
{ int32_t tmp; bcopy (ptr, (char *)&tmp, sizeof(int)); (*o).val[i0].flags = ntohl(tmp); ptr += sizeof(int);}
}
}
return ptr;
}
