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

#include <afsconfig.h>
#include <afs/param.h>
#include <roken.h>
#include "rxstat.h"

static afs_int32 _RXSTATS_RetrieveProcessRPCStats(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_uint32 clientVersion;
	afs_uint32 serverVersion, clock_sec, clock_usec, stat_count;
	rpcStats stats;


	memset(&clientVersion, 0, sizeof(clientVersion));
	memset(&serverVersion, 0, sizeof(serverVersion));
	memset(&clock_sec, 0, sizeof(clock_sec));
	memset(&clock_usec, 0, sizeof(clock_usec));
	memset(&stat_count, 0, sizeof(stat_count));
	memset(&stats, 0, sizeof(stats));

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

	z_result = MRXSTATS_RetrieveProcessRPCStats(z_call, clientVersion, &serverVersion, &clock_sec, &clock_usec, &stat_count, &stats);
	if (z_result)
		goto fail;
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_uint32(z_xdrs, &serverVersion))
	     || (!xdr_afs_uint32(z_xdrs, &clock_sec))
	     || (!xdr_afs_uint32(z_xdrs, &clock_usec))
	     || (!xdr_afs_uint32(z_xdrs, &stat_count))
	     || (!xdr_rpcStats(z_xdrs, &stats)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	z_xdrs->x_op = XDR_FREE;
	if ((!xdr_rpcStats(z_xdrs, &stats)))
		z_result = RXGEN_SS_XDRFREE;

	if (rx_enable_stats) {
	    rx_RecordCallStatistics(z_call, RXSTATS_STATINDEX,
		0, RXSTATS_NO_OF_STAT_FUNCS, 0);
	}

	return z_result;
}

static afs_int32 _RXSTATS_RetrievePeerRPCStats(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_uint32 clientVersion;
	afs_uint32 serverVersion, stat_count, clock_sec, clock_usec;
	rpcStats stats;


	memset(&clientVersion, 0, sizeof(clientVersion));
	memset(&serverVersion, 0, sizeof(serverVersion));
	memset(&stat_count, 0, sizeof(stat_count));
	memset(&clock_sec, 0, sizeof(clock_sec));
	memset(&clock_usec, 0, sizeof(clock_usec));
	memset(&stats, 0, sizeof(stats));

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

	z_result = MRXSTATS_RetrievePeerRPCStats(z_call, clientVersion, &serverVersion, &stat_count, &clock_sec, &clock_usec, &stats);
	if (z_result)
		goto fail;
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_uint32(z_xdrs, &serverVersion))
	     || (!xdr_afs_uint32(z_xdrs, &stat_count))
	     || (!xdr_afs_uint32(z_xdrs, &clock_sec))
	     || (!xdr_afs_uint32(z_xdrs, &clock_usec))
	     || (!xdr_rpcStats(z_xdrs, &stats)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	z_xdrs->x_op = XDR_FREE;
	if ((!xdr_rpcStats(z_xdrs, &stats)))
		z_result = RXGEN_SS_XDRFREE;

	if (rx_enable_stats) {
	    rx_RecordCallStatistics(z_call, RXSTATS_STATINDEX,
		1, RXSTATS_NO_OF_STAT_FUNCS, 0);
	}

	return z_result;
}

static afs_int32 _RXSTATS_QueryProcessRPCStats(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_int32 on;


	memset(&on, 0, sizeof(on));
	z_result = MRXSTATS_QueryProcessRPCStats(z_call, &on);
	if (z_result)
		goto fail;
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_int32(z_xdrs, &on)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	if (rx_enable_stats) {
	    rx_RecordCallStatistics(z_call, RXSTATS_STATINDEX,
		2, RXSTATS_NO_OF_STAT_FUNCS, 0);
	}

	return z_result;
}

static afs_int32 _RXSTATS_QueryPeerRPCStats(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_int32 on;


	memset(&on, 0, sizeof(on));
	z_result = MRXSTATS_QueryPeerRPCStats(z_call, &on);
	if (z_result)
		goto fail;
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_int32(z_xdrs, &on)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	if (rx_enable_stats) {
	    rx_RecordCallStatistics(z_call, RXSTATS_STATINDEX,
		3, RXSTATS_NO_OF_STAT_FUNCS, 0);
	}

	return z_result;
}

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


	z_result = MRXSTATS_EnableProcessRPCStats(z_call);
	if (z_result)
		goto fail;
