version 1 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
RPC |
|
|
2 |
!!!RPC |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS AND DESCRIPTION |
|
|
5 |
SEE ALSO |
|
|
6 |
---- |
|
|
7 |
!!NAME |
|
|
8 |
|
|
|
9 |
|
|
|
10 |
rpc - library routines for remote procedure calls |
|
|
11 |
!!SYNOPSIS AND DESCRIPTION |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
These routines allow C programs to make procedure calls on |
|
|
15 |
other machines across the network. First, the client calls a |
|
|
16 |
procedure to send a data packet to the server. Upon receipt |
|
|
17 |
of the packet, the server calls a dispatch routine to |
|
|
18 |
perform the requested service, and then sends back a reply. |
|
|
19 |
Finally, the procedure call returns to the |
|
|
20 |
client. |
|
|
21 |
|
|
|
22 |
|
|
|
23 |
Routines that are used for Secure RPC (DES authentication) |
|
|
24 |
are described in __rpc_secure__(3N). Secure RPC can be |
|
|
25 |
used only if DES encryption is available. |
|
|
26 |
|
|
|
27 |
|
|
|
28 |
__#include |
|
|
29 |
__ |
|
|
30 |
|
|
|
31 |
|
|
|
32 |
void |
|
|
33 |
auth_destroy(auth) |
|
|
34 |
AUTH *auth; |
|
|
35 |
|
|
|
36 |
|
|
|
37 |
A macro that destroys the authentication information |
|
|
38 |
associated with ''auth''. Destruction usually involves |
|
|
39 |
deallocation of private data structures. The use of |
|
|
40 |
''auth'' is undefined after calling |
|
|
41 |
__auth_destroy()__. |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
__AUTH * |
|
|
45 |
authnone_create() |
|
|
46 |
__ |
|
|
47 |
|
|
|
48 |
|
|
|
49 |
Create and returns an RPC authentication |
|
|
50 |
handle that passes nonusable authentication information with |
|
|
51 |
each remote procedure call. This is the default |
|
|
52 |
authentication used by RPC. |
|
|
53 |
|
|
|
54 |
|
|
|
55 |
__AUTH__ __* |
|
|
56 |
authunix_create(host, uid, gid, len, aup_gids) |
|
|
57 |
char *host; |
|
|
58 |
int uid, gid, len, *aup.gids; |
|
|
59 |
__ |
|
|
60 |
|
|
|
61 |
|
|
|
62 |
Create and return an RPC authentication |
|
|
63 |
handle that contains authentication information. The |
|
|
64 |
parameter ''host'' is the name of the machine on which |
|
|
65 |
the information was created; ''uid'' is the user's user |
|
|
66 |
ID ; ''gid'' is the user's current group |
|
|
67 |
ID ; ''len'' and ''aup_gids'' refer to |
|
|
68 |
a counted array of groups to which the user belongs. It is |
|
|
69 |
easy to impersonate a user. |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
__AUTH * |
|
|
73 |
authunix_create_default() |
|
|
74 |
__ |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
Calls __authunix_create()__ with the appropriate |
|
|
78 |
parameters. |
|
|
79 |
|
|
|
80 |
|
|
|
81 |
__callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out) |
|
|
82 |
char *host; |
|
|
83 |
u_long prognum, versnum, procnum; |
|
|
84 |
char *in, *out; |
|
|
85 |
xdrproc_t inproc, outproc; |
|
|
86 |
__ |
|
|
87 |
|
|
|
88 |
|
|
|
89 |
Call the remote procedure associated with ''prognum'', |
|
|
90 |
''versnum'', and ''procnum'' on the machine, |
|
|
91 |
''host''. The parameter ''in'' is the address of the |
|
|
92 |
procedure's argument(s), and ''out'' is the address of |
|
|
93 |
where to place the result(s); ''inproc'' is used to |
|
|
94 |
encode the procedure's parameters, and ''outproc'' is |
|
|
95 |
used to decode the procedure's results. This routine returns |
|
|
96 |
zero if it succeeds, or the value of __enum clnt_stat__ |
|
|
97 |
cast to an integer if it fails. The routine |
|
|
98 |
__clnt_perrno()__ is handy for translating failure |
|
|
99 |
statuses into messages. |
|
|
100 |
|
|
|
101 |
|
|
|
102 |
Warning: calling remote procedures with this routine uses |
|
|
103 |
UDP/IP as a transport; see |
|
|
104 |
__clntudp_create()__ for restrictions. You do not have |
|
|
105 |
control of timeouts or authentication using this |
|
|
106 |
routine. |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
__enum clnt_stat |
|
|
110 |
clnt_broadcast(prognum, versnum, procnum, inproc, in, outproc, out, eachresult) |
|
|
111 |
u_long prognum, versnum, procnum; |
|
|
112 |
char *in, *out; |
|
|
113 |
xdrproc_t inproc, outproc; |
|
|
114 |
resultproc_t eachresult; |
|
|
115 |
__ |
|
|
116 |
|
|
|
117 |
|
|
|
118 |
Like __callrpc()__, except the call message is broadcast |
|
|
119 |
to all locally connected broadcast nets. Each time it |
|
|
120 |
receives a response, this routine calls __eachresult()__, |
|
|
121 |
whose form is: |
|
|
122 |
|
|
|
123 |
|
|
|
124 |
__eachresult(out, addr) |
|
|
125 |
char *out; |
|
|
126 |
struct sockaddr_in *addr; |
|
|
127 |
__ |
|
|
128 |
|
|
|
129 |
|
|
|
130 |
where ''out'' is the same as ''out'' passed to |
|
|
131 |
__clnt_broadcast()__, except that the remote procedure's |
|
|
132 |
output is decoded there; ''addr'' points to the address |
|
|
133 |
of the machine that sent the results. If __eachresult()__ |
|
|
134 |
returns zero, __clnt_broadcast()__ waits for more |
|
|
135 |
replies; otherwise it returns with appropriate |
|
|
136 |
status. |
|
|
137 |
|
|
|
138 |
|
|
|
139 |
Warning: broadcast sockets are limited in size to the |
|
|
140 |
maximum transfer unit of the data link. For ethernet, this |
|
|
141 |
value is 1500 bytes. |
|
|
142 |
|
|
|
143 |
|
|
|
144 |
__enum clnt_stat |
|
|
145 |
clnt_call(clnt, procnum, inproc, in, outproc, out, tout) |
|
|
146 |
CLIENT *clnt; |
|
|
147 |
u_long |
|
|
148 |
procnum; |
|
|
149 |
xdrproc_t inproc, outproc; |
|
|
150 |
char *in, *out; |
|
|
151 |
struct timeval tout; |
|
|
152 |
__ |
|
|
153 |
|
|
|
154 |
|
|
|
155 |
A macro that calls the remote procedure ''procnum'' |
|
|
156 |
associated with the client handle, ''clnt'', which is |
|
|
157 |
obtained with an RPC client creation routine |
|
|
158 |
such as __clnt_create()__. The parameter ''in'' is the |
|
|
159 |
address of the procedure's argument(s), and ''out'' is |
|
|
160 |
the address of where to place the result(s); ''inproc'' |
|
|
161 |
is used to encode the procedure's parameters, and |
|
|
162 |
''outproc'' is used to decode the procedure's results; |
|
|
163 |
''tout'' is the time allowed for results to come |
|
|
164 |
back. |
|
|
165 |
|
|
|
166 |
|
|
|
167 |
__clnt_destroy(clnt) |
|
|
168 |
CLIENT *clnt; |
|
|
169 |
__ |
|
|
170 |
|
|
|
171 |
|
|
|
172 |
A macro that destroys the client's RPC |
|
|
173 |
handle. Destruction usually involves deallocation of private |
|
|
174 |
data structures, including ''clnt'' itself. Use of |
|
|
175 |
''clnt'' is undefined after calling |
|
|
176 |
__clnt_destroy()__. If the RPC library |
|
|
177 |
opened the associated socket, it will close it also. |
|
|
178 |
Otherwise, the socket remains open. |
|
|
179 |
|
|
|
180 |
|
|
|
181 |
__CLIENT * |
|
|
182 |
clnt_create(host, prog, vers, proto) |
|
|
183 |
char *host; |
|
|
184 |
u_long prog, vers; |
|
|
185 |
char *proto; |
|
|
186 |
__ |
|
|
187 |
|
|
|
188 |
|
|
|
189 |
Generic client creation routine. ''host'' identifies the |
|
|
190 |
name of the remote host where the server is located. |
|
|
191 |
''proto'' indicates which kind of transport protocol to |
|
|
192 |
use. The currently supported values for this field are |
|
|
193 |
``udp'' and ``tcp''. Default timeouts are set, but can be |
|
|
194 |
modified using __clnt_control()__. |
|
|
195 |
|
|
|
196 |
|
|
|
197 |
Warning: Using UDP has its shortcomings. |
|
|
198 |
Since UDP -based RPC messages |
|
|
199 |
can only hold up to 8 Kbytes of encoded data, this transport |
|
|
200 |
cannot be used for procedures that take large arguments or |
|
|
201 |
return huge results. |
|
|
202 |
|
|
|
203 |
|
|
|
204 |
__bool_t |
|
|
205 |
clnt_control(cl, req, info) |
|
|
206 |
CLIENT *cl; |
|
|
207 |
char *info; |
|
|
208 |
__ |
|
|
209 |
|
|
|
210 |
|
|
|
211 |
A macro used to change or retrieve various information about |
|
|
212 |
a client object. ''req'' indicates the type of operation, |
|
|
213 |
and ''info'' is a pointer to the information. For both |
|
|
214 |
UDP and TCP , the supported |
|
|
215 |
values of ''req'' and their argument types and what they |
|
|
216 |
do are: |
|
|
217 |
|
|
|
218 |
|
|
|
219 |
CLSET_TIMEOUT struct timeval set total timeout |
|
|
220 |
CLGET_TIMEOUT struct timeval get total timeout |
|
|
221 |
Note: if you set the timeout using __clnt_control()__, the timeout parameter passed to __clnt_call()__ will be ignored in all future calls. |
|
|
222 |
|
|
|
223 |
|
|
|
224 |
CLGET_SERVER_ADDR struct sockaddr_in get server's address |
|
|
225 |
The following operations are valid for UDP only: |
|
|
226 |
|
|
|
227 |
|
|
|
228 |
CLSET_RETRY_TIMEOUT struct timeval set the retry timeout |
|
|
229 |
CLGET_RETRY_TIMEOUT struct timeval get the retry timeout |
|
|
230 |
The retry timeout is the time that UDP RPC waits for the server to reply before retransmitting the request. |
|
|
231 |
|
|
|
232 |
|
|
|
233 |
__clnt_freeres(clnt, outproc, out) |
|
|
234 |
CLIENT *clnt; |
|
|
235 |
xdrproc_t outproc; |
|
|
236 |
char *out; |
|
|
237 |
__ |
|
|
238 |
|
|
|
239 |
|
|
|
240 |
A macro that frees any data allocated by the |
|
|
241 |
RPC/XDR system when it decoded the results of |
|
|
242 |
an RPC call. The parameter ''out'' is the |
|
|
243 |
address of the results, and ''outproc'' is the |
|
|
244 |
XDR routine describing the results. This |
|
|
245 |
routine returns one if the results were successfully freed, |
|
|
246 |
and zero otherwise. |
|
|
247 |
|
|
|
248 |
|
|
|
249 |
__void |
|
|
250 |
clnt_geterr(clnt, errp) |
|
|
251 |
CLIENT *clnt; |
|
|
252 |
struct rpc_err *errp; |
|
|
253 |
__ |
|
|
254 |
|
|
|
255 |
|
|
|
256 |
A macro that copies the error structure out of the client |
|
|
257 |
handle to the structure at address ''errp''. |
|
|
258 |
|
|
|
259 |
|
|
|
260 |
__void |
|
|
261 |
clnt_pcreateerror(s) |
|
|
262 |
char *s; |
|
|
263 |
__ |
|
|
264 |
|
|
|
265 |
|
|
|
266 |
Print a message to standard error indicating why a client |
|
|
267 |
RPC handle could not be created. The message |
|
|
268 |
is prepended with string ''s'' and a colon. Used when a |
|
|
269 |
__clnt_create()__, __clntraw_create()__, |
|
|
270 |
__clnttcp_create()__, or __clntudp_create()__ call |
|
|
271 |
fails. |
|
|
272 |
|
|
|
273 |
|
|
|
274 |
__void |
|
|
275 |
clnt_perrno(stat) |
|
|
276 |
enum clnt_stat stat; |
|
|
277 |
__ |
|
|
278 |
|
|
|
279 |
|
|
|
280 |
Print a message to standard error corresponding to the |
|
|
281 |
condition indicated by ''stat''. Used after |
|
|
282 |
__callrpc()__. |
|
|
283 |
|
|
|
284 |
|
|
|
285 |
__clnt_perror(clnt, s) |
|
|
286 |
CLIENT *clnt; |
|
|
287 |
char *s; |
|
|
288 |
__ |
|
|
289 |
|
|
|
290 |
|
|
|
291 |
Print a message to standard error indicating why an |
|
|
292 |
RPC call failed; ''clnt'' is the handle |
|
|
293 |
used to do the call. The message is prepended with string |
|
|
294 |
''s'' and a colon. Used after |
|
|
295 |
__clnt_call()__. |
|
|
296 |
|
|
|
297 |
|
|
|
298 |
__char * |
|
|
299 |
clnt_spcreateerror |
|
|
300 |
char *s; |
|
|
301 |
__ |
|
|
302 |
|
|
|
303 |
|
|
|
304 |
Like __clnt_pcreateerror()__, except that it returns a |
|
|
305 |
string instead of printing to the standard |
|
|
306 |
error. |
|
|
307 |
|
|
|
308 |
|
|
|
309 |
Bugs: returns pointer to static data that is overwritten on |
|
|
310 |
each call. |
|
|
311 |
|
|
|
312 |
|
|
|
313 |
__char * |
|
|
314 |
clnt_sperrno(stat) |
|
|
315 |
enum clnt_stat stat; |
|
|
316 |
__ |
|
|
317 |
|
|
|
318 |
|
|
|
319 |
Take the same arguments as __clnt_perrno()__, but instead |
|
|
320 |
of sending a message to the standard error indicating why an |
|
|
321 |
RPC call failed, return a pointer to a string |
|
|
322 |
which contains the message. The string ends with a |
|
|
323 |
NEWLINE . |
|
|
324 |
|
|
|
325 |
|
|
|
326 |
__clnt_sperrno()__ is used instead of |
|
|
327 |
__clnt_perrno()__ if the program does not have a standard |
|
|
328 |
error (as a program running as a server quite likely does |
|
|
329 |
not), or if the programmer does not want the message to be |
|
|
330 |
output with __printf__, or if a message format different |
|
|
331 |
than that supported by __clnt_perrno()__ is to be used. |
|
|
332 |
Note: unlike __clnt_sperror()__ and |
|
|
333 |
__clnt_spcreaterror()__, __clnt_sperrno()__ returns |
|
|
334 |
pointer to static data, but the result will not get |
|
|
335 |
overwritten on each call. |
|
|
336 |
|
|
|
337 |
|
|
|
338 |
__char * |
|
|
339 |
clnt_sperror(rpch, s) |
|
|
340 |
CLIENT *rpch; |
|
|
341 |
char *s; |
|
|
342 |
__ |
|
|
343 |
|
|
|
344 |
|
|
|
345 |
Like __clnt_perror()__, except that (like |
|
|
346 |
__clnt_sperrno()__) it returns a string instead of |
|
|
347 |
printing to standard error. |
|
|
348 |
|
|
|
349 |
|
|
|
350 |
Bugs: returns pointer to static data that is overwritten on |
|
|
351 |
each call. |
|
|
352 |
|
|
|
353 |
|
|
|
354 |
__CLIENT * |
|
|
355 |
clntraw_create(prognum, versnum) |
|
|
356 |
u_long prognum, versnum; |
|
|
357 |
__ |
|
|
358 |
|
|
|
359 |
|
|
|
360 |
This routine creates a toy RPC client for the |
|
|
361 |
remote program ''prognum'', version ''versnum''. The |
|
|
362 |
transport used to pass messages to the service is actually a |
|
|
363 |
buffer within the process's address space, so the |
|
|
364 |
corresponding RPC server should live in the |
|
|
365 |
same address space; see __svcraw_create()__. This allows |
|
|
366 |
simulation of RPC and acquisition of |
|
|
367 |
RPC overheads, such as round trip times, |
|
|
368 |
without any kernel interference. This routine returns |
|
|
369 |
NULL if it fails. |
|
|
370 |
|
|
|
371 |
|
|
|
372 |
__CLIENT * |
|
|
373 |
clnttcp_create(addr, prognum, versnum, sockp, sendsz, recvsz) |
|
|
374 |
struct sockaddr_in *addr; |
|
|
375 |
u_long prognum, versnum; |
|
|
376 |
int *sockp; |
|
|
377 |
u_int sendsz, recvsz; |
|
|
378 |
__ |
|
|
379 |
|
|
|
380 |
|
|
|
381 |
This routine creates an RPC client for the |
|
|
382 |
remote program ''prognum'', version ''versnum''; the |
|
|
383 |
client uses TCP/IP as a transport. The remote |
|
|
384 |
program is located at Internet address ''*addr''. If |
|
|
385 |
__addr-__ is zero, then it is set to the |
|
|
386 |
actual port that the remote program is listening on (the |
|
|
387 |
remote __portmap__ service is consulted for this |
|
|
388 |
information). The parameter ''sockp'' is a socket; if it |
|
|
389 |
is __RPC_ANYSOCK__ , then this routine |
|
|
390 |
opens a new one and sets ''sockp''. Since |
|
|
391 |
TCP -based RPC uses buffered |
|
|
392 |
I/O , the user may specify the size of the |
|
|
393 |
send and receive buffers with the parameters ''sendsz'' |
|
|
394 |
and ''recvsz''; values of zero choose suitable defaults. |
|
|
395 |
This routine returns NULL if it |
|
|
396 |
fails. |
|
|
397 |
|
|
|
398 |
|
|
|
399 |
__CLIENT * |
|
|
400 |
clntudp_create(addr, prognum, versnum, wait, sockp) |
|
|
401 |
struct sockaddr_in *addr; |
|
|
402 |
u_long prognum, versnum; |
|
|
403 |
struct timeval wait; |
|
|
404 |
int *sockp; |
|
|
405 |
__ |
|
|
406 |
|
|
|
407 |
|
|
|
408 |
This routine creates an RPC client for the |
|
|
409 |
remote program ''prognum'', version ''versnum''; the |
|
|
410 |
client uses use UDP/IP as a transport. The |
|
|
411 |
remote program is located at Internet address ''addr''. |
|
|
412 |
If __addr-__ is zero, then it is set to |
|
|
413 |
actual port that the remote program is listening on (the |
|
|
414 |
remote __portmap__ service is consulted for this |
|
|
415 |
information). The parameter ''sockp'' is a socket; if it |
|
|
416 |
is __RPC_ANYSOCK__ , then this routine |
|
|
417 |
opens a new one and sets ''sockp''. The |
|
|
418 |
UDP transport resends the call message in |
|
|
419 |
intervals of __wait__ time until a response is received |
|
|
420 |
or until the call times out. The total time for the call to |
|
|
421 |
time out is specified by __clnt_call()__. |
|
|
422 |
|
|
|
423 |
|
|
|
424 |
Warning: since UDP -based RPC |
|
|
425 |
messages can only hold up to 8 Kbytes of encoded data, this |
|
|
426 |
transport cannot be used for procedures that take large |
|
|
427 |
arguments or return huge results. |
|
|
428 |
|
|
|
429 |
|
|
|
430 |
__CLIENT * |
|
|
431 |
clntudp_bufcreate(addr, prognum, versnum, wait, sockp, sendsize, recosize) |
|
|
432 |
struct sockaddr_in *addr; |
|
|
433 |
u_long prognum, versnum; |
|
|
434 |
struct timeval wait; |
|
|
435 |
int *sockp; |
|
|
436 |
unsigned int sendsize; |
|
|
437 |
unsigned int recosize; |
|
|
438 |
__ |
|
|
439 |
|
|
|
440 |
|
|
|
441 |
This routine creates an RPC client for the |
|
|
442 |
remote program ''prognum'', on ''versnum''; the client |
|
|
443 |
uses use UDP/IP as a transport. The remote |
|
|
444 |
program is located at Internet address ''addr''. If |
|
|
445 |
__addr-__ is zero, then it is set to actual |
|
|
446 |
port that the remote program is listening on (the remote |
|
|
447 |
__portmap__ service is consulted for this information). |
|
|
448 |
The parameter ''sockp'' is a socket; if it is |
|
|
449 |
__RPC_ANYSOCK__ , then this routine opens |
|
|
450 |
a new one and sets __sockp__. The UDP |
|
|
451 |
transport resends the call message in intervals of |
|
|
452 |
__wait__ time until a response is received or until the |
|
|
453 |
call times out. The total time for the call to time out is |
|
|
454 |
specified by __clnt_call()__. |
|
|
455 |
|
|
|
456 |
|
|
|
457 |
This allows the user to specify the maximun packet size for |
|
|
458 |
sending and receiving UDP -based |
|
|
459 |
RPC messages. |
|
|
460 |
|
|
|
461 |
|
|
|
462 |
__void |
|
|
463 |
get_myaddress(addr) |
|
|
464 |
struct sockaddr_in *addr; |
|
|
465 |
__ |
|
|
466 |
|
|
|
467 |
|
|
|
468 |
Stuff the machine's IP address into |
|
|
469 |
''*addr'', without consulting the library routines that |
|
|
470 |
deal with __/etc/hosts__. The port number is always set |
|
|
471 |
to __htons( PMAPPORT )__. |
|
|
472 |
|
|
|
473 |
|
|
|
474 |
__struct pmaplist * |
|
|
475 |
pmap_getmaps(addr) |
|
|
476 |
struct sockaddr_in *addr; |
|
|
477 |
__ |
|
|
478 |
|
|
|
479 |
|
|
|
480 |
A user interface to the __portmap__ service, which |
|
|
481 |
returns a list of the current RPC |
|
|
482 |
program-to-port mappings on the host located at |
|
|
483 |
IP address ''*addr''. This routine can |
|
|
484 |
return NULL . The command `__rpcinfo -p__' |
|
|
485 |
uses this routine. |
|
|
486 |
|
|
|
487 |
|
|
|
488 |
__u_short |
|
|
489 |
pmap_getport(addr, prognum, versnum, protocol) |
|
|
490 |
struct sockaddr_in *addr; |
|
|
491 |
u_long prognum, versnum, protocol; |
|
|
492 |
__ |
|
|
493 |
|
|
|
494 |
|
|
|
495 |
A user interface to the __portmap__ service, which |
|
|
496 |
returns the port number on which waits a service that |
|
|
497 |
supports program number ''prognum'', version |
|
|
498 |
''versnum'', and speaks the transport protocol associated |
|
|
499 |
with ''protocol''. The value of ''protocol'' is most |
|
|
500 |
likely __IPPROTO_UDP__ or |
|
|
501 |
__IPPROTO_TCP__ . A return value of zero |
|
|
502 |
means that the mapping does not exist or that the |
|
|
503 |
RPC system failured to contact the remote |
|
|
504 |
__portmap__ service. In the latter case, the global |
|
|
505 |
variable __rpc_createerr()__ contains the |
|
|
506 |
RPC status. |
|
|
507 |
|
|
|
508 |
|
|
|
509 |
__enum clnt_stat |
|
|
510 |
pmap_rmtcall(addr, prognum, versnum, procnum, inproc, in, outproc, out, tout, portp) |
|
|
511 |
struct sockaddr_in *addr; |
|
|
512 |
u_long prognum, versnum, procnum; |
|
|
513 |
char *in, *out; |
|
|
514 |
xdrproc_t inproc, outproc; |
|
|
515 |
struct timeval tout; |
|
|
516 |
u_long *portp; |
|
|
517 |
__ |
|
|
518 |
|
|
|
519 |
|
|
|
520 |
A user interface to the __portmap__ service, which |
|
|
521 |
instructs __portmap__ on the host at IP |
|
|
522 |
address ''*addr'' to make an RPC call on |
|
|
523 |
your behalf to a procedure on that host. The parameter |
|
|
524 |
''*portp'' will be modified to the program's port number |
|
|
525 |
if the procedure succeeds. The definitions of other |
|
|
526 |
parameters are discussed in __callrpc()__ and |
|
|
527 |
__clnt_call()__. This procedure should be used for a |
|
|
528 |
``ping'' and nothing else. See also |
|
|
529 |
__clnt_broadcast()__. |
|
|
530 |
|
|
|
531 |
|
|
|
532 |
__pmap_set(prognum, versnum, protocol, port) |
|
|
533 |
u_long prognum, versnum, protocol; |
|
|
534 |
u_short port; |
|
|
535 |
__ |
|
|
536 |
|
|
|
537 |
|
|
|
538 |
A user interface to the __portmap__ service, which |
|
|
539 |
establishes a mapping between the triple |
|
|
540 |
[[''prognum'',''versnum'',''protocol''] and |
|
|
541 |
''port'' on the machine's __portmap__ service. The |
|
|
542 |
value of ''protocol'' is most likely |
|
|
543 |
__IPPROTO_UDP__ or |
|
|
544 |
__IPPROTO_TCP__ . This routine returns one |
|
|
545 |
if it succeeds, zero otherwise. Automatically done by |
|
|
546 |
__svc_register()__. |
|
|
547 |
|
|
|
548 |
|
|
|
549 |
__pmap_unset(prognum, versnum) |
|
|
550 |
u_long prognum, versnum; |
|
|
551 |
__ |
|
|
552 |
|
|
|
553 |
|
|
|
554 |
A user interface to the __portmap__ service, which |
|
|
555 |
destroys all mapping between the triple |
|
|
556 |
[[''prognum'',''versnum'',''*''] and __ports__ on |
|
|
557 |
the machine's __portmap__ service. This routine returns |
|
|
558 |
one if it succeeds, zero otherwise. |
|
|
559 |
|
|
|
560 |
|
|
|
561 |
__registerrpc(prognum, versnum, procnum, procname, inproc, outproc) |
|
|
562 |
u_long prognum, versnum, procnum; |
|
|
563 |
char *(*procname) () ; |
|
|
564 |
xdrproc_t inproc, outproc; |
|
|
565 |
__ |
|
|
566 |
|
|
|
567 |
|
|
|
568 |
Register procedure ''procname'' with the |
|
|
569 |
RPC service package. If a request arrives for |
|
|
570 |
program ''prognum'', version ''versnum'', and |
|
|
571 |
procedure ''procnum'', ''procname'' is called with a |
|
|
572 |
pointer to its parameter(s); ''progname'' should return a |
|
|
573 |
pointer to its static result(s); ''inproc'' is used to |
|
|
574 |
decode the parameters while ''outproc'' is used to encode |
|
|
575 |
the results. This routine returns zero if the registration |
|
|
576 |
succeeded, -1 otherwise. |
|
|
577 |
|
|
|
578 |
|
|
|
579 |
Warning: remote procedures registered in this form are |
|
|
580 |
accessed using the UDP/IP transport; see |
|
|
581 |
__svcudp_create()__ for restrictions. |
|
|
582 |
|
|
|
583 |
|
|
|
584 |
__struct rpc_createerr rpc_createerr; |
|
|
585 |
__ |
|
|
586 |
|
|
|
587 |
|
|
|
588 |
A global variable whose value is set by any |
|
|
589 |
RPC client creation routine that does not |
|
|
590 |
succeed. Use the routine __clnt_pcreateerror()__ to print |
|
|
591 |
the reason why. |
|
|
592 |
|
|
|
593 |
|
|
|
594 |
__svc_destroy(xprt) |
|
|
595 |
SVCXPRT * |
|
|
596 |
xprt; |
|
|
597 |
__ |
|
|
598 |
|
|
|
599 |
|
|
|
600 |
A macro that destroys the RPC service |
|
|
601 |
transport handle, ''xprt''. Destruction usually involves |
|
|
602 |
deallocation of private data structures, including |
|
|
603 |
''xprt'' itself. Use of ''xprt'' is undefined after |
|
|
604 |
calling this routine. |
|
|
605 |
|
|
|
606 |
|
|
|
607 |
__fd_set svc_fdset; |
|
|
608 |
__ |
|
|
609 |
|
|
|
610 |
|
|
|
611 |
A global variable reflecting the RPC service |
|
|
612 |
side's read file descriptor bit mask; it is suitable as a |
|
|
613 |
parameter to the __select__ system call. This is only of |
|
|
614 |
interest if a service implementor does not call |
|
|
615 |
__svc_run()__, but rather does his own asynchronous event |
|
|
616 |
processing. This variable is read-only (do not pass its |
|
|
617 |
address to __select__!), yet it may change after calls to |
|
|
618 |
__svc_getreqset()__ or any creation |
|
|
619 |
routines. |
|
|
620 |
|
|
|
621 |
|
|
|
622 |
__int svc_fds; |
|
|
623 |
__ |
|
|
624 |
|
|
|
625 |
|
|
|
626 |
Similar to __svc_fdset__, but limited to 32 descriptors. |
|
|
627 |
This interface is obsoleted by |
|
|
628 |
__svc_fdset__. |
|
|
629 |
|
|
|
630 |
|
|
|
631 |
__svc_freeargs(xprt, inproc, in) |
|
|
632 |
SVCXPRT *xprt; |
|
|
633 |
xdrproc_t inproc; |
|
|
634 |
char *in; |
|
|
635 |
__ |
|
|
636 |
|
|
|
637 |
|
|
|
638 |
A macro that frees any data allocated by the |
|
|
639 |
RPC/XDR system when it decoded the arguments |
|
|
640 |
to a service procedure using __svc_getargs()__. This |
|
|
641 |
routine returns 1 if the results were successfully freed, |
|
|
642 |
and zero otherwise. |
|
|
643 |
|
|
|
644 |
|
|
|
645 |
__svc_getargs(xprt, inproc, in) |
|
|
646 |
SVCXPRT *xprt; |
|
|
647 |
xdrproc_t inproc; |
|
|
648 |
char *in; |
|
|
649 |
__ |
|
|
650 |
|
|
|
651 |
|
|
|
652 |
A macro that decodes the arguments of an RPC |
|
|
653 |
request associated with the RPC service |
|
|
654 |
transport handle, ''xprt''. The parameter ''in'' is |
|
|
655 |
the address where the arguments will be placed; |
|
|
656 |
''inproc'' is the XDR routine used to |
|
|
657 |
decode the arguments. This routine returns one if decoding |
|
|
658 |
succeeds, and zero otherwise. |
|
|
659 |
|
|
|
660 |
|
|
|
661 |
__struct sockaddr_in * |
|
|
662 |
svc_getcaller(xprt) |
|
|
663 |
SVCXPRT *xprt; |
|
|
664 |
__ |
|
|
665 |
|
|
|
666 |
|
|
|
667 |
The approved way of getting the network address of the |
|
|
668 |
caller of a procedure associated with the RPC |
|
|
669 |
service transport handle, ''xprt''. |
|
|
670 |
|
|
|
671 |
|
|
|
672 |
__svc_getreqset(rdfds) |
|
|
673 |
fd_set *rdfds; |
|
|
674 |
__ |
|
|
675 |
|
|
|
676 |
|
|
|
677 |
This routine is only of interest if a service implementor |
|
|
678 |
does not call __svc_run()__, but instead implements |
|
|
679 |
custom asynchronous event processing. It is called when the |
|
|
680 |
__select__ system call has determined that an |
|
|
681 |
RPC request has arrived on some |
|
|
682 |
RPC __socket(s) ;__ ''rdfds'' is the |
|
|
683 |
resultant read file descriptor bit mask. The routine returns |
|
|
684 |
when all sockets associated with the value of ''rdfds'' |
|
|
685 |
have been serviced. |
|
|
686 |
|
|
|
687 |
|
|
|
688 |
__svc_getreq(rdfds) |
|
|
689 |
int rdfds; |
|
|
690 |
__ |
|
|
691 |
|
|
|
692 |
|
|
|
693 |
Similar to __svc_getreqset()__, but limited to 32 |
|
|
694 |
descriptors. This interface is obsoleted by |
|
|
695 |
__svc_getreqset()__. |
|
|
696 |
|
|
|
697 |
|
|
|
698 |
__svc_register(xprt, prognum, versnum, dispatch, protocol) |
|
|
699 |
SVCXPRT *xprt; |
|
|
700 |
u_long prognum, versnum; |
|
|
701 |
void (*dispatch) (); |
|
|
702 |
u_long protocol; |
|
|
703 |
__ |
|
|
704 |
|
|
|
705 |
|
|
|
706 |
Associates ''prognum'' and ''versnum'' with the |
|
|
707 |
service dispatch procedure, ''dispatch''. If |
|
|
708 |
''protocol'' is zero, the service is not registered with |
|
|
709 |
the __portmap__ service. If ''protocol'' is non-zero, |
|
|
710 |
then a mapping of the triple |
|
|
711 |
[[''prognum'',''versnum'',''protocol''] to |
|
|
712 |
__xprt-__ is established with the local |
|
|
713 |
__portmap__ service (generally ''protocol'' is zero, |
|
|
714 |
__IPPROTO_UDP__ or |
|
|
715 |
__IPPROTO_TCP__ ). The procedure |
|
|
716 |
''dispatch'' has the following form: |
|
|
717 |
|
|
|
718 |
|
|
|
719 |
__dispatch(request, xprt) |
|
|
720 |
struct svc_req *request; |
|
|
721 |
SVCXPRT *xprt; |
|
|
722 |
__ |
|
|
723 |
|
|
|
724 |
|
|
|
725 |
The __svc_register()__ routine returns one if it |
|
|
726 |
succeeds, and zero otherwise. |
|
|
727 |
|
|
|
728 |
|
|
|
729 |
__svc_run() |
|
|
730 |
__ |
|
|
731 |
|
|
|
732 |
|
|
|
733 |
This routine never returns. It waits for RPC |
|
|
734 |
requests to arrive, and calls the appropriate service |
|
|
735 |
procedure using __svc_getreq()__ when one arrives. This |
|
|
736 |
procedure is usually waiting for a __select()__ system |
|
|
737 |
call to return. |
|
|
738 |
|
|
|
739 |
|
|
|
740 |
__svc_sendreply(xprt, outproc, out) |
|
|
741 |
SVCXPRT *xprt; |
|
|
742 |
xdrproc_t outproc; |
|
|
743 |
char *out; |
|
|
744 |
__ |
|
|
745 |
|
|
|
746 |
|
|
|
747 |
Called by an RPC service's dispatch routine |
|
|
748 |
to send the results of a remote procedure call. The |
|
|
749 |
parameter ''xprt'' is the request's associated transport |
|
|
750 |
handle; ''outproc'' is the XDR routine |
|
|
751 |
which is used to encode the results; and ''out'' is the |
|
|
752 |
address of the results. This routine returns one if it |
|
|
753 |
succeeds, zero otherwise. |
|
|
754 |
|
|
|
755 |
|
|
|
756 |
__void |
|
|
757 |
svc_unregister(prognum, versnum) |
|
|
758 |
u_long prognum, versnum; |
|
|
759 |
__ |
|
|
760 |
|
|
|
761 |
|
|
|
762 |
Remove all mapping of the double |
|
|
763 |
[[''prognum'',''versnum''] to dispatch routines, and of |
|
|
764 |
the triple [[''prognum'',''versnum'',''*''] to port |
|
|
765 |
number. |
|
|
766 |
|
|
|
767 |
|
|
|
768 |
__void |
|
|
769 |
svcerr_auth(xprt, why) |
|
|
770 |
SVCXPRT *xprt; |
|
|
771 |
enum auth_stat why; |
|
|
772 |
__ |
|
|
773 |
|
|
|
774 |
|
|
|
775 |
Called by a service dispatch routine that refuses to perform |
|
|
776 |
a remote procedure call due to an authentication |
|
|
777 |
error. |
|
|
778 |
|
|
|
779 |
|
|
|
780 |
__void |
|
|
781 |
svcerr_decode(xprt) |
|
|
782 |
SVCXPRT *xprt; |
|
|
783 |
__ |
|
|
784 |
|
|
|
785 |
|
|
|
786 |
Called by a service dispatch routine that cannot |
|
|
787 |
successfully decode its parameters. See also |
|
|
788 |
__svc_getargs()__. |
|
|
789 |
|
|
|
790 |
|
|
|
791 |
__void |
|
|
792 |
svcerr_noproc(xprt) |
|
|
793 |
SVCXPRT *xprt; |
|
|
794 |
__ |
|
|
795 |
|
|
|
796 |
|
|
|
797 |
Called by a service dispatch routine that does not implement |
|
|
798 |
the procedure number that the caller requests. |
|
|
799 |
|
|
|
800 |
|
|
|
801 |
__void |
|
|
802 |
svcerr_noprog(xprt) |
|
|
803 |
SVCXPRT *xprt; |
|
|
804 |
__ |
|
|
805 |
|
|
|
806 |
|
|
|
807 |
Called when the desired program is not registered with the |
|
|
808 |
RPC package. Service implementors usually do |
|
|
809 |
not need this routine. |
|
|
810 |
|
|
|
811 |
|
|
|
812 |
__void |
|
|
813 |
svcerr_progvers(xprt) |
|
|
814 |
SVCXPRT *xprt; |
|
|
815 |
__ |
|
|
816 |
|
|
|
817 |
|
|
|
818 |
Called when the desired version of a program is not |
|
|
819 |
registered with the RPC package. Service |
|
|
820 |
implementors usually do not need this routine. |
|
|
821 |
|
|
|
822 |
|
|
|
823 |
__void |
|
|
824 |
svcerr_systemerr(xprt) |
|
|
825 |
SVCXPRT *xprt; |
|
|
826 |
__ |
|
|
827 |
|
|
|
828 |
|
|
|
829 |
Called by a service dispatch routine when it detects a |
|
|
830 |
system error not covered by any particular protocol. For |
|
|
831 |
example, if a service can no longer allocate storage, it may |
|
|
832 |
call this routine. |
|
|
833 |
|
|
|
834 |
|
|
|
835 |
__void |
|
|
836 |
svcerr_weakauth(xprt) |
|
|
837 |
SVCXPRT *xprt; |
|
|
838 |
__ |
|
|
839 |
|
|
|
840 |
|
|
|
841 |
Called by a service dispatch routine that refuses to perform |
|
|
842 |
a remote procedure call due to insufficient authentication |
|
|
843 |
parameters. The routine calls __svcerr_auth(xprt, |
|
|
844 |
AUTH_TOOWEAK )__. |
|
|
845 |
|
|
|
846 |
|
|
|
847 |
__SVCXPRT * |
|
|
848 |
svcraw_create() |
|
|
849 |
__ |
|
|
850 |
|
|
|
851 |
|
|
|
852 |
This routine creates a toy RPC service |
|
|
853 |
transport, to which it returns a pointer. The transport is |
|
|
854 |
really a buffer within the process's address space, so the |
|
|
855 |
corresponding RPC client should live in the |
|
|
856 |
same address space; see __clntraw_create()__. This |
|
|
857 |
routine allows simulation of RPC and |
|
|
858 |
acquisition of RPC overheads (such as round |
|
|
859 |
trip times), without any kernel interference. This routine |
|
|
860 |
returns NULL if it fails. |
|
|
861 |
|
|
|
862 |
|
|
|
863 |
__SVCXPRT * |
|
|
864 |
svctcp_create(sock, send_buf_size, recv_buf_size) |
|
|
865 |
int sock; |
|
|
866 |
u_int send_buf_size, recv_buf_size; |
|
|
867 |
__ |
|
|
868 |
|
|
|
869 |
|
|
|
870 |
This routine creates a TCP/IP -based |
|
|
871 |
RPC service transport, to which it returns a |
|
|
872 |
pointer. The transport is associated with the socket |
|
|
873 |
''sock'', which may be __RPC_ANYSOCK__ |
|
|
874 |
, in which case a new socket is created. If the socket is |
|
|
875 |
not bound to a local TCP port, then this |
|
|
876 |
routine binds it to an arbitrary port. Upon completion, |
|
|
877 |
__xprt-__ is the transport's socket |
|
|
878 |
descriptor, and __xprt-__ is the transport's |
|
|
879 |
port number. This routine returns NULL if it |
|
|
880 |
fails. Since TCP -based RPC |
|
|
881 |
uses buffered I/O , users may specify the |
|
|
882 |
size of buffers; values of zero choose suitable |
|
|
883 |
defaults. |
|
|
884 |
|
|
|
885 |
|
|
|
886 |
__SVCXPRT * |
|
|
887 |
svcfd_create(fd, sendsize, recvsize) |
|
|
888 |
int fd; |
|
|
889 |
u_int sendsize; |
|
|
890 |
u_int recvsize; |
|
|
891 |
__ |
|
|
892 |
|
|
|
893 |
|
|
|
894 |
Create a service on top of any open descriptor. Typically, |
|
|
895 |
this descriptor is a connected socket for a stream protocol |
|
|
896 |
such as TCP . ''sendsize'' and |
|
|
897 |
''recvsize'' indicate sizes for the send and receive |
|
|
898 |
buffers. If they are zero, a reasonable default is |
|
|
899 |
chosen. |
|
|
900 |
|
|
|
901 |
|
|
|
902 |
__SVCXPRT * |
|
|
903 |
svcudp_bufcreate(sock, sendsize, recosize) |
|
|
904 |
int sock; |
|
|
905 |
__ |
|
|
906 |
|
|
|
907 |
|
|
|
908 |
This routine creates a UDP/IP -based |
|
|
909 |
RPC service transport, to which it returns a |
|
|
910 |
pointer. The transport is associated with the socket |
|
|
911 |
''sock'', which may be __RPC_ANYSOCK |
|
|
912 |
,__ in which case a new socket is created. If the socket |
|
|
913 |
is not bound to a local UDP port, then this |
|
|
914 |
routine binds it to an arbitrary port. Upon completion, |
|
|
915 |
__xprt-__ is the transport's socket |
|
|
916 |
descriptor, and __xprt-__ is the transport's |
|
|
917 |
port number. This routine returns NULL if it |
|
|
918 |
fails. |
|
|
919 |
|
|
|
920 |
|
|
|
921 |
This allows the user to specify the maximun packet size for |
|
|
922 |
sending and receiving UDP -based RPC |
|
|
923 |
messages. |
|
|
924 |
|
|
|
925 |
|
|
|
926 |
__xdr_accepted_reply(xdrs, ar) |
|
|
927 |
XDR *xdrs; |
|
|
928 |
struct accepted_reply *ar; |
|
|
929 |
__ |
|
|
930 |
|
|
|
931 |
|
|
|
932 |
Used for encoding RPC reply messages. This |
|
|
933 |
routine is useful for users who wish to generate |
|
|
934 |
RPC -style messages without using the |
|
|
935 |
RPC package. |
|
|
936 |
|
|
|
937 |
|
|
|
938 |
__xdr_authunix_parms(xdrs, aupp) |
|
|
939 |
XDR *xdrs; |
|
|
940 |
struct authunix_parms *aupp; |
|
|
941 |
__ |
|
|
942 |
|
|
|
943 |
|
|
|
944 |
Used for describing UNIX credentials. This |
|
|
945 |
routine is useful for users who wish to generate these |
|
|
946 |
credentials without using the RPC |
|
|
947 |
authentication package. |
|
|
948 |
|
|
|
949 |
|
|
|
950 |
__void |
|
|
951 |
xdr_callhdr(xdrs, chdr) |
|
|
952 |
XDR *xdrs; |
|
|
953 |
struct rpc_msg *chdr; |
|
|
954 |
__ |
|
|
955 |
|
|
|
956 |
|
|
|
957 |
Used for describing RPC call header messages. |
|
|
958 |
This routine is useful for users who wish to generate |
|
|
959 |
RPC -style messages without using the |
|
|
960 |
RPC package. |
|
|
961 |
|
|
|
962 |
|
|
|
963 |
__xdr_callmsg(xdrs, cmsg) |
|
|
964 |
XDR *xdrs; |
|
|
965 |
struct rpc_msg *cmsg; |
|
|
966 |
__ |
|
|
967 |
|
|
|
968 |
|
|
|
969 |
Used for describing RPC call messages. This |
|
|
970 |
routine is useful for users who wish to generate |
|
|
971 |
RPC -style messages without using the |
|
|
972 |
RPC package. |
|
|
973 |
|
|
|
974 |
|
|
|
975 |
__xdr_opaque_auth(xdrs, ap) |
|
|
976 |
XDR *xdrs; |
|
|
977 |
struct opaque_auth *ap; |
|
|
978 |
__ |
|
|
979 |
|
|
|
980 |
|
|
|
981 |
Used for describing RPC authentication |
|
|
982 |
information messages. This routine is useful for users who |
|
|
983 |
wish to generate RPC -style messages without |
|
|
984 |
using the RPC package. |
|
|
985 |
|
|
|
986 |
|
|
|
987 |
__xdr_pmap(xdrs, regs) |
|
|
988 |
XDR *xdrs; |
|
|
989 |
struct pmap *regs; |
|
|
990 |
__ |
|
|
991 |
|
|
|
992 |
|
|
|
993 |
Used for describing parameters to various __portmap__ |
|
|
994 |
procedures, externally. This routine is useful for users who |
|
|
995 |
wish to generate these parameters without using the |
|
|
996 |
__pmap__ interface. |
|
|
997 |
|
|
|
998 |
|
|
|
999 |
__xdr_pmaplist(xdrs, rp) |
|
|
1000 |
XDR *xdrs; |
|
|
1001 |
struct pmaplist **rp; |
|
|
1002 |
__ |
|
|
1003 |
|
|
|
1004 |
|
|
|
1005 |
Used for describing a list of port mappings, externally. |
|
|
1006 |
This routine is useful for users who wish to generate these |
|
|
1007 |
parameters without using the __pmap__ |
|
|
1008 |
interface. |
|
|
1009 |
|
|
|
1010 |
|
|
|
1011 |
__xdr_rejected_reply(xdrs, rr) |
|
|
1012 |
XDR *xdrs; |
|
|
1013 |
struct rejected_reply *rr; |
|
|
1014 |
__ |
|
|
1015 |
|
|
|
1016 |
|
|
|
1017 |
Used for describing RPC reply messages. This |
|
|
1018 |
routine is useful for users who wish to generate |
|
|
1019 |
RPC -style messages without using the |
|
|
1020 |
RPC package. |
|
|
1021 |
|
|
|
1022 |
|
|
|
1023 |
__xdr_replymsg(xdrs, rmsg) |
|
|
1024 |
XDR *xdrs; |
|
|
1025 |
struct rpc_msg *rmsg; |
|
|
1026 |
__ |
|
|
1027 |
|
|
|
1028 |
|
|
|
1029 |
Used for describing RPC reply messages. This |
|
|
1030 |
routine is useful for users who wish to generate |
|
|
1031 |
RPC style messages without using the |
|
|
1032 |
RPC package. |
|
|
1033 |
|
|
|
1034 |
|
|
|
1035 |
__void |
|
|
1036 |
xprt_register(xprt) |
|
|
1037 |
SVCXPRT *xprt; |
|
|
1038 |
__ |
|
|
1039 |
|
|
|
1040 |
|
|
|
1041 |
After RPC service transport handles are |
|
|
1042 |
created, they should register themselves with the |
|
|
1043 |
RPC service package. This routine modifies |
|
|
1044 |
the global variable __svc_fds()__. Service implementors |
|
|
1045 |
usually do not need this routine. |
|
|
1046 |
|
|
|
1047 |
|
|
|
1048 |
__void |
|
|
1049 |
xprt_unregister(xprt) |
|
|
1050 |
SVCXPRT *xprt; |
|
|
1051 |
__ |
|
|
1052 |
|
|
|
1053 |
|
|
|
1054 |
Before an RPC service transport handle is |
|
|
1055 |
destroyed, it should unregister itself with the |
|
|
1056 |
RPC service package. This routine modifies |
|
|
1057 |
the global variable __svc_fds()__. Service implementors |
|
|
1058 |
usually do not need this routine. |
|
|
1059 |
!!SEE ALSO |
|
|
1060 |
|
|
|
1061 |
|
|
|
1062 |
__rpc_secure__(3N), __xdr__(3N) |
|
|
1063 |
The following manuals: |
|
|
1064 |
|
|
|
1065 |
|
|
|
1066 |
''Remote Procedure Calls: Protocol Specification |
|
|
1067 |
Remote Procedure Call Programming Guide |
|
|
1068 |
rpcgen Programming Guide'' |
|
|
1069 |
|
|
|
1070 |
|
|
|
1071 |
''RPC : Remote Procedure Call Protocol |
|
|
1072 |
Specification'', RFC1050, Sun Microsystems, Inc., |
|
|
1073 |
USC-ISI . |
|
|
1074 |
---- |