RPC_SVC_REG(3N)

NAME
svc_fds, svc_fdset, svc_freeargs, svc_getargs, svc_getcaller, svc_getreq, svc_getreqset, svc_getcaller, svc_run, svc_sendreply - library routines for RPC servers

DESCRIPTION

RPC routines allow C programs to make procedure calls on other machines across the network. First, the client calls a procedure to send a request to the server. Upon receipt of the request, the server calls a dispatch routine to perform the requested service, and then sends back a reply. Finally, the procedure call returns to the client.

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

The SVCXPRT data structure is defined in the RPC/XDR Library Definitions of the

#include <rpc/rpc.h>

int svc_fds;

    Similar to svc_fdset, but limited to 32 descriptors. This interface is obsoleted by svc_fdset.

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() system call. This is only of interest if a service implementor does not call svc_run(), but rather does their own asynchronous event processing. This variable is read-only (do not pass its address to select()!), yet it may change after calls to svc_getreqset() or any creation routines.

bool_t svc_freeargs(xprt, inproc, in)
SVCXPRT *xprt;
xdrproc_t inproc;
char *in;

    Free 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(xprt, inproc, in)
SVCXPRT *xprt;
xdrproc_t inproc;
char *in;

    Decode 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.

struct sockaddr_in * svc_getcaller(xprt)
SVCXPRT *xprt;

    The approved way of getting the network address of the caller of a procedure associated with the RPC service transport handle, xprt.

void svc_getreq(rdfds)
int rdfds;

    Similar to svc_getreqset(), but limited to 32 descriptors. This interface is obsoleted by svc_getreqset().

void svc_getreqset(rdfdsp)
fd_set *rdfdsp;

    This routine is only of interest if a service implementor does not use svc_run(), but instead implements custom asynchronous event processing. It is called when the select() system call has determined that an RPC request has arrived on some RPC socket(s) ; rdfdsp is the resultant read file descriptor bit mask. The routine returns when all sockets associated with the value of rdfdsp have been serviced.

void svc_run()

    Normally, this routine only returns in the case of some errors. It waits for RPC requests to arrive, and calls the appropriate service procedure using svc_getreq() when one arrives. This procedure is usually waiting for a select() system call to return.

bool_t svc_sendreply(xprt, outproc, out)
SVCXPRT *xprt;
xdrproc_t outproc;
char *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
select(2), rpc(3N), rpc_svc_calls(3N), rpc_svc_create(3N), rpc_svc_err(3N)