All RPC routines require the header In rpc/rpc.h . Routines that take a Vt struct netconfig also require that In netconfig.h be included.
The Fa nettype argument can be one of the following:
If Fa nettype is NULL it defaults to Qq netpath . The transports are tried in left to right order in the NETPATH variable or in top to down order in the /etc/netconfig file.
typedef u_int32_t rpcprog_t; typedef u_int32_t rpcvers_t; typedef u_int32_t rpcproc_t; typedef u_int32_t rpcprot_t; typedef u_int32_t rpcport_t; typedef int32_t rpc_inline_t;
/* * Authentication info. Opaque to client. */ struct opaque_auth { enum_t oa_flavor; /* flavor of auth */ caddr_t oa_base; /* address of more auth stuff */ u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ }; /* * Auth handle, interface to client side authenticators. */ typedef struct { struct opaque_auth ah_cred; struct opaque_auth ah_verf; struct auth_ops { void (*ah_nextverf)(); int (*ah_marshal)(); /* nextverf & serialize */ int (*ah_validate)(); /* validate verifier */ int (*ah_refresh)(); /* refresh credentials */ void (*ah_destroy)(); /* destroy this structure */ } *ah_ops; caddr_t ah_private; } AUTH;
/* * Client rpc handle. * Created by individual implementations. * Client is responsible for initializing auth. */ typedef struct { AUTH *cl_auth; /* authenticator */ struct clnt_ops { enum clnt_stat (*cl_call)(); /* call remote procedure */ void (*cl_abort)(); /* abort a call */ void (*cl_geterr)(); /* get specific error code */ bool_t (*cl_freeres)(); /* frees results */ void (*cl_destroy)(); /* destroy this structure */ bool_t (*cl_control)(); /* the ioctl() of rpc */ } *cl_ops; caddr_t cl_private; /* private stuff */ char *cl_netid; /* network identifier */ char *cl_tp; /* device name */ } CLIENT;
enum xprt_stat { XPRT_DIED, XPRT_MOREREQS, XPRT_IDLE }; /* * Server side transport handle */ typedef struct { int xp_fd; /* file descriptor for the server handle */ u_short xp_port; /* obsolete */ const struct xp_ops { bool_t (*xp_recv)(); /* receive incoming requests */ enum xprt_stat (*xp_stat)(); /* get transport status */ bool_t (*xp_getargs)(); /* get arguments */ bool_t (*xp_reply)(); /* send reply */ bool_t (*xp_freeargs)(); /* free mem allocated for args */ void (*xp_destroy)(); /* destroy this struct */ } *xp_ops; int xp_addrlen; /* length of remote addr. Obsolete */ struct sockaddr_in xp_raddr; /* Obsolete */ const struct xp_ops2 { bool_t (*xp_control)(); /* catch-all function */ } *xp_ops2; char *xp_tp; /* transport provider device name */ char *xp_netid; /* network identifier */ struct netbuf xp_ltaddr; /* local transport address */ struct netbuf xp_rtaddr; /* remote transport address */ struct opaque_auth xp_verf; /* raw response verifier */ caddr_t xp_p1; /* private: for use by svc ops */ caddr_t xp_p2; /* private: for use by svc ops */ caddr_t xp_p3; /* private: for use by svc lib */ int xp_type /* transport type */ } SVCXPRT;
struct svc_req { rpcprog_t rq_prog; /* service program number */ rpcvers_t rq_vers; /* service protocol version */ rpcproc_t rq_proc; /* the desired procedure */ struct opaque_auth rq_cred; /* raw creds from the wire */ caddr_t rq_clntcred; /* read only cooked cred */ SVCXPRT *rq_xprt; /* associated transport */ };
/* * XDR operations. * XDR_ENCODE causes the type to be encoded into the stream. * XDR_DECODE causes the type to be extracted from the stream. * XDR_FREE can be used to release the space allocated by an XDR_DECODE * request. */ enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 }; /* * This is the number of bytes per unit of external data. */ #define BYTES_PER_XDR_UNIT (4) #define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ * BYTES_PER_XDR_UNIT) /* * A xdrproc_t exists for each data type which is to be encoded or * decoded. The second argument to the xdrproc_t is a pointer to * an opaque pointer. The opaque pointer generally points to a * structure of the data type to be decoded. If this points to 0, * then the type routines should allocate dynamic storage of the * appropriate size and return it. * bool_t (*xdrproc_t)(XDR *, caddr_t *); */ typedef bool_t (*xdrproc_t)(); /* * The XDR handle. * Contains operation which is being applied to the stream, * an operations vector for the particular implementation */ typedef struct { enum xdr_op x_op; /* operation; fast additional param */ struct xdr_ops { bool_t (*x_getlong)(); /* get a long from underlying stream */ bool_t (*x_putlong)(); /* put a long to underlying stream */ bool_t (*x_getbytes)(); /* get bytes from underlying stream */ bool_t (*x_putbytes)(); /* put bytes to underlying stream */ u_int (*x_getpostn)(); /* returns bytes off from beginning */ bool_t (*x_setpostn)(); /* lets you reposition the stream */ long * (*x_inline)(); /* buf quick ptr to buffered data */ void (*x_destroy)(); /* free privates of this xdr_stream */ } *x_ops; caddr_t x_public; /* users' data */ caddr_t x_private; /* pointer to private data */ caddr_t x_base; /* private used for position info */ u_int x_handy; /* extra private word */ } XDR; /* * The netbuf structure. This structure is defined in <xti.h> on SysV * systems, but NetBSD / FreeBSD do not use XTI. * * Usually, buf will point to a struct sockaddr, and len and maxlen * will contain the length and maximum length of that socket address, * respectively. */ struct netbuf { unsigned int maxlen; unsigned int len; void *buf; }; /* * The format of the address and options arguments of the XTI t_bind call. * Only provided for compatibility, it should not be used other than * as an argument to svc_tli_create(). */ struct t_bind { struct netbuf addr; unsigned int qlen; };