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

#include "rpcgen/gp_rpc.h"

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

bool_t
xdr_gp_rpc_opaque_auth (XDR *xdrs, gp_rpc_opaque_auth *objp)
{
	 if (!xdr_gp_rpc_auth_flavor (xdrs, &objp->flavor))
		 return FALSE;
	 if (!xdr_bytes (xdrs, (char **)&objp->body.body_val, (u_int *) &objp->body.body_len, 400))
		 return FALSE;
	return TRUE;
}

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

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

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

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

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

bool_t
xdr_gp_rpc_mismatch_info (XDR *xdrs, gp_rpc_mismatch_info *objp)
{
	 if (!xdr_u_int (xdrs, &objp->low))
		 return FALSE;
	 if (!xdr_u_int (xdrs, &objp->high))
		 return FALSE;
	return TRUE;
}

bool_t
xdr_gp_rpc_reply_union (XDR *xdrs, gp_rpc_reply_union *objp)
{
	 if (!xdr_gp_rpc_accept_status (xdrs, &objp->status))
		 return FALSE;
	switch (objp->status) {
	case GP_RPC_SUCCESS:
		 if (!xdr_opaque (xdrs, objp->gp_rpc_reply_union_u.results, 0))
			 return FALSE;
		break;
	case GP_RPC_PROG_MISMATCH:
		 if (!xdr_gp_rpc_mismatch_info (xdrs, &objp->gp_rpc_reply_union_u.mismatch_info))
			 return FALSE;
		break;
	default:
		break;
	}
	return TRUE;
}

bool_t
xdr_gp_rpc_accepted_reply (XDR *xdrs, gp_rpc_accepted_reply *objp)
{
	 if (!xdr_gp_rpc_opaque_auth (xdrs, &objp->verf))
		 return FALSE;
	 if (!xdr_gp_rpc_reply_union (xdrs, &objp->reply_data))
		 return FALSE;
	return TRUE;
}

bool_t
xdr_gp_rpc_rejected_reply (XDR *xdrs, gp_rpc_rejected_reply *objp)
{
	 if (!xdr_gp_rpc_reject_status (xdrs, &objp->status))
		 return FALSE;
	switch (objp->status) {
	case GP_RPC_RPC_MISMATCH:
		 if (!xdr_gp_rpc_mismatch_info (xdrs, &objp->gp_rpc_rejected_reply_u.mismatch_info))
			 return FALSE;
		break;
	case GP_RPC_AUTH_ERROR:
		 if (!xdr_gp_rpc_auth_status (xdrs, &objp->gp_rpc_rejected_reply_u.status))
			 return FALSE;
		break;
	default:
		return FALSE;
	}
	return TRUE;
}

bool_t
xdr_gp_rpc_call_header (XDR *xdrs, gp_rpc_call_header *objp)
{
	register int32_t *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->rpcvers))
				 return FALSE;
			 if (!xdr_u_int (xdrs, &objp->prog))
				 return FALSE;
			 if (!xdr_u_int (xdrs, &objp->vers))
				 return FALSE;
			 if (!xdr_u_int (xdrs, &objp->proc))
				 return FALSE;

		} else {
		IXDR_PUT_U_LONG(buf, objp->rpcvers);
		IXDR_PUT_U_LONG(buf, objp->prog);
		IXDR_PUT_U_LONG(buf, objp->vers);
		IXDR_PUT_U_LONG(buf, objp->proc);
		}
		 if (!xdr_gp_rpc_opaque_auth (xdrs, &objp->cred))
			 return FALSE;
		 if (!xdr_gp_rpc_opaque_auth (xdrs, &objp->verf))
			 return FALSE;
		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->rpcvers))
				 return FALSE;
			 if (!xdr_u_int (xdrs, &objp->prog))
				 return FALSE;
			 if (!xdr_u_int (xdrs, &objp->vers))
				 return FALSE;
			 if (!xdr_u_int (xdrs, &objp->proc))
				 return FALSE;

		} else {
		objp->rpcvers = IXDR_GET_U_LONG(buf);
		objp->prog = IXDR_GET_U_LONG(buf);
		objp->vers = IXDR_GET_U_LONG(buf);
		objp->proc = IXDR_GET_U_LONG(buf);
		}
		 if (!xdr_gp_rpc_opaque_auth (xdrs, &objp->cred))
			 return FALSE;
		 if (!xdr_gp_rpc_opaque_auth (xdrs, &objp->verf))
			 return FALSE;
	 return TRUE;
	}

	 if (!xdr_u_int (xdrs, &objp->rpcvers))
		 return FALSE;
	 if (!xdr_u_int (xdrs, &objp->prog))
		 return FALSE;
	 if (!xdr_u_int (xdrs, &objp->vers))
		 return FALSE;
	 if (!xdr_u_int (xdrs, &objp->proc))
		 return FALSE;
	 if (!xdr_gp_rpc_opaque_auth (xdrs, &objp->cred))
		 return FALSE;
	 if (!xdr_gp_rpc_opaque_auth (xdrs, &objp->verf))
		 return FALSE;
	return TRUE;
}

bool_t
xdr_gp_rpc_reply_header (XDR *xdrs, gp_rpc_reply_header *objp)
{
	 if (!xdr_gp_rpc_reply_status (xdrs, &objp->status))
		 return FALSE;
	switch (objp->status) {
	case GP_RPC_MSG_ACCEPTED:
		 if (!xdr_gp_rpc_accepted_reply (xdrs, &objp->gp_rpc_reply_header_u.accepted))
			 return FALSE;
		break;
	case GP_RPC_MSG_DENIED:
		 if (!xdr_gp_rpc_rejected_reply (xdrs, &objp->gp_rpc_reply_header_u.rejected))
			 return FALSE;
		break;
	default:
		return FALSE;
	}
	return TRUE;
}

bool_t
xdr_gp_rpc_msg_union (XDR *xdrs, gp_rpc_msg_union *objp)
{
	 if (!xdr_gp_rpc_msg_type (xdrs, &objp->type))
		 return FALSE;
	switch (objp->type) {
	case GP_RPC_CALL:
		 if (!xdr_gp_rpc_call_header (xdrs, &objp->gp_rpc_msg_union_u.chdr))
			 return FALSE;
		break;
	case GP_RPC_REPLY:
		 if (!xdr_gp_rpc_reply_header (xdrs, &objp->gp_rpc_msg_union_u.rhdr))
			 return FALSE;
		break;
	default:
		return FALSE;
	}
	return TRUE;
}

bool_t
xdr_gp_rpc_msg (XDR *xdrs, gp_rpc_msg *objp)
{
	 if (!xdr_u_int (xdrs, &objp->xid))
		 return FALSE;
	 if (!xdr_gp_rpc_msg_union (xdrs, &objp->header))
		 return FALSE;
	return TRUE;
}
