malloc.3: ffix
[man-pages.git] / man3 / rpc.3
blob3d2fe4243c15db26db30907cddf90e52f66d7928
1 .\" This page was taken from the 4.4BSD-Lite CDROM (BSD license)
2 .\"
3 .\" %%%LICENSE_START(BSD_ONELINE_CDROM)
4 .\" This page was taken from the 4.4BSD-Lite CDROM (BSD license)
5 .\" %%%LICENSE_END
6 .\"
7 .\" @(#)rpc.3n  2.4 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI
8 .\"
9 .\" 2007-12-30, mtk, Convert function prototypes to modern C syntax
10 .\"
11 .TH RPC 3 2021-03-22 "" "Linux Programmer's Manual"
12 .SH NAME
13 rpc \- library routines for remote procedure calls
14 .SH SYNOPSIS AND DESCRIPTION
15 These routines allow C programs to make procedure
16 calls on other machines across the network.
17 First, the client calls a procedure to send a data packet to the server.
18 Upon receipt of the packet, the server calls a dispatch routine
19 to perform the requested service, and then sends back a reply.
20 Finally, the procedure call returns to the client.
21 .\" .LP
22 .\" We don't have an rpc_secure.3 page at the moment -- MTK, 19 Sep 05
23 .\" Routines that are used for Secure RPC (DES authentication) are described in
24 .\" .BR rpc_secure (3).
25 .\" Secure RPC can be used only if DES encryption is available.
26 .PP
27 To take use of these routines, include the header file
28 .IR "<rpc/rpc.h>" .
29 .PP
30 The prototypes below make use of the following types:
31 .PP
32 .RS 4
33 .EX
34 .BI "typedef int " bool_t ;
35 .PP
36 .BI "typedef bool_t (*" xdrproc_t ")(XDR *, void *, ...);"
37 .PP
38 .BI "typedef bool_t (*" resultproc_t ")(caddr_t " resp ,
39 .BI "                               struct sockaddr_in *" raddr );
40 .EE
41 .RE
42 .PP
43 See the header files for the declarations of the
44 .IR AUTH ,
45 .IR CLIENT ,
46 .IR SVCXPRT ,
47 and
48 .IR XDR
49 types.
50 .PP
51 .nf
52 .BI "void auth_destroy(AUTH *" auth );
53 .fi
54 .IP
55 A macro that destroys the authentication information associated with
56 .IR auth .
57 Destruction usually involves deallocation of private data structures.
58 The use of
59 .I auth
60 is undefined after calling
61 .BR auth_destroy ().
62 .PP
63 .nf
64 .BI "AUTH *authnone_create(void);"
65 .fi
66 .IP
67 Create and return an RPC
68 authentication handle that passes nonusable authentication
69 information with each remote procedure call.
70 This is the default authentication used by RPC.
71 .PP
72 .nf
73 .BI "AUTH *authunix_create(char *" host ", uid_t " uid ", gid_t " gid ,
74 .BI "                      int " len ", gid_t *" aup_gids );
75 .fi
76 .IP
77 Create and return an RPC authentication handle that contains
78 authentication information.
79 The parameter
80 .I host
81 is the name of the machine on which the information was created;
82 .I uid
83 is the user's user ID;
84 .I gid
85 is the user's current group ID;
86 .I len
87 and
88 .I aup_gids
89 refer to a counted array of groups to which the user belongs.
90 It is easy to impersonate a user.
91 .PP
92 .nf
93 .BI "AUTH *authunix_create_default(void);"
94 .fi
95 .IP
96 Calls
97 .BR authunix_create ()
98 with the appropriate parameters.
99 .PP
101 .BI "int callrpc(char *" host ", unsigned long " prognum ,
102 .BI "            unsigned long " versnum ", unsigned long " procnum ,
103 .BI "            xdrproc_t " inproc ", const char *" in ,
104 .BI "            xdrproc_t " outproc ", char *" out );
107 Call the remote procedure associated with
108 .IR prognum ,
109 .IR versnum ,
111 .I procnum
112 on the machine,
113 .IR host .
114 The parameter
115 .I in
116 is the address of the procedure's argument(s), and
117 .I out
118 is the address of where to place the result(s);
119 .I inproc
120 is used to encode the procedure's parameters, and
121 .I outproc
122 is used to decode the procedure's results.
123 This routine returns zero if it succeeds, or the value of
124 .B "enum clnt_stat"
125 cast to an integer if it fails.
126 The routine
127 .BR clnt_perrno ()
128 is handy for translating failure statuses into messages.
130 Warning: calling remote procedures with this routine
131 uses UDP/IP as a transport; see
132 .BR clntudp_create ()
133 for restrictions.
134 You do not have control of timeouts or authentication using this routine.
137 .BI "enum clnt_stat clnt_broadcast(unsigned long " prognum ,
138 .BI "                     unsigned long " versnum ", unsigned long " procnum ,
139 .BI "                     xdrproc_t " inproc ", char *" in ,
140 .BI "                     xdrproc_t " outproc ", char *" out ,
141 .BI "                     resultproc_t " eachresult );
144 Like
145 .BR callrpc (),
146 except the call message is broadcast to all locally
147 connected broadcast nets.
148 Each time it receives a response, this routine calls
149 .BR eachresult (),
150 whose form is:
152 .in +4n
154 .BI "eachresult(char *" out ", struct sockaddr_in *" addr );
158 where
159 .I out
160 is the same as
161 .I out
162 passed to
163 .BR clnt_broadcast (),
164 except that the remote procedure's output is decoded there;
165 .I addr
166 points to the address of the machine that sent the results.
168 .BR eachresult ()
169 returns zero,
170 .BR clnt_broadcast ()
171 waits for more replies; otherwise it returns with appropriate status.
173 Warning: broadcast sockets are limited in size to the
174 maximum transfer unit of the data link.
175 For ethernet, this value is 1500 bytes.
178 .BI "enum clnt_stat clnt_call(CLIENT *" clnt ", unsigned long " procnum ,
179 .BI "                    xdrproc_t " inproc ", char *" in ,
180 .BI "                    xdrproc_t " outproc ", char *" out ,
181 .BI "                    struct timeval " tout );
184 A macro that calls the remote procedure
185 .I procnum
186 associated with the client handle,
187 .IR clnt ,
188 which is obtained with an RPC client creation routine such as
189 .BR clnt_create ().
190 The parameter
191 .I in
192 is the address of the procedure's argument(s), and
193 .I out
194 is the address of where to place the result(s);
195 .I inproc
196 is used to encode the procedure's parameters, and
197 .I outproc
198 is used to decode the procedure's results;
199 .I tout
200 is the time allowed for results to come back.
203 .BI "clnt_destroy(CLIENT *" clnt );
206 A macro that destroys the client's RPC handle.
207 Destruction usually involves deallocation
208 of private data structures, including
209 .I clnt
210 itself.
211 Use of
212 .I clnt
213 is undefined after calling
214 .BR clnt_destroy ().
215 If the RPC library opened the associated socket, it will close it also.
216 Otherwise, the socket remains open.
219 .BI "CLIENT *clnt_create(const char *" host ", unsigned long " prog ,
220 .BI "                    unsigned long " vers ", const char *" proto );
223 Generic client creation routine.
224 .I host
225 identifies the name of the remote host where the server is located.
226 .I proto
227 indicates which kind of transport protocol to use.
228 The currently supported values for this field are \(lqudp\(rq
229 and \(lqtcp\(rq.
230 Default timeouts are set, but can be modified using
231 .BR clnt_control ().
233 Warning: using UDP has its shortcomings.
234 Since UDP-based RPC messages can hold only up to 8 Kbytes of encoded data,
235 this transport cannot be used for procedures that take
236 large arguments or return huge results.
239 .BI "bool_t clnt_control(CLIENT *" cl ", int " req ", char *" info );
242 A macro used to change or retrieve various information
243 about a client object.
244 .I req
245 indicates the type of operation, and
246 .I info
247 is a pointer to the information.
248 For both UDP and TCP, the supported values of
249 .I req
250 and their argument types and what they do are:
252 .in +4n
254 \fBCLSET_TIMEOUT\fP  \fIstruct timeval\fP // set total timeout
255 \fBCLGET_TIMEOUT\fP  \fIstruct timeval\fP // get total timeout
259 Note: if you set the timeout using
260 .BR clnt_control (),
261 the timeout parameter passed to
262 .BR clnt_call ()
263 will be ignored in all future calls.
265 .in +4n
267 \fBCLGET_SERVER_ADDR\fP  \fIstruct sockaddr_in\fP
268                 // get server\(aqs address
272 The following operations are valid for UDP only:
274 .in +4n
276 \fBCLSET_RETRY_TIMEOUT\fP  \fIstruct timeval\fP // set the retry timeout
277 \fBCLGET_RETRY_TIMEOUT\fP  \fIstruct timeval\fP // get the retry timeout
281 The retry timeout is the time that "UDP RPC"
282 waits for the server to reply before
283 retransmitting the request.
286 .BI "clnt_freeres(CLIENT * " clnt ", xdrproc_t " outproc ", char *" out );
289 A macro that frees any data allocated by the RPC/XDR
290 system when it decoded the results of an RPC call.
291 The parameter
292 .I out
293 is the address of the results, and
294 .I outproc
295 is the XDR routine describing the results.
296 This routine returns one if the results were successfully freed,
297 and zero otherwise.
300 .BI "void clnt_geterr(CLIENT *" clnt ", struct rpc_err *" errp );
303 A macro that copies the error structure out of the client
304 handle to the structure at address
305 .IR errp .
308 .BI "void clnt_pcreateerror(const char *" s );
311 Print a message to standard error indicating why a client RPC
312 handle could not be created.
313 The message is prepended with string
314 .I s
315 and a colon.
316 Used when a
317 .BR clnt_create (),
318 .BR clntraw_create (),
319 .BR clnttcp_create (),
321 .BR clntudp_create ()
322 call fails.
325 .BI "void clnt_perrno(enum clnt_stat " stat );
328 Print a message to standard error corresponding
329 to the condition indicated by
330 .IR stat .
331 Used after
332 .BR callrpc ().
335 .BI "clnt_perror(CLIENT *" clnt ", const char *" s );
338 Print a message to standard error indicating why an RPC call failed;
339 .I clnt
340 is the handle used to do the call.
341 The message is prepended with string
342 .I s
343 and a colon.
344 Used after
345 .BR clnt_call ().
348 .BI "char *clnt_spcreateerror(const char *" s );
351 Like
352 .BR clnt_pcreateerror (),
353 except that it returns a string instead of printing to the standard error.
355 Bugs: returns pointer to static data that is overwritten on each call.
358 .BI "char *clnt_sperrno(enum clnt_stat " stat );
361 Take the same arguments as
362 .BR clnt_perrno (),
363 but instead of sending a message to the standard error indicating why an RPC
364 call failed, return a pointer to a string which contains the message.
365 The string ends with a NEWLINE.
367 .BR clnt_sperrno ()
368 is used instead of
369 .BR clnt_perrno ()
370 if the program does not have a standard error (as a program
371 running as a server quite likely does not), or if the programmer
372 does not want the message to be output with
373 .BR printf (3),
374 or if a message format different than that supported by
375 .BR clnt_perrno ()
376 is to be used.
377 Note: unlike
378 .BR clnt_sperror ()
380 .BR clnt_spcreateerror (),
381 .BR clnt_sperrno ()
382 returns pointer to static data, but the
383 result will not get overwritten on each call.
386 .BI "char *clnt_sperror(CLIENT *" rpch ", const char *" s );
389 Like
390 .BR clnt_perror (),
391 except that (like
392 .BR clnt_sperrno ())
393 it returns a string instead of printing to standard error.
395 Bugs: returns pointer to static data that is overwritten on each call.
398 .BI "CLIENT *clntraw_create(unsigned long " prognum \
399 ", unsigned long " versnum );
402 This routine creates a toy RPC client for the remote program
403 .IR prognum ,
404 version
405 .IR versnum .
406 The transport used to pass messages to the service is
407 actually a buffer within the process's address space, so the
408 corresponding RPC server should live in the same address space; see
409 .BR svcraw_create ().
410 This allows simulation of RPC and acquisition of RPC
411 overheads, such as round trip times, without any kernel interference.
412 This routine returns NULL if it fails.
415 .BI "CLIENT *clnttcp_create(struct sockaddr_in *" addr ,
416 .BI "                unsigned long " prognum ", unsigned long " versnum ,
417 .BI "                int *" sockp ", unsigned int " sendsz \
418 ", unsigned int " recvsz );
421 This routine creates an RPC client for the remote program
422 .IR prognum ,
423 version
424 .IR versnum ;
425 the client uses TCP/IP as a transport.
426 The remote program is located at Internet address
427 .IR *addr .
429 .\"The following inline font conversion is necessary for the hyphen indicator
430 .I addr\->sin_port
431 is zero, then it is set to the actual port that the remote
432 program is listening on (the remote
433 .B portmap
434 service is consulted for this information).
435 The parameter
436 .I sockp
437 is a socket; if it is
438 .BR RPC_ANYSOCK ,
439 then this routine opens a new one and sets
440 .IR sockp .
441 Since TCP-based RPC uses buffered I/O,
442 the user may specify the size of the send and receive buffers
443 with the parameters
444 .I sendsz
446 .IR recvsz ;
447 values of zero choose suitable defaults.
448 This routine returns NULL if it fails.
451 .BI "CLIENT *clntudp_create(struct sockaddr_in *" addr ,
452 .BI "                unsigned long " prognum ", unsigned long " versnum ,
453 .BI "                struct timeval " wait ", int *" sockp );
456 This routine creates an RPC client for the remote program
457 .IR prognum ,
458 version
459 .IR versnum ;
460 the client uses use UDP/IP as a transport.
461 The remote program is located at Internet address
462 .IR addr .
464 .I addr\->sin_port
465 is zero, then it is set to actual port that the remote
466 program is listening on (the remote
467 .B portmap
468 service is consulted for this information).
469 The parameter
470 .I sockp
471 is a socket; if it is
472 .BR RPC_ANYSOCK ,
473 then this routine opens a new one and sets
474 .IR sockp .
475 The UDP transport resends the call message in intervals of
476 .I wait
477 time until a response is received or until the call times out.
478 The total time for the call to time out is specified by
479 .BR clnt_call ().
481 Warning: since UDP-based RPC messages can hold only up to 8 Kbytes
482 of encoded data, this transport cannot be used for procedures
483 that take large arguments or return huge results.
486 .BI "CLIENT *clntudp_bufcreate(struct sockaddr_in *" addr ,
487 .BI "            unsigned long " prognum ", unsigned long " versnum ,
488 .BI "            struct timeval " wait ", int *" sockp ,
489 .BI "            unsigned int " sendsize ", unsigned int "recosize );
492 This routine creates an RPC client for the remote program
493 .IR prognum ,
495 .IR versnum ;
496 the client uses use UDP/IP as a transport.
497 The remote program is located at Internet address
498 .IR addr .
500 .I addr\->sin_port
501 is zero, then it is set to actual port that the remote
502 program is listening on (the remote
503 .B portmap
504 service is consulted for this information).
505 The parameter
506 .I sockp
507 is a socket; if it is
508 .BR RPC_ANYSOCK ,
509 then this routine opens a new one and sets
510 .IR sockp .
511 The UDP transport resends the call message in intervals of
512 .I wait
513 time until a response is received or until the call times out.
514 The total time for the call to time out is specified by
515 .BR clnt_call ().
517 This allows the user to specify the maximum packet
518 size for sending and receiving UDP-based RPC messages.
521 .BI "void get_myaddress(struct sockaddr_in *" addr );
524 Stuff the machine's IP address into
525 .IR *addr ,
526 without consulting the library routines that deal with
527 .IR /etc/hosts .
528 The port number is always set to
529 .BR htons(PMAPPORT) .
532 .BI "struct pmaplist *pmap_getmaps(struct sockaddr_in *" addr );
535 A user interface to the
536 .B portmap
537 service, which returns a list of the current RPC
538 program-to-port mappings on the host located at IP address
539 .IR *addr .
540 This routine can return NULL.
541 The command
542 .IR "rpcinfo\ \-p"
543 uses this routine.
546 .BI "unsigned short pmap_getport(struct sockaddr_in *" addr ,
547 .BI "                    unsigned long " prognum ", unsigned long " versnum ,
548 .BI "                    unsigned int " protocol );
551 A user interface to the
552 .B portmap
553 service, which returns the port number
554 on which waits a service that supports program number
555 .IR prognum ,
556 version
557 .IR versnum ,
558 and speaks the transport protocol associated with
559 .IR protocol .
560 The value of
561 .I protocol
562 is most likely
563 .B IPPROTO_UDP
565 .BR IPPROTO_TCP .
566 A return value of zero means that the mapping does not exist
567 or that the RPC system failed to contact the remote
568 .B portmap
569 service.
570 In the latter case, the global variable
571 .I rpc_createerr
572 contains the RPC status.
575 .BI "enum clnt_stat pmap_rmtcall(struct sockaddr_in *" addr ,
576 .BI "                    unsigned long " prognum ", unsigned long " versnum ,
577 .BI "                    unsigned long " procnum ,
578 .BI "                    xdrproc_t " inproc ", char *" in ,
579 .BI "                    xdrproc_t " outproc ", char *" out ,
580 .BI "                    struct timeval " tout ", unsigned long *" portp );
583 A user interface to the
584 .B portmap
585 service, which instructs
586 .B portmap
587 on the host at IP address
588 .I *addr
589 to make an RPC call on your behalf to a procedure on that host.
590 The parameter
591 .I *portp
592 will be modified to the program's port number if the procedure succeeds.
593 The definitions of other parameters are discussed
595 .BR callrpc ()
597 .BR clnt_call ().
598 This procedure should be used for a \(lqping\(rq and nothing else.
599 See also
600 .BR clnt_broadcast ().
603 .BI "bool_t pmap_set(unsigned long " prognum ", unsigned long " versnum ,
604 .BI "                int " protocol ", unsigned short " port );
607 A user interface to the
608 .B portmap
609 service, which establishes a mapping between the triple
610 .RI [ prognum , versnum , protocol ]
612 .I port
613 on the machine's
614 .B portmap
615 service.
616 The value of
617 .I protocol
618 is most likely
619 .B IPPROTO_UDP
621 .BR IPPROTO_TCP .
622 This routine returns one if it succeeds, zero otherwise.
623 Automatically done by
624 .BR svc_register ().
627 .BI "bool_t pmap_unset(unsigned long " prognum ", unsigned long " versnum );
630 A user interface to the
631 .B portmap
632 service, which destroys all mapping between the triple
633 .RI [ prognum , versnum , * ]
635 .B ports
636 on the machine's
637 .B portmap
638 service.
639 This routine returns one if it succeeds, zero otherwise.
642 .BI "int registerrpc(unsigned long " prognum ", unsigned long " versnum ,
643 .BI "                unsigned long " procnum ", char *(*" procname ")(char *),"
644 .BI "                xdrproc_t " inproc ", xdrproc_t " outproc );
647 Register procedure
648 .I procname
649 with the RPC service package.
650 If a request arrives for program
651 .IR prognum ,
652 version
653 .IR versnum ,
654 and procedure
655 .IR procnum ,
656 .I procname
657 is called with a pointer to its parameter(s);
658 .I procname
659 should return a pointer to its static result(s);
660 .I inproc
661 is used to decode the parameters while
662 .I outproc
663 is used to encode the results.
664 This routine returns zero if the registration succeeded, \-1 otherwise.
666 Warning: remote procedures registered in this form
667 are accessed using the UDP/IP transport; see
668 .BR svcudp_create ()
669 for restrictions.
672 .BI "struct rpc_createerr " rpc_createerr ;
675 A global variable whose value is set by any RPC client creation routine
676 that does not succeed.
677 Use the routine
678 .BR clnt_pcreateerror ()
679 to print the reason why.
682 .BI "void svc_destroy(SVCXPRT *" xprt );
685 A macro that destroys the RPC service transport handle,
686 .IR xprt .
687 Destruction usually involves deallocation
688 of private data structures, including
689 .I xprt
690 itself.
691 Use of
692 .I xprt
693 is undefined after calling this routine.
696 .BI "fd_set " svc_fdset ;
699 A global variable reflecting the RPC service side's
700 read file descriptor bit mask; it is suitable as a parameter to the
701 .BR select (2)
702 system call.
703 This is of interest only if a service implementor does their own
704 asynchronous event processing, instead of calling
705 .BR svc_run ().
706 This variable is read-only (do not pass its address to
707 .BR select (2)!),
708 yet it may change after calls to
709 .BR svc_getreqset ()
710 or any creation routines.
713 .BI "int " svc_fds ;
716 Similar to
717 .BR svc_fdset ,
718 but limited to 32 file descriptors.
719 This interface is obsoleted by
720 .BR svc_fdset .
723 .BI "svc_freeargs(SVCXPRT *" xprt ", xdrproc_t " inproc ", char *" in );
726 A macro that frees any data allocated by the RPC/XDR
727 system when it decoded the arguments to a service procedure using
728 .BR svc_getargs ().
729 This routine returns 1 if the results were successfully freed,
730 and zero otherwise.
733 .BI "svc_getargs(SVCXPRT *" xprt ", xdrproc_t " inproc ", char *" in );
736 A macro that decodes the arguments of an RPC request
737 associated with the RPC service transport handle,
738 .IR xprt .
739 The parameter
740 .I in
741 is the address where the arguments will be placed;
742 .I inproc
743 is the XDR routine used to decode the arguments.
744 This routine returns one if decoding succeeds, and zero otherwise.
747 .BI "struct sockaddr_in *svc_getcaller(SVCXPRT *" xprt );
750 The approved way of getting the network address of the caller
751 of a procedure associated with the RPC service transport handle,
752 .IR xprt .
755 .BI "void svc_getreqset(fd_set *" rdfds );
758 This routine is of interest only if a service implementor does not call
759 .BR svc_run (),
760 but instead implements custom asynchronous event processing.
761 It is called when the
762 .BR select (2)
763 system call has determined that an RPC request has arrived on some
764 RPC socket(s);
765 .I rdfds
766 is the resultant read file descriptor bit mask.
767 The routine returns when all sockets associated with the value of
768 .I rdfds
769 have been serviced.
772 .BI "void svc_getreq(int " rdfds );
775 Similar to
776 .BR svc_getreqset (),
777 but limited to 32 file descriptors.
778 This interface is obsoleted by
779 .BR svc_getreqset ().
782 .BI "bool_t svc_register(SVCXPRT *" xprt ", unsigned long " prognum ,
783 .BI "                    unsigned long " versnum ,
784 .BI "                    void (*" dispatch ")(struct svc_req *, SVCXPRT *),"
785 .BI "                    unsigned long " protocol );
788 Associates
789 .I prognum
791 .I versnum
792 with the service dispatch procedure,
793 .IR dispatch .
795 .I protocol
796 is zero, the service is not registered with the
797 .B portmap
798 service.
800 .I protocol
801 is nonzero, then a mapping of the triple
802 .RI [ prognum , versnum , protocol ]
804 .I xprt\->xp_port
805 is established with the local
806 .B portmap
807 service (generally
808 .I protocol
809 is zero,
810 .B IPPROTO_UDP
812 .BR IPPROTO_TCP ).
813 The procedure
814 .I dispatch
815 has the following form:
817 .in +4n
819 dispatch(struct svc_req *request, SVCXPRT *xprt);
824 .BR svc_register ()
825 routine returns one if it succeeds, and zero otherwise.
828 .B "void svc_run(void);"
831 This routine never returns.
832 It waits for RPC requests to arrive, and calls the appropriate service
833 procedure using
834 .BR svc_getreq ()
835 when one arrives.
836 This procedure is usually waiting for a
837 .BR select (2)
838 system call to return.
841 .BI "bool_t svc_sendreply(SVCXPRT *" xprt ", xdrproc_t " outproc \
842 ", char *" out );
845 Called by an RPC service's dispatch routine to send the results of a
846 remote procedure call.
847 The parameter
848 .I xprt
849 is the request's associated transport handle;
850 .I outproc
851 is the XDR routine which is used to encode the results; and
852 .I out
853 is the address of the results.
854 This routine returns one if it succeeds, zero otherwise.
857 .BI "void svc_unregister(unsigned long " prognum ", unsigned long " versnum );
860 Remove all mapping of the double
861 .RI [ prognum , versnum ]
862 to dispatch routines, and of the triple
863 .RI [ prognum , versnum , * ]
864 to port number.
867 .BI "void svcerr_auth(SVCXPRT *" xprt ", enum auth_stat " why );
870 Called by a service dispatch routine that refuses to perform
871 a remote procedure call due to an authentication error.
874 .BI "void svcerr_decode(SVCXPRT *" xprt );
877 Called by a service dispatch routine that cannot successfully
878 decode its parameters.
879 See also
880 .BR svc_getargs ().
883 .BI "void svcerr_noproc(SVCXPRT *" xprt );
886 Called by a service dispatch routine that does not implement
887 the procedure number that the caller requests.
890 .BI "void svcerr_noprog(SVCXPRT *" xprt );
893 Called when the desired program is not registered with the RPC package.
894 Service implementors usually do not need this routine.
897 .BI "void svcerr_progvers(SVCXPRT *" xprt ", unsigned long " low_vers ,
898 .BI "                     unsigned long " high_vers );
901 Called when the desired version of a program is not registered
902 with the RPC package.
903 Service implementors usually do not need this routine.
906 .BI "void svcerr_systemerr(SVCXPRT *" xprt );
909 Called by a service dispatch routine when it detects a system
910 error not covered by any particular protocol.
911 For example, if a service can no longer allocate storage,
912 it may call this routine.
915 .BI "void svcerr_weakauth(SVCXPRT *" xprt );
918 Called by a service dispatch routine that refuses to perform
919 a remote procedure call due to insufficient authentication parameters.
920 The routine calls
921 .BR "svcerr_auth(xprt, AUTH_TOOWEAK)" .
924 .BI "SVCXPRT *svcfd_create(int " fd ", unsigned int " sendsize ,
925 .BI "                      unsigned int " recvsize );
928 Create a service on top of any open file descriptor.
929 Typically, this file descriptor is a connected socket for a stream protocol such
930 as TCP.
931 .I sendsize
933 .I recvsize
934 indicate sizes for the send and receive buffers.
935 If they are zero, a reasonable default is chosen.
938 .BI "SVCXPRT *svcraw_create(void);"
941 This routine creates a toy RPC
942 service transport, to which it returns a pointer.
943 The transport is really a buffer within the process's address space,
944 so the corresponding RPC client should live in the same address space; see
945 .BR clntraw_create ().
946 This routine allows simulation of RPC and acquisition of RPC
947 overheads (such as round trip times), without any kernel interference.
948 This routine returns NULL if it fails.
951 .BI "SVCXPRT *svctcp_create(int " sock ", unsigned int " send_buf_size ,
952 .BI "                       unsigned int " recv_buf_size );
955 This routine creates a TCP/IP-based RPC
956 service transport, to which it returns a pointer.
957 The transport is associated with the socket
958 .IR sock ,
959 which may be
960 .BR RPC_ANYSOCK ,
961 in which case a new socket is created.
962 If the socket is not bound to a local TCP
963 port, then this routine binds it to an arbitrary port.
964 Upon completion,
965 .I xprt\->xp_sock
966 is the transport's socket descriptor, and
967 .I xprt\->xp_port
968 is the transport's port number.
969 This routine returns NULL if it fails.
970 Since TCP-based RPC uses buffered I/O,
971 users may specify the size of buffers; values of zero
972 choose suitable defaults.
975 .BI "SVCXPRT *svcudp_bufcreate(int " sock ", unsigned int " sendsize ,
976 .BI "                          unsigned int " recosize );
979 This routine creates a UDP/IP-based RPC
980 service transport, to which it returns a pointer.
981 The transport is associated with the socket
982 .IR sock ,
983 which may be
984 .BR RPC_ANYSOCK ,
985 in which case a new socket is created.
986 If the socket is not bound to a local UDP
987 port, then this routine binds it to an arbitrary port.
988 Upon completion,
989 .I xprt\->xp_sock
990 is the transport's socket descriptor, and
991 .I xprt\->xp_port
992 is the transport's port number.
993 This routine returns NULL if it fails.
995 This allows the user to specify the maximum packet size for sending and
996 receiving UDP-based RPC messages.
999 .BI "SVCXPRT *svcudp_create(int " sock );
1002 This call is equivalent to
1003 .I svcudp_bufcreate(sock,SZ,SZ)
1004 for some default size
1005 .IR SZ .
1008 .BI "bool_t xdr_accepted_reply(XDR *" xdrs ", struct accepted_reply *" ar );
1011 Used for encoding RPC reply messages.
1012 This routine is useful for users who wish to generate
1013 RPC-style messages without using the RPC package.
1016 .BI "bool_t xdr_authunix_parms(XDR *" xdrs ", struct authunix_parms *" aupp );
1019 Used for describing UNIX credentials.
1020 This routine is useful for users
1021 who wish to generate these credentials without using the RPC
1022 authentication package.
1025 .BI "void xdr_callhdr(XDR *" xdrs ", struct rpc_msg *" chdr );
1028 Used for describing RPC call header messages.
1029 This routine is useful for users who wish to generate
1030 RPC-style messages without using the RPC package.
1033 .BI "bool_t xdr_callmsg(XDR *" xdrs ", struct rpc_msg *" cmsg );
1036 Used for describing RPC call messages.
1037 This routine is useful for users who wish to generate RPC-style
1038 messages without using the RPC package.
1041 .BI "bool_t xdr_opaque_auth(XDR *" xdrs ", struct opaque_auth *" ap );
1044 Used for describing RPC authentication information messages.
1045 This routine is useful for users who wish to generate
1046 RPC-style messages without using the RPC package.
1049 .BI "bool_t xdr_pmap(XDR *" xdrs ", struct pmap *" regs );
1052 Used for describing parameters to various
1053 .B portmap
1054 procedures, externally.
1055 This routine is useful for users who wish to generate
1056 these parameters without using the
1057 .B pmap
1058 interface.
1061 .BI "bool_t xdr_pmaplist(XDR *" xdrs ", struct pmaplist **" rp );
1064 Used for describing a list of port mappings, externally.
1065 This routine is useful for users who wish to generate
1066 these parameters without using the
1067 .B pmap
1068 interface.
1071 .BI "bool_t xdr_rejected_reply(XDR *" xdrs ", struct rejected_reply *" rr );
1074 Used for describing RPC reply messages.
1075 This routine is useful for users who wish to generate
1076 RPC-style messages without using the RPC package.
1079 .BI "bool_t xdr_replymsg(XDR *" xdrs ", struct rpc_msg *" rmsg );
1082 Used for describing RPC reply messages.
1083 This routine is useful for users who wish to generate
1084 RPC style messages without using the RPC package.
1087 .BI "void xprt_register(SVCXPRT *" xprt );
1090 After RPC service transport handles are created,
1091 they should register themselves with the RPC service package.
1092 This routine modifies the global variable
1093 .IR svc_fds .
1094 Service implementors usually do not need this routine.
1097 .BI "void xprt_unregister(SVCXPRT *" xprt );
1100 Before an RPC service transport handle is destroyed,
1101 it should unregister itself with the RPC service package.
1102 This routine modifies the global variable
1103 .IR svc_fds .
1104 Service implementors usually do not need this routine.
1105 .SH ATTRIBUTES
1106 For an explanation of the terms used in this section, see
1107 .BR attributes (7).
1108 .ad l
1111 allbox;
1112 lbx lb lb
1113 l l l.
1114 Interface       Attribute       Value
1116 .BR auth_destroy (),
1117 .BR authnone_create (),
1118 .BR authunix_create (),
1119 .BR authunix_create_default (),
1120 .BR callrpc (),
1121 .BR clnt_broadcast (),
1122 .BR clnt_call (),
1123 .BR clnt_destroy (),
1124 .BR clnt_create (),
1125 .BR clnt_control (),
1126 .BR clnt_freeres (),
1127 .BR clnt_geterr (),
1128 .BR clnt_pcreateerror (),
1129 .BR clnt_perrno (),
1130 .BR clnt_perror (),
1131 .BR clnt_spcreateerror (),
1132 .BR clnt_sperrno (),
1133 .BR clnt_sperror (),
1134 .BR clntraw_create (),
1135 .BR clnttcp_create (),
1136 .BR clntudp_create (),
1137 .BR clntudp_bufcreate (),
1138 .BR get_myaddress (),
1139 .BR pmap_getmaps (),
1140 .BR pmap_getport (),
1141 .BR pmap_rmtcall (),
1142 .BR pmap_set (),
1143 .BR pmap_unset (),
1144 .BR registerrpc (),
1145 .BR svc_destroy (),
1146 .BR svc_freeargs (),
1147 .BR svc_getargs (),
1148 .BR svc_getcaller (),
1149 .BR svc_getreqset (),
1150 .BR svc_getreq (),
1151 .BR svc_register (),
1152 .BR svc_run (),
1153 .BR svc_sendreply (),
1154 .BR svc_unregister (),
1155 .BR svcerr_auth (),
1156 .BR svcerr_decode (),
1157 .BR svcerr_noproc (),
1158 .BR svcerr_noprog (),
1159 .BR svcerr_progvers (),
1160 .BR svcerr_systemerr (),
1161 .BR svcerr_weakauth (),
1162 .BR svcfd_create (),
1163 .BR svcraw_create (),
1164 .BR svctcp_create (),
1165 .BR svcudp_bufcreate (),
1166 .BR svcudp_create (),
1167 .BR xdr_accepted_reply (),
1168 .BR xdr_authunix_parms (),
1169 .BR xdr_callhdr (),
1170 .BR xdr_callmsg (),
1171 .BR xdr_opaque_auth (),
1172 .BR xdr_pmap (),
1173 .BR xdr_pmaplist (),
1174 .BR xdr_rejected_reply (),
1175 .BR xdr_replymsg (),
1176 .BR xprt_register (),
1177 .BR xprt_unregister ()
1178 T}      Thread safety   MT-Safe
1182 .sp 1
1183 .SH SEE ALSO
1184 .\" We don't have an rpc_secure.3 page in the set at the moment -- MTK, 19 Sep 05
1185 .\" .BR rpc_secure (3),
1186 .BR xdr (3)
1188 The following manuals:
1190 Remote Procedure Calls: Protocol Specification
1192 Remote Procedure Call Programming Guide
1194 rpcgen Programming Guide
1198 .IR "RPC: Remote Procedure Call Protocol Specification" ,
1199 RFC\ 1050, Sun Microsystems, Inc.,
1200 USC-ISI.