FreeBSD/sys/rpc/rpc_generic.c
/*
 * Implement XDR-style API for RPC call.
 */
Implement XDR-style API for RPC call.
Implement XDR - style API for RPC call .
enum clnt_stat
clnt_call_private(
	CLIENT		*cl,		
	struct rpc_callextra *ext,	
	rpcproc_t	proc,		
	xdrproc_t	xargs,		
	void		*argsp,		
	xdrproc_t	xresults,	
	void		*resultsp,	
	struct timeval	utimeout)	
{
	XDR xdrs;
	struct mbuf *mreq;
	struct mbuf *mrep;
	enum clnt_stat stat;
	mreq = m_getcl(M_WAITOK, MT_DATA, 0);
	xdrmbuf_create(&xdrs, mreq, XDR_ENCODE);
	if (!xargs(&xdrs, argsp)) {
		m_freem(mreq);
		return (RPC_CANTENCODEARGS);
	}
	XDR_DESTROY(&xdrs);
	stat = CLNT_CALL_MBUF(cl, ext, proc, mreq, &mrep, utimeout);
	m_freem(mreq);
	if (stat == RPC_SUCCESS) {
		xdrmbuf_create(&xdrs, mrep, XDR_DECODE);
		if (!xresults(&xdrs, resultsp)) {
			XDR_DESTROY(&xdrs);
			return (RPC_CANTDECODERES);
		}
		XDR_DESTROY(&xdrs);
	}
	return (stat);
}
enum clnt_stat clnt_call_private ( CLIENT * cl , struct rpc_callextra * ext , rpcproc_t proc , xdrproc_t xargs , void * argsp , xdrproc_t xresults , void * resultsp , struct timeval utimeout ) { XDR xdrs ; struct mbuf * mreq ; struct mbuf * mrep ; enum clnt_stat stat ; mreq = m_getcl ( M_WAITOK , MT_DATA , 0 ) ; xdrmbuf_create ( & xdrs , mreq , XDR_ENCODE ) ; if ( ! xargs ( & xdrs , argsp ) ) { m_freem ( mreq ) ; return ( RPC_CANTENCODEARGS ) ; } XDR_DESTROY ( & xdrs ) ; stat = CLNT_CALL_MBUF ( cl , ext , proc , mreq , & mrep , utimeout ) ; m_freem ( mreq ) ; if ( stat == RPC_SUCCESS ) { xdrmbuf_create ( & xdrs , mrep , XDR_DECODE ) ; if ( ! xresults ( & xdrs , resultsp ) ) { XDR_DESTROY ( & xdrs ) ; return ( RPC_CANTDECODERES ) ; } XDR_DESTROY ( & xdrs ) ; } return ( stat ) ; }
Implement XDR-style API for RPC call.
Implement XDR - style API for RPC call .
/* client handle */ /* call metadata */ /* procedure number */ /* xdr routine for args */ /* pointer to args */ /* xdr routine for results */ /* pointer to results */ /* seconds to wait before giving up */