1 /* $NetBSD: clnt.h,v 1.14 2000/06/02 22:57:55 fvdl Exp $ */ 2 3 /* 4 * The contents of this file are subject to the Sun Standards 5 * License Version 1.0 the (the "License";) You may not use 6 * this file except in compliance with the License. You may 7 * obtain a copy of the License at lib/libc/rpc/LICENSE 8 * 9 * Software distributed under the License is distributed on 10 * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 11 * express or implied. See the License for the specific 12 * language governing rights and limitations under the License. 13 * 14 * The Original Code is Copyright 1998 by Sun Microsystems, Inc 15 * 16 * The Initial Developer of the Original Code is: Sun 17 * Microsystems, Inc. 18 * 19 * All Rights Reserved. 20 * 21 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 22 * unrestricted use provided that this legend is included on all tape 23 * media and as a part of the software program in whole or part. Users 24 * may copy or modify Sun RPC without charge, but are not authorized 25 * to license or distribute it to anyone else except as part of a product or 26 * program developed by the user. 27 * 28 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 29 * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 30 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 31 * 32 * Sun RPC is provided with no support and without any obligation on the 33 * part of Sun Microsystems, Inc. to assist in its use, correction, 34 * modification or enhancement. 35 * 36 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 37 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 38 * OR ANY PART THEREOF. 39 * 40 * In no event will Sun Microsystems, Inc. be liable for any lost revenue 41 * or profits or other special, indirect and consequential damages, even if 42 * Sun has been advised of the possibility of such damages. 43 * 44 * Sun Microsystems, Inc. 45 * 2550 Garcia Avenue 46 * Mountain View, California 94043 47 * 48 * from: @(#)clnt.h 1.31 94/04/29 SMI 49 * from: @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC 50 * $FreeBSD$ 51 */ 52 53 /* 54 * clnt.h - Client side remote procedure call interface. 55 * 56 * Copyright (c) 1986-1991,1994-1999 by Sun Microsystems, Inc. 57 * All rights reserved. 58 */ 59 60 #ifndef _RPC_CLNT_H_ 61 #define _RPC_CLNT_H_ 62 #include <rpc/clnt_stat.h> 63 #include <sys/cdefs.h> 64 #ifdef _KERNEL 65 #include <sys/refcount.h> 66 #include <rpc/netconfig.h> 67 #else 68 #include <netconfig.h> 69 #endif 70 #include <sys/un.h> 71 72 /* 73 * Well-known IPV6 RPC broadcast address. 74 */ 75 #define RPCB_MULTICAST_ADDR "ff02::202" 76 77 /* 78 * the following errors are in general unrecoverable. The caller 79 * should give up rather than retry. 80 */ 81 #define IS_UNRECOVERABLE_RPC(s) (((s) == RPC_AUTHERROR) || \ 82 ((s) == RPC_CANTENCODEARGS) || \ 83 ((s) == RPC_CANTDECODERES) || \ 84 ((s) == RPC_VERSMISMATCH) || \ 85 ((s) == RPC_PROCUNAVAIL) || \ 86 ((s) == RPC_PROGUNAVAIL) || \ 87 ((s) == RPC_PROGVERSMISMATCH) || \ 88 ((s) == RPC_CANTDECODEARGS)) 89 90 /* 91 * Error info. 92 */ 93 struct rpc_err { 94 enum clnt_stat re_status; 95 union { 96 int RE_errno; /* related system error */ 97 enum auth_stat RE_why; /* why the auth error occurred */ 98 struct { 99 rpcvers_t low; /* lowest version supported */ 100 rpcvers_t high; /* highest version supported */ 101 } RE_vers; 102 struct { /* maybe meaningful if RPC_FAILED */ 103 int32_t s1; 104 int32_t s2; 105 } RE_lb; /* life boot & debugging only */ 106 } ru; 107 #define re_errno ru.RE_errno 108 #define re_why ru.RE_why 109 #define re_vers ru.RE_vers 110 #define re_lb ru.RE_lb 111 }; 112 113 #ifdef _KERNEL 114 /* 115 * Functions of this type may be used to receive notification when RPC 116 * calls have to be re-transmitted etc. 117 */ 118 typedef void rpc_feedback(int cmd, int procnum, void *); 119 120 /* 121 * A structure used with CLNT_CALL_EXT to pass extra information used 122 * while processing an RPC call. 123 */ 124 struct rpc_callextra { 125 AUTH *rc_auth; /* auth handle to use for this call */ 126 rpc_feedback *rc_feedback; /* callback for retransmits etc. */ 127 void *rc_feedback_arg; /* argument for callback */ 128 }; 129 #endif 130 131 /* 132 * Client rpc handle. 133 * Created by individual implementations 134 * Client is responsible for initializing auth, see e.g. auth_none.c. 135 */ 136 typedef struct __rpc_client { 137 #ifdef _KERNEL 138 volatile u_int cl_refs; /* reference count */ 139 AUTH *cl_auth; /* authenticator */ 140 struct clnt_ops { 141 /* call remote procedure */ 142 enum clnt_stat (*cl_call)(struct __rpc_client *, 143 struct rpc_callextra *, rpcproc_t, xdrproc_t, void *, 144 xdrproc_t, void *, struct timeval); 145 /* abort a call */ 146 void (*cl_abort)(struct __rpc_client *); 147 /* get specific error code */ 148 void (*cl_geterr)(struct __rpc_client *, 149 struct rpc_err *); 150 /* frees results */ 151 bool_t (*cl_freeres)(struct __rpc_client *, 152 xdrproc_t, void *); 153 /* destroy this structure */ 154 void (*cl_destroy)(struct __rpc_client *); 155 /* the ioctl() of rpc */ 156 bool_t (*cl_control)(struct __rpc_client *, u_int, 157 void *); 158 } *cl_ops; 159 #else 160 AUTH *cl_auth; /* authenticator */ 161 struct clnt_ops { 162 /* call remote procedure */ 163 enum clnt_stat (*cl_call)(struct __rpc_client *, 164 rpcproc_t, xdrproc_t, void *, xdrproc_t, 165 void *, struct timeval); 166 /* abort a call */ 167 void (*cl_abort)(struct __rpc_client *); 168 /* get specific error code */ 169 void (*cl_geterr)(struct __rpc_client *, 170 struct rpc_err *); 171 /* frees results */ 172 bool_t (*cl_freeres)(struct __rpc_client *, 173 xdrproc_t, void *); 174 /* destroy this structure */ 175 void (*cl_destroy)(struct __rpc_client *); 176 /* the ioctl() of rpc */ 177 bool_t (*cl_control)(struct __rpc_client *, u_int, 178 void *); 179 } *cl_ops; 180 #endif 181 void *cl_private; /* private stuff */ 182 char *cl_netid; /* network token */ 183 char *cl_tp; /* device name */ 184 } CLIENT; 185 186 /* 187 * Timers used for the pseudo-transport protocol when using datagrams 188 */ 189 struct rpc_timers { 190 u_short rt_srtt; /* smoothed round-trip time */ 191 u_short rt_deviate; /* estimated deviation */ 192 u_long rt_rtxcur; /* current (backed-off) rto */ 193 }; 194 195 /* 196 * Feedback values used for possible congestion and rate control 197 */ 198 #define FEEDBACK_OK 1 /* no retransmits */ 199 #define FEEDBACK_REXMIT1 2 /* first retransmit */ 200 #define FEEDBACK_REXMIT2 3 /* second and subsequent retransmit */ 201 #define FEEDBACK_RECONNECT 4 /* client reconnect */ 202 203 /* Used to set version of portmapper used in broadcast */ 204 205 #define CLCR_SET_LOWVERS 3 206 #define CLCR_GET_LOWVERS 4 207 208 #define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ 209 210 /* 211 * client side rpc interface ops 212 * 213 * Parameter types are: 214 * 215 */ 216 217 #ifdef _KERNEL 218 #define CLNT_ACQUIRE(rh) \ 219 refcount_acquire(&(rh)->cl_refs) 220 #define CLNT_RELEASE(rh) \ 221 if (refcount_release(&(rh)->cl_refs)) \ 222 CLNT_DESTROY(rh) 223 224 /* 225 * enum clnt_stat 226 * CLNT_CALL_EXT(rh, ext, proc, xargs, argsp, xres, resp, timeout) 227 * CLIENT *rh; 228 * struct rpc_callextra *ext; 229 * rpcproc_t proc; 230 * xdrproc_t xargs; 231 * void *argsp; 232 * xdrproc_t xres; 233 * void *resp; 234 * struct timeval timeout; 235 */ 236 #define CLNT_CALL_EXT(rh, ext, proc, xargs, argsp, xres, resp, secs) \ 237 ((*(rh)->cl_ops->cl_call)(rh, ext, proc, xargs, \ 238 argsp, xres, resp, secs)) 239 #endif 240 241 /* 242 * enum clnt_stat 243 * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) 244 * CLIENT *rh; 245 * rpcproc_t proc; 246 * xdrproc_t xargs; 247 * void *argsp; 248 * xdrproc_t xres; 249 * void *resp; 250 * struct timeval timeout; 251 */ 252 #ifdef _KERNEL 253 #define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ 254 ((*(rh)->cl_ops->cl_call)(rh, NULL, proc, xargs, \ 255 argsp, xres, resp, secs)) 256 #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ 257 ((*(rh)->cl_ops->cl_call)(rh, NULL, proc, xargs, \ 258 argsp, xres, resp, secs)) 259 #else 260 #define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ 261 ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \ 262 argsp, xres, resp, secs)) 263 #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ 264 ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \ 265 argsp, xres, resp, secs)) 266 #endif 267 268 /* 269 * void 270 * CLNT_ABORT(rh); 271 * CLIENT *rh; 272 */ 273 #define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) 274 #define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) 275 276 /* 277 * struct rpc_err 278 * CLNT_GETERR(rh); 279 * CLIENT *rh; 280 */ 281 #define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) 282 #define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) 283 284 285 /* 286 * bool_t 287 * CLNT_FREERES(rh, xres, resp); 288 * CLIENT *rh; 289 * xdrproc_t xres; 290 * void *resp; 291 */ 292 #define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) 293 #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) 294 295 /* 296 * bool_t 297 * CLNT_CONTROL(cl, request, info) 298 * CLIENT *cl; 299 * u_int request; 300 * char *info; 301 */ 302 #define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) 303 #define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) 304 305 /* 306 * control operations that apply to both udp and tcp transports 307 */ 308 #define CLSET_TIMEOUT 1 /* set timeout (timeval) */ 309 #define CLGET_TIMEOUT 2 /* get timeout (timeval) */ 310 #define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ 311 #define CLGET_FD 6 /* get connections file descriptor */ 312 #define CLGET_SVC_ADDR 7 /* get server's address (netbuf) */ 313 #define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */ 314 #define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy */ 315 #define CLGET_XID 10 /* Get xid */ 316 #define CLSET_XID 11 /* Set xid */ 317 #define CLGET_VERS 12 /* Get version number */ 318 #define CLSET_VERS 13 /* Set version number */ 319 #define CLGET_PROG 14 /* Get program number */ 320 #define CLSET_PROG 15 /* Set program number */ 321 #define CLSET_SVC_ADDR 16 /* get server's address (netbuf) */ 322 #define CLSET_PUSH_TIMOD 17 /* push timod if not already present */ 323 #define CLSET_POP_TIMOD 18 /* pop timod */ 324 /* 325 * Connectionless only control operations 326 */ 327 #define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ 328 #define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ 329 #define CLSET_ASYNC 19 330 #define CLSET_CONNECT 20 /* Use connect() for UDP. (int) */ 331 332 #ifdef _KERNEL 333 /* 334 * Kernel control operations. The default msleep string is "rpcrecv", 335 * and sleeps are non-interruptible by default. 336 */ 337 #define CLSET_WAITCHAN 21 /* set string to use in msleep call */ 338 #define CLGET_WAITCHAN 22 /* get string used in msleep call */ 339 #define CLSET_INTERRUPTIBLE 23 /* set interruptible flag */ 340 #define CLGET_INTERRUPTIBLE 24 /* set interruptible flag */ 341 #define CLSET_RETRIES 25 /* set retry count for reconnect */ 342 #define CLGET_RETRIES 26 /* get retry count for reconnect */ 343 #endif 344 345 346 /* 347 * void 348 * CLNT_DESTROY(rh); 349 * CLIENT *rh; 350 */ 351 #define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) 352 #define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) 353 354 355 /* 356 * RPCTEST is a test program which is accessible on every rpc 357 * transport/port. It is used for testing, performance evaluation, 358 * and network administration. 359 */ 360 361 #define RPCTEST_PROGRAM ((rpcprog_t)1) 362 #define RPCTEST_VERSION ((rpcvers_t)1) 363 #define RPCTEST_NULL_PROC ((rpcproc_t)2) 364 #define RPCTEST_NULL_BATCH_PROC ((rpcproc_t)3) 365 366 /* 367 * By convention, procedure 0 takes null arguments and returns them 368 */ 369 370 #define NULLPROC ((rpcproc_t)0) 371 372 /* 373 * Below are the client handle creation routines for the various 374 * implementations of client side rpc. They can return NULL if a 375 * creation failure occurs. 376 */ 377 378 /* 379 * Generic client creation routine. Supported protocols are those that 380 * belong to the nettype namespace (/etc/netconfig). 381 */ 382 __BEGIN_DECLS 383 #ifdef _KERNEL 384 385 /* 386 * struct socket *so; -- socket 387 * struct sockaddr *svcaddr; -- servers address 388 * rpcprog_t prog; -- program number 389 * rpcvers_t vers; -- version number 390 * size_t sendsz; -- buffer recv size 391 * size_t recvsz; -- buffer send size 392 */ 393 extern CLIENT *clnt_dg_create(struct socket *so, 394 struct sockaddr *svcaddr, rpcprog_t program, rpcvers_t version, 395 size_t sendsz, size_t recvsz); 396 397 /* 398 * struct socket *so; -- socket 399 * struct sockaddr *svcaddr; -- servers address 400 * rpcprog_t prog; -- program number 401 * rpcvers_t vers; -- version number 402 * size_t sendsz; -- buffer recv size 403 * size_t recvsz; -- buffer send size 404 */ 405 extern CLIENT *clnt_vc_create(struct socket *so, 406 struct sockaddr *svcaddr, rpcprog_t program, rpcvers_t version, 407 size_t sendsz, size_t recvsz); 408 409 /* 410 * struct netconfig *nconf; -- network type 411 * struct sockaddr *svcaddr; -- servers address 412 * rpcprog_t prog; -- program number 413 * rpcvers_t vers; -- version number 414 * size_t sendsz; -- buffer recv size 415 * size_t recvsz; -- buffer send size 416 */ 417 extern CLIENT *clnt_reconnect_create(struct netconfig *nconf, 418 struct sockaddr *svcaddr, rpcprog_t program, rpcvers_t version, 419 size_t sendsz, size_t recvsz); 420 421 #else 422 423 extern CLIENT *clnt_create(const char *, const rpcprog_t, const rpcvers_t, 424 const char *); 425 /* 426 * 427 * const char *hostname; -- hostname 428 * const rpcprog_t prog; -- program number 429 * const rpcvers_t vers; -- version number 430 * const char *nettype; -- network type 431 */ 432 433 /* 434 * Generic client creation routine. Just like clnt_create(), except 435 * it takes an additional timeout parameter. 436 */ 437 extern CLIENT * clnt_create_timed(const char *, const rpcprog_t, 438 const rpcvers_t, const char *, const struct timeval *); 439 /* 440 * 441 * const char *hostname; -- hostname 442 * const rpcprog_t prog; -- program number 443 * const rpcvers_t vers; -- version number 444 * const char *nettype; -- network type 445 * const struct timeval *tp; -- timeout 446 */ 447 448 /* 449 * Generic client creation routine. Supported protocols are which belong 450 * to the nettype name space. 451 */ 452 extern CLIENT *clnt_create_vers(const char *, const rpcprog_t, rpcvers_t *, 453 const rpcvers_t, const rpcvers_t, 454 const char *); 455 /* 456 * const char *host; -- hostname 457 * const rpcprog_t prog; -- program number 458 * rpcvers_t *vers_out; -- servers highest available version 459 * const rpcvers_t vers_low; -- low version number 460 * const rpcvers_t vers_high; -- high version number 461 * const char *nettype; -- network type 462 */ 463 464 /* 465 * Generic client creation routine. Supported protocols are which belong 466 * to the nettype name space. 467 */ 468 extern CLIENT * clnt_create_vers_timed(const char *, const rpcprog_t, 469 rpcvers_t *, const rpcvers_t, const rpcvers_t, const char *, 470 const struct timeval *); 471 /* 472 * const char *host; -- hostname 473 * const rpcprog_t prog; -- program number 474 * rpcvers_t *vers_out; -- servers highest available version 475 * const rpcvers_t vers_low; -- low version number 476 * const rpcvers_t vers_high; -- high version number 477 * const char *nettype; -- network type 478 * const struct timeval *tp -- timeout 479 */ 480 481 /* 482 * Generic client creation routine. It takes a netconfig structure 483 * instead of nettype 484 */ 485 extern CLIENT *clnt_tp_create(const char *, const rpcprog_t, 486 const rpcvers_t, const struct netconfig *); 487 /* 488 * const char *hostname; -- hostname 489 * const rpcprog_t prog; -- program number 490 * const rpcvers_t vers; -- version number 491 * const struct netconfig *netconf; -- network config structure 492 */ 493 494 /* 495 * Generic client creation routine. Just like clnt_tp_create(), except 496 * it takes an additional timeout parameter. 497 */ 498 extern CLIENT * clnt_tp_create_timed(const char *, const rpcprog_t, 499 const rpcvers_t, const struct netconfig *, const struct timeval *); 500 /* 501 * const char *hostname; -- hostname 502 * const rpcprog_t prog; -- program number 503 * const rpcvers_t vers; -- version number 504 * const struct netconfig *netconf; -- network config structure 505 * const struct timeval *tp -- timeout 506 */ 507 508 /* 509 * Generic TLI create routine. Only provided for compatibility. 510 */ 511 512 extern CLIENT *clnt_tli_create(const int, const struct netconfig *, 513 struct netbuf *, const rpcprog_t, 514 const rpcvers_t, const u_int, const u_int); 515 /* 516 * const register int fd; -- fd 517 * const struct netconfig *nconf; -- netconfig structure 518 * struct netbuf *svcaddr; -- servers address 519 * const u_long prog; -- program number 520 * const u_long vers; -- version number 521 * const u_int sendsz; -- send size 522 * const u_int recvsz; -- recv size 523 */ 524 525 /* 526 * Low level clnt create routine for connectionful transports, e.g. tcp. 527 */ 528 extern CLIENT *clnt_vc_create(const int, const struct netbuf *, 529 const rpcprog_t, const rpcvers_t, 530 u_int, u_int); 531 /* 532 * Added for compatibility to old rpc 4.0. Obsoleted by clnt_vc_create(). 533 */ 534 extern CLIENT *clntunix_create(struct sockaddr_un *, 535 u_long, u_long, int *, u_int, u_int); 536 /* 537 * const int fd; -- open file descriptor 538 * const struct netbuf *svcaddr; -- servers address 539 * const rpcprog_t prog; -- program number 540 * const rpcvers_t vers; -- version number 541 * const u_int sendsz; -- buffer recv size 542 * const u_int recvsz; -- buffer send size 543 */ 544 545 /* 546 * Low level clnt create routine for connectionless transports, e.g. udp. 547 */ 548 extern CLIENT *clnt_dg_create(const int, const struct netbuf *, 549 const rpcprog_t, const rpcvers_t, 550 const u_int, const u_int); 551 /* 552 * const int fd; -- open file descriptor 553 * const struct netbuf *svcaddr; -- servers address 554 * const rpcprog_t program; -- program number 555 * const rpcvers_t version; -- version number 556 * const u_int sendsz; -- buffer recv size 557 * const u_int recvsz; -- buffer send size 558 */ 559 560 /* 561 * Memory based rpc (for speed check and testing) 562 * CLIENT * 563 * clnt_raw_create(prog, vers) 564 * u_long prog; 565 * u_long vers; 566 */ 567 extern CLIENT *clnt_raw_create(rpcprog_t, rpcvers_t); 568 #endif 569 570 __END_DECLS 571 572 573 /* 574 * Print why creation failed 575 */ 576 __BEGIN_DECLS 577 extern void clnt_pcreateerror(const char *); /* stderr */ 578 extern char *clnt_spcreateerror(const char *); /* string */ 579 __END_DECLS 580 581 /* 582 * Like clnt_perror(), but is more verbose in its output 583 */ 584 __BEGIN_DECLS 585 extern void clnt_perrno(enum clnt_stat); /* stderr */ 586 extern char *clnt_sperrno(enum clnt_stat); /* string */ 587 __END_DECLS 588 589 /* 590 * Print an English error message, given the client error code 591 */ 592 __BEGIN_DECLS 593 extern void clnt_perror(CLIENT *, const char *); /* stderr */ 594 extern char *clnt_sperror(CLIENT *, const char *); /* string */ 595 __END_DECLS 596 597 598 /* 599 * If a creation fails, the following allows the user to figure out why. 600 */ 601 struct rpc_createerr { 602 enum clnt_stat cf_stat; 603 struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ 604 }; 605 606 #ifdef _KERNEL 607 extern struct rpc_createerr rpc_createerr; 608 #else 609 __BEGIN_DECLS 610 extern struct rpc_createerr *__rpc_createerr(void); 611 __END_DECLS 612 #define rpc_createerr (*(__rpc_createerr())) 613 #endif 614 615 #ifndef _KERNEL 616 /* 617 * The simplified interface: 618 * enum clnt_stat 619 * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype) 620 * const char *host; 621 * const rpcprog_t prognum; 622 * const rpcvers_t versnum; 623 * const rpcproc_t procnum; 624 * const xdrproc_t inproc, outproc; 625 * const char *in; 626 * char *out; 627 * const char *nettype; 628 */ 629 __BEGIN_DECLS 630 extern enum clnt_stat rpc_call(const char *, const rpcprog_t, 631 const rpcvers_t, const rpcproc_t, 632 const xdrproc_t, const char *, 633 const xdrproc_t, char *, const char *); 634 __END_DECLS 635 636 /* 637 * RPC broadcast interface 638 * The call is broadcasted to all locally connected nets. 639 * 640 * extern enum clnt_stat 641 * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, 642 * eachresult, nettype) 643 * const rpcprog_t prog; -- program number 644 * const rpcvers_t vers; -- version number 645 * const rpcproc_t proc; -- procedure number 646 * const xdrproc_t xargs; -- xdr routine for args 647 * caddr_t argsp; -- pointer to args 648 * const xdrproc_t xresults; -- xdr routine for results 649 * caddr_t resultsp; -- pointer to results 650 * const resultproc_t eachresult; -- call with each result 651 * const char *nettype; -- Transport type 652 * 653 * For each valid response received, the procedure eachresult is called. 654 * Its form is: 655 * done = eachresult(resp, raddr, nconf) 656 * bool_t done; 657 * caddr_t resp; 658 * struct netbuf *raddr; 659 * struct netconfig *nconf; 660 * where resp points to the results of the call and raddr is the 661 * address if the responder to the broadcast. nconf is the transport 662 * on which the response was received. 663 * 664 * extern enum clnt_stat 665 * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp, 666 * eachresult, inittime, waittime, nettype) 667 * const rpcprog_t prog; -- program number 668 * const rpcvers_t vers; -- version number 669 * const rpcproc_t proc; -- procedure number 670 * const xdrproc_t xargs; -- xdr routine for args 671 * caddr_t argsp; -- pointer to args 672 * const xdrproc_t xresults; -- xdr routine for results 673 * caddr_t resultsp; -- pointer to results 674 * const resultproc_t eachresult; -- call with each result 675 * const int inittime; -- how long to wait initially 676 * const int waittime; -- maximum time to wait 677 * const char *nettype; -- Transport type 678 */ 679 680 typedef bool_t (*resultproc_t)(caddr_t, ...); 681 682 __BEGIN_DECLS 683 extern enum clnt_stat rpc_broadcast(const rpcprog_t, const rpcvers_t, 684 const rpcproc_t, const xdrproc_t, 685 caddr_t, const xdrproc_t, caddr_t, 686 const resultproc_t, const char *); 687 extern enum clnt_stat rpc_broadcast_exp(const rpcprog_t, const rpcvers_t, 688 const rpcproc_t, const xdrproc_t, 689 caddr_t, const xdrproc_t, caddr_t, 690 const resultproc_t, const int, 691 const int, const char *); 692 __END_DECLS 693 694 /* For backward compatibility */ 695 #include <rpc/clnt_soc.h> 696 #endif 697 698 #endif /* !_RPC_CLNT_H_ */ 699