[mod.sources] Sun RPC part 5 of 10

sources-request@genrad.UUCP (04/15/85)

From: blyon@sun (Bob Lyon)

----------------- cut here --------------------
# run this script through "sh" to extract files
echo x - rpc.prog2
sed 's/^X//' >rpc.prog2 <<'!Funky!Stuff!'
X.H A "Synopsis of RPC Routines"
X.SH
auth_destroy()
X.LP
X.LS
void
auth_destroy(auth)
	AUTH *auth;
X.LE
A macro that destroys the authentication information associated with
X.L auth .
Destruction usually involves deallocation
of private data structures.  The use of 
X.L auth
is undefined after calling
X.L auth_destroy() .
X.SH
authnone_create()
X.LP
X.LS
AUTH *
authnone_create()
X.LE
Creates and returns an RPC authentication handle that passes no
usable authentication information with each remote procedure call.
X.SH
authunix_create()
X.LP
X.LS
AUTH *
authunix_create(host, uid, gid, len, aup_gids)
	char *host;
	int uid, gid, len, *aup_gids;
X.LE
Creates and returns an RPC authentication handle that contains
X.UX
authentication information.
The parameter
X.L host
is the name of the machine on which the information was created;
X.L uid
is the user's user ID;
X.L gid
is the user's current group ID;
X.L len
and
X.L aup_gids
refer to a counted array of groups to which the user belongs.
It is easy to impersonate a user.
X.SH
authunix_create_default()
X.LP
X.LS
AUTH *
authunix_create_default()
X.LE
Calls
X.L authunix_create()
with the appropriate parameters.
X.SH
callrpc()
X.LP
X.LS
callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
	char *host;
	u_long prognum, versnum, procnum;
	char *in, *out;
	xdrproc_t inproc, outproc;
X.LE
Calls the remote procedure associated with
X.L prognum ,
X.L versnum ,
and
X.L procnum
on the machine,
X.L host .
The parameter
X.L in
is the address of the procedure's argument(s), and
X.L out
is the address of where to place the result(s);
X.L inproc
is used to encode the procedure's parameters, and
X.L outproc
is used to decode the procedure's results.
This routine returns zero if it succeeds, or the value of
X.L "enum clnt_stat"
cast to an integer if it fails.
The routine
X.L clnt_perrno()
is handy for translating failure statuses into messages.
Warning: calling remote procedures with this routine
uses UDP/IP as a transport; see
X.L clntudp_create()
for restrictions.
X.SH
clnt_broadcast()
X.LP
X.LS
enum clnt_stat
clnt_broadcast(prognum, versnum, procnum, inproc, in, outproc, out, eachresult)
	u_long prognum, versnum, procnum;
	char *in, *out;
	xdrproc_t inproc, outproc;
	resultproc_t eachresult;
X.LE
Like
X.L callrpc() ,
except the call message is broadcast to all locally connected broadcast nets.
Each time it receives a response, this routine calls
X.L eachresult ,
whose form is
X.LS
	eachresult(out, addr)
		char *out;
		struct sockaddr_in *addr;
X.LE
where
X.L out
is the same as
X.L out
passed to
X.L clnt_broadcast() ,
except that the remote procedure's output is decoded there;
X.L addr
points to the address of the machine that sent the results.  If
X.L eachresult()
returns zero,
X.L clnt_broadcast()
waits for more replies;
otherwise it returns with appropriate status.
X.SH
clnt_call()
X.LP
X.LS
enum clnt_stat
clnt_call(clnt, procnum, inproc, in, outproc, out, tout)
	CLIENT *clnt; long procnum;
	xdrproc_t inproc, outproc;
	char *in, *out;
	struct timeval tout;
X.LE
A macro that calls the remote procedure
X.L procnum
associated with the client handle,
X.L clnt ,
which is obtained with an RPC client creation routine such as
X.L clntudp_create .
The parameter
X.L in
is the address of the procedure's argument(s), and
X.L out
is the address of where to place the result(s);
X.L inproc
is used to encode the procedure's parameters, and
X.L outproc
is used to decode the procedure's results;
X.L tout
is the time allowed for results to come back.
X.SH
clnt_destroy()
X.LP
X.LS
clnt_destroy(clnt)
	CLIENT *clnt;
X.LE
A macro that destroys the client's RPC handle.
Destruction usually involves deallocation
of private data structures, including
X.L clnt
itself.  Use of
X.L clnt
is undefined after calling
X.L clnt_destroy() .
Warning: client destruction routines do not close sockets associated with
X.L clnt ;
this is the responsibility of the user.
X.SH
clnt_freeres()
X.LP
X.LS
clnt_freeres(clnt, outproc, out)
	CLIENT *clnt;
	xdrproc_t outproc;
	char *out;
X.LE
A macro that frees any data allocated by the RPC/XDR system
when it decoded the results of an RPC call.
The parameter
X.L out
is the address of the results, and
X.L outproc
is the XDR routine describing the results in simple primitives.
This routine returns one if the results were successfully freed,
and zero otherwise.
X.SH
clnt_geterr()
X.LP
X.LS
void
clnt_geterr(clnt, errp)
	CLIENT *clnt;
	struct rpc_err *errp;
