1RPC_SOC(3)               BSD Library Functions Manual               RPC_SOC(3)
2

NAME

4     rpc_soc, auth_destroy, authnone_create, authunix_create,
5     authunix_create_default, callrpc, clnt_broadcast, clnt_call,
6     clnt_control, clnt_create, clnt_destroy, clnt_freeres, clnt_geterr,
7     clnt_pcreateerror, clnt_perrno, clnt_perror, clnt_spcreateerror,
8     clnt_sperrno, clnt_sperror, clntraw_create, clnttcp_create,
9     clntudp_bufcreate, clntudp_create, clntunix_create, get_myaddress,
10     pmap_getmaps, pmap_getport, pmap_rmtcall, pmap_set, pmap_unset,
11     registerrpc, rpc_createerr, svc_destroy, svc_fds, svc_fdset, svc_getargs,
12     svc_getcaller, svc_getreq, svc_getreqset, svc_register, svc_run,
13     svc_sendreply, svc_unregister, svcerr_auth, svcerr_decode, svcerr_noproc,
14     svcerr_noprog, svcerr_progvers, svcerr_systemerr, svcerr_weakauth,
15     svcfd_create, svcunixfd_create, svcraw_create, svcunix_create,
16     xdr_accepted_reply, xdr_authunix_parms, xdr_callhdr, xdr_callmsg,
17     xdr_opaque_auth, xdr_pmap, xdr_pmaplist, xdr_rejected_reply,
18     xdr_replymsg, xprt_register, xprt_unregister — library routines for
19     remote procedure calls
20

LIBRARY

22     Standard C Library (libc, -lc)
23

SYNOPSIS

25     #include <rpc/rpc.h>
26
27     See DESCRIPTION for function declarations.
28

DESCRIPTION

