/* Machine generated file -- Do NOT edit */

#include "budb.h"

#ifndef NEVERDATE
#define NEVERDATE 037777777777 /* a date that will never come */
#endif
#ifndef Date
#define Date afs_uint32
#endif
#ifndef dumpId
#define dumpId afs_uint32
#endif
#define TB_DUMPSCHEDULE 0
#define TB_VOLUMESET 1
#define TB_TAPEHOSTS 2
#define TB_NUM 3 /* no. of block types */
#define TB_MAX 6 /* unused items are spares */
#define budb_MakeTapeName(name,set,seq) sprintf (name, (set)->format, (set)->a*(seq) + (set)->b)
#define BUDB_DUMP_INCOMPLETE (1<<0) /* some vols omitted due to errors */
#define BUDB_DUMP_TAPEERROR (1<<1) /* tape error during dump */
#define BUDB_DUMP_INPROGRESS (1<<2)
#define BUDB_DUMP_ABORTED (1<<3) /* aborted: prob. dump unavailable */
#define BUDB_DUMP_XBSA_NSS (1<<8) /* dump was done with a client    */
#define BUDB_DUMP_BUTA (1<<11) /* (used by ADSM buta) == 0x800 */
#define BUDB_DUMP_ADSM (1<<12) /* (used by XBSA/ADSM buta) == 0x1000 */
#define BUDB_TAPE_TAPEERROR (1<<0)
#define BUDB_TAPE_DELETED (1<<1)
#define BUDB_TAPE_BEINGWRITTEN (1<<2) /* writing in progress */
#define BUDB_TAPE_ABORTED (1<<3) /* aborted: tape probably garbaged */
#define BUDB_TAPE_STAGED (1<<4) /* not yet on permanent media */
#define BUDB_TAPE_WRITTEN (1<<5) /* tape writing finished: all OK */
#define BUDB_VOL_TAPEERROR (1<<0) /* tape problem during dump */
#define BUDB_VOL_FILEERROR (1<<1) /* voldump aborted during dump */
#define BUDB_VOL_BEINGWRITTEN (1<<2)
#define BUDB_VOL_FIRSTFRAG (1<<3) /* same as low bits of tape position */
#define BUDB_VOL_LASTFRAG (1<<4)
#define BUDB_VOL_ABORTED (1<<5) /* aborted: vol probably undumped */
#define BUDB_OP_NAMES (0x7)
#define BUDB_OP_STARTS (0x7<<3)
#define BUDB_OP_ENDS (0x7<<6)
#define BUDB_OP_TIMES (0x3<<9)
#define BUDB_OP_MISC (0xff<<16)
#define BUDB_OP_DUMPNAME (1<<0)
#define BUDB_OP_VOLUMENAME (2<<0)
#define BUDB_OP_TAPENAME (3<<0)
#define BUDB_OP_TAPESEQ (4<<0)
#define BUDB_OP_STARTTIME (1<<3)
#define BUDB_OP_RANGE (1<<6)
#define BUDB_OP_NPREVIOUS (2<<6)
#define BUDB_OP_NFOLLOWING (3<<6)
#define BUDB_OP_DUMPID (2<<3)
#define BUDB_OP_CLONETIME (1<<9) /* use clone time */
#define BUDB_OP_DUMPTIME (2<<9) /* use dump time (create?) */
#define BUDB_OP_INCTIME (3<<9) /* use inc time */
#define BUDB_OP_FIRSTFRAG (1<<16)
#define BUDB_TEXT_COMPLETE 1
#define SD_DBHEADER 1
#define SD_DUMP 2
#define SD_TAPE 3
#define SD_VOLUME 4
#define SD_TEXT_DUMPSCHEDULE 5
#define SD_TEXT_VOLUMESET 6
#define SD_TEXT_TAPEHOSTS 7
#define SD_END 8
#define BUDB_OP_DATES (0x01)
#define BUDB_OP_GROUPID (0x02)
#define BUDB_OP_APPDUMP (0x01)
#define BUDB_OP_DBDUMP (0x02)
static afs_int32 _BUDB_AddVolume(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	struct budb_volumeEntry vol;




	if ((!xdr_budb_volumeEntry(z_xdrs, &vol))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_AddVolume(z_call, &vol);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_budb_volumeEntry(z_xdrs, &vol)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	return z_result;
}

static afs_int32 _BUDB_CreateDump(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	struct budb_dumpEntry dump;




	if ((!xdr_budb_dumpEntry(z_xdrs, &dump))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_CreateDump(z_call, &dump);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_budb_dumpEntry(z_xdrs, &dump)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	return z_result;
}

static afs_int32 _BUDB_DeleteDump(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_uint32 id, fromTime, toTime;
	budb_dumpsList dumps;



	dumps.budb_dumpsList_val = 0;
	dumps.budb_dumpsList_len = 0;

	if ((!xdr_afs_uint32(z_xdrs, &id))
	     || (!xdr_afs_uint32(z_xdrs, &fromTime))
	     || (!xdr_afs_uint32(z_xdrs, &toTime))
	     || (!xdr_budb_dumpsList(z_xdrs, &dumps))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_DeleteDump(z_call, id, fromTime, toTime, &dumps);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_budb_dumpsList(z_xdrs, &dumps)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_budb_dumpsList(z_xdrs, &dumps)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_DeleteTape(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	struct budb_tapeEntry tape;




	if ((!xdr_budb_tapeEntry(z_xdrs, &tape))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_DeleteTape(z_call, &tape);
fail:
	return z_result;
}

static afs_int32 _BUDB_DeleteVDP(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	char * dsname=(char *)0, *dumpPath=(char *)0;
	afs_int32 curDumpId;



	if ((!xdr_string(z_xdrs, &dsname, 32))
	     || (!xdr_string(z_xdrs, &dumpPath, 256))
	     || (!xdr_afs_int32(z_xdrs, &curDumpId))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_DeleteVDP(z_call, dsname, dumpPath, curDumpId);
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_string(z_xdrs, &dsname, 32)) goto fail1;
	if (!xdr_string(z_xdrs, &dumpPath, 256)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_FindClone(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_int32 dumpID;
	char * volName=(char *)0;
	afs_int32 clonetime;



	if ((!xdr_afs_int32(z_xdrs, &dumpID))
	     || (!xdr_string(z_xdrs, &volName, 32))
	     || (!xdr_afs_int32(z_xdrs, &clonetime))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_FindClone(z_call, dumpID, volName, &clonetime);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_int32(z_xdrs, &clonetime)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_string(z_xdrs, &volName, 32)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_FindDump(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	char * volumeName=(char *)0;
	afs_int32 beforeDate;
	struct budb_dumpEntry deptr;



	if ((!xdr_string(z_xdrs, &volumeName, 32))
	     || (!xdr_afs_int32(z_xdrs, &beforeDate))
	     || (!xdr_budb_dumpEntry(z_xdrs, &deptr))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_FindDump(z_call, volumeName, beforeDate, &deptr);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_budb_dumpEntry(z_xdrs, &deptr)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_string(z_xdrs, &volumeName, 32)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_FindLatestDump(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	char * vsname=(char *)0, *dname=(char *)0;
	budb_dumpEntry dumpentry;



	if ((!xdr_string(z_xdrs, &vsname, 32))
	     || (!xdr_string(z_xdrs, &dname, 256))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_FindLatestDump(z_call, vsname, dname, &dumpentry);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_budb_dumpEntry(z_xdrs, &dumpentry)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_string(z_xdrs, &vsname, 32)) goto fail1;
	if (!xdr_string(z_xdrs, &dname, 256)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_MakeDumpAppended(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_int32 appendedDumpID, intialDumpID, startTapeSeq;




	if ((!xdr_afs_int32(z_xdrs, &appendedDumpID))
	     || (!xdr_afs_int32(z_xdrs, &intialDumpID))
	     || (!xdr_afs_int32(z_xdrs, &startTapeSeq))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_MakeDumpAppended(z_call, appendedDumpID, intialDumpID, startTapeSeq);
fail:
	return z_result;
}

static afs_int32 _BUDB_FindLastTape(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_int32 dumpID;
	struct budb_dumpEntry dumpEntry;
	struct budb_tapeEntry tapeEntry;
	struct budb_volumeEntry volEntry;




	if ((!xdr_afs_int32(z_xdrs, &dumpID))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_FindLastTape(z_call, dumpID, &dumpEntry, &tapeEntry, &volEntry);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_budb_dumpEntry(z_xdrs, &dumpEntry))
	     || (!xdr_budb_tapeEntry(z_xdrs, &tapeEntry))
	     || (!xdr_budb_volumeEntry(z_xdrs, &volEntry)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	return z_result;
}

static afs_int32 _BUDB_FinishDump(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	struct budb_dumpEntry dump;




	if ((!xdr_budb_dumpEntry(z_xdrs, &dump))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_FinishDump(z_call, &dump);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_budb_dumpEntry(z_xdrs, &dump)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	return z_result;
}

static afs_int32 _BUDB_FinishTape(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	struct budb_tapeEntry tape;




	if ((!xdr_budb_tapeEntry(z_xdrs, &tape))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_FinishTape(z_call, &tape);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_budb_tapeEntry(z_xdrs, &tape)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	return z_result;
}

static afs_int32 _BUDB_GetDumps(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_int32 majorVersion, flags, start, end, index;
	char * name=(char *)0;
	afs_int32 nextIndex, dbUpdate;
	budb_dumpList dumps;


	dumps.budb_dumpList_val = 0;
	dumps.budb_dumpList_len = 0;

	if ((!xdr_afs_int32(z_xdrs, &majorVersion))
	     || (!xdr_afs_int32(z_xdrs, &flags))
	     || (!xdr_string(z_xdrs, &name, 32))
	     || (!xdr_afs_int32(z_xdrs, &start))
	     || (!xdr_afs_int32(z_xdrs, &end))
	     || (!xdr_afs_int32(z_xdrs, &index))
	     || (!xdr_budb_dumpList(z_xdrs, &dumps))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_GetDumps(z_call, majorVersion, flags, name, start, end, index, &nextIndex, &dbUpdate, &dumps);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_int32(z_xdrs, &nextIndex))
	     || (!xdr_afs_int32(z_xdrs, &dbUpdate))
	     || (!xdr_budb_dumpList(z_xdrs, &dumps)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_string(z_xdrs, &name, 32)) goto fail1;
	if (!xdr_budb_dumpList(z_xdrs, &dumps)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_GetTapes(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_int32 majorVersion, flags, start, end, index;
	char * name=(char *)0;
	afs_int32 nextIndex, dbUpdate;
	struct budb_tapeList tapes;


	tapes.budb_tapeList_val = 0;
	tapes.budb_tapeList_len = 0;

	if ((!xdr_afs_int32(z_xdrs, &majorVersion))
	     || (!xdr_afs_int32(z_xdrs, &flags))
	     || (!xdr_string(z_xdrs, &name, 32))
	     || (!xdr_afs_int32(z_xdrs, &start))
	     || (!xdr_afs_int32(z_xdrs, &end))
	     || (!xdr_afs_int32(z_xdrs, &index))
	     || (!xdr_budb_tapeList(z_xdrs, &tapes))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_GetTapes(z_call, majorVersion, flags, name, start, end, index, &nextIndex, &dbUpdate, &tapes);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_int32(z_xdrs, &nextIndex))
	     || (!xdr_afs_int32(z_xdrs, &dbUpdate))
	     || (!xdr_budb_tapeList(z_xdrs, &tapes)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_string(z_xdrs, &name, 32)) goto fail1;
	if (!xdr_budb_tapeList(z_xdrs, &tapes)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_GetVolumes(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_int32 majorVersion, flags, start, end, index;
	char * name=(char *)0;
	afs_int32 nextIndex, dbUpdate;
	budb_volumeList volumes;


	volumes.budb_volumeList_val = 0;
	volumes.budb_volumeList_len = 0;

	if ((!xdr_afs_int32(z_xdrs, &majorVersion))
	     || (!xdr_afs_int32(z_xdrs, &flags))
	     || (!xdr_string(z_xdrs, &name, 32))
	     || (!xdr_afs_int32(z_xdrs, &start))
	     || (!xdr_afs_int32(z_xdrs, &end))
	     || (!xdr_afs_int32(z_xdrs, &index))
	     || (!xdr_budb_volumeList(z_xdrs, &volumes))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_GetVolumes(z_call, majorVersion, flags, name, start, end, index, &nextIndex, &dbUpdate, &volumes);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_int32(z_xdrs, &nextIndex))
	     || (!xdr_afs_int32(z_xdrs, &dbUpdate))
	     || (!xdr_budb_volumeList(z_xdrs, &volumes)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_string(z_xdrs, &name, 32)) goto fail1;
	if (!xdr_budb_volumeList(z_xdrs, &volumes)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_UseTape(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	struct budb_tapeEntry tape;
	afs_int32 new;




	if ((!xdr_budb_tapeEntry(z_xdrs, &tape))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_UseTape(z_call, &tape, &new);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_budb_tapeEntry(z_xdrs, &tape))
	     || (!xdr_afs_int32(z_xdrs, &new)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	return z_result;
}

static afs_int32 _BUDB_GetText(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_uint32 lockHandle;
	afs_int32 textType, maxLength, offset;
	afs_int32 nextOffset;
	charListT charListPtr;



	charListPtr.charListT_val = 0;
	charListPtr.charListT_len = 0;

	if ((!xdr_afs_uint32(z_xdrs, &lockHandle))
	     || (!xdr_afs_int32(z_xdrs, &textType))
	     || (!xdr_afs_int32(z_xdrs, &maxLength))
	     || (!xdr_afs_int32(z_xdrs, &offset))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_GetText(z_call, lockHandle, textType, maxLength, offset, &nextOffset, &charListPtr);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_int32(z_xdrs, &nextOffset))
	     || (!xdr_charListT(z_xdrs, &charListPtr)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_charListT(z_xdrs, &charListPtr)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_GetTextVersion(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_int32 textType;
	afs_uint32 tversion;




	if ((!xdr_afs_int32(z_xdrs, &textType))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_GetTextVersion(z_call, textType, &tversion);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_uint32(z_xdrs, &tversion)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	return z_result;
}

static afs_int32 _BUDB_SaveText(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_uint32 lockHandle;
	afs_int32 textType, offset, flags;
	charListT charListPtr;



	charListPtr.charListT_val = 0;
	charListPtr.charListT_len = 0;

	if ((!xdr_afs_uint32(z_xdrs, &lockHandle))
	     || (!xdr_afs_int32(z_xdrs, &textType))
	     || (!xdr_afs_int32(z_xdrs, &offset))
	     || (!xdr_afs_int32(z_xdrs, &flags))
	     || (!xdr_charListT(z_xdrs, &charListPtr))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_SaveText(z_call, lockHandle, textType, offset, flags, &charListPtr);
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_charListT(z_xdrs, &charListPtr)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_FreeAllLocks(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_uint32 instanceId;




	if ((!xdr_afs_uint32(z_xdrs, &instanceId))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_FreeAllLocks(z_call, instanceId);
fail:
	return z_result;
}

static afs_int32 _BUDB_FreeLock(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_uint32 lockHandle;




	if ((!xdr_afs_uint32(z_xdrs, &lockHandle))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_FreeLock(z_call, lockHandle);
fail:
	return z_result;
}

static afs_int32 _BUDB_GetInstanceId(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_uint32 instanceId;



	z_result = SBUDB_GetInstanceId(z_call, &instanceId);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_uint32(z_xdrs, &instanceId)))
		z_result = RXGEN_SS_MARSHAL;
	return z_result;
}

static afs_int32 _BUDB_GetLock(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_uint32 instanceId;
	afs_int32 lockName, expiration;
	afs_uint32 lockHandle;




	if ((!xdr_afs_uint32(z_xdrs, &instanceId))
	     || (!xdr_afs_int32(z_xdrs, &lockName))
	     || (!xdr_afs_int32(z_xdrs, &expiration))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_GetLock(z_call, instanceId, lockName, expiration, &lockHandle);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_uint32(z_xdrs, &lockHandle)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	return z_result;
}

static afs_int32 _BUDB_DbVerify(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_int32 status, orphans, host;



	z_result = SBUDB_DbVerify(z_call, &status, &orphans, &host);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_int32(z_xdrs, &status))
	     || (!xdr_afs_int32(z_xdrs, &orphans))
	     || (!xdr_afs_int32(z_xdrs, &host)))
		z_result = RXGEN_SS_MARSHAL;
	return z_result;
}

static afs_int32 _BUDB_DumpDB(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	int firstcall;
	afs_int32 maxLength;
	charListT charListPtr;
	afs_int32 flags;



	charListPtr.charListT_val = 0;
	charListPtr.charListT_len = 0;

	if ((!xdr_int(z_xdrs, &firstcall))
	     || (!xdr_afs_int32(z_xdrs, &maxLength))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_DumpDB(z_call, firstcall, maxLength, &charListPtr, &flags);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_charListT(z_xdrs, &charListPtr))
	     || (!xdr_afs_int32(z_xdrs, &flags)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_charListT(z_xdrs, &charListPtr)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_RestoreDbHeader(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	struct DbHeader header;




	if ((!xdr_DbHeader(z_xdrs, &header))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_RestoreDbHeader(z_call, &header);
fail:
	return z_result;
}

static afs_int32 _BUDB_T_GetVersion(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_int32 majorVersion;



	z_result = SBUDB_T_GetVersion(z_call, &majorVersion);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_int32(z_xdrs, &majorVersion)))
		z_result = RXGEN_SS_MARSHAL;
	return z_result;
}

static afs_int32 _BUDB_T_DumpHashTable(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_int32 type;
	char * filename=(char *)0;



	if ((!xdr_afs_int32(z_xdrs, &type))
	     || (!xdr_string(z_xdrs, &filename, 32))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_T_DumpHashTable(z_call, type, filename);
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_string(z_xdrs, &filename, 32)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_T_DumpDatabase(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	char * filename=(char *)0;



	if ((!xdr_string(z_xdrs, &filename, 32))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_T_DumpDatabase(z_call, filename);
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_string(z_xdrs, &filename, 32)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_AddVolumes(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	struct budb_volumeList vols;



	vols.budb_volumeList_val = 0;
	vols.budb_volumeList_len = 0;

	if ((!xdr_budb_volumeList(z_xdrs, &vols))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_AddVolumes(z_call, &vols);
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_budb_volumeList(z_xdrs, &vols)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}

static afs_int32 _BUDB_ListDumps(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_int32 sflags, group;
	char * name=(char *)0;
	afs_uint32 fromTime, toTime;
	budb_dumpsList dumps, flags;


	dumps.budb_dumpsList_val = 0;
	dumps.budb_dumpsList_len = 0;
	flags.budb_dumpsList_val = 0;
	flags.budb_dumpsList_len = 0;

	if ((!xdr_afs_int32(z_xdrs, &sflags))
	     || (!xdr_string(z_xdrs, &name, 256))
	     || (!xdr_afs_int32(z_xdrs, &group))
	     || (!xdr_afs_uint32(z_xdrs, &fromTime))
	     || (!xdr_afs_uint32(z_xdrs, &toTime))
	     || (!xdr_budb_dumpsList(z_xdrs, &dumps))
	     || (!xdr_budb_dumpsList(z_xdrs, &flags))) {
		z_result = RXGEN_SS_UNMARSHAL;
		goto fail;
	}

	z_result = SBUDB_ListDumps(z_call, sflags, name, group, fromTime, toTime, &dumps, &flags);
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_budb_dumpsList(z_xdrs, &dumps))
	     || (!xdr_budb_dumpsList(z_xdrs, &flags)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	z_xdrs->x_op = XDR_FREE;
	if (!xdr_string(z_xdrs, &name, 256)) goto fail1;
	if (!xdr_budb_dumpsList(z_xdrs, &dumps)) goto fail1;
	if (!xdr_budb_dumpsList(z_xdrs, &flags)) goto fail1;
	return z_result;
fail1:
	return RXGEN_SS_XDRFREE;
}



static afs_int32 (*StubProcsArray0[])(struct rx_call *z_call, XDR *z_xdrs) = {_BUDB_AddVolume, _BUDB_CreateDump, _BUDB_DeleteDump, _BUDB_DeleteTape, _BUDB_DeleteVDP, _BUDB_FindClone, _BUDB_FindDump, _BUDB_FindLatestDump, _BUDB_MakeDumpAppended, _BUDB_FindLastTape, _BUDB_FinishDump, _BUDB_FinishTape, _BUDB_GetDumps, _BUDB_GetTapes, _BUDB_GetVolumes, _BUDB_UseTape, _BUDB_GetText, _BUDB_GetTextVersion, _BUDB_SaveText, _BUDB_FreeAllLocks, _BUDB_FreeLock, _BUDB_GetInstanceId, _BUDB_GetLock, _BUDB_DbVerify, _BUDB_DumpDB, _BUDB_RestoreDbHeader, _BUDB_T_GetVersion, _BUDB_T_DumpHashTable, _BUDB_T_DumpDatabase, _BUDB_AddVolumes, _BUDB_ListDumps};

int BUDB_ExecuteRequest(register struct rx_call *z_call)
{
	int op;
	XDR z_xdrs;
	afs_int32 z_result;

	xdrrx_create(&z_xdrs, z_call, XDR_DECODE);
	if (!xdr_int(&z_xdrs, &op))
		z_result = RXGEN_DECODE;
	else if (op < BUDB_LOWEST_OPCODE || op > BUDB_HIGHEST_OPCODE)
		z_result = RXGEN_OPCODE;
	else
		z_result = (*StubProcsArray0[op - BUDB_LOWEST_OPCODE])(z_call, &z_xdrs);
	return hton_syserr_conv(z_result);
}