X.LE
A macro that copies the error structure out of the client handle
to the structure at address
X.L errp .
X.SH
clnt_pcreateerror()
X.LP
X.LS
void
clnt_pcreateerror(s)
	char *s;
X.LE
Prints a message to standard error indicating
why a client RPC handle could not be created.
The message is prepended with string
X.L s
and a colon.
X.SH
clnt_perrno()
X.LP
X.LS
void
clnt_perrno(stat)
	enum clnt_stat;
X.LE
Prints a message to standard error corresponding
to the condition indicated by
X.L stat .
X.SH
clnt_perror()
X.LP
X.LS
clnt_perror(clnt, s)
	CLIENT *clnt;
	char *s;
X.LE
Prints a message to standard error indicating why an RPC call failed;
X.L clnt
is the handle used to do the call.
The message is prepended with string
X.L s
and a colon.
X.SH
clntraw_create()
X.LP
X.LS
CLIENT *
clntraw_create(prognum, versnum)
	u_long prognum, versnum;
X.LE
This routine creates a toy RPC client for the remote program
X.L prognum ,
version
X.L versnum .
The transport used to pass messages to the service
is actually a buffer within the process's address space,
so the corresponding RPC server should live in the same address space; see
X.L svcraw_create() .
This allows simulation of RPC and acquisition of RPC overheads,
such as round trip times, without any kernel interference.
This routine returns NULL if it fails.
X.SH
clnttcp_create()
X.LP
X.LS
CLIENT *
clnttcp_create(addr, prognum, versnum, sockp, sendsz, recvsz)
	struct sockaddr_in *addr;
	u_long prognum, versnum;
	int *sockp;
	u_int sendsz, recvsz;
X.LE
This routine creates an RPC client for the remote program
X.L prognum ,
version
X.L versnum ;
the client uses TCP/IP as a transport.
The remote program is located at Internet address
X.L *addr .
If
X.L addr->sin_port
is zero, then it is set to the actual port that the remote
program is listening on (the remote
X.I portmap
service is consulted for this information).
The parameter
X.L *sockp
is a socket; if it is RPC_ANYSOCK, then
this routine opens a new one and sets
X.L *sockp .
Since TCP-based RPC uses buffered I/O, the user may specify
the size of the send and receive buffers with the parameters
X.L sendsz
and
X.L recvsz ;
values of zero choose suitable defaults.
This routine returns NULL if it fails.
X.SH
clntudp_create()
X.LP
X.LS
CLIENT *
clntudp_create(addr, prognum, versnum, wait, sockp)
	struct sockaddr_in *addr;
	u_long prognum, versnum;
	struct timeval wait;
	int *sockp;
X.LE
This routine creates an RPC client for the remote program
X.L prognum ,
version
X.L versnum ;
the client uses use UDP/IP as a transport.
The remote program is located at Internet address
X.L *addr .
If
X.L addr->sin_port
is zero, then it is set to actual port that the remote
program is listening on (the remote
X.I portmap
service is consulted for this information).
The parameter
X.L *sockp
is a socket; if it is RPC_ANYSOCK,
then this routine opens a new one and sets
X.L *sockp .
The UDP transport resends the call message in intervals of
X.L wait
time until a response is received or until the call times out.
Warning: since UDP-based RPC messages can only hold up to 8 Kbytes
of encoded data, this transport cannot be used for procedures
that take large arguments or return huge results.
X.SH
get_myaddress()
X.LP
X.LS
void
get_myaddress(addr)
	struct sockaddr_in *addr;
X.LE
Stuffs the machine's IP address into
X.L *addr ,
without consulting the library routines that deal with
X.I /etc/hosts .
The port number is always set to
X.L htons(PMAPPORT) .
X.SH
pmap_getmaps()
X.LP
X.LS
struct pmaplist *
pmap_getmaps(addr)
	struct sockaddr_in *addr;
X.LE
A user interface to the
X.I portmap
service, which returns a list of the current RPC program-to-port mappings
on the host located at IP address
X.L *addr .
This routine can return NULL.  The command
X.L "rpcinfo -p"
uses this routine.
X.SH
pmap_getport()
X.LP
X.LS
u_short
pmap_getport(addr, prognum, versnum, protocol)
	struct sockaddr_in *addr;
	u_long prognum, versnum, protocol;
X.LE
A user interface to the
X.I portmap
service, which returns the port number
on which waits a service that supports program number
X.L prognum ,
version
X.L versnum ,
and speaks the transport protocol associated with protocol.
A return value of zero means that the mapping does not exist or that
the RPC system failured to contact the remote
X.I portmap
service.  In the latter case, the global variable
X.L rpc_createerr
contains the RPC status.
X.SH
pmap_rmtcall()
X.LP
X.LS
enum clnt_stat
pmap_rmtcall(addr, prognum, versnum, procnum,
	     inproc, in, outproc, out, tout, portp)
	struct sockaddr_in *addr;
	u_long prognum, versnum, procnum;
	char *in, *out;
	xdrproc_t inproc, outproc;
	struct timeval tout;
	u_long *portp;