30     The svc_*() and clnt_*() functions described in this page are the old,
31     TS-RPC interface to the XDR and RPC library, and exist for backward com‐
32     patibility.  The new interface is described in the pages referenced from
33     rpc(3).
34
35     These routines allow C programs to make procedure calls on other machines
36     across the network.  First, the client calls a procedure to send a data
37     packet to the server.  Upon receipt of the packet, the server calls a
38     dispatch routine to perform the requested service, and then sends back a
39     reply.  Finally, the procedure call returns to the client.
40
41     Routines that are used for Secure RPC (DES authentication) are described
42     in rpc_secure(3).  Secure RPC can be used only if DES encryption is
43     available.
44
45     void
46     auth_destroy(AUTH *auth)
47
48             A macro that destroys the authentication information associated
49             with auth.  Destruction usually involves deallocation of private
50             data structures.  The use of auth is undefined after calling
51             auth_destroy().
52
53     AUTH *
54     authnone_create()
55
56             Create and return an RPC authentication handle that passes nonus‐
57             able authentication information with each remote procedure call.
58             This is the default authentication used by RPC.
59
60     AUTH *
61     authunix_create(char *host, int uid, int gid, int len, int *aup_gids)
62
63             Create and return an RPC authentication handle that contains UNIX
64             authentication information.  The host argument is the name of the
65             machine on which the information was created; uid is the user's
66             user ID; gid is the user's current group ID; len and aup_gids
67             refer to a counted array of groups to which the user belongs.  It
68             is easy to impersonate a user.
69
70     AUTH *
71     authunix_create_default()
72
73             Calls authunix_create() with the appropriate arguments.
74
75     int callrpc(char *host, u_long prognum, u_long versnum, u_long procnum,
76             xdrproc_t inproc, void *in, xdrproc_t outproc, void *out)
77
78             Call the remote procedure associated with prognum, versnum, and
79             procnum on the machine host.  The in argument is the address of
80             the procedure's argument(s), and out is the address of where to
81             place the result(s); inproc is used to encode the procedure's
82             arguments, and outproc is used to decode the procedure's results.
83             This routine returns zero if it succeeds, or the value of enum
84             clnt_stat cast to an integer if it fails.  The routine
85             clnt_perrno() is handy for translating failure statuses into mes‐
86             sages.
87
88             Warning: calling remote procedures with this routine uses UDP/IP
89             as a transport; see clntudp_create() for restrictions.  You do
90             not have control of timeouts or authentication using this rou‐
91             tine.
92
93     enum clnt_stat
94     clnt_broadcast(u_long prognum, u_long versnum, u_long procnum,
95             xdrproc_t inproc, char *in, xdrproc_t outproc, char *out,
96             bool_t (*eachresult)(caddr_t, struct sockaddr_in *))
97
98             Like callrpc(), except the call message is broadcast to all
99             locally connected broadcast nets.  Each time it receives a
100             response, this routine calls eachresult(), whose form is:
101
102                   bool_t eachresult(caddr_t out, struct sockaddr_in *addr)
103
104             where out is the same as out passed to clnt_broadcast(), except
105             that the remote procedure's output is decoded there; addr points
106             to the address of the machine that sent the results.  If
107             eachresult() returns zero, clnt_broadcast() waits for more
108             replies; otherwise it returns with appropriate status.
109
110             Warning: broadcast sockets are limited in size to the maximum
111             transfer unit of the data link.  For ethernet, this value is 1500
112             bytes.
113
114     enum clnt_stat
115     clnt_call(CLIENT *clnt, u_long procnum, xdrproc_t inproc, char *in,
116             xdrproc_t outproc, char *out, struct timeval tout)
117
118             A macro that calls the remote procedure procnum associated with
119             the client handle, clnt, which is obtained with an RPC client
120             creation routine such as clnt_create().  The in argument is the
121             address of the procedure's argument(s), and out is the address of
122             where to place the result(s); inproc is used to encode the proce‐
123             dure's arguments, and outproc is used to decode the procedure's
124             results; tout is the time allowed for results to come back.
125
126     void clnt_destroy(CLIENT *clnt)
127
128             A macro that destroys the client's RPC handle.  Destruction usu‐
129             ally involves deallocation of private data structures, including
130             clnt itself.  Use of clnt is undefined after calling
131             clnt_destroy().  If the RPC library opened the associated socket,
132             it will close it also.  Otherwise, the socket remains open.
133
134     CLIENT *
135     clnt_create(char *host, u_long prog, u_long vers, char *proto)
136
137             Generic client creation routine.  The host argument identifies
138             the name of the remote host where the server is located.  The
139             proto argument indicates which kind of transport protocol to use.
140             The currently supported values for this field are "udp" and
141             "tcp".  Default timeouts are set, but can be modified using
142             clnt_control().
143
144             Warning: Using UDP has its shortcomings.  Since UDP-based RPC
145             messages can only hold up to 8 Kbytes of encoded data, this
146             transport cannot be used for procedures that take large arguments
147             or return huge results.
148
149     bool_t
150     clnt_control(CLIENT *cl, u_int req, char *info)
151
152             A macro used to change or retrieve various information about a
153             client object.  The req argument indicates the type of operation,
154             and info is a pointer to the information.  For both UDP and TCP,
155             the supported values of req and their argument types and what
156             they do are:
157
158             CLSET_TIMEOUT          struct timeval        set total timeout
159             CLGET_TIMEOUT          struct timeval        get total timeout
160
161             Note: if you set the timeout using clnt_control(), the timeout
162             argument passed to clnt_call() will be ignored in all future
163             calls.
164
165             CLGET_SERVER_ADDR      struct sockaddr_in    get server's address
166
167             The following operations are valid for UDP only:
168
169             CLSET_RETRY_TIMEOUT    struct timeval        set the retry
170                                                          timeout
171             CLGET_RETRY_TIMEOUT    struct timeval        get the retry
172                                                          timeout
173
174             The retry timeout is the time that UDP RPC waits for the server
175             to reply before retransmitting the request.
176
177     bool_t clnt_freeres(CLIENT *clnt, xdrproc_t outproc, char *out)
178
179             A macro that frees any data allocated by the RPC/XDR system when
180             it decoded the results of an RPC call.  The out argument is the
181             address of the results, and outproc is the XDR routine describing
182             the results.  This routine returns one if the results were suc‐
183             cessfully freed, and zero otherwise.
184
185     void
186     clnt_geterr(CLIENT *clnt, struct rpc_err *errp)
187
188             A macro that copies the error structure out of the client handle
189             to the structure at address errp.
190
191     void
192     clnt_pcreateerror(char *s)
193
194             prints a message to standard error indicating why a client RPC
195             handle could not be created.  The message is prepended with
196             string s and a colon.  A newline is appended at the end of the
197             message.  Used when a clnt_create(), clntraw_create(),
198             clnttcp_create(), or clntudp_create() call fails.
199
200     void
201     clnt_perrno(enum clnt_stat stat)
202
203             Print a message to standard error corresponding to the condition
204             indicated by stat.  A newline is appended at the end of the mes‐
205             sage.  Used after callrpc().
206
207     void clnt_perror(CLIENT *clnt, char *s)
208
209             Print a message to standard error indicating why an RPC call
210             failed; clnt is the handle used to do the call.  The message is
211             prepended with string s and a colon.  A newline is appended at
212             the end of the message.  Used after clnt_call().
213
214     char *
215     clnt_spcreateerror(char *s)
216
217             Like clnt_pcreateerror(), except that it returns a string instead
218             of printing to the standard error.
219
220             Bugs: returns pointer to static data that is overwritten on each
221             call.
222
223     char *
224     clnt_sperrno(enum clnt_stat stat)
225
226             Take the same arguments as clnt_perrno(), but instead of sending
227             a message to the standard error indicating why an RPC call
228             failed, return a pointer to a string which contains the message.
229
230             The clnt_sperrno() function is used instead of clnt_perrno() if
231             the program does not have a standard error (as a program running
232             as a server quite likely does not), or if the programmer does not
233             want the message to be output with printf(), or if a message for‐
234             mat different from that supported by clnt_perrno() is to be used.
235
236             Note: unlike clnt_sperror() and clnt_spcreateerror(),
237             clnt_sperrno() returns pointer to static data, but the result
238             will not get overwritten on each call.
239
240     char *
241     clnt_sperror(CLIENT *rpch, char *s)
242
243             Like clnt_perror(), except that (like clnt_sperrno()) it returns
244             a string instead of printing to standard error.
245
246             Bugs: returns pointer to static data that is overwritten on each
247             call.
248
249     CLIENT *
250     clntraw_create(u_long prognum, u_long versnum)
251
252             This routine creates a toy RPC client for the remote program
253             prognum, version versnum.  The transport used to pass messages to
254             the service is actually a buffer within the process's address
255             space, so the corresponding RPC server should live in the same
256             address space; see svcraw_create().  This allows simulation of
257             RPC and acquisition of RPC overheads, such as round trip times,
258             without any kernel interference.  This routine returns NULL if it
259             fails.
260
261     CLIENT *
262     clnttcp_create(struct sockaddr_in *addr, u_long prognum, u_long versnum,
263             int *sockp, u_int sendsz, u_int recvsz)
264
265             This routine creates an RPC client for the remote program
266             prognum, version versnum; the client uses TCP/IP as a transport.
267             The remote program is located at Internet address addr.  If
268             addr->sin_port is zero, then it is set to the actual port that
269             the remote program is listening on (the remote rpcbind(8) service
270             is consulted for this information).  The sockp argument is a
271             socket; if it is RPC_ANYSOCK, then this routine opens a new one
272             and sets sockp.  Since TCP-based RPC uses buffered I/O, the user
273             may specify the size of the send and receive buffers with the
274             sendsz and recvsz arguments; values of zero choose suitable
275             defaults.  This routine returns NULL if it fails.
276
277     CLIENT *
278     clntudp_create(struct sockaddr_in *addr, u_long prognum, u_long versnum,
279             struct timeval wait, int *sockp)
280
281             This routine creates an RPC client for the remote program
282             prognum, version versnum; the client uses UDP/IP as a transport.
283             The remote program is located at Internet address addr.  If
284             addr->sin_port is zero, then it is set to actual port that the
285             remote program is listening on (the remote rpcbind(8) service is
286             consulted for this information).  The sockp argument is a socket;
287             if it is RPC_ANYSOCK, then this routine opens a new one and sets
288             sockp.  The UDP transport resends the call message in intervals
289             of wait time until a response is received or until the call times
290             out.  The total time for the call to time out is specified by
291             clnt_call().
292
293             Warning: since UDP-based RPC messages can only hold up to 8
294             Kbytes of encoded data, this transport cannot be used for proce‐
295             dures that take large arguments or return huge results.
296
297     CLIENT *
298     clntudp_bufcreate(struct sockaddr_in *addr, u_long prognum,
299             u_long versnum, struct timeval wait, int *sockp,
300             unsigned int sendsize, unsigned int recosize)
301
302             This routine creates an RPC client for the remote program
303             prognum, on versnum; the client uses UDP/IP as a transport.  The
304             remote program is located at Internet address addr.  If
305             addr->sin_port is zero, then it is set to actual port that the
306             remote program is listening on (the remote rpcbind(8) service is
307             consulted for this information).  The sockp argument is a socket;
308             if it is RPC_ANYSOCK, then this routine opens a new one and sets
309             sockp.  The UDP transport resends the call message in intervals
310             of wait time until a response is received or until the call times
311             out.  The total time for the call to time out is specified by
312             clnt_call().
313
314             This allows the user to specify the maximum packet size for send‐
315             ing and receiving UDP-based RPC messages.
316
317     CLIENT *
318     clntunix_create(struct sockaddr_un *raddr, u_long prognum,
319             u_long versnum, int *sockp, u_int sendsz, u_int recvsz)
320
321             This routine creates an RPC client for the local program prognum,
322             version versnum; the client uses UNIX-domain sockets as a trans‐
323             port.  The local program is located at the *raddr.  The sockp
324             argument is a socket; if it is RPC_ANYSOCK, then this routine
325             opens a new one and sets sockp.  Since UNIX-based RPC uses
326             buffered I/O, the user may specify the size of the send and
327             receive buffers with the sendsz and recvsz arguments; values of
328             zero choose suitable defaults.  This routine returns NULL if it
329             fails.
330
331     int
332     get_myaddress(struct sockaddr_in *addr)
333
334             Stuff the machine's IP address into addr, without consulting the
335             library routines that deal with /etc/hosts.  The port number is
336             always set to htons(PMAPPORT).  Returns zero on success, non-zero
337             on failure.
338
339     struct pmaplist *
340     pmap_getmaps(struct sockaddr_in *addr)
341
342             A user interface to the rpcbind(8) service, which returns a list
343             of the current RPC program-to-port mappings on the host located
344             at IP address addr.  This routine can return NULL.  The command
345rpcinfo -p” uses this routine.
346
347     u_short
348     pmap_getport(struct sockaddr_in *addr, u_long prognum, u_long versnum,
349             u_long protocol)
350
351             A user interface to the rpcbind(8) service, which returns the
352             port number on which waits a service that supports program number
353             prognum, version versnum, and speaks the transport protocol asso‐
354             ciated with protocol.  The value of protocol is most likely
355             IPPROTO_UDP or IPPROTO_TCP.  A return value of zero means that
356             the mapping does not exist or that the RPC system failed to con‐
357             tact the remote rpcbind(8) service.  In the latter case, the
358             global variable rpc_createerr contains the RPC status.
359
360     enum clnt_stat
361     pmap_rmtcall(struct sockaddr_in *addr, u_long prognum, u_long versnum,
362             u_long procnum, xdrproc_t inproc, char *in, xdrproc_t outproc,
363             char *out, struct timeval tout, u_long *portp)
364
365             A user interface to the rpcbind(8) service, which instructs
366             rpcbind(8) on the host at IP address addr to make an RPC call on
367             your behalf to a procedure on that host.  The portp argument will
368             be modified to the program's port number if the procedure suc‐
369             ceeds.  The definitions of other arguments are discussed in
370             callrpc() and clnt_call().  This procedure should be used for a
371             “ping” and nothing else.  See also clnt_broadcast().
372
373     bool_t pmap_set(u_long prognum, u_long versnum, u_long protocol, u_short
374             port)
375
376             A user interface to the rpcbind(8) service, which establishes a
377             mapping between the triple (prognum, versnum, protocol) and port
378             on the machine's rpcbind(8) service.  The value of protocol is
379             most likely IPPROTO_UDP or IPPROTO_TCP.  This routine returns one
380             if it succeeds, zero otherwise.  Automatically done by
381             svc_register().
382
383     bool_t pmap_unset(u_long prognum, u_long versnum)
384
385             A user interface to the rpcbind(8) service, which destroys all
386             mapping between the triple (prognum, versnum, *) and ports on the
387             machine's rpcbind(8) service.  This routine returns one if it
388             succeeds, zero otherwise.
389
390     bool_t registerrpc(u_long prognum, u_long versnum, u_long procnum,
391             char *(*procname)(void), xdrproc_t inproc, xdrproc_t outproc)
392
393             Register procedure procname with the RPC service package.  If a
394             request arrives for program prognum, version versnum, and proce‐
395             dure procnum, procname is called with a pointer to its argu‐
396             ment(s); progname should return a pointer to its static
397             result(s); inproc is used to decode the arguments while outproc
398             is used to encode the results.  This routine returns zero if the
399             registration succeeded, -1 otherwise.
400
401             Warning: remote procedures registered in this form are accessed
402             using the UDP/IP transport; see svcudp_create() for restrictions.
403
404     struct rpc_createerr rpc_createerr;
405
406             A global variable whose value is set by any RPC client creation
407             routine that does not succeed.  Use the routine
408             clnt_pcreateerror() to print the reason why.
409
410     bool_t svc_destroy(SVCXPRT * xprt)
411
412             A macro that destroys the RPC service transport handle, xprt.
413             Destruction usually involves deallocation of private data struc‐
414             tures, including xprt itself.  Use of xprt is undefined after
415             calling this routine.
416
417     fd_set svc_fdset;
418
419             A global variable reflecting the RPC service side's read file
420             descriptor bit mask; it is suitable as a template argument to the
421             select(2) system call.  This is only of interest if a service
422             implementor does not call svc_run(), but rather does his own
423             asynchronous event processing.  This variable is read-only (do
424             not pass its address to select(2)!), yet it may change after
425             calls to svc_getreqset() or any creation routines.  As well, note
426             that if the process has descriptor limits which are extended
427             beyond FD_SETSIZE, this variable will only be usable for the
428             first FD_SETSIZE descriptors.
429
430     int svc_fds;
431
432             Similar to svc_fdset, but limited to 32 descriptors.  This inter‐
433             face is obsoleted by svc_fdset.
434
435     bool_t svc_freeargs(SVCXPRT *xprt, xdrproc_t inproc, char *in)
436
437             A macro that frees any data allocated by the RPC/XDR system when
438             it decoded the arguments to a service procedure using
439             svc_getargs().  This routine returns 1 if the results were suc‐
440             cessfully freed, and zero otherwise.
441
442     bool_t svc_getargs(SVCXPRT *xprt, xdrproc_t inproc, char *in)
443
444             A macro that decodes the arguments of an RPC request associated
445             with the RPC service transport handle, xprt.  The in argument is
446             the address where the arguments will be placed; inproc is the XDR
447             routine used to decode the arguments.  This routine returns one
448             if decoding succeeds, and zero otherwise.
449
450     struct sockaddr_in *
451     svc_getcaller(SVCXPRT *xprt)
452
453             The approved way of getting the network address of the caller of
454             a procedure associated with the RPC service transport handle,
455             xprt.
456
457     void svc_getreqset(fd_set *rdfds)
458
459             This routine is only of interest if a service implementor does
460             not call svc_run(), but instead implements custom asynchronous
461             event processing.  It is called when the select(2) system call
462             has determined that an RPC request has arrived on some RPC
463             socket(s); rdfds is the resultant read file descriptor bit mask.
464             The routine returns when all sockets associated with the value of
465             rdfds have been serviced.
466
467     void svc_getreq(int rdfds)
468
469             Similar to svc_getreqset(), but limited to 32 descriptors.  This
470             interface is obsoleted by svc_getreqset().
471
472     bool_t svc_register(SVCXPRT *xprt, u_long prognum, u_long versnum,
473             void (*dispatch)(struct svc_req *, SVCXPRT *), int protocol)
474
475             Associates prognum and versnum with the service dispatch proce‐
476             dure, dispatch().  If protocol is zero, the service is not regis‐
477             tered with the rpcbind(8) service.  If protocol is non-zero, then
478             a mapping of the triple (prognum, versnum, protocol) to
479             xprt->xp_port is established with the local rpcbind(8) service
480             (generally protocol is zero, IPPROTO_UDP or IPPROTO_TCP).  The
481             procedure dispatch() has the following form:
482
483                   bool_t dispatch(struct svc_req *request, SVCXPRT *xprt)
484
485             The svc_register() routine returns one if it succeeds, and zero
486             otherwise.
487
488     svc_run()
489
490             This routine never returns.  It waits for RPC requests to arrive,
491             and calls the appropriate service procedure using svc_getreq()
492             when one arrives.  This procedure is usually waiting for a
493             select(2) system call to return.
494
495     bool_t svc_sendreply(SVCXPRT *xprt, xdrproc_t outproc, char *out)
496
497             Called by an RPC service's dispatch routine to send the results
498             of a remote procedure call.  The xprt argument is the request's
499             associated transport handle; outproc is the XDR routine which is
500             used to encode the results; and out is the address of the
501             results.  This routine returns one if it succeeds, zero other‐
502             wise.
503
504     void
505     svc_unregister(u_long prognum, u_long versnum)
506
507             Remove all mapping of the double (prognum, versnum) to dispatch
508             routines, and of the triple (prognum, versnum, *) to port number.
509
510     void
511     svcerr_auth(SVCXPRT *xprt, enum auth_stat why)
512
513             Called by a service dispatch routine that refuses to perform a
514             remote procedure call due to an authentication error.
515
516     void
517     svcerr_decode(SVCXPRT *xprt)
518
519             Called by a service dispatch routine that cannot successfully
520             decode its arguments.  See also svc_getargs().
521
522     void
523     svcerr_noproc(SVCXPRT *xprt)
524
525             Called by a service dispatch routine that does not implement the
526             procedure number that the caller requests.
527
528     void
529     svcerr_noprog(SVCXPRT *xprt)
530
531             Called when the desired program is not registered with the RPC
532             package.  Service implementors usually do not need this routine.
533
534     void
535     svcerr_progvers(SVCXPRT *xprt, u_long low_vers, u_long high_vers)
536
537             Called when the desired version of a program is not registered
538             with the RPC package.  Service implementors usually do not need
539             this routine.
540
541     void
542     svcerr_systemerr(SVCXPRT *xprt)
543
544             Called by a service dispatch routine when it detects a system
545             error not covered by any particular protocol.  For example, if a
546             service can no longer allocate storage, it may call this routine.
547
548     void
549     svcerr_weakauth(SVCXPRT *xprt)
550
551             Called by a service dispatch routine that refuses to perform a
552             remote procedure call due to insufficient authentication argu‐
553             ments.  The routine calls svcerr_auth(xprt, AUTH_TOOWEAK).
554
555     SVCXPRT *
556     svcraw_create(void)
557
558             This routine creates a toy RPC service transport, to which it
559             returns a pointer.  The transport is really a buffer within the
560             process's address space, so the corresponding RPC client should
561             live in the same address space; see clntraw_create().  This rou‐
562             tine allows simulation of RPC and acquisition of RPC overheads
563             (such as round trip times), without any kernel interference.
564             This routine returns NULL if it fails.
565
566     SVCXPRT *
567     svctcp_create(int sock, u_int send_buf_size, u_int recv_buf_size)
568
569             This routine creates a TCP/IP-based RPC service transport, to
570             which it returns a pointer.  The transport is associated with the
571             socket sock, which may be RPC_ANYSOCK, in which case a new socket
572             is created.  If the socket is not bound to a local TCP port, then
573             this routine binds it to an arbitrary port.  Upon completion,
574             xprt->xp_fd is the transport's socket descriptor, and
575             xprt->xp_port is the transport's port number.  This routine
576             returns NULL if it fails.  Since TCP-based RPC uses buffered I/O,
577             users may specify the size of buffers; values of zero choose
578             suitable defaults.
579
580     SVCXPRT *
581     svcunix_create(int sock, u_int send_buf_size, u_int recv_buf_size, char
582             *path)
583
584             This routine creates a UNIX-based RPC service transport, to which
585             it returns a pointer.  The transport is associated with the
586             socket sock, which may be RPC_ANYSOCK, in which case a new socket
587             is created.  The *path argument is a variable-length file system
588             pathname of at most 104 characters.  This file is not removed
589             when the socket is closed.  The unlink(2) system call must be
590             used to remove the file.  Upon completion, xprt->xp_fd is the
591             transport's socket descriptor.  This routine returns NULL if it
592             fails.  Since UNIX-based RPC uses buffered I/O, users may specify
593             the size of buffers; values of zero choose suitable defaults.
594
595     SVCXPRT *
596     svcunixfd_create(int fd, u_int sendsize, u_int recvsize)
597
598             Create a service on top of any open descriptor.  The sendsize and
599             recvsize arguments indicate sizes for the send and receive buf‐
600             fers.  If they are zero, a reasonable default is chosen.
601
602     SVCXPRT *
603     svcfd_create(int fd, u_int sendsize, u_int recvsize)
604
605             Create a service on top of any open descriptor.  Typically, this
606             descriptor is a connected socket for a stream protocol such as
607             TCP.  The sendsize and recvsize arguments indicate sizes for the
608             send and receive buffers.  If they are zero, a reasonable default
609             is chosen.
610
611     SVCXPRT *
612     svcudp_bufcreate(int sock, u_int sendsize, u_int recvsize)
613
614             This routine creates a UDP/IP-based RPC service transport, to
615             which it returns a pointer.  The transport is associated with the
616             socket sock, which may be RPC_ANYSOCK, in which case a new socket
617             is created.  If the socket is not bound to a local UDP port, then
618             this routine binds it to an arbitrary port.  Upon completion,
619             xprt->xp_fd is the transport's socket descriptor, and
620             xprt->xp_port is the transport's port number.  This routine
621             returns NULL if it fails.
622
623             This allows the user to specify the maximum packet size for send‐
624             ing and receiving UDP-based RPC messages.
625
626     bool_t xdr_accepted_reply(XDR *xdrs, struct accepted_reply *ar)
627
628             Used for encoding RPC reply messages.  This routine is useful for
629             users who wish to generate RPC-style messages without using the
630             RPC package.
631
632     bool_t xdr_authunix_parms(XDR *xdrs, struct authunix_parms *aupp)
633
634             Used for describing UNIX credentials.  This routine is useful for
635             users who wish to generate these credentials without using the
636             RPC authentication package.
637
638     void
639     bool_t xdr_callhdr(XDR *xdrs, struct rpc_msg *chdr)
640
641             Used for describing RPC call header messages.  This routine is
642             useful for users who wish to generate RPC-style messages without
643             using the RPC package.
644
645     bool_t xdr_callmsg(XDR *xdrs, struct rpc_msg *cmsg)
646
647             Used for describing RPC call messages.  This routine is useful
648             for users who wish to generate RPC-style messages without using
649             the RPC package.
650
651     bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap)
652
653             Used for describing RPC authentication information messages.
654             This routine is useful for users who wish to generate RPC-style
655             messages without using the RPC package.
656
657     struct pmap;
658     bool_t xdr_pmap(XDR *xdrs, struct pmap *regs)
659
660             Used for describing arguments to various rpcbind(8) procedures,
661             externally.  This routine is useful for users who wish to gener‐
662             ate these arguments without using the pmap_*() interface.
663
664     bool_t xdr_pmaplist(XDR *xdrs, struct pmaplist **rp)
665
666             Used for describing a list of port mappings, externally.  This
667             routine is useful for users who wish to generate these arguments
668             without using the pmap_*() interface.
669
670     bool_t xdr_rejected_reply(XDR *xdrs, struct rejected_reply *rr)
671
672             Used for describing RPC reply messages.  This routine is useful
673             for users who wish to generate RPC-style messages without using
674             the RPC package.
675
676     bool_t xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg)
677
678             Used for describing RPC reply messages.  This routine is useful
679             for users who wish to generate RPC style messages without using
680             the RPC package.
681
682     void
683     xprt_register(SVCXPRT *xprt)
684
685             After RPC service transport handles are created, they should reg‐
686             ister themselves with the RPC service package.  This routine mod‐
687             ifies the global variable svc_fds.  Service implementors usually
688             do not need this routine.
689
690     void
691     xprt_unregister(SVCXPRT *xprt)
692
693             Before an RPC service transport handle is destroyed, it should
694             unregister itself with the RPC service package.  This routine
695             modifies the global variable svc_fds.  Service implementors usu‐
696             ally do not need this routine.
697

SEE ALSO

699     rpc_secure(3), xdr(3)
700
701     Remote Procedure Calls: Protocol Specification.
702
703     Remote Procedure Call Programming Guide.
704
705     rpcgen Programming Guide.
706
707     RPC: Remote Procedure Call Protocol Specification, Sun Microsystems,
708     Inc., USC-ISI, RFC1050.
709
710BSD                            February 16, 1988                           BSD
Impressum