'\"macro stdmacro
.if n .pH g3n.rpc_svc_reg @(#)rpc_svc_reg	40.5 of 10/10/89
.\" Copyright 1989 AT&T
.\" ident	"@(#)svid_rs:rs_lib/rpc_svc_reg	1.5"
.\" @(#)rpc_svc_reg 1.5 89/07/25 SMI;
'\" macro stdmacro
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
.nr X
.if \nX=0 .ds x} rpc_svc_reg 3N "" "\&"
.if \nX=1 .ds x} rpc_svc_reg 3N ""
.if \nX=2 .ds x} rpc_svc_reg 3N "" "\&"
.if \nX=3 .ds x} rpc_svc_reg "" "" "\&"
.TH \*(x}
.SH NAME
.na
\f4rpc_svc_reg\fP:  \f4 svc_freeargs\f1, \f4svc_getargs\f1, \f4svc_getreqset\f1, \f4svc_getrpccaller\f1, \f4svc_run\f1, \f4svc_sendreply\f1 \- library routines for RPC servers
.ad
.SH DESCRIPTION
These routines are part of the RPC library which
allows C language programs to make procedure
calls on other machines across the network.
.P
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
\f4svc_run\f1]
are called when the server is initiated.
.SS Routines
.ig
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 8
.P
.ft 4
.nf
.sp .5
int
svc_freeargs(const SVCXPRT *xprt, const xdrproc_t inproc, char *in);
.fi
.ft 1
.IP
A function macro that frees any data allocated by the RPC/XDR
system when it decoded the arguments to a service procedure
using
\f4svc_getargs\f1.
This routine returns \f41\f1 if the results were successfully
freed,
and \f40\f1 otherwise.
.br
.if t .ne 10
.P
.ft 4
.nf
.sp .5
int
svc_getargs(const SVCXPRT *xprt, const xdrproc_t inproc, caddr_t *in);
.fi
.ft 1
.IP
A function macro that decodes the arguments of an
RPC request associated with the
RPC service transport handle
\f2xprt\f1.
The parameter
\f2in\f1
is the address where the arguments will be placed;
\f2inproc\f1
is the XDR
routine used to decode the arguments.
This routine returns \f41\f1 if decoding succeeds,
and \f40\f1 otherwise.
.br
.if t .ne 9
.P
.ft 4
.nf
.sp .5
void
svc_getreqset(fd_set *rdfds);
.fi
.ft 1
.IP
This routine is only of interest if a service implementor
does not call
\f4svc_run\f1,
but instead implements custom asynchronous event processing.
It is called when \f4poll\f1
has determined that an RPC
request has arrived on some RPC
file descriptors;
\f2rdfds\f1
is the resultant read file descriptor bit mask.
The routine returns when all file descriptors
associated with the value of
\f2rdfds\f1
have been serviced
.br
.if t .ne 9
.P
.ft 4
.nf
.sp .5
struct netbuf *
svc_getrpccaller(const SVCXPRT *xprt);
.fi
.ft 1
.IP
The approved way of getting the
network address of the caller
of a procedure associated with the
RPC service transport handle
\f2xprt\f1.
.br
.if t .ne 6
.P
.ft 4
.nf
.sp .5
void
svc_run(void);
.fi
.ft 1
.IP
This routine never returns.
It waits for RPC requests to arrive,
and calls the appropriate service
procedure using
\f4svc_getreqset\f1
when one arrives.
This procedure is usually waiting for a
\f4poll\f1
library call to return.
.br
.if t .ne 9
.P
.ft 4
.nf
.sp .5
int
svc_sendreply(const SVCXPRT *xprt, const xdrproc_t outproc,
	const caddr_t *out);
.fi
.ft 1
.IP
Called by an RPC
service's dispatch routine to send the results of a
remote procedure call.
The parameter
\f2xprt\f1
is the request's associated transport handle;
\f2outproc\f1
is the XDR
routine which is used to encode the results;
and
\f2out\f1
is the address of the results.
This routine returns \f41\f1 if it succeeds,
\f40\f1 otherwise.
.SH SEE ALSO
.na
\f4poll\fP(2),
\f4rpc\fP(3N),
\f4rpc_svc_calls\fP(3N),
\f4rpc_svc_create\fP(3N),
\f4rpc_svc_err\fP(3N).
.ad