X.LE
A user interface to the
X.I portmap
service, which instructs
X.I portmap
on the host at IP address
X.L *addr
to make an RPC call on your behalf to a procedure on that host.
The parameter
X.L *portp
will be modified to the program's port number if the procedure succeeds.
The definitions of other parameters are discussed in
X.L callrpc()
and
X.L clnt_call() ;
see also
X.L clnt_broadcast() .
X.SH
pmap_set()
X.LP
X.LS
pmap_set(prognum, versnum, protocol, port)
	u_long prognum, versnum, protocol;
	u_short port;
X.LE
A user interface to the
X.I portmap
service, which establishes a mapping between the triple
X.L [prognum,versnum,protocol]
and
X.L port
on the machine's
X.I portmap
service.  The value of protocol is most likely IPPROTO_UDP or IPPROTO_TCP.
This routine returns one if it succeeds, zero otherwise.
X.SH
pmap_unset()
X.LP
X.LS
pmap_unset(prognum, versnum)
	u_long prognum, versnum;
X.LE
A user interface to the
X.I portmap
service, which destroys all mappings between the triple
X.L [prognum,versnum,*]
and
X.L ports 
on the machine's
X.I portmap
service.
This routine returns one if it succeeds, zero otherwise.
X.SH
registerrpc()
X.LP
X.LS
registerrpc(prognum, versnum, procnum, procname, inproc, outproc)
	u_long prognum, versnum, procnum;
	char *(*procname)();
	xdrproc_t inproc, outproc;
X.LE
Registers procedure
X.L procname
with the RPC service package.  If a request arrives for program
X.L prognum ,
version
X.L versnum ,
and procedure
X.L procnum ,
X.L procname
is called with a pointer to its parameter(s);
X.L progname
should return a pointer to its static result(s);
X.L inproc
is used to decode the parameters while
X.L outproc
is used to encode the results.
This routine returns zero if the registration succeeded, \-1 otherwise.
Warning: remote procedures registered in this form
are accessed using the UDP/IP transport; see
X.L svcudp_create()
for restrictions.
X.SH
rpc_createerr
X.LP
X.LS
struct rpc_createerr	rpc_createerr;
X.LE
A global variable whose value is set by any RPC client creation routine
that does not succeed.  Use the routine
X.L clnt_pcreateerror()
to print the reason why.
X.SH
svc_destroy()
X.LP
X.LS
svc_destroy(xprt)
	SVCXPRT *xprt;
X.LE
A macro that destroys the RPC service transport handle,
X.L xprt .
Destruction usually involves deallocation
of private data structures, including
X.L xprt
itself.  Use of
X.L xprt
is undefined after calling this routine.
X.SH
svc_fds
X.LP
X.LS
int	svc_fds;
X.LE
A global variable reflecting the RPC service side's
read file descriptor bit mask; it is suitable as a parameter to the
X.L select
system call.  This is only of interest
if a service implementor does not call
X.L svc_run() ,
but rather does his own asynchronous event processing.
This variable is read-only (do not pass its address to
X.L select !),
yet it may change after calls to
X.L svc_getreq()
or any creation routines.
X.SH
svc_freeargs()
X.LP
X.LS
svc_freeargs(xprt, inproc, in)
	SVCXPRT *xprt;
	xdrproc_t inproc;
	char *in;
X.LE
A macro that frees any data allocated by the RPC/XDR system
when it decoded the arguments to a service procedure using
X.L svc_getargs().
This routine returns one if the results were successfully freed,
and zero otherwise.
X.SH
svc_getargs()
X.LP
X.LS
svc_getargs(xprt, inproc, in)
	SVCXPRT *xprt;
	xdrproc_t inproc;
	char *in;
X.LE
A macro that decodes the arguments of an RPC request
associated with the RPC service transport handle,
X.L xprt .
The parameter
X.L in
is the address where the arguments will be placed;
X.L inproc
is the XDR routine used to decode the arguments.
This routine returns one if decoding succeeds, and zero otherwise.
X.SH
svc_getcaller()
X.LP
X.LS
struct sockaddr_in
svc_getcaller(xprt)
	SVCXPRT *xprt;
X.LE
The approved way of getting the network address of the caller
of a procedure associated with the RPC service transport handle,
X.L xprt .
X.SH
svc_getreq()
X.LP
X.LS
svc_getreq(rdfds)
	int rdfds;
X.LE
This routine is only of interest if a service implementor does not call
X.L svc_run() ,
but instead implements custom asynchronous event processing.
It is called when the
X.L select
system call has determined that an RPC request
has arrived on some RPC socket(s);
X.L rdfds
is the resultant read file descriptor bit mask.
The routine returns when all sockets associated with the value of
X.L rdfds
have been serviced. 
X.SH
svc_register()
X.LP
X.LS
svc_register(xprt, prognum, versnum, dispatch, protocol)
	SVCXPRT *xprt;
	u_long prognum, versnum;
	void (*dispatch)();
	u_long protocol;
