tzfile.5, tzselect.8: sync from tzdb upstream
[man-pages.git] / man3 / rpc.3
blob7ebe97898ad8031d501d4704d7afd44e4cce817c
1 '\" t
2 .\" This page was taken from the 4.4BSD-Lite CDROM (BSD license)
3 .\"
4 .\" %%%LICENSE_START(BSD_ONELINE_CDROM)
5 .\" This page was taken from the 4.4BSD-Lite CDROM (BSD license)
6 .\" %%%LICENSE_END
7 .\"
8 .\" @(#)rpc.3n  2.4 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI
9 .\"
10 .\" 2007-12-30, mtk, Convert function prototypes to modern C syntax
11 .\"
12 .TH rpc 3 (date) "Linux man-pages (unreleased)"
13 .SH NAME
14 rpc \- library routines for remote procedure calls
15 .SH LIBRARY
16 Standard C library
17 .RI ( libc ", " \-lc )
18 .SH SYNOPSIS AND DESCRIPTION
19 These routines allow C programs to make procedure
20 calls on other machines across the network.
21 First, the client calls a procedure to send a data packet to the server.
22 Upon receipt of the packet, the server calls a dispatch routine
23 to perform the requested service, and then sends back a reply.
24 Finally, the procedure call returns to the client.
25 .\" .LP
26 .\" We don't have an rpc_secure.3 page at the moment -- MTK, 19 Sep 05
27 .\" Routines that are used for Secure RPC (DES authentication) are described in
28 .\" .BR rpc_secure (3).
29 .\" Secure RPC can be used only if DES encryption is available.
30 .PP
31 To take use of these routines, include the header file
32 .IR "<rpc/rpc.h>" .
33 .PP
34 The prototypes below make use of the following types:
35 .PP
36 .RS 4
37 .EX
38 .BI "typedef int " bool_t ;
39 .PP
40 .BI "typedef bool_t (*" xdrproc_t ")(XDR *, void *, ...);"
41 .PP
42 .BI "typedef bool_t (*" resultproc_t ")(caddr_t " resp ,
43 .BI "                               struct sockaddr_in *" raddr );
44 .EE
45 .RE
46 .PP
47 See the header files for the declarations of the
48 .IR AUTH ,
49 .IR CLIENT ,
50 .IR SVCXPRT ,
51 and
52 .I XDR
53 types.
54 .PP
55 .nf
56 .BI "void auth_destroy(AUTH *" auth );
57 .fi
58 .IP
59 A macro that destroys the authentication information associated with
60 .IR auth .
61 Destruction usually involves deallocation of private data structures.
62 The use of
63 .I auth
64 is undefined after calling
65 .BR auth_destroy ().
66 .PP
67 .nf
68 .B AUTH *authnone_create(void);
69 .fi
70 .IP
71 Create and return an RPC
72 authentication handle that passes nonusable authentication
73 information with each remote procedure call.
74 This is the default authentication used by RPC.
75 .PP
76 .nf
77 .BI "AUTH *authunix_create(char *" host ", uid_t " uid ", gid_t " gid ,
78 .BI "                      int " len ", gid_t " aup_gids [. len ]);
79 .fi
80 .IP
81 Create and return an RPC authentication handle that contains
82 authentication information.
83 The parameter
84 .I host
85 is the name of the machine on which the information was created;
86 .I uid
87 is the user's user ID;
88 .I gid
89 is the user's current group ID;
90 .I len
91 and
92 .I aup_gids
93 refer to a counted array of groups to which the user belongs.
94 It is easy to impersonate a user.
95 .PP
96 .nf
97 .B AUTH *authunix_create_default(void);
98 .fi
99 .IP
100 Calls
101 .BR authunix_create ()
102 with the appropriate parameters.
105 .BI "int callrpc(char *" host ", unsigned long " prognum ,
106 .BI "            unsigned long " versnum ", unsigned long " procnum ,
107 .BI "            xdrproc_t " inproc ", const char *" in ,
108 .BI "            xdrproc_t " outproc ", char *" out );
111 Call the remote procedure associated with
112 .IR prognum ,
113 .IR versnum ,
115 .I procnum
116 on the machine,
117 .IR host .
118 The parameter
119 .I in
120 is the address of the procedure's argument(s), and
121 .I out
122 is the address of where to place the result(s);
123 .I inproc
124 is used to encode the procedure's parameters, and
125 .I outproc
126 is used to decode the procedure's results.
127 This routine returns zero if it succeeds, or the value of
128 .B "enum clnt_stat"
129 cast to an integer if it fails.
130 The routine
131 .BR clnt_perrno ()
132 is handy for translating failure statuses into messages.
134 Warning: calling remote procedures with this routine
135 uses UDP/IP as a transport; see
136 .BR clntudp_create ()
137 for restrictions.
138 You do not have control of timeouts or authentication using this routine.
141 .BI "enum clnt_stat clnt_broadcast(unsigned long " prognum ,
142 .BI "                     unsigned long " versnum ", unsigned long " procnum ,
143 .BI "                     xdrproc_t " inproc ", char *" in ,
144 .BI "                     xdrproc_t " outproc ", char *" out ,
145 .BI "                     resultproc_t " eachresult );
148 Like
149 .BR callrpc (),
150 except the call message is broadcast to all locally
151 connected broadcast nets.
152 Each time it receives a response, this routine calls
153 .BR eachresult (),
154 whose form is:
156 .in +4n
158 .BI "eachresult(char *" out ", struct sockaddr_in *" addr );
162 where
163 .I out
164 is the same as
165 .I out
166 passed to
167 .BR clnt_broadcast (),
168 except that the remote procedure's output is decoded there;
169 .I addr
170 points to the address of the machine that sent the results.
172 .BR eachresult ()
173 returns zero,
174 .BR clnt_broadcast ()
175 waits for more replies; otherwise it returns with appropriate status.
177 Warning: broadcast sockets are limited in size to the
178 maximum transfer unit of the data link.
179 For ethernet, this value is 1500 bytes.
182 .BI "enum clnt_stat clnt_call(CLIENT *" clnt ", unsigned long " procnum ,
183 .BI "                    xdrproc_t " inproc ", char *" in ,
184 .BI "                    xdrproc_t " outproc ", char *" out ,
185 .BI "                    struct timeval " tout );
188 A macro that calls the remote procedure
189 .I procnum
190 associated with the client handle,
191 .IR clnt ,
192 which is obtained with an RPC client creation routine such as
193 .BR clnt_create ().
194 The parameter
195 .I in
196 is the address of the procedure's argument(s), and
197 .I out
198 is the address of where to place the result(s);
199 .I inproc
200 is used to encode the procedure's parameters, and
201 .I outproc
202 is used to decode the procedure's results;
203 .I tout
204 is the time allowed for results to come back.
207 .BI "clnt_destroy(CLIENT *" clnt );
210 A macro that destroys the client's RPC handle.
211 Destruction usually involves deallocation
212 of private data structures, including
213 .I clnt
214 itself.
215 Use of
216 .I clnt
217 is undefined after calling
218 .BR clnt_destroy ().
219 If the RPC library opened the associated socket, it will close it also.
220 Otherwise, the socket remains open.
223 .BI "CLIENT *clnt_create(const char *" host ", unsigned long " prog ,
224 .BI "                    unsigned long " vers ", const char *" proto );
227 Generic client creation routine.
228 .I host
229 identifies the name of the remote host where the server is located.
230 .I proto
231 indicates which kind of transport protocol to use.
232 The currently supported values for this field are \[lq]udp\[rq]
233 and \[lq]tcp\[rq].
234 Default timeouts are set, but can be modified using
235 .BR clnt_control ().
237 Warning: using UDP has its shortcomings.
238 Since UDP-based RPC messages can hold only up to 8 Kbytes of encoded data,
239 this transport cannot be used for procedures that take
240 large arguments or return huge results.
243 .BI "bool_t clnt_control(CLIENT *" cl ", int " req ", char *" info );
246 A macro used to change or retrieve various information
247 about a client object.
248 .I req
249 indicates the type of operation, and
250 .I info
251 is a pointer to the information.
252 For both UDP and TCP, the supported values of
253 .I req
254 and their argument types and what they do are:
256 .in +4n
258 \fBCLSET_TIMEOUT\fP  \fIstruct timeval\fP // set total timeout
259 \fBCLGET_TIMEOUT\fP  \fIstruct timeval\fP // get total timeout
263 Note: if you set the timeout using
264 .BR clnt_control (),
265 the timeout parameter passed to
266 .BR clnt_call ()
267 will be ignored in all future calls.
269 .in +4n
271 \fBCLGET_SERVER_ADDR\fP  \fIstruct sockaddr_in\fP
272                 // get server\[aq]s address
276 The following operations are valid for UDP only:
278 .in +4n
280 \fBCLSET_RETRY_TIMEOUT\fP  \fIstruct timeval\fP // set the retry timeout
281 \fBCLGET_RETRY_TIMEOUT\fP  \fIstruct timeval\fP // get the retry timeout
285 The retry timeout is the time that "UDP RPC"
286 waits for the server to reply before
287 retransmitting the request.
290 .BI "clnt_freeres(CLIENT * " clnt ", xdrproc_t " outproc ", char *" out );
293 A macro that frees any data allocated by the RPC/XDR
294 system when it decoded the results of an RPC call.
295 The parameter
296 .I out
297 is the address of the results, and
298 .I outproc
299 is the XDR routine describing the results.
300 This routine returns one if the results were successfully freed,
301 and zero otherwise.
304 .BI "void clnt_geterr(CLIENT *" clnt ", struct rpc_err *" errp );
307 A macro that copies the error structure out of the client
308 handle to the structure at address
309 .IR errp .
312 .BI "void clnt_pcreateerror(const char *" s );
315 Print a message to standard error indicating why a client RPC
316 handle could not be created.
317 The message is prepended with string
318 .I s
319 and a colon.
320 Used when a
321 .BR clnt_create (),
322 .BR clntraw_create (),
323 .BR clnttcp_create (),
325 .BR clntudp_create ()
326 call fails.
329 .BI "void clnt_perrno(enum clnt_stat " stat );
332 Print a message to standard error corresponding
333 to the condition indicated by
334 .IR stat .
335 Used after
336 .BR callrpc ().
339 .BI "clnt_perror(CLIENT *" clnt ", const char *" s );
342 Print a message to standard error indicating why an RPC call failed;
343 .I clnt
344 is the handle used to do the call.
345 The message is prepended with string
346 .I s
347 and a colon.
348 Used after
349 .BR clnt_call ().
352 .BI "char *clnt_spcreateerror(const char *" s );
355 Like
356 .BR clnt_pcreateerror (),
357 except that it returns a string instead of printing to the standard error.
359 Bugs: returns pointer to static data that is overwritten on each call.
362 .BI "char *clnt_sperrno(enum clnt_stat " stat );
365 Take the same arguments as
366 .BR clnt_perrno (),
367 but instead of sending a message to the standard error indicating why an RPC
368 call failed, return a pointer to a string which contains the message.
369 The string ends with a NEWLINE.
371 .BR clnt_sperrno ()
372 is used instead of
373 .BR clnt_perrno ()
374 if the program does not have a standard error (as a program
375 running as a server quite likely does not), or if the programmer
376 does not want the message to be output with
377 .BR printf (3),
378 or if a message format different than that supported by
379 .BR clnt_perrno ()
380 is to be used.
381 Note: unlike
382 .BR clnt_sperror ()
384 .BR clnt_spcreateerror (),
385 .BR clnt_sperrno ()
386 returns pointer to static data, but the
387 result will not get overwritten on each call.
390 .BI "char *clnt_sperror(CLIENT *" rpch ", const char *" s );
393 Like
394 .BR clnt_perror (),
395 except that (like
396 .BR clnt_sperrno ())
397 it returns a string instead of printing to standard error.
399 Bugs: returns pointer to static data that is overwritten on each call.
402 .BI "CLIENT *clntraw_create(unsigned long " prognum \
403 ", unsigned long " versnum );
406 This routine creates a toy RPC client for the remote program
407 .IR prognum ,
408 version
409 .IR versnum .
410 The transport used to pass messages to the service is
411 actually a buffer within the process's address space, so the
412 corresponding RPC server should live in the same address space; see
413 .BR svcraw_create ().
414 This allows simulation of RPC and acquisition of RPC
415 overheads, such as round trip times, without any kernel interference.
416 This routine returns NULL if it fails.
419 .BI "CLIENT *clnttcp_create(struct sockaddr_in *" addr ,
420 .BI "                unsigned long " prognum ", unsigned long " versnum ,
421 .BI "                int *" sockp ", unsigned int " sendsz \
422 ", unsigned int " recvsz );
425 This routine creates an RPC client for the remote program
426 .IR prognum ,
427 version
428 .IR versnum ;
429 the client uses TCP/IP as a transport.
430 The remote program is located at Internet address
431 .IR *addr .
433 .\"The following inline font conversion is necessary for the hyphen indicator
434 .I addr\->sin_port
435 is zero, then it is set to the actual port that the remote
436 program is listening on (the remote
437 .B portmap
438 service is consulted for this information).
439 The parameter
440 .I sockp
441 is a socket; if it is
442 .BR RPC_ANYSOCK ,
443 then this routine opens a new one and sets
444 .IR sockp .
445 Since TCP-based RPC uses buffered I/O,
446 the user may specify the size of the send and receive buffers
447 with the parameters
448 .I sendsz
450 .IR recvsz ;
451 values of zero choose suitable defaults.
452 This routine returns NULL if it fails.
455 .BI "CLIENT *clntudp_create(struct sockaddr_in *" addr ,
456 .BI "                unsigned long " prognum ", unsigned long " versnum ,
457 .BI "                struct timeval " wait ", int *" sockp );
460 This routine creates an RPC client for the remote program
461 .IR prognum ,
462 version
463 .IR versnum ;
464 the client uses use UDP/IP as a transport.
465 The remote program is located at Internet address
466 .IR addr .
468 .I addr\->sin_port
469 is zero, then it is set to actual port that the remote
470 program is listening on (the remote
471 .B portmap
472 service is consulted for this information).
473 The parameter
474 .I sockp
475 is a socket; if it is
476 .BR RPC_ANYSOCK ,
477 then this routine opens a new one and sets
478 .IR sockp .
479 The UDP transport resends the call message in intervals of
480 .I wait
481 time until a response is received or until the call times out.
482 The total time for the call to time out is specified by
483 .BR clnt_call ().
485 Warning: since UDP-based RPC messages can hold only up to 8 Kbytes
486 of encoded data, this transport cannot be used for procedures
487 that take large arguments or return huge results.
490 .BI "CLIENT *clntudp_bufcreate(struct sockaddr_in *" addr ,
491 .BI "            unsigned long " prognum ", unsigned long " versnum ,
492 .BI "            struct timeval " wait ", int *" sockp ,
493 .BI "            unsigned int " sendsize ", unsigned int "recosize );
496 This routine creates an RPC client for the remote program
497 .IR prognum ,
499 .IR versnum ;
500 the client uses use UDP/IP as a transport.
501 The remote program is located at Internet address
502 .IR addr .
504 .I addr\->sin_port
505 is zero, then it is set to actual port that the remote
506 program is listening on (the remote
507 .B portmap
508 service is consulted for this information).
509 The parameter
510 .I sockp
511 is a socket; if it is
512 .BR RPC_ANYSOCK ,
513 then this routine opens a new one and sets
514 .IR sockp .
515 The UDP transport resends the call message in intervals of
516 .I wait
517 time until a response is received or until the call times out.
518 The total time for the call to time out is specified by
519 .BR clnt_call ().
521 This allows the user to specify the maximum packet
522 size for sending and receiving UDP-based RPC messages.
525 .BI "void get_myaddress(struct sockaddr_in *" addr );
528 Stuff the machine's IP address into
529 .IR *addr ,
530 without consulting the library routines that deal with
531 .IR /etc/hosts .
532 The port number is always set to
533 .BR htons(PMAPPORT) .
536 .BI "struct pmaplist *pmap_getmaps(struct sockaddr_in *" addr );
539 A user interface to the
540 .B portmap
541 service, which returns a list of the current RPC
542 program-to-port mappings on the host located at IP address
543 .IR *addr .
544 This routine can return NULL.
545 The command
546 .I rpcinfo\~\-p
547 uses this routine.
550 .BI "unsigned short pmap_getport(struct sockaddr_in *" addr ,
551 .BI "                    unsigned long " prognum ", unsigned long " versnum ,
552 .BI "                    unsigned int " protocol );
555 A user interface to the
556 .B portmap
557 service, which returns the port number
558 on which waits a service that supports program number
559 .IR prognum ,
560 version
561 .IR versnum ,
562 and speaks the transport protocol associated with
563 .IR protocol .
564 The value of
565 .I protocol
566 is most likely
567 .B IPPROTO_UDP
569 .BR IPPROTO_TCP .
570 A return value of zero means that the mapping does not exist
571 or that the RPC system failed to contact the remote
572 .B portmap
573 service.
574 In the latter case, the global variable
575 .I rpc_createerr
576 contains the RPC status.
579 .BI "enum clnt_stat pmap_rmtcall(struct sockaddr_in *" addr ,
580 .BI "                    unsigned long " prognum ", unsigned long " versnum ,
581 .BI "                    unsigned long " procnum ,
582 .BI "                    xdrproc_t " inproc ", char *" in ,
583 .BI "                    xdrproc_t " outproc ", char *" out ,
584 .BI "                    struct timeval " tout ", unsigned long *" portp );
587 A user interface to the
588 .B portmap
589 service, which instructs
590 .B portmap
591 on the host at IP address
592 .I *addr
593 to make an RPC call on your behalf to a procedure on that host.
594 The parameter
595 .I *portp
596 will be modified to the program's port number if the procedure succeeds.
597 The definitions of other parameters are discussed
599 .BR callrpc ()
601 .BR clnt_call ().
602 This procedure should be used for a \[lq]ping\[rq] and nothing else.
603 See also
604 .BR clnt_broadcast ().
607 .BI "bool_t pmap_set(unsigned long " prognum ", unsigned long " versnum ,
608 .BI "                int " protocol ", unsigned short " port );
611 A user interface to the
612 .B portmap
613 service, which establishes a mapping between the triple
614 .RI [ prognum , versnum , protocol ]
616 .I port
617 on the machine's
618 .B portmap
619 service.
620 The value of
621 .I protocol
622 is most likely
623 .B IPPROTO_UDP
625 .BR IPPROTO_TCP .
626 This routine returns one if it succeeds, zero otherwise.
627 Automatically done by
628 .BR svc_register ().
631 .BI "bool_t pmap_unset(unsigned long " prognum ", unsigned long " versnum );
634 A user interface to the
635 .B portmap
636 service, which destroys all mapping between the triple
637 .RI [ prognum , versnum , * ]
639 .B ports
640 on the machine's
641 .B portmap
642 service.
643 This routine returns one if it succeeds, zero otherwise.
646 .BI "int registerrpc(unsigned long " prognum ", unsigned long " versnum ,
647 .BI "                unsigned long " procnum ", char *(*" procname ")(char *),"
648 .BI "                xdrproc_t " inproc ", xdrproc_t " outproc );
651 Register procedure
652 .I procname
653 with the RPC service package.
654 If a request arrives for program
655 .IR prognum ,
656 version
657 .IR versnum ,
658 and procedure
659 .IR procnum ,
660 .I procname
661 is called with a pointer to its parameter(s);
662 .I procname
663 should return a pointer to its static result(s);
664 .I inproc
665 is used to decode the parameters while
666 .I outproc
667 is used to encode the results.
668 This routine returns zero if the registration succeeded, \-1 otherwise.
670 Warning: remote procedures registered in this form
671 are accessed using the UDP/IP transport; see
672 .BR svcudp_create ()
673 for restrictions.
676 .BI "struct rpc_createerr " rpc_createerr ;
679 A global variable whose value is set by any RPC client creation routine
680 that does not succeed.
681 Use the routine
682 .BR clnt_pcreateerror ()
683 to print the reason why.
686 .BI "void svc_destroy(SVCXPRT *" xprt );
689 A macro that destroys the RPC service transport handle,
690 .IR xprt .
691 Destruction usually involves deallocation
692 of private data structures, including
693 .I xprt
694 itself.
695 Use of
696 .I xprt
697 is undefined after calling this routine.
700 .BI "fd_set " svc_fdset ;
703 A global variable reflecting the RPC service side's
704 read file descriptor bit mask; it is suitable as a parameter to the
705 .BR select (2)
706 system call.
707 This is of interest only if a service implementor does their own
708 asynchronous event processing, instead of calling
709 .BR svc_run ().
710 This variable is read-only (do not pass its address to
711 .BR select (2)!),
712 yet it may change after calls to
713 .BR svc_getreqset ()
714 or any creation routines.
717 .BI "int " svc_fds ;
720 Similar to
721 .BR svc_fdset ,
722 but limited to 32 file descriptors.
723 This interface is obsoleted by
724 .BR svc_fdset .
727 .BI "svc_freeargs(SVCXPRT *" xprt ", xdrproc_t " inproc ", char *" in );
730 A macro that frees any data allocated by the RPC/XDR
731 system when it decoded the arguments to a service procedure using
732 .BR svc_getargs ().
733 This routine returns 1 if the results were successfully freed,
734 and zero otherwise.
737 .BI "svc_getargs(SVCXPRT *" xprt ", xdrproc_t " inproc ", char *" in );
740 A macro that decodes the arguments of an RPC request
741 associated with the RPC service transport handle,
742 .IR xprt .
743 The parameter
744 .I in
745 is the address where the arguments will be placed;
746 .I inproc
747 is the XDR routine used to decode the arguments.
748 This routine returns one if decoding succeeds, and zero otherwise.
751 .BI "struct sockaddr_in *svc_getcaller(SVCXPRT *" xprt );
754 The approved way of getting the network address of the caller
755 of a procedure associated with the RPC service transport handle,
756 .IR xprt .
759 .BI "void svc_getreqset(fd_set *" rdfds );
762 This routine is of interest only if a service implementor does not call
763 .BR svc_run (),
764 but instead implements custom asynchronous event processing.
765 It is called when the
766 .BR select (2)
767 system call has determined that an RPC request has arrived on some
768 RPC socket(s);
769 .I rdfds
770 is the resultant read file descriptor bit mask.
771 The routine returns when all sockets associated with the value of
772 .I rdfds
773 have been serviced.
776 .BI "void svc_getreq(int " rdfds );
779 Similar to
780 .BR svc_getreqset (),
781 but limited to 32 file descriptors.
782 This interface is obsoleted by
783 .BR svc_getreqset ().
786 .BI "bool_t svc_register(SVCXPRT *" xprt ", unsigned long " prognum ,
787 .BI "                    unsigned long " versnum ,
788 .BI "                    void (*" dispatch ")(struct svc_req *, SVCXPRT *),"
789 .BI "                    unsigned long " protocol );
792 Associates
793 .I prognum
795 .I versnum
796 with the service dispatch procedure,
797 .IR dispatch .
799 .I protocol
800 is zero, the service is not registered with the
801 .B portmap
802 service.
804 .I protocol
805 is nonzero, then a mapping of the triple
806 .RI [ prognum , versnum , protocol ]
808 .I xprt\->xp_port
809 is established with the local
810 .B portmap
811 service (generally
812 .I protocol
813 is zero,
814 .B IPPROTO_UDP
816 .BR IPPROTO_TCP ).
817 The procedure
818 .I dispatch
819 has the following form:
821 .in +4n
823 dispatch(struct svc_req *request, SVCXPRT *xprt);
828 .BR svc_register ()
829 routine returns one if it succeeds, and zero otherwise.
832 .B "void svc_run(void);"
835 This routine never returns.
836 It waits for RPC requests to arrive, and calls the appropriate service
837 procedure using
838 .BR svc_getreq ()
839 when one arrives.
840 This procedure is usually waiting for a
841 .BR select (2)
842 system call to return.
845 .BI "bool_t svc_sendreply(SVCXPRT *" xprt ", xdrproc_t " outproc \
846 ", char *" out );
849 Called by an RPC service's dispatch routine to send the results of a
850 remote procedure call.
851 The parameter
852 .I xprt
853 is the request's associated transport handle;
854 .I outproc
855 is the XDR routine which is used to encode the results; and
856 .I out
857 is the address of the results.
858 This routine returns one if it succeeds, zero otherwise.
861 .BI "void svc_unregister(unsigned long " prognum ", unsigned long " versnum );
864 Remove all mapping of the double
865 .RI [ prognum , versnum ]
866 to dispatch routines, and of the triple
867 .RI [ prognum , versnum , * ]
868 to port number.
871 .BI "void svcerr_auth(SVCXPRT *" xprt ", enum auth_stat " why );
874 Called by a service dispatch routine that refuses to perform
875 a remote procedure call due to an authentication error.
878 .BI "void svcerr_decode(SVCXPRT *" xprt );
881 Called by a service dispatch routine that cannot successfully
882 decode its parameters.
883 See also
884 .BR svc_getargs ().
887 .BI "void svcerr_noproc(SVCXPRT *" xprt );
890 Called by a service dispatch routine that does not implement
891 the procedure number that the caller requests.
894 .BI "void svcerr_noprog(SVCXPRT *" xprt );
897 Called when the desired program is not registered with the RPC package.
898 Service implementors usually do not need this routine.
901 .BI "void svcerr_progvers(SVCXPRT *" xprt ", unsigned long " low_vers ,
902 .BI "                     unsigned long " high_vers );
905 Called when the desired version of a program is not registered
906 with the RPC package.
907 Service implementors usually do not need this routine.
910 .BI "void svcerr_systemerr(SVCXPRT *" xprt );
913 Called by a service dispatch routine when it detects a system
914 error not covered by any particular protocol.
915 For example, if a service can no longer allocate storage,
916 it may call this routine.
919 .BI "void svcerr_weakauth(SVCXPRT *" xprt );
922 Called by a service dispatch routine that refuses to perform
923 a remote procedure call due to insufficient authentication parameters.
924 The routine calls
925 .BR "svcerr_auth(xprt, AUTH_TOOWEAK)" .
928 .BI "SVCXPRT *svcfd_create(int " fd ", unsigned int " sendsize ,
929 .BI "                      unsigned int " recvsize );
932 Create a service on top of any open file descriptor.
933 Typically, this file descriptor is a connected socket for a stream protocol such
934 as TCP.
935 .I sendsize
937 .I recvsize
938 indicate sizes for the send and receive buffers.
939 If they are zero, a reasonable default is chosen.
942 .B SVCXPRT *svcraw_create(void);
945 This routine creates a toy RPC
946 service transport, to which it returns a pointer.
947 The transport is really a buffer within the process's address space,
948 so the corresponding RPC client should live in the same address space; see
949 .BR clntraw_create ().
950 This routine allows simulation of RPC and acquisition of RPC
951 overheads (such as round trip times), without any kernel interference.
952 This routine returns NULL if it fails.
955 .BI "SVCXPRT *svctcp_create(int " sock ", unsigned int " send_buf_size ,
956 .BI "                       unsigned int " recv_buf_size );
959 This routine creates a TCP/IP-based RPC
960 service transport, to which it returns a pointer.
961 The transport is associated with the socket
962 .IR sock ,
963 which may be
964 .BR RPC_ANYSOCK ,
965 in which case a new socket is created.
966 If the socket is not bound to a local TCP
967 port, then this routine binds it to an arbitrary port.
968 Upon completion,
969 .I xprt\->xp_sock
970 is the transport's socket descriptor, and
971 .I xprt\->xp_port
972 is the transport's port number.
973 This routine returns NULL if it fails.
974 Since TCP-based RPC uses buffered I/O,
975 users may specify the size of buffers; values of zero
976 choose suitable defaults.
979 .BI "SVCXPRT *svcudp_bufcreate(int " sock ", unsigned int " sendsize ,
980 .BI "                          unsigned int " recosize );
983 This routine creates a UDP/IP-based RPC
984 service transport, to which it returns a pointer.
985 The transport is associated with the socket
986 .IR sock ,
987 which may be
988 .BR RPC_ANYSOCK ,
989 in which case a new socket is created.
990 If the socket is not bound to a local UDP
991 port, then this routine binds it to an arbitrary port.
992 Upon completion,
993 .I xprt\->xp_sock
994 is the transport's socket descriptor, and
995 .I xprt\->xp_port
996 is the transport's port number.
997 This routine returns NULL if it fails.
999 This allows the user to specify the maximum packet size for sending and
1000 receiving UDP-based RPC messages.
1003 .BI "SVCXPRT *svcudp_create(int " sock );
1006 This call is equivalent to
1007 .I svcudp_bufcreate(sock,SZ,SZ)
1008 for some default size
1009 .IR SZ .
1012 .BI "bool_t xdr_accepted_reply(XDR *" xdrs ", struct accepted_reply *" ar );
1015 Used for encoding RPC reply messages.
1016 This routine is useful for users who wish to generate
1017 RPC-style messages without using the RPC package.
1020 .BI "bool_t xdr_authunix_parms(XDR *" xdrs ", struct authunix_parms *" aupp );
1023 Used for describing UNIX credentials.
1024 This routine is useful for users
1025 who wish to generate these credentials without using the RPC
1026 authentication package.
1029 .BI "void xdr_callhdr(XDR *" xdrs ", struct rpc_msg *" chdr );
1032 Used for describing RPC call header messages.
1033 This routine is useful for users who wish to generate
1034 RPC-style messages without using the RPC package.
1037 .BI "bool_t xdr_callmsg(XDR *" xdrs ", struct rpc_msg *" cmsg );
1040 Used for describing RPC call messages.
1041 This routine is useful for users who wish to generate RPC-style
1042 messages without using the RPC package.
1045 .BI "bool_t xdr_opaque_auth(XDR *" xdrs ", struct opaque_auth *" ap );
1048 Used for describing RPC authentication information messages.
1049 This routine is useful for users who wish to generate
1050 RPC-style messages without using the RPC package.
1053 .BI "bool_t xdr_pmap(XDR *" xdrs ", struct pmap *" regs );
1056 Used for describing parameters to various
1057 .B portmap
1058 procedures, externally.
1059 This routine is useful for users who wish to generate
1060 these parameters without using the
1061 .B pmap
1062 interface.
1065 .BI "bool_t xdr_pmaplist(XDR *" xdrs ", struct pmaplist **" rp );
1068 Used for describing a list of port mappings, externally.
1069 This routine is useful for users who wish to generate
1070 these parameters without using the
1071 .B pmap
1072 interface.
1075 .BI "bool_t xdr_rejected_reply(XDR *" xdrs ", struct rejected_reply *" rr );
1078 Used for describing RPC reply messages.
1079 This routine is useful for users who wish to generate
1080 RPC-style messages without using the RPC package.
1083 .BI "bool_t xdr_replymsg(XDR *" xdrs ", struct rpc_msg *" rmsg );
1086 Used for describing RPC reply messages.
1087 This routine is useful for users who wish to generate
1088 RPC style messages without using the RPC package.
1091 .BI "void xprt_register(SVCXPRT *" xprt );
1094 After RPC service transport handles are created,
1095 they should register themselves with the RPC service package.
1096 This routine modifies the global variable
1097 .IR svc_fds .
1098 Service implementors usually do not need this routine.
1101 .BI "void xprt_unregister(SVCXPRT *" xprt );
1104 Before an RPC service transport handle is destroyed,
1105 it should unregister itself with the RPC service package.
1106 This routine modifies the global variable
1107 .IR svc_fds .
1108 Service implementors usually do not need this routine.
1109 .SH ATTRIBUTES
1110 For an explanation of the terms used in this section, see
1111 .BR attributes (7).
1112 .ad l
1115 allbox;
1116 lbx lb lb
1117 l l l.
1118 Interface       Attribute       Value
1120 .BR auth_destroy (),
1121 .BR authnone_create (),
1122 .BR authunix_create (),
1123 .BR authunix_create_default (),
1124 .BR callrpc (),
1125 .BR clnt_broadcast (),
1126 .BR clnt_call (),
1127 .BR clnt_destroy (),
1128 .BR clnt_create (),
1129 .BR clnt_control (),
1130 .BR clnt_freeres (),
1131 .BR clnt_geterr (),
1132 .BR clnt_pcreateerror (),
1133 .BR clnt_perrno (),
1134 .BR clnt_perror (),
1135 .BR clnt_spcreateerror (),
1136 .BR clnt_sperrno (),
1137 .BR clnt_sperror (),
1138 .BR clntraw_create (),
1139 .BR clnttcp_create (),
1140 .BR clntudp_create (),
1141 .BR clntudp_bufcreate (),
1142 .BR get_myaddress (),
1143 .BR pmap_getmaps (),
1144 .BR pmap_getport (),
1145 .BR pmap_rmtcall (),
1146 .BR pmap_set (),
1147 .BR pmap_unset (),
1148 .BR registerrpc (),
1149 .BR svc_destroy (),
1150 .BR svc_freeargs (),
1151 .BR svc_getargs (),
1152 .BR svc_getcaller (),
1153 .BR svc_getreqset (),
1154 .BR svc_getreq (),
1155 .BR svc_register (),
1156 .BR svc_run (),
1157 .BR svc_sendreply (),
1158 .BR svc_unregister (),
1159 .BR svcerr_auth (),
1160 .BR svcerr_decode (),
1161 .BR svcerr_noproc (),
1162 .BR svcerr_noprog (),
1163 .BR svcerr_progvers (),
1164 .BR svcerr_systemerr (),
1165 .BR svcerr_weakauth (),
1166 .BR svcfd_create (),
1167 .BR svcraw_create (),
1168 .BR svctcp_create (),
1169 .BR svcudp_bufcreate (),
1170 .BR svcudp_create (),
1171 .BR xdr_accepted_reply (),
1172 .BR xdr_authunix_parms (),
1173 .BR xdr_callhdr (),
1174 .BR xdr_callmsg (),
1175 .BR xdr_opaque_auth (),
1176 .BR xdr_pmap (),
1177 .BR xdr_pmaplist (),
1178 .BR xdr_rejected_reply (),
1179 .BR xdr_replymsg (),
1180 .BR xprt_register (),
1181 .BR xprt_unregister ()
1182 T}      Thread safety   MT-Safe
1186 .sp 1
1187 .SH SEE ALSO
1188 .\" We don't have an rpc_secure.3 page in the set at the moment -- MTK, 19 Sep 05
1189 .\" .BR rpc_secure (3),
1190 .BR xdr (3)
1192 The following manuals:
1194 Remote Procedure Calls: Protocol Specification
1196 Remote Procedure Call Programming Guide
1198 rpcgen Programming Guide
1202 .IR "RPC: Remote Procedure Call Protocol Specification" ,
1203 RFC\ 1050, Sun Microsystems, Inc.,
1204 USC-ISI.