fail:
	if (rx_enable_stats) {
	    rx_RecordCallStatistics(z_call, RXSTATS_STATINDEX,
		4, RXSTATS_NO_OF_STAT_FUNCS, 0);
	}

	return z_result;
}

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


	z_result = MRXSTATS_EnablePeerRPCStats(z_call);
	if (z_result)
		goto fail;
fail:
	if (rx_enable_stats) {
	    rx_RecordCallStatistics(z_call, RXSTATS_STATINDEX,
		5, RXSTATS_NO_OF_STAT_FUNCS, 0);
	}

	return z_result;
}

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


	z_result = MRXSTATS_DisableProcessRPCStats(z_call);
	if (z_result)
		goto fail;
fail:
	if (rx_enable_stats) {
	    rx_RecordCallStatistics(z_call, RXSTATS_STATINDEX,
		6, RXSTATS_NO_OF_STAT_FUNCS, 0);
	}

	return z_result;
}

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


	z_result = MRXSTATS_DisablePeerRPCStats(z_call);
	if (z_result)
		goto fail;
fail:
	if (rx_enable_stats) {
	    rx_RecordCallStatistics(z_call, RXSTATS_STATINDEX,
		7, RXSTATS_NO_OF_STAT_FUNCS, 0);
	}

	return z_result;
}

static afs_int32 _RXSTATS_QueryRPCStatsVersion(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_uint32 ver;


	memset(&ver, 0, sizeof(ver));
	z_result = MRXSTATS_QueryRPCStatsVersion(z_call, &ver);
	if (z_result)
		goto fail;
	z_xdrs->x_op = XDR_ENCODE;
	if ((!xdr_afs_uint32(z_xdrs, &ver)))
		z_result = RXGEN_SS_MARSHAL;
fail:
	if (rx_enable_stats) {
	    rx_RecordCallStatistics(z_call, RXSTATS_STATINDEX,
		8, RXSTATS_NO_OF_STAT_FUNCS, 0);
	}

	return z_result;
}

static afs_int32 _RXSTATS_ClearProcessRPCStats(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_uint32 clearFlag;


	memset(&clearFlag, 0, sizeof(clearFlag));

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

	z_result = MRXSTATS_ClearProcessRPCStats(z_call, clearFlag);
	if (z_result)
		goto fail;
fail:
	if (rx_enable_stats) {
	    rx_RecordCallStatistics(z_call, RXSTATS_STATINDEX,
		9, RXSTATS_NO_OF_STAT_FUNCS, 0);
	}

	return z_result;
}

static afs_int32 _RXSTATS_ClearPeerRPCStats(struct rx_call *z_call, XDR *z_xdrs)
{
	afs_int32 z_result;
	afs_uint32 clearFlag;


	memset(&clearFlag, 0, sizeof(clearFlag));

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

	z_result = MRXSTATS_ClearPeerRPCStats(z_call, clearFlag);
	if (z_result)
		goto fail;
fail:
	if (rx_enable_stats) {
	    rx_RecordCallStatistics(z_call, RXSTATS_STATINDEX,
		10, RXSTATS_NO_OF_STAT_FUNCS, 0);
	}

	return z_result;
}



static afs_int32 (*StubProcsArray0[])(struct rx_call *z_call, XDR *z_xdrs) = {_RXSTATS_RetrieveProcessRPCStats, _RXSTATS_RetrievePeerRPCStats, _RXSTATS_QueryProcessRPCStats, _RXSTATS_QueryPeerRPCStats, _RXSTATS_EnableProcessRPCStats, _RXSTATS_EnablePeerRPCStats, _RXSTATS_DisableProcessRPCStats, _RXSTATS_DisablePeerRPCStats, _RXSTATS_QueryRPCStatsVersion, _RXSTATS_ClearProcessRPCStats, _RXSTATS_ClearPeerRPCStats};

int RXSTATS_ExecuteRequest(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 < RXSTATS_LOWEST_OPCODE || op > RXSTATS_HIGHEST_OPCODE)
		z_result = RXGEN_OPCODE;
	else
		z_result = (*StubProcsArray0[op - RXSTATS_LOWEST_OPCODE])(z_call, &z_xdrs);
	return hton_syserr_conv(z_result);
}
