rpc_svc_calls(3R)rpc_svc_calls(3R)NAME
rpc_svc_calls: registerrpc, rpc_reg, svc_reg, svc_register, svc_unreg,
svc_unregister, xprt_register, xprt_unregister - library routines for
registering servers
DESCRIPTION
These routines are a part of the RPC library which allows the RPC servers
to register themselves with rpcbind [see rpcbind(1M)], and it associates
the given program and version number with the dispatch function.
This page describes functions in the IRIX standard C library (libc).
Some of these functions are part of the new Transport Independent RPC
(TI-RPC) functionality added to the IRIX standard C library in IRIX
release 6.5.21 (known as BSD TI-RPC) and should not be confused with the
older TI-RPC functionality in the UNIX System V Networking Library (known
as System V TI-RPC, see intro(3N)). In particular, the BSD TI-RPC
functions use the BSD socket network API instead of the System V TLI
network API.
BSD TI-RPC functions are marked in this page as BSD TI-RPC only. To use
them code must be compiled with:
cc -D_BSD_TIRPC prog.c
The BSD TI-RPC functions in this page did not exist in IRIX before
release 6.5.21. Applications using them should use the
_MIPS_SYMBOL_PRESENT macro to provide a graceful failure mode when run on
older IRIX releases.
Routines
#include <rpc/rpc.h>
#ifdef _BSD_TIRPC
#include <netconfig.h>
#endif
int
registerrpc(rpcprog_t prognum,
rpcvers_t versnum, rpcproc_t procnum,
void *(*procname)(void *),
xdrproc_t inproc, xdrproc_t 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(s);
progname should return a pointer to its static result(s); 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.
Page 1
rpc_svc_calls(3R)rpc_svc_calls(3R)
Warning: remote procedures registered in this form are accessed
using the UDP/IP transport; see svcudp_create() for restrictions.
int
rpc_reg(rpcprog_t prognum, rpcvers_t versnum,
rpcproc_t procnum, void *(*procname)(void*),
xdrproc_t inproc, xdrproc_t outproc,
const char *nettype);
BSD TI-RPC only. Register program prognum, procedure procname, and
version versnum 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(s); procname
should return a pointer to its static result(s); inproc is used to
decode the parameters while outproc is used to encode the results.
Procedures are registered on all available transports of the class
nettype. nettype defines a class of transports which can be used
for a particular application. If nettype is NULL, it defaults to
netpath. This routine returns 0 if the registration succeeded, -1
otherwise.
int
svc_reg(SVCXPRT *xprt, rpcprog_t prognum, rpcvers_t versnum,
const void (*dispatch)(struct svc_req *, SVCXPRT *),
struct netconfig *netconf);
BSD TI-RPC only. Associates prognum and versnum with the service
dispatch procedure, dispatch. If netconf is NULL, the service is
not registered with the rpcbind service. If netconf is non-zero,
then a mapping of the triple [prognum, versnum, netconf->nc_netid]
to xprt->xp_ltaddr is established with the local rpcbind service.
The svc_reg routine returns 1 if it succeeds, and 0 otherwise
bool_t
svc_register(SVCXPRT *xprt,
rpcprog_t prognum, rpcvers_t versnum,
void (*dispatch)(struct svc_req *,SVCXPRT *),
int protocol)
Associates prognum and versnum with the service dispatch procedure,
dispatch. If protocol is 0, the service is not registered with the
portmap service. If protocol is non-zero, then a mapping of the
triple [prognum, versnum, protocol] to xprt->xp_port is established
with the local portmap service (generally protocol is 0, IPPROTO_UDP
or IPPROTO_TCP ). The procedure dispatch has the following form:
void
dispatch(struct svc_req *request, SVCXPRT *xprt)
Page 2
rpc_svc_calls(3R)rpc_svc_calls(3R)
The svc_register() routine returns 1 if it succeeds, and 0
otherwise.
void
svc_unreg(rpcprog_t prognum, rpcvers_t versnum);
BSD TI-RPC only. Remove, from the rpcbind service, all mappings of
the double [prognum, versnum] to dispatch routines, and of the
triple [prognum, versnum, *] to network address.
void
svc_unregister(rpcprog_t prognum, rpcvers_t versnum)
Remove all mapping of the double [prognum, versnum] to dispatch
routines, and of the triple [prognum, versnum, *] to port number.
void
xprt_register(SVCXPRT *xprt);
After RPC service transport handle xprt is created, it is registered
with the RPC service package. This routine modifies the global
variable svc_fds. Service implementors usually do not need this
routine.
void
xprt_unregister(SVCXPRT *xprt);
Before an RPC service transport handle xprt is destroyed, it
unregisters itself with the RPC service package. This routine
modifies the global variable svc_fds. Service implementors usually
do not need this routine.
SEE ALSOgetnetconfigent(3N), rpc(3R), rpcbind(1M), rpcbind(3R),
rpc_svc_create(3R), rpc_svc_reg(3R)
Page 3