X.LE
Associates
X.L prognum
and
X.L versnum
with the service dispatch procedure,
X.L dispatch .
If
X.L protocol
is non-zero, then a mapping of the triple
X.L [prognum,versnum,protocol]
to
X.L xprt->xp_port
is also established with the local
X.I portmap
service (generally
X.L protocol
is zero, IPPROTO_UDP or IPPROTO_TCP).
The procedure
X.L dispatch()
has the following form:
X.LS
	dispatch(request, xprt)
		struct svc_req *request;
		SVCXPRT *xprt;
X.LE
The
X.L svc_register
routine returns one if it succeeds, and zero otherwise.
X.SH
svc_run()
X.LP
X.LS
svc_run()
X.LE
This routine never returns.  It waits for RPC requests to arrive
and calls the appropriate service procedure (using
X.L svc_getreq )
when one arrives.  This procedure is usually waiting for a
X.L select
system call to return.
X.SH
svc_sendreply()
X.LP
X.LS
svc_sendreply(xprt, outproc, out)
	SVCXPRT *xprt;
	xdrproc_t outproc;
	char *out;
X.LE
Called by an RPC service's dispatch routine
to send the results of a remote procedure call.
The parameter
X.L xprt
is the caller's associated transport handle;
X.L outproc
is the XDR routine which is used to encode the results; and
X.L out
is the address of the results.
This routine returns one if it succeeds, zero otherwise.
X.SH
svc_unregister()
X.LP
X.LS
void
svc_unregister(prognum, versnum)
	u_long prognum, versnum;
X.LE
Removes all mapping of the double
X.L [prognum,versnum]
to dispatch routines, and of the triple
X.L [prognum,versnum,*]
to port number.
X.SH
svcerr_auth()
X.LP
X.LS
void
svcerr_auth(xprt, why)
	SVCXPRT *xprt;
	enum auth_stat why;
X.LE
Called by a service dispatch routine that refuses to perform
a remote procedure call due to an authentication error.
X.SH
svcerr_decode()
X.LP
X.LS
void
svcerr_decode(xprt)
	SVCXPRT *xprt;
X.LE
Called by a service dispatch routine that can't successfully
decode its parameters.  See also
X.L svc_getargs() .
X.SH
svcerr_noproc()
X.LP
X.LS
void
svcerr_noproc(xprt)
	SVCXPRT *xprt;
X.LE
Called by a service dispatch routine that doesn't implement
the desired procedure number the caller request.
X.SH
svcerr_noprog()
X.LP
X.LS
void
svcerr_noprog(xprt)
	SVCXPRT *xprt;
X.LE
Called when the desired program is not registered with the RPC package.
Service implementors usually don't need this routine.
X.SH
svcerr_progvers()
X.LP
X.LS
void
svcerr_progvers(xprt)
	SVCXPRT *xprt;
X.LE
Called when the desired version of a program is not registered
with the RPC package.
Service implementors usually don't need this routine.
X.SH
svcerr_systemerr()
X.LP
X.LS
void
svcerr_systemerr(xprt)
	SVCXPRT *xprt;
X.LE
Called by a service dispatch routine when it detects a system error
not covered by any particular protocol.
For example, if a service can no longer allocate storage,
it may call this routine.
X.SH
svcerr_weakauth()
X.LP
X.LS
void
svcerr_weakauth(xprt)
	SVCXPRT *xprt;
X.LE
Called by a service dispatch routine that refuses to perform
a remote procedure call due to insufficient (but correct)
authentication parameters.  The routine calls
X.L svcerr_auth(xprt,AUTH_TOOWEAK) .
X.SH
svcraw_create()
X.LP
X.LS
SVCXPRT *
svcraw_create()
X.LE
This routine creates a toy RPC service transport,
to which it returns a pointer.  The transport
is really a buffer within the process's address space,
so the corresponding RPC client should live in the same address space; see
X.L clntraw_create() .
This routine allows simulation of RPC and acquisition of RPC overheads
(such as round trip times), without any kernel interference.
This routine returns NULL if it fails.
X.SH
svctcp_create()
X.LP
X.LS
SVCXPRT *
svctcp_create(sock, send_buf_size, recv_buf_size)
	int sock;
	u_int send_buf_size, recv_buf_size;
X.LE
This routine creates a TCP/IP-based RPC service transport,
to which it returns a pointer.
The transport is associated with the socket
X.L sock ,
which may be RPC_ANYSOCK, in which case a new socket is created.
If the socket is not bound to a local TCP port, then this routine
binds it to an arbitrary port.  Upon completion,
X.L xprt->xp_sock
is the transport's socket number, and
X.L xprt->xp_port
is the transport's port number.
This routine returns NULL if it fails.
Since TCP-based RPC uses buffered I/O, users may specify the size of the
X.L send
and
X.L receive
buffers; values of zero choose suitable defaults.
X.SH
svcudp_create()
X.LP
X.LS
SVCXPRT *
svcudp_create(sock)
	int sock;
