/*
 * Please do not edit this file.
 * It was generated using rpcgen.
 */

#include <rpc/types.h>
#include <rpc/xdr.h>

#include "rpc.h"

bool_t
xdr_rpc_data(XDR *xdrs, rpc_data *objp)
{

	 register long *buf=buf;

	 if (!xdr_enum(xdrs, (enum_t *)objp)) {
		 return (FALSE);
	 }
	return (TRUE);
}

bool_t
xdr_rpc_string(XDR *xdrs, rpc_string *objp)
{

	 register long *buf=buf;

	 if (!xdr_bool(xdrs, &objp->defined)) {
		 return (FALSE);
	 }
	 if (!xdr_string(xdrs, &objp->stringval, ~0)) {
		 return (FALSE);
	 }
	return (TRUE);
}

bool_t
xdr_rpc_value(XDR *xdrs, rpc_value *objp)
{

	 register long *buf=buf;

	 if (!xdr_rpc_data(xdrs, &objp->type)) {
		 return (FALSE);
	 }
	switch (objp->type) {
	case RPC_LONG:
		 if (!xdr_int(xdrs, &objp->rpc_value_u.longval)) {
			 return (FALSE);
		 }
		break;
	case RPC_DOUBLE:
		 if (!xdr_double(xdrs, &objp->rpc_value_u.doubleval)) {
			 return (FALSE);
		 }
		break;
	case RPC_STRING:
		 if (!xdr_rpc_string(xdrs, &objp->rpc_value_u.stringval)) {
			 return (FALSE);
		 }
		break;
	case RPC_ULONG:
		 if (!xdr_u_int(xdrs, &objp->rpc_value_u.ulongval)) {
			 return (FALSE);
		 }
		break;
	default:
		break;
	}
	return (TRUE);
}

bool_t
xdr_rpc_error(XDR *xdrs, rpc_error *objp)
{

	 register long *buf=buf;

	 if (!xdr_string(xdrs, &objp->error, ~0)) {
		 return (FALSE);
	 }
	 if (!xdr_u_int(xdrs, &objp->line)) {
		 return (FALSE);
	 }
	return (TRUE);
}

bool_t
xdr_rpc_accounting_element(XDR *xdrs, rpc_accounting_element *objp)
{

	 register long *buf=buf;


	 if (xdrs->x_op == XDR_ENCODE) {
		buf = XDR_INLINE(xdrs,4 * BYTES_PER_XDR_UNIT);
		if (buf == NULL) {
		 if (!xdr_u_int(xdrs, &objp->count_normal)) {
			 return (FALSE);
		 }
		 if (!xdr_u_int(xdrs, &objp->count_akt)) {
			 return (FALSE);
		 }
		 if (!xdr_u_int(xdrs, &objp->count_time_sec)) {
			 return (FALSE);
		 }
		 if (!xdr_u_int(xdrs, &objp->count_time_usec)) {
			 return (FALSE);
		 }

	  }
	  else {
		 IXDR_PUT_U_LONG(buf,objp->count_normal);
		 IXDR_PUT_U_LONG(buf,objp->count_akt);
		 IXDR_PUT_U_LONG(buf,objp->count_time_sec);
		 IXDR_PUT_U_LONG(buf,objp->count_time_usec);
	  }

 	 return (TRUE);
	} else if (xdrs->x_op == XDR_DECODE) {
		buf = XDR_INLINE(xdrs,4 * BYTES_PER_XDR_UNIT);
		if (buf == NULL) {
		 if (!xdr_u_int(xdrs, &objp->count_normal)) {
			 return (FALSE);
		 }
		 if (!xdr_u_int(xdrs, &objp->count_akt)) {
			 return (FALSE);
		 }
		 if (!xdr_u_int(xdrs, &objp->count_time_sec)) {
			 return (FALSE);
		 }
		 if (!xdr_u_int(xdrs, &objp->count_time_usec)) {
			 return (FALSE);
		 }

	  }
	  else {
		 objp->count_normal = IXDR_GET_U_LONG(buf);
		 objp->count_akt = IXDR_GET_U_LONG(buf);
		 objp->count_time_sec = IXDR_GET_U_LONG(buf);
		 objp->count_time_usec = IXDR_GET_U_LONG(buf);
	  }
	 return(TRUE);
	}

	 if (!xdr_u_int(xdrs, &objp->count_normal)) {
		 return (FALSE);
	 }
	 if (!xdr_u_int(xdrs, &objp->count_akt)) {
		 return (FALSE);
	 }
	 if (!xdr_u_int(xdrs, &objp->count_time_sec)) {
		 return (FALSE);
	 }
	 if (!xdr_u_int(xdrs, &objp->count_time_usec)) {
		 return (FALSE);
	 }
	return (TRUE);
}

bool_t
xdr_rpc_accounting(XDR *xdrs, rpc_accounting *objp)
{

	 register long *buf=buf;

	 int i=i;
	 if (!xdr_vector(xdrs, (char *)objp->accounting, ACCOUNTING_ANZ, sizeof(rpc_accounting_element), (xdrproc_t)xdr_rpc_accounting_element)) {
		 return (FALSE);
	 }
	return (TRUE);
}

bool_t
xdr_rpc_flowctrl(XDR *xdrs, rpc_flowctrl *objp)
{

	 register long *buf=buf;

	 if (!xdr_u_int(xdrs, &objp->ctrl)) {
		 return (FALSE);
	 }
	 if (!xdr_rpc_value(xdrs, &objp->returnval)) {
		 return (FALSE);
	 }
	 if (!xdr_pointer(xdrs, (char **)&objp->error, sizeof(rpc_error), (xdrproc_t)xdr_rpc_error)) {
		 return (FALSE);
	 }
	 if (!xdr_pointer(xdrs, (char **)&objp->accounting, sizeof(rpc_accounting), (xdrproc_t)xdr_rpc_accounting)) {
		 return (FALSE);
	 }
	return (TRUE);
}

bool_t
xdr_rpc_function_args(XDR *xdrs, rpc_function_args *objp)
{

	 register long *buf=buf;

	 if (!xdr_array(xdrs, (char **)&objp->args.args_val, (u_int *)&objp->args.args_len, MAX_RPC_ARGS, sizeof(rpc_value), (xdrproc_t)xdr_rpc_value)) {
		 return (FALSE);
	 }
	return (TRUE);
}

bool_t
xdr_rpc_callargs(XDR *xdrs, rpc_callargs *objp)
{

	 register long *buf=buf;

	 if (!xdr_string(xdrs, &objp->function, ~0)) {
		 return (FALSE);
	 }
	 if (!xdr_string(xdrs, &objp->password, ~0)) {
		 return (FALSE);
	 }
	 if (!xdr_rpc_function_args(xdrs, &objp->args)) {
		 return (FALSE);
	 }
	return (TRUE);
}
