'\"macro stdmacro
.if n .pH g3n.rpc_svc_cls @(#)rpc_svc_cls	40.5 of 10/10/89
.\" Copyright 1989 AT&T
.\" ident	"@(#)svid_rs:rs_lib/rpc_svc_calls	1.5"
.\" @(#)rpc_svc_call 1.5 89/07/20 SMI;
'\" macro stdmacro
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
.nr X
.if \nX=0 .ds x} rpc_svc_calls 3N "" "\&"
.if \nX=1 .ds x} rpc_svc_calls 3N ""
.if \nX=2 .ds x} rpc_svc_calls 3N "" "\&"
.if \nX=3 .ds x} rpc_svc_calls "" "" "\&"
.TH \*(x}
.SH NAME
.na
\f4rpc_svc_calls\fP:  \f4 rpc_reg\f1, \f4svc_reg\f1, \f4svc_unreg\f1, \f4xprt_register\f1, \f4xprt_unregister\f1 \- library routines for registering servers
.ad
.SH DESCRIPTION
.P
These routines are a part of the RPC library which
allows the
RPC
servers to register themselves with
\f4rpcbind\f1 [see \f4rpcbind\fP(1M)],
and it associates the given program and version
number with the dispatch function.
.SS Routines
See \f4rpc\fP(3N) for the definition of the 
\f4SVCXPRT\f1
data structure.
.P
.ft 4
.nf
.sp .5
#include <rpc/rpc.h>
.fi
.ft 1
.br
.if t .ne 15
.P
.ft 4
.nf
.sp .5
.\" this routine was originally registerrpc_cots, then registerrpc_nt
int
rpc_reg(const u_long prognum, const u_long versnum,
	const u_long procnum, const char *(*procname),
	const xdrproc_t inproc, const xdrproc_t outproc,
	const char *nettype);
.fi
.ft 1
.IP
Register program
\f2prognum\fP,
procedure
\f2procname\fP,
and version
\f2versnum\fP
with the RPC service package.
If a request arrives for program
\f2prognum\f1,
version
\f2versnum\f1,
and procedure
\f2procnum\f1,
\f2procname\f1
is called with a pointer to its parameter(s);
\f2procname\f1
should return a pointer to its \f4static\fP result(s);
\f2inproc\f1
is used to decode the parameters while
\f2outproc\f1
is used to encode the results.
Procedures are registered on all available
transports of the class
\f2nettype\f1.
\f2nettype\f1
defines a class of transports which can be used
for a particular application.
If
\f2nettype\f1
is \f4NULL\fP,
it defaults to
\f4netpath\f1.
This routine returns \f40\f1 if the registration succeeded,
\f4\-1\f1 otherwise.
.br
.if t .ne 17
.P
.ft 4
.nf
.sp .5
int
svc_reg(const SVCXPRT *xprt, const u_long prognum, const u_long versnum,
	const void (*dispatch), const struct netconfig *netconf);
.fi
.ft 1
.IP
Associates
\f2prognum\f1
and
\f2versnum\f1
with the service dispatch procedure,
\f2dispatch\f1.
If
\f2netconf\f1
is \f4NULL\fP,
the service is not registered with the
\f4rpcbind\f1
service.
If
\f2netconf\f1
is non-zero,
then a mapping of the triple
[\f2prognum, versnum, netconf\f4\->nc_netid\f1]
to
\f2\%xprt\f4\->xp_ltaddr\f1
is established with the local
\f4rpcbind\f1
service.
.IP
The
\f4svc_reg\f1
routine returns \f41\f1 if it succeeds,
and \f40\f1 otherwise
.br
.if t .ne 7
.P
.ft 4
.nf
.sp .5
void
svc_unreg(const u_long prognum, const u_long versnum);
.fi
.ft 1
.IP
Remove, from the
\f4rpcbind\fP
service,
all mappings of the double
[\f2prognum, versnum\f1]
to dispatch routines, and of the triple
[\f2prognum, versnum, \f4*\f1]
to network address.
.br
.if t .ne 8
.P
.ft 4
.nf
.sp .5
void
xprt_register(const SVCXPRT *xprt);
.fi
.ft 1
.IP
After RPC service transport handle
\f2xprt\f1
is created,
it is registered with the
RPC service package.
This routine modifies the global variable
\f4svc_fds\f1.
Service implementors usually do not need this routine.
.br
.if t .ne 8
.P
.ft 4
.nf
.sp .5
void
xprt_unregister(const SVCXPRT *xprt);
.fi
.ft 1
.IP
Before an RPC
service transport handle
\f2xprt\f1
is destroyed,
it unregisters itself with the
RPC service package.
This routine modifies the global variable
\f4svc_fds\f1.
Service implementors usually do not need this routine.
.SH SEE ALSO
.na
\f4rpcbind\fP(1M),
\f4rpcbind\fP(3N),
\f4rpc\fP(3N),
\f4rpc_svc_err\fP(3N),
\f4rpc_svc_create\fP(3N),
\f4rpc_svc_reg\fP(3N).
.ad
