/* Generated from vldb.xg */
#include "vldb.h"

#include "vldb.ss.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 */

int _VL_CreateEntry(
struct rx_call *call)
{
int _result;
struct vldbentry newentry;

{
int i0;
for(i0 = 0; i0 < 65;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.name[i0] = ntohl (u);
}
}
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.volumeType = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.nServers = ntohl (u);
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.serverNumber[i0] = ntohl (u);
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.serverPartition[i0] = ntohl (u);
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.serverFlags[i0] = ntohl (u);
}
}
}
{
int i0;
for(i0 = 0; i0 < 3;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.volumeId[i0] = ntohl (u);
}
}
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.cloneId = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.flags = ntohl (u);
}
_result = VL_CreateEntry(call, &newentry);
return _result;
}

int _VL_DeleteEntry(
struct rx_call *call)
{
int _result;
int32_t Volid;
int32_t voltype;

{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
Volid = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
voltype = ntohl (u);
}
_result = VL_DeleteEntry(call, Volid, voltype);
return _result;
}

int _VL_GetEntryByID(
struct rx_call *call)
{
int _result;
int32_t Volid;
int32_t voltype;
struct vldbentry entry;

{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
Volid = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
voltype = ntohl (u);
}
_result = VL_GetEntryByID(call, Volid, voltype, &entry);
{
int i0;
for(i0 = 0; i0 < 65;++i0){
{ u_int32_t u;
u = htonl (entry.name[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{ u_int32_t u;
u = htonl (entry.volumeType);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (entry.nServers);
rx_Write(call, &u, sizeof(u));
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
u = htonl (entry.serverNumber[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
u = htonl (entry.serverPartition[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
u = htonl (entry.serverFlags[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i0;
for(i0 = 0; i0 < 3;++i0){
{ u_int32_t u;
u = htonl (entry.volumeId[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{ u_int32_t u;
u = htonl (entry.cloneId);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (entry.flags);
rx_Write(call, &u, sizeof(u));
}
return _result;
}

int _VL_GetEntryByName(
struct rx_call *call)
{
int _result;
char *volumename;
struct vldbentry entry;

{ unsigned len;
char zero[4] = {0, 0, 0, 0};
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
len = ntohl (u);
}
rx_Read(call, volumename, len);
rx_Read(call, zero, (4 - (len % 4)) % 4);
}
_result = VL_GetEntryByName(call, volumename, &entry);
{
int i0;
for(i0 = 0; i0 < 65;++i0){
{ u_int32_t u;
u = htonl (entry.name[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{ u_int32_t u;
u = htonl (entry.volumeType);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (entry.nServers);
rx_Write(call, &u, sizeof(u));
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
u = htonl (entry.serverNumber[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
u = htonl (entry.serverPartition[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
u = htonl (entry.serverFlags[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i0;
for(i0 = 0; i0 < 3;++i0){
{ u_int32_t u;
u = htonl (entry.volumeId[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{ u_int32_t u;
u = htonl (entry.cloneId);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (entry.flags);
rx_Write(call, &u, sizeof(u));
}
return _result;
}

int _VL_GetNewVolumeId(
struct rx_call *call)
{
int _result;
int32_t bumpcount;
int32_t newvolumid;

{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
bumpcount = ntohl (u);
}
_result = VL_GetNewVolumeId(call, bumpcount, &newvolumid);
{ u_int32_t u;
u = htonl (newvolumid);
rx_Write(call, &u, sizeof(u));
}
return _result;
}

int _VL_ReplaceEntry(
struct rx_call *call)
{
int _result;
int32_t Volid;
int32_t voltype;
struct vldbentry newentry;
int32_t ReleaseType;

{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
Volid = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
voltype = ntohl (u);
}
{
int i0;
for(i0 = 0; i0 < 65;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.name[i0] = ntohl (u);
}
}
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.volumeType = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.nServers = ntohl (u);
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.serverNumber[i0] = ntohl (u);
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.serverPartition[i0] = ntohl (u);
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.serverFlags[i0] = ntohl (u);
}
}
}
{
int i0;
for(i0 = 0; i0 < 3;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.volumeId[i0] = ntohl (u);
}
}
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.cloneId = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
newentry.flags = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
ReleaseType = ntohl (u);
}
_result = VL_ReplaceEntry(call, Volid, voltype, &newentry, ReleaseType);
return _result;
}

int _VL_UpdateEntry(
struct rx_call *call)
{
int _result;
int32_t Volid;
int32_t voltype;
struct VldbUpdateEntry UpdateEntry;
int32_t ReleaseType;

{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
Volid = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
voltype = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.Mask = ntohl (u);
}
{
int i0;
for(i0 = 0; i0 < 65;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.name[i0] = ntohl (u);
}
}
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.volumeType = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.flags = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.ReadOnlyId = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.BackupId = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.cloneid = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.nModifiedRepsites = ntohl (u);
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.RepsitesMask[i0] = ntohl (u);
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.RepsitesTargetServer[i0] = ntohl (u);
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.RepsitesTargetPart[i0] = ntohl (u);
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.RepsitesNewServer[i0] = ntohl (u);
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.RepsitesNewPart[i0] = ntohl (u);
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
UpdateEntry.RepsitesNewFlags[i0] = ntohl (u);
}
}
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
ReleaseType = ntohl (u);
}
_result = VL_UpdateEntry(call, Volid, voltype, &UpdateEntry, ReleaseType);
return _result;
}

int _VL_SetLock(
struct rx_call *call)
{
int _result;
int32_t Volid;
int32_t voltype;
int32_t voloper;

{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
Volid = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
voltype = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
voloper = ntohl (u);
}
_result = VL_SetLock(call, Volid, voltype, voloper);
return _result;
}

int _VL_ReleaseLock(
struct rx_call *call)
{
int _result;
int32_t volid;
int32_t voltype;
int32_t ReleaseType;

{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
volid = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
voltype = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
ReleaseType = ntohl (u);
}
_result = VL_ReleaseLock(call, volid, voltype, ReleaseType);
return _result;
}

int _VL_ListEntry(
struct rx_call *call)
{
int _result;
int32_t previous_index;
int32_t count;
int32_t next_index;
struct vldbentry entry;

{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
previous_index = ntohl (u);
}
_result = VL_ListEntry(call, previous_index, &count, &next_index, &entry);
{ u_int32_t u;
u = htonl (count);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (next_index);
rx_Write(call, &u, sizeof(u));
}
{
int i0;
for(i0 = 0; i0 < 65;++i0){
{ u_int32_t u;
u = htonl (entry.name[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{ u_int32_t u;
u = htonl (entry.volumeType);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (entry.nServers);
rx_Write(call, &u, sizeof(u));
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
u = htonl (entry.serverNumber[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
u = htonl (entry.serverPartition[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i0;
for(i0 = 0; i0 < 8;++i0){
{ u_int32_t u;
u = htonl (entry.serverFlags[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i0;
for(i0 = 0; i0 < 3;++i0){
{ u_int32_t u;
u = htonl (entry.volumeId[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{ u_int32_t u;
u = htonl (entry.cloneId);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (entry.flags);
rx_Write(call, &u, sizeof(u));
}
return _result;
}

int _VL_ListAttributes(
struct rx_call *call)
{
int _result;
struct VldbListByAttributes attributes;
int32_t nentries;
bulkentries blkentries;

{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
attributes.Mask = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
attributes.server = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
attributes.partition = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
attributes.volumetype = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
attributes.volumeid = ntohl (u);
}
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
attributes.flag = ntohl (u);
}
_result = VL_ListAttributes(call, &attributes, &nentries, &blkentries);
{ u_int32_t u;
u = htonl (nentries);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (blkentries.len);
rx_Write(call, &u, sizeof(u));
}
{
int i0;
for(i0 = 0; i0 < blkentries.len;++i0){
{
int i1;
for(i1 = 0; i1 < 65;++i1){
{ u_int32_t u;
u = htonl (blkentries.val[i0].name[i1]);
rx_Write(call, &u, sizeof(u));
}
}
}
{ u_int32_t u;
u = htonl (blkentries.val[i0].volumeType);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (blkentries.val[i0].nServers);
rx_Write(call, &u, sizeof(u));
}
{
int i1;
for(i1 = 0; i1 < 8;++i1){
{ u_int32_t u;
u = htonl (blkentries.val[i0].serverNumber[i1]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i1;
for(i1 = 0; i1 < 8;++i1){
{ u_int32_t u;
u = htonl (blkentries.val[i0].serverPartition[i1]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i1;
for(i1 = 0; i1 < 8;++i1){
{ u_int32_t u;
u = htonl (blkentries.val[i0].serverFlags[i1]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i1;
for(i1 = 0; i1 < 3;++i1){
{ u_int32_t u;
u = htonl (blkentries.val[i0].volumeId[i1]);
rx_Write(call, &u, sizeof(u));
}
}
}
{ u_int32_t u;
u = htonl (blkentries.val[i0].cloneId);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (blkentries.val[i0].flags);
rx_Write(call, &u, sizeof(u));
}
}
}
return _result;
}

int _VL_GetStats(
struct rx_call *call)
{
int _result;
struct vldstats stats;
struct vital_vlheader vital_header;

_result = VL_GetStats(call, &stats, &vital_header);
{ u_int32_t u;
u = htonl (stats.start_time);
rx_Write(call, &u, sizeof(u));
}
{
int i0;
for(i0 = 0; i0 < 30;++i0){
{ u_int32_t u;
u = htonl (stats.requests[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i0;
for(i0 = 0; i0 < 30;++i0){
{ u_int32_t u;
u = htonl (stats.aborts[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{
int i0;
for(i0 = 0; i0 < 5;++i0){
{ u_int32_t u;
u = htonl (stats.reserved[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
{ u_int32_t u;
u = htonl (vital_header.vldbversion);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (vital_header.headersize);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (vital_header.feePtr);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (vital_header.eofPtr);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (vital_header.allocs);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (vital_header.frees);
rx_Write(call, &u, sizeof(u));
}
{ u_int32_t u;
u = htonl (vital_header.MaxVolumeId);
rx_Write(call, &u, sizeof(u));
}
{
int i0;
for(i0 = 0; i0 < 3;++i0){
{ u_int32_t u;
u = htonl (vital_header.totalEntries[i0]);
rx_Write(call, &u, sizeof(u));
}
}
}
return _result;
}

int _VL_Probe(
struct rx_call *call)
{
int _result;

_result = VL_Probe(call);
return _result;
}

int VL_ExecuteRequest(struct rx_call *call)
{
unsigned opcode;
int _result;
{ u_int32_t u;
rx_Read(call, &u, sizeof(u));
opcode = ntohl (u);
}
switch(opcode) {
case 501: {
_result = _VL_CreateEntry(call);
break;
}
case 502: {
_result = _VL_DeleteEntry(call);
break;
}
case 503: {
_result = _VL_GetEntryByID(call);
break;
}
case 504: {
_result = _VL_GetEntryByName(call);
break;
}
case 505: {
_result = _VL_GetNewVolumeId(call);
break;
}
case 506: {
_result = _VL_ReplaceEntry(call);
break;
}
case 507: {
_result = _VL_UpdateEntry(call);
break;
}
case 508: {
_result = _VL_SetLock(call);
break;
}
case 509: {
_result = _VL_ReleaseLock(call);
break;
}
case 510: {
_result = _VL_ListEntry(call);
break;
}
case 511: {
_result = _VL_ListAttributes(call);
break;
}
case 513: {
_result = _VL_GetStats(call);
break;
}
case 514: {
_result = _VL_Probe(call);
break;
}
default:
fprintf (stderr, "Ignoring %d\n", opcode);
}
return _result;
}