X.LE
This routine creates a UDP/IP-based RPC service transport,
to which it returns a pointer.
The transport is associated with the socket
X.L sock ,
which may be RPC_ANYSOCK, in which case a new socket is created.
If the socket is not bound to a local UDP port, then this routine
binds it to an arbitrary port.  Upon completion,
X.L xprt->xp_sock
is the transport's socket number, and
X.L xprt->xp_port
is the transport's port number.
This routine returns NULL if it fails.
Warning: since UDP-based RPC messages can only hold up to 8 Kbytes
of encoded data, this transport cannot be used for procedures
that take large arguments or return huge results.
X.SH
xdr_accepted_reply()
X.LP
X.LS
xdr_accepted_reply(xdrs, ar)
	XDR *xdrs;
	struct accepted_reply *ar;
X.LE
Used for describing RPC messages, externally.
This routine is useful for users who wish to generate
RPC-style messages without using the RPC package.
X.SH
xdr_array()
X.LP
X.LS
xdr_array(xdrs, arrp, sizep, maxsize, elsize, elproc)
	XDR *xdrs;
	char **arrp;
	u_int *sizep, maxsize, elsize;
	xdrproc_t elproc;
X.LE
A filter primitive that translates between arrays
and their corresponding external representations.
The parameter
X.L arrp
is the address of the pointer to the array, while
X.L sizep
is the address of the element count of the array;
this element count cannot exceed
X.L maxsize .
The parameter
X.L elsize
is the
X.L sizeof()
each of the array's elements, and
X.L elproc
is an XDR filter that translates between
the array elements' C form, and their external representation.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_authunix_parms()
X.LP
X.LS
xdr_authunix_parms(xdrs, aupp)
	XDR *xdrs;
	struct authunix_parms *aupp;
X.LE
Used for describing UNIX credentials, externally.
This routine is useful for users who wish to generate
these credentials without using the RPC authentication package.
X.SH
xdr_bool()
X.LP
X.LS
xdr_bool(xdrs, bp)
	XDR *xdrs;
	bool_t *bp;
X.LE
A filter primitive that translates between booleans (C integers)
and their external representations.
When encoding data, this filter produces values of either one or zero.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_bytes()
X.LP
X.LS
xdr_bytes(xdrs, sp, sizep, maxsize)
	XDR *xdrs;
	char **sp;
	u_int *sizep, maxsize;
X.LE
A filter primitive that translates between counted byte strings
and their external representations.
The parameter
X.L sp
is the address of the string pointer.
The length of the string is located at address
X.L sizep ;
strings cannot be longer than
X.L maxsize .
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_callhdr()
X.LP
X.LS
void
xdr_callhdr(xdrs, chdr)
	XDR *xdrs;
	struct rpc_msg *chdr;
X.LE
Used for describing RPC messages, externally.
This routine is useful for users who wish to generate
RPC-style messages without using the RPC package.
X.SH
xdr_callmsg()
X.LP
X.LS
xdr_callmsg(xdrs, cmsg)
	XDR *xdrs;
	struct rpc_msg *cmsg;
X.LE
Used for describing RPC messages, externally.
This routine is useful for users who wish to generate
RPC-style messages without using the RPC package.
X.SH
xdr_double()
X.LP
X.LS
xdr_double(xdrs, dp)
	XDR *xdrs;
	double *dp;
X.LE
A filter primitive that translates between C
X.L double
precision numbers and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_enum()
X.LP
X.LS
xdr_enum(xdrs, ep)
	XDR *xdrs;
	enum_t *ep;
X.LE
A filter primitive that translates between C
X.L enum s
(actually integers) and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_float()
X.LP
X.LS
xdr_float(xdrs, fp)
	XDR *xdrs;
	float *fp;
X.LE
A filter primitive that translates between C
X.L float s
and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_inline()
X.LP
X.LS
long *
xdr_inline(xdrs, len)
	XDR *xdrs;
	int len;
X.LE
A macro that invokes the in-line routine associated with the XDR stream,
X.L xdrs .
The routine returns a pointer
to a contiguous piece of the stream's buffer;
X.L len
is the byte length of the desired buffer.
Note that pointer is cast to
X.L "long *" .
Warning:
X.L xdr_inline()
may return 0 (NULL) if it cannot allocate
a contiguous piece of a buffer.
Therefore the behavior may vary among stream instances;
it exists for the sake of efficiency.
X.SH
xdr_int()
X.LP
X.LS
xdr_int(xdrs, ip)
	XDR *xdrs;
	int *ip;
X.LE
A filter primitive that translates between C integers
and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_long()
X.LP
X.LS
xdr_long(xdrs, lp)
	XDR *xdrs;
	long *lp;
X.LE
A filter primitive that translates between C
X.L long
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_opaque()
X.LP
X.LS
xdr_opaque(xdrs, cp, cnt)
	XDR *xdrs;
	char *cp;
	u_int cnt;
X.LE
A filter primitive that translates between fixed size opaque data
and its external representation.
The parameter
X.L cp
is the address of the opaque object, and
X.L cnt
is its size in bytes.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_opaque_auth()
X.LP
X.LS
xdr_opaque_auth(xdrs, ap)
	XDR *xdrs;
	struct opaque_auth *ap;
