xref: /netbsd-src/lib/libc/rpc/rpc_soc.3 (revision 01869ca4d24a86379a68731bf9706a9f0820fe4e)
17df0ccbaSfvdl.\"	@(#)rpc.3n	2.4 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI
2*01869ca4Swiz.\"	$NetBSD: rpc_soc.3,v 1.17 2017/07/03 21:32:49 wiz Exp $
399410184Ssalo.\" Converted to mdoc by Thomas Klausner <wiz@NetBSD.org>
47df0ccbaSfvdl.\"
542d8f555Swiz.Dd December 29, 2016
6df25ca45Swiz.Dt RPC_SOC 3
7df25ca45Swiz.Os
8df25ca45Swiz.Sh NAME
9df25ca45Swiz.Nm rpc_soc ,
10df25ca45Swiz.Nm auth_destroy ,
11df25ca45Swiz.Nm authnone_create ,
12df25ca45Swiz.Nm authunix_create ,
13df25ca45Swiz.Nm authunix_create_default ,
14df25ca45Swiz.Nm callrpc ,
15df25ca45Swiz.Nm clnt_broadcast ,
16df25ca45Swiz.Nm clnt_call ,
17df25ca45Swiz.Nm clnt_control ,
18df25ca45Swiz.Nm clnt_create ,
19df25ca45Swiz.Nm clnt_destroy ,
20df25ca45Swiz.Nm clnt_freeres ,
21df25ca45Swiz.Nm clnt_geterr ,
22df25ca45Swiz.Nm clnt_pcreateerror ,
23df25ca45Swiz.Nm clnt_perrno ,
24df25ca45Swiz.Nm clnt_perror ,
25df25ca45Swiz.Nm clnt_spcreateerror ,
26df25ca45Swiz.Nm clnt_sperrno ,
27df25ca45Swiz.Nm clnt_sperror ,
28df25ca45Swiz.Nm clntraw_create ,
29df25ca45Swiz.Nm clnttcp_create ,
30df25ca45Swiz.Nm clntudp_bufcreate ,
31df25ca45Swiz.Nm clntudp_create ,
32df25ca45Swiz.Nm get_myaddress ,
33df25ca45Swiz.Nm pmap_getmaps ,
34df25ca45Swiz.Nm pmap_getport ,
35df25ca45Swiz.Nm pmap_rmtcall ,
36df25ca45Swiz.Nm pmap_set ,
37df25ca45Swiz.Nm pmap_unset ,
38df25ca45Swiz.Nm registerrpc ,
39df25ca45Swiz.Nm rpc_createerr ,
40df25ca45Swiz.Nm svc_destroy ,
41df25ca45Swiz.Nm svc_fds ,
42df25ca45Swiz.Nm svc_fdset ,
43df25ca45Swiz.Nm svc_getargs ,
44df25ca45Swiz.Nm svc_getcaller ,
45df25ca45Swiz.Nm svc_getreg ,
46df25ca45Swiz.Nm svc_getregset ,
4747b2a921Schristos.Nm svc_getrpccaller ,
48df25ca45Swiz.Nm svc_register ,
49df25ca45Swiz.Nm svc_run ,
50df25ca45Swiz.Nm svc_sendreply ,
51df25ca45Swiz.Nm svc_unregister ,
52df25ca45Swiz.Nm svcerr_auth ,
53df25ca45Swiz.Nm svcerr_decode ,
54df25ca45Swiz.Nm svcerr_noproc ,
55df25ca45Swiz.Nm svcerr_noprog ,
56df25ca45Swiz.Nm svcerr_progvers ,
57df25ca45Swiz.Nm svcerr_systemerr ,
58df25ca45Swiz.Nm svcerr_weakauth ,
59df25ca45Swiz.Nm svcfd_create ,
60df25ca45Swiz.Nm svcraw_create ,
61df25ca45Swiz.Nm xdr_accepted_reply ,
62df25ca45Swiz.Nm xdr_authunix_parms ,
63df25ca45Swiz.Nm xdr_callhdr ,
64df25ca45Swiz.Nm xdr_callmsg ,
65df25ca45Swiz.Nm xdr_opaque_auth ,
66df25ca45Swiz.Nm xdr_pmap ,
67df25ca45Swiz.Nm xdr_pmaplist ,
68df25ca45Swiz.Nm xdr_rejected_reply ,
69df25ca45Swiz.Nm xdr_replymsg ,
70df25ca45Swiz.Nm xprt_register ,
71df25ca45Swiz.Nm xprt_unregister
72df25ca45Swiz.Nd library routines for remote procedure calls
73df25ca45Swiz.Sh SYNOPSIS
74df25ca45Swiz.In rpc/rpc.h
75df25ca45Swiz.Ft void
76df25ca45Swiz.Fn auth_destroy "AUTH *auth"
77df25ca45Swiz.Ft AUTH *
78df25ca45Swiz.Fn authnone_create "void"
79df25ca45Swiz.Ft AUTH *
80df25ca45Swiz.Fn authunix_create "char *host" "int uid" "int gid" "int len" "int *aup_gids"
81df25ca45Swiz.Ft AUTH *
82df25ca45Swiz.Fn authunix_create_default "void"
83df25ca45Swiz.Ft int
8442d8f555Swiz.Fn callrpc "char *host" "int prognum" "int versnum" \
8542d8f555Swiz"int procnum" "xdrproc_t inproc" "char *in" "xdrproc_t outproc" "char *out"
86df25ca45Swiz.Ft enum clnt_stat
87df25ca45Swiz.Fn clnt_broadcast "u_long prognum" "u_long versnum" "u_long procnum" \
88df25ca45Swiz"xdrproc_t inproc" "char *in" "xdrproc_t outproc" "char *out" \
89df25ca45Swiz"resultproc_t eachresult"
90df25ca45Swiz.Ft enum clnt_stat
91df25ca45Swiz.Fn clnt_call "CLIENT *clnt" "u_long procnum" "xdrproc_t inproc" \
92df25ca45Swiz"char *in" "xdrproc_t outproc" "char *out" "struct timeval tout"
93df25ca45Swiz.Ft int
94df25ca45Swiz.Fn clnt_destroy "CLIENT *clnt"
95df25ca45Swiz.Ft CLIENT *
9642d8f555Swiz.Fn clnt_create "const char *host" "rpcprog_t prog" "rpcvers_t vers" "const char *proto"
97df25ca45Swiz.Ft bool_t
98df25ca45Swiz.Fn clnt_control "CLIENT *cl" "u_int req" "char *info"
99df25ca45Swiz.Ft int
100df25ca45Swiz.Fn clnt_freeres "CLIENT *clnt" "xdrproc_t outproc" "char *out"
101df25ca45Swiz.Ft void
102df25ca45Swiz.Fn clnt_geterr "CLIENT *clnt" "struct rpc_err errp"
103df25ca45Swiz.Ft void
10442d8f555Swiz.Fn clnt_pcreateerror "const char *s"
105df25ca45Swiz.Ft void
106df25ca45Swiz.Fn clnt_perrno "enum clnt_stat stat"
10742d8f555Swiz.Ft void
10842d8f555Swiz.Fn clnt_perror "CLIENT *clnt" "const char *s"
109df25ca45Swiz.Ft char *
110df25ca45Swiz.Fn clnt_spcreateerror "const char *s"
111df25ca45Swiz.Ft char *
112df25ca45Swiz.Fn clnt_sperrno "enum clnt_stat stat"
113df25ca45Swiz.Ft char *
11442d8f555Swiz.Fn clnt_sperror "CLIENT *rpch" "const char *s"
115df25ca45Swiz.Ft CLIENT *
116df25ca45Swiz.Fn clntraw_create "u_long prognum" "u_long versnum"
117df25ca45Swiz.Ft CLIENT *
118df25ca45Swiz.Fn clnttcp_create "struct sockaddr_in *addr" "u_long prognum" \
119df25ca45Swiz"u_long versnum" "int *sockp" "u_int sendsz" "u_int recvsz"
120df25ca45Swiz.Ft CLIENT *
121df25ca45Swiz.Fn clntudp_create "struct sockaddr_in *addr" "u_long prognum" \
122df25ca45Swiz"u_long versnum" "struct timeval wait" "int *sockp"
123df25ca45Swiz.Ft CLIENT *
124df25ca45Swiz.Fn clntudp_bufcreate "struct sockaddr_in *addr" "u_long prognum" \
125df25ca45Swiz"u_long versnum" "struct timeval wait" "int *sockp" \
126df25ca45Swiz"unsigned int sendsize" "unsigned int recosize"
127df25ca45Swiz.Ft int
128df25ca45Swiz.Fn get_myaddress "struct sockaddr_in *addr"
129df25ca45Swiz.Ft struct pmaplist *
130df25ca45Swiz.Fn pmap_getmaps "struct sockaddr_in *addr"
131df25ca45Swiz.Ft u_short
132df25ca45Swiz.Fn pmap_getport "struct sockaddr_in *addr" "u_long prognum" \
13342d8f555Swiz"u_long versnum" "u_int protocol"
134df25ca45Swiz.Ft enum clnt_stat
135df25ca45Swiz.Fo pmap_rmtcall
136df25ca45Swiz.Fa "struct sockaddr_in *addr"
137df25ca45Swiz.Fa "u_long prognum"
138df25ca45Swiz.Fa "u_long versnum"
139df25ca45Swiz.Fa "u_long procnum"
140df25ca45Swiz.Fa "xdrproc_t inproc"
141df25ca45Swiz.Fa "char *in"
14242d8f555Swiz.Fa "xdrproc_t outproc"
143df25ca45Swiz.Fa "char *out"
144df25ca45Swiz.Fa "struct timeval tout"
145df25ca45Swiz.Fa "u_long *portp"
146df25ca45Swiz.Fc
147df25ca45Swiz.Ft int
148df25ca45Swiz.Fn pmap_set "u_long prognum" "u_long versnum" "int protocol" \
149df25ca45Swiz"int port"
150df25ca45Swiz.Ft int
151df25ca45Swiz.Fn pmap_unset "u_long prognum" "u_long versnum"
152df25ca45Swiz.Ft int
15342d8f555Swiz.Fn registerrpc "int prognum" "int versnum" "int procnum" \
154df25ca45Swiz"char *(*procname)()" "xdrproc_t inproc" "xdrproc_t outproc"
155df25ca45Swiz.Fd struct rpc_createerr rpc_createerr;
156df25ca45Swiz.Ft int
157df25ca45Swiz.Fn svc_destroy "SVCXPRT *xprt"
158df25ca45Swiz.Fd fd_set svc_fdset;
159df25ca45Swiz.Fd int svc_fds;
160df25ca45Swiz.Ft int
161df25ca45Swiz.Fn svc_freeargs "SVCXPRT *xprt" "xdrproc_t inproc" "char *in"
162df25ca45Swiz.Ft int
163df25ca45Swiz.Fn svc_getargs "SVCXPRT *xprt" "xdrproc_t inproc" "char *in"
164df25ca45Swiz.Ft struct sockaddr_in *
165df25ca45Swiz.Fn svc_getcaller "SVCXPRT *xprt"
16642d8f555Swiz.Ft void
167df25ca45Swiz.Fn svc_getreqset "fd_set *rdfds"
16842d8f555Swiz.Ft void
169df25ca45Swiz.Fn svc_getreq "int rdfds"
17047b2a921Schristos.Ft struct netbuf *
17147b2a921Schristos.Fn svc_getrpccaller "SVCXPRT *xprt"
17242d8f555Swiz.Ft bool_t
173df25ca45Swiz.Fn svc_register "SVCXPRT *xprt" "u_long prognum" "u_long versnum" \
17442d8f555Swiz"void (*dispatch)()" "int protocol"
17542d8f555Swiz.Ft void
176df25ca45Swiz.Fn svc_run "void"
17742d8f555Swiz.Ft bool_t
17842d8f555Swiz.Fn svc_sendreply "SVCXPRT *xprt" "xdrproc_t xdr_results" "const char *location"
179df25ca45Swiz.Ft void
180df25ca45Swiz.Fn svc_unregister "u_long prognum" "u_long versnum"
181df25ca45Swiz.Ft void
182df25ca45Swiz.Fn svcerr_auth "SVCXPRT *xprt" "enum auth_stat why"
183df25ca45Swiz.Ft void
184df25ca45Swiz.Fn svcerr_decode "SVCXPRT *xprt"
185df25ca45Swiz.Ft void
186df25ca45Swiz.Fn svcerr_noproc "SVCXPRT *xprt"
187df25ca45Swiz.Ft void
188df25ca45Swiz.Fn svcerr_noprog "SVCXPRT *xprt"
189df25ca45Swiz.Ft void
19042d8f555Swiz.Fn svcerr_progvers "SVCXPRT *xprt" "rpcvers_t low_vers" "rpcvers_t high_vers"
191df25ca45Swiz.Ft void
192df25ca45Swiz.Fn svcerr_systemerr "SVCXPRT *xprt"
193df25ca45Swiz.Ft void
194df25ca45Swiz.Fn svcerr_weakauth "SVCXPRT *xprt"
195df25ca45Swiz.Ft SVCXPRT *
196df25ca45Swiz.Fn svcraw_create "void"
197df25ca45Swiz.Ft SVCXPRT *
198df25ca45Swiz.Fn svctcp_create "int sock" "u_int send_buf_size" \
199df25ca45Swiz"u_int recv_buf_size"
200df25ca45Swiz.Ft SVCXPRT *
201df25ca45Swiz.Fn svcfd_create "int fd" "u_int sendsize" "u_int recvsize"
202df25ca45Swiz.Ft SVCXPRT *
203df25ca45Swiz.Fn svcudp_bufcreate "int sock" "u_int sendsize" "u_int recosize"
204aff92072Slukem.Ft SVCXPRT *
205aff92072Slukem.Fn svcudp_create "int sock"
206df25ca45Swiz.Ft int
207df25ca45Swiz.Fn xdr_accepted_reply "XDR *xdrs" "struct accepted_reply *ar"
208df25ca45Swiz.Ft int
209df25ca45Swiz.Fn xdr_authunix_parms "XDR *xdrs" "struct authunix_parms *aupp"
21042d8f555Swiz.Ft bool_t
211df25ca45Swiz.Fn xdr_callhdr "XDR *xdrs" "struct rpc_msg *chdr"
212df25ca45Swiz.Ft int
213df25ca45Swiz.Fn xdr_callmsg "XDR *xdrs" "struct rpc_msg *cmsg"
214df25ca45Swiz.Ft int
215df25ca45Swiz.Fn xdr_opaque_auth "XDR *xdrs" "struct opaque_auth *ap"
216df25ca45Swiz.Ft int
217df25ca45Swiz.Fn xdr_pmap "XDR *xdrs" "struct pmap *regs"
218df25ca45Swiz.Ft int
219df25ca45Swiz.Fn xdr_pmaplist "XDR *xdrs" "struct pmaplist **rp"
220df25ca45Swiz.Ft int
221df25ca45Swiz.Fn xdr_rejected_reply "XDR *xdrs" "struct rejected_reply *rr"
222df25ca45Swiz.Ft int
223df25ca45Swiz.Fn xdr_replymsg "XDR *xdrs" "struct rpc_msg *rmsg"
2244ce5b0bdSchristos.Ft bool_t
225df25ca45Swiz.Fn xprt_register "SVCXPRT *xprt"
226df25ca45Swiz.Ft void
227df25ca45Swiz.Fn xprt_unregister "SVCXPRT *xprt"
228df25ca45Swiz.Sh DESCRIPTION
229df25ca45Swiz.Em "The svc and clnt functions described in this page are the old, TS-RPC"
230df25ca45Swiz.Em "interface to the XDR and RPC library, and exist for backward compatibility."
231df25ca45Swiz.Em "The new interface is described in the pages referenced from"
232df25ca45Swiz.Xr rpc 3 .
233df25ca45Swiz.Pp
2347df0ccbaSfvdlThese routines allow C programs to make procedure
2357df0ccbaSfvdlcalls on other machines across the network.
2367df0ccbaSfvdlFirst, the client calls a procedure to send a
2377df0ccbaSfvdldata packet to the server.
2387df0ccbaSfvdlUpon receipt of the packet, the server calls a dispatch routine
2397df0ccbaSfvdlto perform the requested service, and then sends back a
2407df0ccbaSfvdlreply.
2417df0ccbaSfvdlFinally, the procedure call returns to the client.
2427df0ccbaSfvdl.\" XXX: NOTYET
243df25ca45Swiz.\".Pp
2447df0ccbaSfvdl.\"Routines that are used for Secure RPC (DES authentication) are described in
245df25ca45Swiz.\".Xr rpc_secure 3 .
2467df0ccbaSfvdl.\"Secure RPC can be used only if DES encryption is available.
247df25ca45Swiz.Pp
248df25ca45Swiz.Bl -tag -width xxx
249df25ca45Swiz.It Fn auth_destroy
2507df0ccbaSfvdlA macro that destroys the authentication information associated with
251df25ca45Swiz.Fa auth .
2526569c5c5SwizDestruction usually involves deallocation of private data structures.
2536569c5c5SwizThe use of
254df25ca45Swiz.Fa auth
2557df0ccbaSfvdlis undefined after calling
256df25ca45Swiz.Fn auth_destroy .
257df25ca45Swiz.It Fn authnone_create
258df25ca45SwizCreate and returns an RPC authentication handle that passes nonusable
259df25ca45Swizauthentication information with each remote procedure call.
260df25ca45SwizThis is the default authentication used by RPC.
261df25ca45Swiz.It Fn authunix_create
262df25ca45SwizCreate and return an RPC authentication handle that contains
263df25ca45Swiz.\" XXX: .UX ?
2647df0ccbaSfvdlauthentication information.
2657df0ccbaSfvdlThe parameter
266df25ca45Swiz.Fa host
2677df0ccbaSfvdlis the name of the machine on which the information was
2687df0ccbaSfvdlcreated;
269df25ca45Swiz.Fa uid
270df25ca45Swizis the user's user ID;
271df25ca45Swiz.Fa gid
272df25ca45Swizis the user's current group id;
273df25ca45Swiz.Fa len
2747df0ccbaSfvdland
275df25ca45Swiz.Fa aup_gids
2767df0ccbaSfvdlrefer to a counted array of groups to which the user belongs.
2777df0ccbaSfvdlIt is easy to impersonate a user.
278df25ca45Swiz.It Fn authunix_create_default
2797df0ccbaSfvdlCalls
280df25ca45Swiz.Fn authunix_create
2817df0ccbaSfvdlwith the appropriate parameters.
282df25ca45Swiz.It Fn callrpc
2837df0ccbaSfvdlCall the remote procedure associated with
284df25ca45Swiz.Fa prognum ,
285df25ca45Swiz.Fa versnum ,
2867df0ccbaSfvdland
287df25ca45Swiz.Fa procnum
2887df0ccbaSfvdlon the machine,
289df25ca45Swiz.Fa host .
2907df0ccbaSfvdlThe parameter
291df25ca45Swiz.Fa in
2927df0ccbaSfvdlis the address of the procedure's argument(s), and
293df25ca45Swiz.Fa out
2947df0ccbaSfvdlis the address of where to place the result(s);
295df25ca45Swiz.Fa inproc
2967df0ccbaSfvdlis used to encode the procedure's parameters, and
297df25ca45Swiz.Fa outproc
2987df0ccbaSfvdlis used to decode the procedure's results.
2997df0ccbaSfvdlThis routine returns zero if it succeeds, or the value of
300df25ca45Swiz.Va "enum clnt_stat"
3017df0ccbaSfvdlcast to an integer if it fails.
3027df0ccbaSfvdlThe routine
303df25ca45Swiz.Fn clnt_perrno
3047df0ccbaSfvdlis handy for translating failure statuses into messages.
305df25ca45Swiz.Pp
3067df0ccbaSfvdlWarning: calling remote procedures with this routine
307df25ca45Swizuses UDP/IP as a transport; see
308df25ca45Swiz.Fn clntudp_create
3097df0ccbaSfvdlfor restrictions.
3107df0ccbaSfvdlYou do not have control of timeouts or authentication using
3117df0ccbaSfvdlthis routine.
312df25ca45Swiz.It Fn clnt_broadcast
3137df0ccbaSfvdlLike
314df25ca45Swiz.Fn callrpc ,
3157df0ccbaSfvdlexcept the call message is broadcast to all locally
3166569c5c5Swizconnected broadcast nets.
3176569c5c5SwizEach time it receives a response, this routine calls
318df25ca45Swiz.Fn eachresult ,
319df25ca45Swizwhose form is
320df25ca45Swiz.Ft int
321df25ca45Swiz.Fn eachresult "char *out" "struct sockaddr_in *addr"
3227df0ccbaSfvdlwhere
323df25ca45Swiz.Fa out
3247df0ccbaSfvdlis the same as
325df25ca45Swiz.Fa out
3267df0ccbaSfvdlpassed to
327df25ca45Swiz.Fn clnt_broadcast ,
3287df0ccbaSfvdlexcept that the remote procedure's output is decoded there;
329df25ca45Swiz.Fa addr
3307df0ccbaSfvdlpoints to the address of the machine that sent the results.
3317df0ccbaSfvdlIf
332df25ca45Swiz.Fn eachresult
3337df0ccbaSfvdlreturns zero,
334df25ca45Swiz.Fn clnt_broadcast
3357df0ccbaSfvdlwaits for more replies; otherwise it returns with appropriate
3367df0ccbaSfvdlstatus.
337df25ca45Swiz.Pp
3387df0ccbaSfvdlWarning: broadcast sockets are limited in size to the
3396569c5c5Swizmaximum transfer unit of the data link.
3406569c5c5SwizFor ethernet, this value is 1500 bytes.
341df25ca45Swiz.It Fn clnt_call
3427df0ccbaSfvdlA macro that calls the remote procedure
343df25ca45Swiz.Fa procnum
3447df0ccbaSfvdlassociated with the client handle,
345df25ca45Swiz.Fa clnt ,
346df25ca45Swizwhich is obtained with an RPC client creation routine such as
347df25ca45Swiz.Fn clnt_create .
3487df0ccbaSfvdlThe parameter
349df25ca45Swiz.Fa in
3507df0ccbaSfvdlis the address of the procedure's argument(s), and
351df25ca45Swiz.Fa out
3527df0ccbaSfvdlis the address of where to place the result(s);
353df25ca45Swiz.Fa inproc
3547df0ccbaSfvdlis used to encode the procedure's parameters, and
355df25ca45Swiz.Fa outproc
3567df0ccbaSfvdlis used to decode the procedure's results;
357df25ca45Swiz.Fa tout
3587df0ccbaSfvdlis the time allowed for results to come back.
359df25ca45Swiz.It Fn clnt_destroy
360df25ca45SwizA macro that destroys the client's RPC handle.
3616569c5c5SwizDestruction usually involves deallocation
3627df0ccbaSfvdlof private data structures, including
363df25ca45Swiz.Fa clnt
3646569c5c5Swizitself.
3656569c5c5SwizUse of
366df25ca45Swiz.Fa clnt
3677df0ccbaSfvdlis undefined after calling
368df25ca45Swiz.Fn clnt_destroy .
369df25ca45SwizIf the RPC library opened the associated socket, it will close it
370df25ca45Swizalso.
3717df0ccbaSfvdlOtherwise, the socket remains open.
372df25ca45Swiz.It Fn clnt_create
3737df0ccbaSfvdlGeneric client creation routine.
374df25ca45Swiz.Fa host
3757df0ccbaSfvdlidentifies the name of the remote host where the server
3767df0ccbaSfvdlis located.
377df25ca45Swiz.Fa proto
3786569c5c5Swizindicates which kind of transport protocol to use.
379df25ca45SwizThe currently supported values for this field are
380df25ca45Swiz.Dq udp
381df25ca45Swizand
382df25ca45Swiz.Dq tcp .
3837df0ccbaSfvdlDefault timeouts are set, but can be modified using
384df25ca45Swiz.Fn clnt_control .
385df25ca45Swiz.Pp
386df25ca45Swiz.Em Warning :
387df25ca45SwizUsing UDP has its shortcomings.
388df25ca45SwizSince UDP-based RPC messages can only hold up to 8 Kbytes of encoded
389df25ca45Swizdata, this transport cannot be used for procedures that take
3907df0ccbaSfvdllarge arguments or return huge results.
3916f235494Swiz.It Fn clnt_control
3927df0ccbaSfvdlA macro used to change or retrieve various information
3937df0ccbaSfvdlabout a client object.
394df25ca45Swiz.Fa req
3957df0ccbaSfvdlindicates the type of operation, and
396df25ca45Swiz.Fa info
3976569c5c5Swizis a pointer to the information.
398df25ca45SwizFor both UDP and TCP the supported values of
399df25ca45Swiz.Fa req
4007df0ccbaSfvdland their argument types and what they do are:
401df25ca45Swiz.Bl -tag -width CLSET_RETRY_TIMEOUTX
402df25ca45Swiz.It CLSET_TIMEOUT
403df25ca45Swiz.Vt struct timeval ;
404df25ca45Swizset total timeout.
405df25ca45Swiz.It CLGET_TIMEOUT
406df25ca45Swiz.Vt struct timeval ;
407df25ca45Swizget total timeout.
408df25ca45Swiz.Pp
4097df0ccbaSfvdlNote: if you set the timeout using
410df25ca45Swiz.Fn clnt_control ,
4117df0ccbaSfvdlthe timeout parameter passed to
412df25ca45Swiz.Fn clnt_call
4137df0ccbaSfvdlwill be ignored in all future calls.
414df25ca45Swiz.It CLGET_SERVER_ADDR
415df25ca45Swiz.Vt struct sockaddr_in ;
416df25ca45Swizget server's address.
417df25ca45Swiz.El
418df25ca45Swiz.Pp
419df25ca45SwizThe following operations are valid for UDP only:
420df25ca45Swiz.Bl -tag -width CLSET_RETRY_TIMEOUT
421df25ca45Swiz.It CLSET_RETRY_TIMEOUT
422df25ca45Swiz.Vt struct timeval ;
423df25ca45Swizset the retry timeout.
424df25ca45Swiz.It CLGET_RETRY_TIMEOUT
425df25ca45Swiz.Vt struct timeval ;
426df25ca45Swizget the retry timeout.
427df25ca45Swiz.Pp
428df25ca45SwizThe retry timeout is the time that UDP RPC waits for the server to
429df25ca45Swizreply before retransmitting the request.
430df25ca45Swiz.El
431df25ca45Swiz.It Fn clnt_freeres
432df25ca45SwizA macro that frees any data allocated by the RPC/XDR system when it
433df25ca45Swizdecoded the results of an RPC call.
4346569c5c5SwizThe parameter
435df25ca45Swiz.Fa out
4367df0ccbaSfvdlis the address of the results, and
437df25ca45Swiz.Fa outproc
438df25ca45Swizis the XDR routine describing the results.
439df25ca45SwizThis routine returns one if the results were successfully freed,
4407df0ccbaSfvdland zero otherwise.
441df25ca45Swiz.It Fn clnt_geterr
4427df0ccbaSfvdlA macro that copies the error structure out of the client
443df25ca45Swizhandle to the structure at address
444df25ca45Swiz.Fa errp .
445df25ca45Swiz.It Fn clnt_pcreateerror
446df25ca45SwizPrint a message to standard error indicating why a client RPC handle
447df25ca45Swizcould not be created.
4487df0ccbaSfvdlThe message is prepended with string
449df25ca45Swiz.Fa s
4507df0ccbaSfvdland a colon.
451df25ca45SwizA newline character is appended at the end of the message.
4527df0ccbaSfvdlUsed when a
453df25ca45Swiz.Fn clnt_create ,
454df25ca45Swiz.Fn clntraw_create ,
455df25ca45Swiz.Fn clnttcp_create ,
4567df0ccbaSfvdlor
457df25ca45Swiz.Fn clntudp_create
4587df0ccbaSfvdlcall fails.
459df25ca45Swiz.It Fn clnt_perrno
4607df0ccbaSfvdlPrint a message to standard error corresponding
4617df0ccbaSfvdlto the condition indicated by
462df25ca45Swiz.Fa stat .
463df25ca45SwizA newline character is appended at the end of the message.
4647df0ccbaSfvdlUsed after
465df25ca45Swiz.Fn callrpc .
466df25ca45Swiz.It Fn clnt_perror
467df25ca45SwizPrint a message to standard error indicating why an RPC call failed;
468df25ca45Swiz.Fa clnt
4697df0ccbaSfvdlis the handle used to do the call.
4707df0ccbaSfvdlThe message is prepended with string
471df25ca45Swiz.Fa s
4727df0ccbaSfvdland a colon.
473df25ca45SwizA newline character is appended at the end of the message.
4747df0ccbaSfvdlUsed after
475df25ca45Swiz.Fn clnt_call .
476df25ca45Swiz.It Fn clnt_spcreateerror
4777df0ccbaSfvdlLike
478df25ca45Swiz.Fn clnt_pcreateerror ,
4797df0ccbaSfvdlexcept that it returns a string
4807df0ccbaSfvdlinstead of printing to the standard error.
481df25ca45Swiz.Pp
4827df0ccbaSfvdlBugs: returns pointer to static data that is overwritten
4837df0ccbaSfvdlon each call.
484df25ca45Swiz.It Fn clnt_sperrno
4857df0ccbaSfvdlTake the same arguments as
486df25ca45Swiz.Fn clnt_perrno ,
4877df0ccbaSfvdlbut instead of sending a message to the standard error
488df25ca45Swizindicating why an RPC call failed, return a pointer to a string which
489df25ca45Swizcontains the message.
490df25ca45Swiz.Pp
491df25ca45Swiz.Fn clnt_sperrno
4927df0ccbaSfvdlis used instead of
493df25ca45Swiz.Fn clnt_perrno
4947df0ccbaSfvdlif the program does not have a standard error (as a program
4957df0ccbaSfvdlrunning as a server quite likely does not), or if the
496df25ca45Swizprogrammer does not want the message to be output with
497df25ca45Swiz.Xr printf 3 ,
4987df0ccbaSfvdlor if a message format different than that supported by
499df25ca45Swiz.Fn clnt_perrno
5007df0ccbaSfvdlis to be used.
5017df0ccbaSfvdlNote: unlike
502df25ca45Swiz.Fn clnt_sperror
5037df0ccbaSfvdland
504df25ca45Swiz.Fn clnt_spcreateerror ,
505df25ca45Swiz.Fn clnt_sperrno
506df25ca45Swizreturns a pointer to static data, but the
5077df0ccbaSfvdlresult will not get overwritten on each call.
508df25ca45Swiz.It Fn clnt_sperror
5097df0ccbaSfvdlLike
510df25ca45Swiz.Fn clnt_perror ,
5117df0ccbaSfvdlexcept that (like
512df25ca45Swiz.Fn clnt_sperrno )
5137df0ccbaSfvdlit returns a string instead of printing to standard error.
514df25ca45Swiz.Pp
5157df0ccbaSfvdlBugs: returns pointer to static data that is overwritten
5167df0ccbaSfvdlon each call.
517df25ca45Swiz.It Fn clntraw_create
518df25ca45SwizThis routine creates a toy RPC client for the remote program
519df25ca45Swiz.Fa prognum ,
5207df0ccbaSfvdlversion
521df25ca45Swiz.Fa versnum .
5227df0ccbaSfvdlThe transport used to pass messages to the service is
5237df0ccbaSfvdlactually a buffer within the process's address space, so the
524df25ca45Swizcorresponding RPC server should live in the same address space; see
525df25ca45Swiz.Fn svcraw_create .
526df25ca45SwizThis allows simulation of RPC and acquisition of RPC overheads, such
527df25ca45Swizas round trip times, without any kernel interference.
5286569c5c5SwizThis routine returns
529df25ca45Swiz.Dv NULL
5307df0ccbaSfvdlif it fails.
531df25ca45Swiz.It Fn clnttcp_create
532df25ca45SwizThis routine creates an RPC client for the remote program
533df25ca45Swiz.Fa prognum ,
5347df0ccbaSfvdlversion
535df25ca45Swiz.Fa versnum ;
536df25ca45Swizthe client uses TCP/IP as a transport.
5376569c5c5SwizThe remote program is located at Internet address
538df25ca45Swiz.Fa *addr .
5397df0ccbaSfvdlIf
540*01869ca4Swiz.Fa addr->sin_port
5417df0ccbaSfvdlis zero, then it is set to the actual port that the remote
5427df0ccbaSfvdlprogram is listening on (the remote
543df25ca45Swiz.Xr rpcbind 8
544df25ca45Swizor
545df25ca45Swiz.Cm portmap
5466569c5c5Swizservice is consulted for this information).
5476569c5c5SwizThe parameter
548df25ca45Swiz.Fa sockp
5497df0ccbaSfvdlis a socket; if it is
550df25ca45Swiz.Dv RPC_ANYSOCK ,
5517df0ccbaSfvdlthen this routine opens a new one and sets
552df25ca45Swiz.Fa sockp .
553df25ca45SwizSince TCP-based RPC uses buffered I/O ,
5547df0ccbaSfvdlthe user may specify the size of the send and receive buffers
5557df0ccbaSfvdlwith the parameters
556df25ca45Swiz.Fa sendsz
5577df0ccbaSfvdland
558df25ca45Swiz.Fa recvsz ;
5597df0ccbaSfvdlvalues of zero choose suitable defaults.
5607df0ccbaSfvdlThis routine returns
561df25ca45Swiz.Dv NULL
5627df0ccbaSfvdlif it fails.
563df25ca45Swiz.It Fn clntudp_create
564df25ca45SwizThis routine creates an RPC client for the remote program
565df25ca45Swiz.Fa prognum ,
5667df0ccbaSfvdlversion
567df25ca45Swiz.Fa versnum ;
568df25ca45Swizthe client uses UDP/IP as a transport.
5696569c5c5SwizThe remote program is located at Internet address
570df25ca45Swiz.Fa addr .
5717df0ccbaSfvdlIf
572*01869ca4Swiz.Fa addr->sin_port
5737df0ccbaSfvdlis zero, then it is set to actual port that the remote
5747df0ccbaSfvdlprogram is listening on (the remote
575df25ca45Swiz.Xr rpcbind 8
576df25ca45Swizor
577df25ca45Swiz.Cm portmap
5786569c5c5Swizservice is consulted for this information).
5796569c5c5SwizThe parameter
580df25ca45Swiz.Fa sockp
5817df0ccbaSfvdlis a socket; if it is
582df25ca45Swiz.Dv RPC_ANYSOCK ,
5837df0ccbaSfvdlthen this routine opens a new one and sets
584df25ca45Swiz.Fa sockp .
585df25ca45SwizThe UDP transport resends the call message in intervals of
586df25ca45Swiz.Fa wait
5876569c5c5Swiztime until a response is received or until the call times out.
5887df0ccbaSfvdlThe total time for the call to time out is specified by
589df25ca45Swiz.Fa clnt_call .
590df25ca45Swiz.Pp
591df25ca45SwizWarning: since UDP-based RPC messages can only hold up to 8 Kbytes
5927df0ccbaSfvdlof encoded data, this transport cannot be used for procedures
5937df0ccbaSfvdlthat take large arguments or return huge results.
594df25ca45Swiz.It Fn clntudp_bufcreate
595df25ca45SwizThis routine creates an RPC client for the remote program
596df25ca45Swiz.Fa prognum ,
5977df0ccbaSfvdlon
598df25ca45Swiz.Fa versnum ;
599df25ca45Swizthe client uses UDP/IP as a transport.
6006569c5c5SwizThe remote program is located at Internet address
601df25ca45Swiz.Fa addr .
6027df0ccbaSfvdlIf
603*01869ca4Swiz.Fa addr->sin_port
6047df0ccbaSfvdlis zero, then it is set to actual port that the remote
6057df0ccbaSfvdlprogram is listening on (the remote
606df25ca45Swiz.Xr rpcbind 8
607df25ca45Swizor
608df25ca45Swiz.Cm portmap
6096569c5c5Swizservice is consulted for this information).
6106569c5c5SwizThe parameter
611df25ca45Swiz.Fa sockp
6127df0ccbaSfvdlis a socket; if it is
613df25ca45Swiz.Dv RPC_ANYSOCK ,
6147df0ccbaSfvdlthen this routine opens a new one and sets
615df25ca45Swiz.Fa sockp .
616df25ca45SwizThe UDP transport resends the call message in intervals of
617df25ca45Swiz.Fa wait
6186569c5c5Swiztime until a response is received or until the call times out.
6197df0ccbaSfvdlThe total time for the call to time out is specified by
620df25ca45Swiz.Fa clnt_call .
621df25ca45Swiz.Pp
6227df0ccbaSfvdlThis allows the user to specify the maximum packet size for sending and
623df25ca45Swizreceiving UDP-based RPC messages.
624df25ca45Swiz.It Fn get_myaddress
625df25ca45SwizStuff the machine's IP address into
626df25ca45Swiz.Fa *addr ,
6277df0ccbaSfvdlwithout consulting the library routines that deal with
628df25ca45Swiz.Pa /etc/hosts .
6297df0ccbaSfvdlThe port number is always set to
630df25ca45Swiz.Fn htons "PMAPPORT" .
6317df0ccbaSfvdlReturns zero on success, non-zero on failure.
632df25ca45Swiz.It Fn pmap_getmaps
6337df0ccbaSfvdlA user interface to the
634df25ca45Swiz.Xr rpcbind 8
635df25ca45Swizservice, which returns a list of the current RPC program-to-port
636df25ca45Swizmappings on the host located at IP address
637df25ca45Swiz.Fa *addr .
6387df0ccbaSfvdlThis routine can return
639df25ca45Swiz.Dv NULL .
6407df0ccbaSfvdlThe command
641df25ca45Swiz.Dl Cm rpcinfo Fl p
6427df0ccbaSfvdluses this routine.
643df25ca45Swiz.It Fn pmap_getport
6447df0ccbaSfvdlA user interface to the
645df25ca45Swiz.Xr rpcbind 8
6467df0ccbaSfvdlservice, which returns the port number
6477df0ccbaSfvdlon which waits a service that supports program number
648df25ca45Swiz.Fa prognum ,
6497df0ccbaSfvdlversion
650df25ca45Swiz.Fa versnum ,
6517df0ccbaSfvdland speaks the transport protocol associated with
652df25ca45Swiz.Fa protocol .
6537df0ccbaSfvdlThe value of
654df25ca45Swiz.Fa protocol
6557df0ccbaSfvdlis most likely
656df25ca45Swiz.Dv IPPROTO_UDP
6577df0ccbaSfvdlor
658df25ca45Swiz.Dv IPPROTO_TCP .
6597df0ccbaSfvdlA return value of zero means that the mapping does not exist
660df25ca45Swizor that the RPC system failured to contact the remote
661df25ca45Swiz.Xr rpcbind 8
6626569c5c5Swizservice.
6636569c5c5SwizIn the latter case, the global variable
664df25ca45Swiz.Fn rpc_createerr
665df25ca45Swizcontains the RPC status.
666df25ca45Swiz.It Fn pmap_rmtcall
6677df0ccbaSfvdlA user interface to the
668df25ca45Swiz.Xr rpcbind 8
6697df0ccbaSfvdlservice, which instructs
670df25ca45Swiz.Xr rpcbind 8
671df25ca45Swizon the host at IP address
672df25ca45Swiz.Fa *addr
673df25ca45Swizto make an RPC call on your behalf to a procedure on that host.
6747df0ccbaSfvdlThe parameter
675df25ca45Swiz.Fa *portp
6767df0ccbaSfvdlwill be modified to the program's port number if the
6776569c5c5Swizprocedure succeeds.
6786569c5c5SwizThe definitions of other parameters are discussed in
679df25ca45Swiz.Fn callrpc
6807df0ccbaSfvdland
681df25ca45Swiz.Fn clnt_call .
682df25ca45SwizThis procedure should be used for a
683df25ca45Swiz.Dq ping
684df25ca45Swizand nothing else.
6857df0ccbaSfvdlSee also
686df25ca45Swiz.Fn clnt_broadcast .
687df25ca45Swiz.It Fn pmap_set
6887df0ccbaSfvdlA user interface to the
689df25ca45Swiz.Xr rpcbind 8
6907df0ccbaSfvdlservice, which establishes a mapping between the triple
691df25ca45Swiz.Fa [ prognum ,
692df25ca45Swiz.Fa versnum ,
693df25ca45Swiz.Fa protocol ]
6947df0ccbaSfvdland
695df25ca45Swiz.Fa port
6967df0ccbaSfvdlon the machine's
697df25ca45Swiz.Xr rpcbind 8
6986569c5c5Swizservice.
6996569c5c5SwizThe value of
700df25ca45Swiz.Fa protocol
7017df0ccbaSfvdlis most likely
702df25ca45Swiz.Dv IPPROTO_UDP
7037df0ccbaSfvdlor
704df25ca45Swiz.Dv IPPROTO_TCP .
7057df0ccbaSfvdlThis routine returns one if it succeeds, zero otherwise.
7067df0ccbaSfvdlAutomatically done by
707df25ca45Swiz.Fn svc_register .
708df25ca45Swiz.It Fn pmap_unset
7097df0ccbaSfvdlA user interface to the
710df25ca45Swiz.Xr rpcbind 8
7117df0ccbaSfvdlservice, which destroys all mapping between the triple
712df25ca45Swiz.Fa [ prognum ,
713df25ca45Swiz.Fa versnum ,
714df25ca45Swiz.Fa * ]
7157df0ccbaSfvdland
716df25ca45Swiz.Fa ports
7177df0ccbaSfvdlon the machine's
718df25ca45Swiz.Xr rpcbind 8
7196569c5c5Swizservice.
7206569c5c5SwizThis routine returns one if it succeeds, zero otherwise.
721df25ca45Swiz.It Fn registerrpc
7227df0ccbaSfvdlRegister procedure
723df25ca45Swiz.Fa procname
724df25ca45Swizwith the RPC service package.
7256569c5c5SwizIf a request arrives for program
726df25ca45Swiz.Fa prognum ,
7277df0ccbaSfvdlversion
728df25ca45Swiz.Fa versnum ,
7297df0ccbaSfvdland procedure
730df25ca45Swiz.Fa procnum ,
731df25ca45Swiz.Fa procname
7327df0ccbaSfvdlis called with a pointer to its parameter(s);
733df25ca45Swiz.Fa progname
7347df0ccbaSfvdlshould return a pointer to its static result(s);
735df25ca45Swiz.Fa inproc
7367df0ccbaSfvdlis used to decode the parameters while
737df25ca45Swiz.Fa outproc
7387df0ccbaSfvdlis used to encode the results.
7397df0ccbaSfvdlThis routine returns zero if the registration succeeded, \-1
7407df0ccbaSfvdlotherwise.
741df25ca45Swiz.Pp
7427df0ccbaSfvdlWarning: remote procedures registered in this form
743df25ca45Swizare accessed using the UDP/IP transport; see
744aff92072Slukem.Fn svcudp_bufcreate
7457df0ccbaSfvdlfor restrictions.
746df25ca45Swiz.It struct rpc_createerr rpc_createerr ;
747df25ca45SwizA global variable whose value is set by any RPC
7486569c5c5Swizclient creation routine that does not succeed.
7496569c5c5SwizUse the routine
750df25ca45Swiz.Fn clnt_pcreateerror
7517df0ccbaSfvdlto print the reason why.
752df25ca45Swiz.It Fn svc_destroy
753df25ca45SwizA macro that destroys the RPC service transport handle,
754df25ca45Swiz.Fa xprt .
7557df0ccbaSfvdlDestruction usually involves deallocation
7567df0ccbaSfvdlof private data structures, including
757df25ca45Swiz.Fa xprt
7586569c5c5Swizitself.
7596569c5c5SwizUse of
760df25ca45Swiz.Fa xprt
7617df0ccbaSfvdlis undefined after calling this routine.
762df25ca45Swiz.It fd_set svc_fdset ;
763df25ca45SwizA global variable reflecting the RPC service side's read file
764df25ca45Swizdescriptor bit mask; it is suitable as a parameter to the
765df25ca45Swiz.Xr select 2
7666569c5c5Swizsystem call.
767df25ca45SwizThis is only of interest if a service implementor does not call
768df25ca45Swiz.Fn svc_run ,
7697df0ccbaSfvdlbut rather does his own asynchronous event processing.
7707df0ccbaSfvdlThis variable is read-only (do not pass its address to
771df25ca45Swiz.Xr select 2 ! ) ,
7727df0ccbaSfvdlyet it may change after calls to
773df25ca45Swiz.Fn svc_getreqset
7747df0ccbaSfvdlor any creation routines.
775df25ca45Swiz.It int svc_fds;
7767df0ccbaSfvdlSimilar to
777df25ca45Swiz.Fn svc_fedset ,
7786569c5c5Swizbut limited to 32 descriptors.
7796569c5c5SwizThis interface is obsoleted by
780df25ca45Swiz.Fn svc_fdset .
781df25ca45Swiz.It Fn svc_freeargs
782df25ca45SwizA macro that frees any data allocated by the RPC/XDR
7836569c5c5Swizsystem when it decoded the arguments to a service procedure using
784df25ca45Swiz.Fn svc_getargs .
7856569c5c5SwizThis routine returns 1 if the results were successfully freed,
7867df0ccbaSfvdland zero otherwise.
787df25ca45Swiz.It Fn svc_getargs
788df25ca45SwizA macro that decodes the arguments of an RPC request associated with
789df25ca45Swizthe RPC service transport handle,
790df25ca45Swiz.Fa xprt .
7917df0ccbaSfvdlThe parameter
792df25ca45Swiz.Fa in
7937df0ccbaSfvdlis the address where the arguments will be placed;
794df25ca45Swiz.Fa inproc
795df25ca45Swizis the XDR routine used to decode the arguments.
7966569c5c5SwizThis routine returns one if decoding succeeds, and zero otherwise.
797df25ca45Swiz.It Fn svc_getcaller
79847b2a921SchristosThe obsolete way of getting the network address of the caller
799df25ca45Swizof a procedure associated with the RPC service transport handle,
80047b2a921Schristos.Fa xprt ,
80147b2a921Schristosuse
80247b2a921Schristos.Fn svc_getrpccaller .
803df25ca45Swiz.It Fn svc_getreqset
8047df0ccbaSfvdlThis routine is only of interest if a service implementor
8057df0ccbaSfvdldoes not call
806df25ca45Swiz.Fn svc_run ,
8077df0ccbaSfvdlbut instead implements custom asynchronous event processing.
8087df0ccbaSfvdlIt is called when the
809df25ca45Swiz.Xr select 2
810df25ca45Swizsystem call has determined that an RPC request has arrived on some
811df25ca45SwizRPC socket(s) ;
812df25ca45Swiz.Fa rdfds
8137df0ccbaSfvdlis the resultant read file descriptor bit mask.
8147df0ccbaSfvdlThe routine returns when all sockets associated with the
8157df0ccbaSfvdlvalue of
816df25ca45Swiz.Fa rdfds
8177df0ccbaSfvdlhave been serviced.
818df25ca45Swiz.It Fn svc_getreq
8197df0ccbaSfvdlSimilar to
820df25ca45Swiz.Fn svc_getreqset ,
8216569c5c5Swizbut limited to 32 descriptors.
8226569c5c5SwizThis interface is obsoleted by
823df25ca45Swiz.Fn svc_getreqset .
82447b2a921Schristos.It Fn svc_getrpccaller
82547b2a921SchristosThe approved way of getting the network address of the caller
82647b2a921Schristosof a procedure associated with the RPC service transport handle,
82747b2a921Schristos.Fa xprt .
828df25ca45Swiz.It Fn svc_register
8297df0ccbaSfvdlAssociates
830df25ca45Swiz.Fa prognum
8317df0ccbaSfvdland
832df25ca45Swiz.Fa versnum
8337df0ccbaSfvdlwith the service dispatch procedure,
834df25ca45Swiz.Fa dispatch .
8357df0ccbaSfvdlIf
836df25ca45Swiz.Fa protocol
8377df0ccbaSfvdlis zero, the service is not registered with the
838df25ca45Swiz.Xr rpcbind 8
8396569c5c5Swizservice.
8406569c5c5SwizIf
841df25ca45Swiz.Fa protocol
8427df0ccbaSfvdlis non-zero, then a mapping of the triple
843df25ca45Swiz.Fa [ prognum ,
844df25ca45Swiz.Fa versnum ,
845df25ca45Swiz.Fa protocol ]
8467df0ccbaSfvdlto
847*01869ca4Swiz.Fa xprt->xp_port
8487df0ccbaSfvdlis established with the local
849df25ca45Swiz.Xr rpcbind 8
8507df0ccbaSfvdlservice (generally
851df25ca45Swiz.Fa protocol
8527df0ccbaSfvdlis zero,
853df25ca45Swiz.Dv IPPROTO_UDP
8547df0ccbaSfvdlor
855df25ca45Swiz.Dv IPPROTO_TCP ) .
8567df0ccbaSfvdlThe procedure
857df25ca45Swiz.Fa dispatch
8587df0ccbaSfvdlhas the following form:
859df25ca45Swiz.Ft int
860df25ca45Swiz.Fn dispatch "struct svc_req *request" "SVCXPRT *xprt" .
861df25ca45Swiz.Pp
8627df0ccbaSfvdlThe
863df25ca45Swiz.Fn svc_register
8647df0ccbaSfvdlroutine returns one if it succeeds, and zero otherwise.
865df25ca45Swiz.It Fn svc_run
8666569c5c5SwizThis routine never returns.
867df25ca45SwizIt waits for RPC requests to arrive, and calls the appropriate service
8687df0ccbaSfvdlprocedure using
869df25ca45Swiz.Fn svc_getreq
8706569c5c5Swizwhen one arrives.
8716569c5c5SwizThis procedure is usually waiting for a
872df25ca45Swiz.Xr select 2
8737df0ccbaSfvdlsystem call to return.
874df25ca45Swiz.It Fn svc_sendreply
875df25ca45SwizCalled by an RPC service's dispatch routine to send the results of a
8766569c5c5Swizremote procedure call.
8776569c5c5SwizThe parameter
878df25ca45Swiz.Fa xprt
8797df0ccbaSfvdlis the request's associated transport handle;
88042d8f555Swiz.Fa xdr_results
881df25ca45Swizis the XDR routine which is used to encode the results; and
88242d8f555Swiz.Fa xdr_location
8837df0ccbaSfvdlis the address of the results.
8847df0ccbaSfvdlThis routine returns one if it succeeds, zero otherwise.
885df25ca45Swiz.It Fn svc_unregister
8867df0ccbaSfvdlRemove all mapping of the double
887df25ca45Swiz.Fa [ prognum ,
888df25ca45Swiz.Fa versnum ]
8897df0ccbaSfvdlto dispatch routines, and of the triple
890df25ca45Swiz.Fa [ prognum ,
891df25ca45Swiz.Fa versnum ,
892df25ca45Swiz.Fa * ]
8937df0ccbaSfvdlto port number.
894df25ca45Swiz.It Fn svcerr_auth
8957df0ccbaSfvdlCalled by a service dispatch routine that refuses to perform
8967df0ccbaSfvdla remote procedure call due to an authentication error.
897df25ca45Swiz.It Fn svcerr_decode
8987df0ccbaSfvdlCalled by a service dispatch routine that cannot successfully
8996569c5c5Swizdecode its parameters.
9006569c5c5SwizSee also
901df25ca45Swiz.Fn svc_getargs .
902df25ca45Swiz.It Fn svcerr_noproc
9037df0ccbaSfvdlCalled by a service dispatch routine that does not implement
9047df0ccbaSfvdlthe procedure number that the caller requests.
905df25ca45Swiz.It Fn svcerr_noprog
906df25ca45SwizCalled when the desired program is not registered with the RPC
9076569c5c5Swizpackage.
9086569c5c5SwizService implementors usually do not need this routine.
909df25ca45Swiz.It Fn svcerr_progvers
9107df0ccbaSfvdlCalled when the desired version of a program is not registered
911df25ca45Swizwith the RPC package.
9126569c5c5SwizService implementors usually do not need this routine.
91342d8f555Swiz.\" TODO: document low_vers and high_vers
914df25ca45Swiz.It Fn svcerr_systemerr
915df25ca45SwizCalled by a service dispatch routine when it detects a system error
9167df0ccbaSfvdlnot covered by any particular protocol.
9177df0ccbaSfvdlFor example, if a service can no longer allocate storage,
9187df0ccbaSfvdlit may call this routine.
919df25ca45Swiz.It Fn svcerr_weakauth
9207df0ccbaSfvdlCalled by a service dispatch routine that refuses to perform
9217df0ccbaSfvdla remote procedure call due to insufficient
9226569c5c5Swizauthentication parameters.
9236569c5c5SwizThe routine calls
924df25ca45Swiz.Fn svcerr_auth "xprt" "AUTH_TOOWEAK" .
925df25ca45Swiz.It Fn svcraw_create
926df25ca45SwizThis routine creates a toy RPC service transport, to which it returns
927df25ca45Swiza pointer.
9286569c5c5SwizThe transport is really a buffer within the process's address space,
929df25ca45Swizso the corresponding RPC client should live in the same address space;
9307df0ccbaSfvdlsee
931df25ca45Swiz.Fn clntraw_create .
932df25ca45SwizThis routine allows simulation of RPC and acquisition of RPC overheads
933df25ca45Swiz(such as round trip times), without any kernel interference.
9347df0ccbaSfvdlThis routine returns
935df25ca45Swiz.Dv NULL
9367df0ccbaSfvdlif it fails.
937df25ca45Swiz.It Fn svctcp_create
938df25ca45SwizThis routine creates a TCP/IP-based RPC service transport, to which it
939df25ca45Swizreturns a pointer.
9407df0ccbaSfvdlThe transport is associated with the socket
941df25ca45Swiz.Fa sock ,
9427df0ccbaSfvdlwhich may be
943df25ca45Swiz.Dv RPC_ANYSOCK ,
9447df0ccbaSfvdlin which case a new socket is created.
945df25ca45SwizIf the socket is not bound to a local TCP
9466569c5c5Swizport, then this routine binds it to an arbitrary port.
9476569c5c5SwizUpon completion,
948*01869ca4Swiz.Fa xprt->xp_sock
9497df0ccbaSfvdlis the transport's socket descriptor, and
950*01869ca4Swiz.Fa xprt->xp_port
9517df0ccbaSfvdlis the transport's port number.
9527df0ccbaSfvdlThis routine returns
953df25ca45Swiz.Dv NULL
9546569c5c5Swizif it fails.
955df25ca45SwizSince TCP-based RPC uses buffered I/O ,
9567df0ccbaSfvdlusers may specify the size of buffers; values of zero
9577df0ccbaSfvdlchoose suitable defaults.
958df25ca45Swiz.It Fn svcfd_create
9596569c5c5SwizCreate a service on top of any open descriptor.
9606569c5c5SwizTypically, this descriptor is a connected socket
961df25ca45Swizfor a stream protocol such as TCP.
962df25ca45Swiz.Fa sendsize
9637df0ccbaSfvdland
964df25ca45Swiz.Fa recvsize
9656569c5c5Swizindicate sizes for the send and receive buffers.
9666569c5c5SwizIf they are zero, a reasonable default is chosen.
967df25ca45Swiz.It Fn svcudp_bufcreate
968df25ca45SwizThis routine creates a UDP/IP-based RPC
9697df0ccbaSfvdlservice transport, to which it returns a pointer.
9707df0ccbaSfvdlThe transport is associated with the socket
971df25ca45Swiz.Fa sock ,
9727df0ccbaSfvdlwhich may be
973df25ca45Swiz.Dv RPC_ANYSOCK ,
9747df0ccbaSfvdlin which case a new socket is created.
975df25ca45SwizIf the socket is not bound to a local UDP
9766569c5c5Swizport, then this routine binds it to an arbitrary port.
9776569c5c5SwizUpon completion,
978*01869ca4Swiz.Fa xprt->xp_sock
9797df0ccbaSfvdlis the transport's socket descriptor, and
980*01869ca4Swiz.Fa xprt->xp_port
9817df0ccbaSfvdlis the transport's port number.
9827df0ccbaSfvdlThis routine returns
983df25ca45Swiz.Dv NULL
9847df0ccbaSfvdlif it fails.
985df25ca45Swiz.Pp
9867df0ccbaSfvdlThis allows the user to specify the maximum packet size for sending and
987df25ca45Swizreceiving UDP-based RPC messages.
988aff92072Slukem.It Fn svcudp_create
989aff92072SlukemThis acts as
99094048eedSdholland.Fn svcudp_bufcreate
99194048eedSdhollandwith predefined sizes for the maximum packet sizes.
992df25ca45Swiz.It Fn xdr_accepted_reply
993df25ca45SwizUsed for encoding RPC reply messages.
994df25ca45SwizThis routine is useful for users who wish to generate RPC-style
995df25ca45Swizmessages without using the RPC package.
996df25ca45Swiz.It Fn xdr_authunix_parms
997df25ca45SwizUsed for describing UNIX credentials.
998df25ca45SwizThis routine is useful for users who wish to generate these
999df25ca45Swizcredentials without using the RPC authentication package.
1000df25ca45Swiz.It Fn xdr_callhdr
1001df25ca45SwizUsed for describing RPC call header messages.
1002df25ca45SwizThis routine is useful for users who wish to generate RPC-style
1003df25ca45Swizmessages without using the RPC package.
1004df25ca45Swiz.It Fn xdr_callmsg
1005df25ca45SwizUsed for describing RPC call messages.
1006df25ca45SwizThis routine is useful for users who wish to generate RPC-style
1007df25ca45Swizmessages without using the RPC package.
1008df25ca45Swiz.It Fn xdr_opaque_auth
1009df25ca45SwizUsed for describing RPC authentication information messages.
1010df25ca45SwizThis routine is useful for users who wish to generate RPC-style
1011df25ca45Swizmessages without using the RPC package.
1012df25ca45Swiz.It Fn xdr_pmap
10137df0ccbaSfvdlUsed for describing parameters to various
1014df25ca45Swiz.Xr rpcbind 8
10157df0ccbaSfvdlprocedures, externally.
10167df0ccbaSfvdlThis routine is useful for users who wish to generate
10177df0ccbaSfvdlthese parameters without using the
1018df25ca45Swiz.Em pmap
10197df0ccbaSfvdlinterface.
1020df25ca45Swiz.It Fn xdr_pmaplist
10217df0ccbaSfvdlUsed for describing a list of port mappings, externally.
10227df0ccbaSfvdlThis routine is useful for users who wish to generate
10237df0ccbaSfvdlthese parameters without using the
1024df25ca45Swiz.Em pmap
10257df0ccbaSfvdlinterface.
1026df25ca45Swiz.It Fn xdr_rejected_reply
1027df25ca45SwizUsed for describing RPC reply messages.
1028df25ca45SwizThis routine is useful for users who wish to generate RPC-style
1029df25ca45Swizmessages without using the RPC package.
1030df25ca45Swiz.It Fn xdr_replymsg
1031df25ca45SwizUsed for describing RPC reply messages.
1032df25ca45SwizThis routine is useful for users who wish to generate RPC-style
1033df25ca45Swizmessages without using the RPC package.
1034df25ca45Swiz.It Fn xprt_register
1035df25ca45SwizAfter RPC service transport handles are created,
1036df25ca45Swizthey should register themselves with the RPC service package.
10377df0ccbaSfvdlThis routine modifies the global variable
1038df25ca45Swiz.Va svc_fds .
10397df0ccbaSfvdlService implementors usually do not need this routine.
1040df25ca45Swiz.It Fn xprt_unregister
1041df25ca45SwizBefore an RPC service transport handle is destroyed,
1042df25ca45Swizit should unregister itself with the RPC service package.
10437df0ccbaSfvdlThis routine modifies the global variable
1044df25ca45Swiz.Va svc_fds .
10457df0ccbaSfvdlService implementors usually do not need this routine.
1046df25ca45Swiz.El
1047df25ca45Swiz.Sh SEE ALSO
1048df25ca45Swiz.\".Xr rpc_secure 3 ,
1049df25ca45Swiz.Xr xdr 3
1050df25ca45Swiz.Pp
10517df0ccbaSfvdlThe following manuals:
1052df25ca45Swiz.Rs
1053df25ca45Swiz.%B Remote Procedure Calls: Protocol Specification
1054df25ca45Swiz.Re
1055df25ca45Swiz.Rs
1056df25ca45Swiz.%B Remote Procedure Call Programming Guide
1057df25ca45Swiz.Re
1058df25ca45Swiz.Rs
1059df25ca45Swiz.%B rpcgen Programming Guide
1060df25ca45Swiz.Re
1061df25ca45Swiz.Pp
1062df25ca45Swiz.Rs
1063df25ca45Swiz.%A Sun Microsystems, Inc., USC-ISI
1064df25ca45Swiz.%T "RPC: Remote Procedure Call Protocol Specification"
1065df25ca45Swiz.%J RFC
1066df25ca45Swiz.%V 1050
1067df25ca45Swiz.Re
1068