RPC_SVC_CALLS(3N)

NAME
registerrpc, svc_register, svc_unregister, xprt_register, xprt_unregister - library routines for registerring servers

DESCRIPTION

These routines are a part of the RPC library which allows the RPC servers to register themselves with portmap(8C), and it associates the given program and version number with the dispatch function.

  Routines

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

#include <rpc/rpc.h>

int registerrpc(prognum, versnum, procnum, procname, inproc, outproc)
u_long prognum, versnum, procnum;
char *(*procname) () ;
xdrproc_t inproc, outproc;

    Register procedure procname with the RPC service package. If a request arrives for program prognum, version versnum, and procedure procnum, procname is called with a pointer to its parameter; progname must be a procedure that returns a pointer to its static result; inproc is used to decode the parameters while outproc is used to encode the results. This routine returns 0 if the registration succeeded, -1 otherwise.

    Warning: Remote procedures registered in this form are accessed using the UDP/IP transport; see svcudp_create() on rpc_svc_create(3N) for restrictions. This routine should not be used more than once for the same program and version number.

bool_t svc_register(xprt, prognum, versnum, dispatch, protocol)
SVCXPRT *xprt;
u_long prognum, versnum;
void (*dispatch) ();
u_long protocol;

    Associates prognum and versnum with the service dispatch procedure, dispatch. If protocol is zero, the service is not registered with the portmap service. If protocol is non-zero, a mapping of the triple [prognum, versnum, protocol] to xprt->xp_port is established with the local portmap service (generally protocol is zero, IPPROTO_UDP or IPPROTO_TCP). The procedure dispatch has the following form:
    dispatch(request, xprt)
    struct svc_req *request;
    SVCXPRT *xprt;

    The svc_register() routine returns TRUE if it succeeds, and FALSE otherwise.

void svc_unregister(prognum, versnum)
u_long prognum, versnum;

    Remove all mapping of the pair [prognum,versnum] to dispatch routines, and of the triple [prognum,versnum,*] to port number.

void xprt_register(xprt)
SVCXPRT *xprt;

    After RPC service transport handles are created, they should register themselves with the RPC service package. This routine modifies the global variable svc_fds. Service implementors usually do not need this routine.

void xprt_unregister(xprt)
SVCXPRT *xprt;

    Before an RPC service transport handle is destroyed, it should unregister itself with the RPC service package. This routine modifies the global variable svc_fds. Service implementors usually do not need this routine directly.

SEE ALSO
portmap(3N), rpc(3N), rpc_svc_err(3N), rpc_svc_create(3N), rpc_svc_reg(3N), portmap(8C)