X.LE
Used for describing RPC messages, externally.
This routine is useful for users who wish to generate
RPC-style messages without using the RPC package.
X.SH
xdr_pmap()
X.LP
X.LS
xdr_pmap(xdrs, regs)
	XDR *xdrs;
	struct pmap *regs;
X.LE
Used for describing parameters to various
X.I portmap
procedures, externally.
This routine is useful for users who wish to generate
these parameters without using the
X.L pmap
interface.
X.SH
xdr_pmaplist()
X.LP
X.LS
xdr_pmaplist(xdrs, rp)
	XDR *xdrs;
	struct pmaplist **rp;
X.LE
Used for describing a list of port mappings, externally.
This routine is useful for users who wish to generate
these parameters without using the
X.L pmap
interface.
X.SH
xdr_reference()
X.LP
X.LS
xdr_reference(xdrs, pp, size, proc)
	XDR *xdrs;
	char **pp;
	u_int size;
	xdrproc_t proc;
X.LE
A primitive that provides pointer chasing within structures.
The parameter
X.L pp
is the address of the pointer;
X.L size
is the
X.L sizeof()
the structure that
X.L *pp
points to; and
X.L proc
is an XDR procedure that filters the structure
between its C form and its external representation.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_rejected_reply()
X.LP
X.LS
xdr_rejected_reply(xdrs, rr)
	XDR *xdrs;
	struct rejected_reply *rr;
X.LE
Used for describing RPC messages, externally.
This routine is useful for users who wish to generate
RPC-style messages without using the RPC package.
X.SH
xdr_replymsg()
X.LP
X.LS
xdr_replymsg(xdrs, rmsg)
	XDR *xdrs;
	struct rpc_msg *rmsg;
X.LE
Used for describing RPC messages, externally.
This routine is useful for users who wish to generate
RPC style messages without using the RPC package.
X.SH
xdr_short()
X.LP
X.LS
xdr_short(xdrs, sp)
	XDR *xdrs;
	short *sp;
X.LE
A filter primitive that translates between C
X.L short
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_string()
X.LP
X.LS
xdr_string(xdrs, sp, maxsize)
	XDR *xdrs;
	char **sp;
	u_int maxsize;
X.LE
A filter primitive that translates between C strings and their
corresponding external representations.
Strings cannot cannot be longer than
X.L maxsize .
Note that
X.L sp
is the address of the string's pointer.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_u_int()
X.LP
X.LS
xdr_u_int(xdrs, up)
	XDR *xdrs;
	unsigned *up;
X.LE
A filter primitive that translates between C
X.L unsigned
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_u_long()
X.LP
X.LS
xdr_u_long(xdrs, ulp)
	XDR *xdrs;
	unsigned long *ulp;
X.LE
A filter primitive that translates between C
X.L "unsigned long"
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_u_short()
X.LP
X.LS
xdr_u_short(xdrs, usp)
	XDR *xdrs;
	unsigned short *usp;
X.LE
A filter primitive that translates between C
X.L "unsigned short"
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_union()
X.LP
X.LS
xdr_union(xdrs, dscmp, unp, choices, dfault)
	XDR *xdrs;
	int *dscmp;
	char *unp;
	struct xdr_discrim *choices;
	xdrproc_t dfault;
X.LE
A filter primitive that translates between a discriminated C
X.L union
and its corresponding external representation.  The parameter
X.L dscmp
is the address of the union's discriminant, while
X.L unp
in the address of the union.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_void()
X.LP
X.LS
xdr_void()
X.LE
This routine always returns one.
X.SH
xdr_wrapstring()
X.LP
X.LS
xdr_wrapstring(xdrs, sp)
	XDR *xdrs;
	char **sp;
X.LE
A primitive that calls
X.L xdr_string(xdrs,sp,MAXUNSIGNED);
where MAXUNSIGNED is the maximum value of an unsigned integer.
This is handy because the RPC package passes
only two parameters XDR routines, whereas
X.L xdr_string() ,
one of the most frequently used primitives, requires three parameters.
This routine returns one if it succeeds, zero otherwise.
X.SH
xprt_register()
X.LP
X.LS
void
xprt_register(xprt)
	SVCXPRT *xprt;
X.LE
After RPC service transport handles are created,
they should register themselves with the RPC service package.
This routine modifies the global variable
X.L svc_fds .
Service implementors usually don't need this routine.
X.SH
xprt_unregister()
X.LP
X.LS
void
xprt_unregister(xprt)
	SVCXPRT *xprt;
X.LE
Before an RPC service transport handle is destroyed,
it should unregister itself with the RPC service package.
This routine modifies the global variable
X.L svc_fds .
Service implementors usually don't need this routine.
!Funky!Stuff!
echo x - xdr.spec2
sed 's/^X//' >xdr.spec2 <<'!Funky!Stuff!'
X.H A "Synopsis of XDR Routines"
X.SH
xdr_array()
X.LP
X.LS
xdr_array(xdrs, arrp, sizep, maxsize, elsize, elproc)
	XDR *xdrs;
	char **arrp;
	u_int *sizep, maxsize, elsize;
	xdrproc_t elproc;
