rpc_svc_calls(3N)
NAME
rpc_svc_calls, svc_dg_enablecache, svc_exit, svc_fdset, svc_freeargs, svc_getargs, svc_getreq_common, svc_getreq_poll, svc_getreqset, svc_getrpccaller, svc_pollset, svc_run, svc_sendreply − library routines for RPC servers
DESCRIPTION
These routines are part of the RPC library which allows C language programs to make procedure calls on other machines across the network.
These routines are associated with the server side of the RPC mechanism. Some of them are called by the server side dispatch function, while others (such as svc_run()) are called when the server is initiated.
Routines
#include <rpc/rpc.h>
int svc_dg_enablecache(SVCXPRT ∗xprt, const unsigned long cache_size);
This function allocates a duplicate request cache for the service endpoint xprt, large enough to hold cache_size entries. Once enabled, there is no way to disable caching. This routine returns 0 if space necessary for a cache of the given size was successfully allocated, and 1 otherwise.
void svc_exit(void);
This function when called by any of the RPC server procedure or otherwise, causes svc_run() to return.
fd_set svc_fdset;
A global variable reflecting the RPC server’s read file descriptor bit mask; it is suitable as a parameter to the select(3C) system call. This is only of interest if service implementors do not call svc_run(), but rather do their own asynchronous event processing. This variable is read-only (do not pass its address to select(3C)!), yet it may change after calls to svc_getreqset() or any creation routines.
bool_t svc_freeargs(const SVCXPRT ∗xprt, const xdrproc_t inproc, caddr_t in);
A function macro that frees any data allocated by the RPC/XDR system when it decoded the arguments to a service procedure using svc_getargs(). This routine returns TRUE if the results were successfully freed, and FALSE otherwise.
bool_t svc_getargs(const SVCXPRT ∗xprt, const xdrproc_t inproc, caddr_t in);
A function macro that decodes the arguments of an RPC request associated with the RPC service transport handle xprt. The parameter in is the address where the arguments will be placed; inproc is the XDR routine used to decode the arguments. This routine returns TRUE if decoding succeeds, and FALSE otherwise.
void svc_getreq_common(const int fd);
This routine is called to handle a request on the given file descriptor.
void svc_getreq_poll(struct pollfd ∗pfdp, const int pollretval);
This routine is only of interest if a service implementor does not call svc_run(), but instead implements custom asynchronous event processing. It is called when poll(2) has determined that an RPC request has arrived on some RPC file descriptors; pollretval is the return value from poll() and pfdp is the array of pollfd structures on which the poll() was done. It is assumed to be an array large enough to contain the maximal number of descriptors allowed.
void svc_getreqset(fd_set ∗rdfds);
This routine is only of interest if a service implementor does not call svc_run(), but instead implements custom asynchronous event processing. It is called when poll() has determined that an RPC request has arrived on some RPC file descriptors; rdfds is the resultant read file descriptor bit mask. The routine returns when all file descriptors associated with the value of rdfds have been serviced.
struct netbuf ∗svc_getrpccaller(const SVCXPRT ∗xprt);
The approved way of getting the network address of the caller of a procedure associated with the RPC service transport handle xprt.
struct pollfd svc_pollset[FD_SETSIZE];
svc_pollset is an array of pollfd structures derived from svc_fdset[]. It is suitable as a parameter to the poll(2) system call. This is only of interest if a service implementor does not call svc_run(), but rather does their own asynchronous event processing.
void svc_run(void);
This routine never returns. It waits for RPC requests to arrive, and calls the appropriate service procedure using svc_getreq_poll() when one arrives. This procedure is usually waiting for the poll() library call to return.
bool_t svc_sendreply(const SVCXPRT ∗xprt, const xdrproc_t outproc,
const caddr_t ∗out);
Called by an RPC service’s dispatch routine to send the results of a remote procedure call. The parameter xprt is the request’s associated transport handle; outproc is the XDR routine which is used to encode the results; and out is the address of the results. This routine returns TRUE if it succeeds, FALSE otherwise.
SEE ALSO
poll(2), rpc(3N), rpc_svc_create(3N), rpc_svc_err(3N)
SunOS 5.1/SPARC — Last change: 10 Dec 1991