Networking Services Library Functions rpcsvcreg(3NSL)
NAME
rpcsvcreg, rpcreg, svcreg, svcunreg, svcauthreg,
xprtregister, xprtunregister - library routines for regis-
tering 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 associate the given program and version
number with the dispatch function. When the RPC server
receives a RPC request, the library invokes the dispatch
routine with the appropriate arguments.
Routines
See rpc(3NSL) for the definition of the SVCXPRT data struc-
ture.
#include
boolt rpcreg(const rpcprogt prognum, const rpcverst
versnum, const rpcproct procnum, char * (*procname)(),
const xdrproct inproc, const xdrproct outproc, const char
*nettype);
Register program prognum, procedure procname, and ver-
sion versnum with the RPC service package. If a request
arrives for program prognum, version versnum, and pro-
cedure procnum, procname is called with a pointer to its
parameter(s); procname should return a pointer to its
static result(s). The arg parameter to procname is a
pointer to the (decoded) procedure argument. inproc is
the XDR function used to decode the parameters while
outproc is the XDR function used to encode the results.
Procedures are registered on all available transports of
the class nettype. See rpc(3NSL). This routine returns 0
if the registration succeeded, -1 otherwise.
int svcreg(const SVCXPRT *xprt, const rpcprogt prognum,
const rpcverst versnum, const void (*dispatch)(), const
struct netconfig *netconf);
Associates prognum and versnum with the service dispatch
procedure, dispatch. If netconf is NUL, the service is
not registered with the rpcbind service. For example,
if a service has already been registered using some
other means, such as inetd (see inetd(1M)), it will not
need to be registered again. If netconf is non-zero,
then a mapping of the triple [prognum, versnum,
netconf->] to xprt-> xpltaddr is established with the
SunOS 5.11 Last change: 20 Feb 1998 1
Networking Services Library Functions rpcsvcreg(3NSL)
local rpcbind service.
The svcreg() routine returns 1 if it succeeds, and 0
otherwise.
void svcunreg(const rpcprogt prognum, const rpcverst
versnum);
Remove from the rpcbind service, all mappings of the
triple [prognum, versnum, all-transports] to network
address and all mappings within the RPC service package
of the double [prognum, versnum] to dispatch routines.
int svcauthreg(const int credflavor, const enum authstat
(*handler)());
Registers the service authentication routine handler
with the dispatch mechanism so that it can be invoked to
authenticate RPC requests received with authentication
type credflavor. This interface allows developers to
add new authentication types to their RPC applications
without needing to modify the libraries. Service imple-
mentors usually do not need this routine.
Typical service application would call svcauthreg()
after registering the service and prior to calling
svcrun(). When needed to process an RPC credential of
type credflavor, the handler procedure will be called
with two parameters (struct svcreq *rqst, struct
rpcmsg *msg) and is expected to return a valid enum
authstat value. There is no provision to change or
delete an authentication handler once registered.
The svcauthreg() routine returns 0 if the registration
is successful, 1 if credflavor already has an authenti-
cation handler registered for it, and -1 otherwise.
void xprtregister(const SVCXPRT *xprt);
After RPC service transport handle xprt is created, it
is registered with the RPC service package. This routine
modifies the global variable svcfdset (see
rpcsvccalls(3NSL)). Service implementors usually do
not need this routine.
void xprtunregister(const SVCXPRT *xprt);
Before an RPC service transport handle xprt is
SunOS 5.11 Last change: 20 Feb 1998 2
Networking Services Library Functions rpcsvcreg(3NSL)
destroyed, it unregisters itself with the RPC service
package. This routine modifies the global variable
svcfdset (see rpcsvccalls(3NSL)). Service implemen-
tors usually do not need this routine.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
MT-Level MT-Safe
SEE ALSO
inetd(1M), rpcbind(1M), rpc(3NSL), rpcsvccalls(3NSL),
rpcsvccreate(3NSL), rpcsvcerr(3NSL), rpcbind(3NSL),
select(3C), attributes(5)
SunOS 5.11 Last change: 20 Feb 1998 3
|