X.LE
A filter primitive that translates between arrays
and their corresponding external representations.
The parameter
X.L arrp
is the address of the pointer to the array, while
X.L sizep
is the address of the element count of the array;
this element count cannot exceed
X.L maxsize .
The parameter
X.L elsize
is the
X.L sizeof()
each of the array's elements, and
X.L elproc
is an XDR filter that translates between
the array elements' C form, and their external representation.  
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_bool()
X.LP
X.LS
xdr_bool(xdrs, bp)
	XDR *xdrs;
	bool_t *bp;
X.LE
A filter primitive that translates between booleans (C integers)
and their external representations.
When encoding data, this filter produces values of either one or zero.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_bytes()
X.LP
X.LS
xdr_bytes(xdrs, sp, sizep, maxsize)
	XDR *xdrs;
	char **sp;
	u_int *sizep, maxsize;
X.LE
A filter primitive that translates between counted byte strings
and their external representations.
The parameter
X.L sp
is the address of the string pointer.
The length of the string is located at address
X.L sizep ;
strings cannot be longer than
X.L maxsize .
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_destroy()
X.LP
X.LS
void
xdr_destroy(xdrs)
	XDR *xdrs;
X.LE
A macro that invokes the destroy routine
associated with the XDR stream,
X.L xdrs .
Destruction usually involves freeing private data structures
associated with the stream.  Using
X.L xdrs
after invoking
X.L xdr_destroy()
is undefined.
X.SH
xdr_double()
X.LP
X.LS
xdr_double(xdrs, dp)
	XDR *xdrs;
	double *dp;
X.LE
A filter primitive that translates between C
X.L double
precision numbers and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_enum()
X.LP
X.LS
xdr_enum(xdrs, ep)
	XDR *xdrs;
	enum_t *ep;
X.LE
A filter primitive that translates between C
X.L enum s
(actually integers) and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_float()
X.LP
X.LS
xdr_float(xdrs, fp)
	XDR *xdrs;
	float *fp;
X.LE
A filter primitive that translates between C
X.L float s
and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_getpos()
X.LP
X.LS
u_int
xdr_getpos(xdrs)
	XDR *xdrs;
X.LE
A macro that invokes the get-position routine
associated with the XDR stream,
X.L xdrs .
The routine returns an unsigned integer,
which indicates the position of the XDR byte stream.
A desirable feature of XDR streams
is that simple arithmetic works with this number,
although the XDR stream instances need not guarantee this.
X.SH
xdr_inline()
X.LP
X.LS
long *
xdr_inline(xdrs, len)
	XDR *xdrs;
	int len;
X.LE
A macro that invokes the in-line routine associated with the XDR stream,
X.L xdrs .
The routine returns a pointer
to a contiguous piece of the stream's buffer;
X.L len
is the byte length of the desired buffer.
Note that the pointer is cast to
X.L "long *" .
Warning:
X.L xdr_inline()
may return 0 (NULL) if it cannot allocate
a contiguous piece of a buffer.
Therefore the behavior may vary among stream instances;
it exists for the sake of efficiency.
X.SH
xdr_int()
X.LP
X.LS
xdr_int(xdrs, ip)
	XDR *xdrs;
	int *ip;
X.LE
A filter primitive that translates between C integers
and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_long()
X.LP
X.LS
xdr_long(xdrs, lp)
	XDR *xdrs;
	long *lp;
X.LE
A filter primitive that translates between C
X.L long
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_opaque()
X.LP
X.LS
xdr_opaque(xdrs, cp, cnt)
	XDR *xdrs;
	char *cp;
	u_int cnt;
X.LE
A filter primitive that translates between fixed size opaque data
and its external representation.
The parameter
X.L cp
is the address of the opaque object, and
X.L cnt
is its size in bytes.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_reference()
X.LP
X.LS
xdr_reference(xdrs, pp, size, proc)
	XDR *xdrs;
	char **pp;
	u_int size;
	xdrproc_t proc;
X.LE
A primitive that provides pointer chasing within structures.
The parameter
X.L pp
is the address of the pointer;
X.L size
is the
X.L sizeof()
the structure that
X.L *pp
points to; and
X.L proc
is an XDR procedure that filters the structure
between its C form and its external representation.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_setpos()
X.LP
X.LS
xdr_setpos(xdrs, pos)
	XDR *xdrs;
	u_int pos;
X.LE
A macro that invokes the set position routine associated with the XDR stream
X.L xdrs .
The parameter
X.L pos
is a position value obtained from
X.L xdr_getpos() .
This routine returns one if the XDR stream could be repositioned,
and zero otherwise.
Warning: it is difficult to reposition some types of XDR streams,
so this routine may fail with one type of stream and succeed with another. 
X.SH
xdr_short()
X.LP
X.LS
xdr_short(xdrs, sp)
	XDR *xdrs;
	short *sp;
X.LE
A filter primitive that translates between C
X.L short
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_string()
X.LP
X.LS
xdr_string(xdrs, sp, maxsize)
	XDR *xdrs;
	char **sp;
	u_int maxsize;
