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

SYNOPSIS

22     #include <rpc/rpc.h>
23
24     See DESCRIPTION for function declarations.
25

DESCRIPTION

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

AVAILABILITY

696     These functions are part of libtirpc.
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