X.LE
A filter primitive that translates between C strings and their
corresponding external representations.
Strings cannot cannot be longer than
X.L maxsize .
Note that
X.L sp
is the address of the string's pointer.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_u_int()
X.LP
X.LS
xdr_u_int(xdrs, up)
	XDR *xdrs;
	unsigned *up;
X.LE
A filter primitive that translates between C
X.L unsigned
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_u_long()
X.LP
X.LS
xdr_u_long(xdrs, ulp)
	XDR *xdrs;
	unsigned long *ulp;
X.LE
A filter primitive that translates between C
X.L "unsigned long"
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_u_short()
X.LP
X.LS
xdr_u_short(xdrs, usp)
	XDR *xdrs;
	unsigned short *usp;
X.LE
A filter primitive that translates between C
X.L "unsigned short"
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_union()
X.LP
X.LS
xdr_union(xdrs, dscmp, unp, choices, dfault)
	XDR *xdrs;
	int *dscmp;
	char *unp;
	struct xdr_discrim *choices;
	xdrproc_t dfault;
X.LE
A filter primitive that translates between a discriminated C
X.L union
and its corresponding external representation.  The parameter 
X.L dscmp
is the address of the union's discriminant, while
X.L unp
in the address of the union.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdr_void()
X.LP
X.LS
xdr_void()
X.LE
This routine always returns one.
It may be passed to RPC routines that require a function parameter,
where nothing is to be done.
X.SH
xdr_wrapstring()
X.LP
X.LS
xdr_wrapstring(xdrs, sp)
	XDR *xdrs;
	char **sp;
X.LE
A primitive that calls
X.L xdr_string(xdrs,sp,MAXUNSIGNED);
where MAXUNSIGNED is the maximum value of an unsigned integer.
This is handy because the RPC package passes
only two parameters XDR routines, whereas
X.L xdr_string() ,
one of the most frequently used primitives, requires three parameters.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdrmem_create()
X.LP
X.LS
void
xdrmem_create(xdrs, addr, size, op)
	XDR *xdrs;
	char *addr;
	u_int size;
	enum xdr_op op;
X.LE
This routine initializes the XDR stream object pointed to by
X.L xdrs .
The stream's data is written to, or read from,
a chunk of memory at location
X.L addr
whose length is no more than
X.L size
bytes long.  The
X.L op
determines the direction of the XDR stream
(either XDR_ENCODE, XDR_DECODE, or XDR_FREE).
X.SH
xdrrec_create()
X.LP
X.LS
void
xdrrec_create(xdrs, sendsize, recvsize, handle, readit, writeit)
	XDR *xdrs;
	u_int sendsize, recvsize;
	char *handle;
	int (*readit)(), (*writeit)();
X.LE
This routine initializes the XDR stream object pointed to by
X.L xdrs .
The stream's data is written to a buffer of size
X.L sendsize ;
a value of zero indicates the system should use a suitable default.
The stream's data is read from a buffer of size
X.L recvsize ;
it too can be set to a suitable default by passing a zero value.
When a stream's output buffer is full,
X.L writeit()
is called.  Similarly, when a stream's input buffer is empty,
X.L readit()
is called.  The behavior of these two routines
is similar to the UNIX system calls
X.L read
and
X.L write ,
except that
X.L handle
is passed to the former routines as the first parameter.
Note that the XDR stream's
X.L op
field must be set by the caller.
Warning: this XDR stream implements an intermediate record stream.
Therefore there are additional bytes in the stream
to provide record boundary information.
X.SH
xdrrec_endofrecord()
X.LP
X.LS
xdrrec_endofrecord(xdrs, sendnow)
	XDR *xdrs;
	int sendnow;
X.LE
This routine can be invoked only on streams created by
X.L xdrrec_create() .
The data in the output buffer is marked as a completed record,
and the output buffer is optionally written out if
X.L sendnow
is non-zero.  This routine returns one if it succeeds, zero otherwise.
X.SH
xdrrec_eof()
X.LP
X.LS
xdrrec_eof(xdrs)
	XDR *xdrs;
	int empty;
X.LE
This routine can be invoked only on streams created by
X.L xdrrec_create() .
After consuming the rest of the current record in the stream,
this routine returns one if the stream has no more input, zero otherwise.
X.SH
xdrrec_skiprecord()
X.LP
X.LS
xdrrec_skiprecord(xdrs)
	XDR *xdrs;
X.LE
This routine can be invoked only on streams created by
X.L xdrrec_create() .
It tells the XDR implementation that the rest of the current record
in the stream's input buffer should be discarded.
This routine returns one if it succeeds, zero otherwise.
X.SH
xdrstdio_create()
X.LP
X.LS
void
xdrstdio_create(xdrs, file, op)
	XDR *xdrs;
	FILE *file;
	enum xdr_op op;
X.LE
This routine initializes the XDR stream object pointed to by
X.L xdrs .
The XDR stream data is written to, or read from, the Standard I/O stream
X.L file .
The parameter
X.L op
determines the direction of the XDR stream
(either XDR_ENCODE, XDR_DECODE, or XDR_FREE).
Warning: the destroy routine associated with such XDR streams calls
X.L fflush()
on the
X.L file
stream, but never
X.L fclose() . 
!Funky!Stuff!

exit