1 /* $NetBSD: clnt_bcast.c,v 1.3 2000/07/06 03:05:20 christos Exp $ */ 2 3 /* 4 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 5 * unrestricted use provided that this legend is included on all tape 6 * media and as a part of the software program in whole or part. Users 7 * may copy or modify Sun RPC without charge, but are not authorized 8 * to license or distribute it to anyone else except as part of a product or 9 * program developed by the user. 10 * 11 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 12 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 13 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 14 * 15 * Sun RPC is provided with no support and without any obligation on the 16 * part of Sun Microsystems, Inc. to assist in its use, correction, 17 * modification or enhancement. 18 * 19 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 20 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 21 * OR ANY PART THEREOF. 22 * 23 * In no event will Sun Microsystems, Inc. be liable for any lost revenue 24 * or profits or other special, indirect and consequential damages, even if 25 * Sun has been advised of the possibility of such damages. 26 * 27 * Sun Microsystems, Inc. 28 * 2550 Garcia Avenue 29 * Mountain View, California 94043 30 */ 31 /* 32 * Copyright (c) 1986-1991 by Sun Microsystems Inc. 33 */ 34 35 /* #ident "@(#)clnt_bcast.c 1.18 94/05/03 SMI" */ 36 37 #if !defined(lint) && defined(SCCSIDS) 38 static char sccsid[] = "@(#)clnt_bcast.c 1.15 89/04/21 Copyr 1988 Sun Micro"; 39 #endif 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD$"); 42 43 44 /* 45 * clnt_bcast.c 46 * Client interface to broadcast service. 47 * 48 * Copyright (C) 1988, Sun Microsystems, Inc. 49 * 50 * The following is kludged-up support for simple rpc broadcasts. 51 * Someday a large, complicated system will replace these routines. 52 */ 53 54 #include "namespace.h" 55 #include <sys/types.h> 56 #include <sys/socket.h> 57 #include <sys/queue.h> 58 #include <net/if.h> 59 #include <netinet/in.h> 60 #include <ifaddrs.h> 61 #include <sys/poll.h> 62 #include <rpc/rpc.h> 63 #ifdef PORTMAP 64 #include <rpc/pmap_prot.h> 65 #include <rpc/pmap_clnt.h> 66 #include <rpc/pmap_rmt.h> 67 #endif /* PORTMAP */ 68 #include <rpc/nettype.h> 69 #include <arpa/inet.h> 70 #ifdef RPC_DEBUG 71 #include <stdio.h> 72 #endif 73 #include <errno.h> 74 #include <stdlib.h> 75 #include <unistd.h> 76 #include <netdb.h> 77 #include <err.h> 78 #include <string.h> 79 #include "un-namespace.h" 80 81 #include "rpc_com.h" 82 83 #define MAXBCAST 20 /* Max no of broadcasting transports */ 84 #define INITTIME 4000 /* Time to wait initially */ 85 #define WAITTIME 8000 /* Maximum time to wait */ 86 87 /* 88 * If nettype is NULL, it broadcasts on all the available 89 * datagram_n transports. May potentially lead to broadacst storms 90 * and hence should be used with caution, care and courage. 91 * 92 * The current parameter xdr packet size is limited by the max tsdu 93 * size of the transport. If the max tsdu size of any transport is 94 * smaller than the parameter xdr packet, then broadcast is not 95 * sent on that transport. 96 * 97 * Also, the packet size should be less the packet size of 98 * the data link layer (for ethernet it is 1400 bytes). There is 99 * no easy way to find out the max size of the data link layer and 100 * we are assuming that the args would be smaller than that. 101 * 102 * The result size has to be smaller than the transport tsdu size. 103 * 104 * If PORTMAP has been defined, we send two packets for UDP, one for 105 * rpcbind and one for portmap. For those machines which support 106 * both rpcbind and portmap, it will cause them to reply twice, and 107 * also here it will get two responses ... inefficient and clumsy. 108 */ 109 110 struct broadif { 111 int index; 112 struct sockaddr_storage broadaddr; 113 TAILQ_ENTRY(broadif) link; 114 }; 115 116 typedef TAILQ_HEAD(, broadif) broadlist_t; 117 118 int __rpc_getbroadifs(int, int, int, broadlist_t *); 119 void __rpc_freebroadifs(broadlist_t *); 120 int __rpc_broadenable(int, int, struct broadif *); 121 122 int __rpc_lowvers = 0; 123 124 int 125 __rpc_getbroadifs(int af, int proto, int socktype, broadlist_t *list) 126 { 127 int count = 0; 128 struct broadif *bip; 129 struct ifaddrs *ifap, *ifp; 130 #ifdef INET6 131 struct sockaddr_in6 *sin6; 132 #endif 133 struct sockaddr_in *sin; 134 struct addrinfo hints, *res; 135 136 if (getifaddrs(&ifp) < 0) 137 return 0; 138 139 memset(&hints, 0, sizeof hints); 140 141 hints.ai_family = af; 142 hints.ai_protocol = proto; 143 hints.ai_socktype = socktype; 144 145 if (getaddrinfo(NULL, "sunrpc", &hints, &res) != 0) 146 return 0; 147 148 for (ifap = ifp; ifap != NULL; ifap = ifap->ifa_next) { 149 if (ifap->ifa_addr->sa_family != af || 150 !(ifap->ifa_flags & IFF_UP)) 151 continue; 152 bip = (struct broadif *)malloc(sizeof *bip); 153 if (bip == NULL) 154 break; 155 bip->index = if_nametoindex(ifap->ifa_name); 156 if ( 157 #ifdef INET6 158 af != AF_INET6 && 159 #endif 160 (ifap->ifa_flags & IFF_BROADCAST) && 161 ifap->ifa_broadaddr) { 162 memcpy(&bip->broadaddr, ifap->ifa_broadaddr, 163 (size_t)ifap->ifa_broadaddr->sa_len); 164 sin = (struct sockaddr_in *)(void *)&bip->broadaddr; 165 sin->sin_port = 166 ((struct sockaddr_in *) 167 (void *)res->ai_addr)->sin_port; 168 } else 169 #ifdef INET6 170 if (af == AF_INET6 && (ifap->ifa_flags & IFF_MULTICAST)) { 171 sin6 = (struct sockaddr_in6 *)(void *)&bip->broadaddr; 172 inet_pton(af, RPCB_MULTICAST_ADDR, &sin6->sin6_addr); 173 sin6->sin6_family = af; 174 sin6->sin6_len = sizeof *sin6; 175 sin6->sin6_port = 176 ((struct sockaddr_in6 *) 177 (void *)res->ai_addr)->sin6_port; 178 sin6->sin6_scope_id = bip->index; 179 } else 180 #endif 181 { 182 free(bip); 183 continue; 184 } 185 TAILQ_INSERT_TAIL(list, bip, link); 186 count++; 187 } 188 freeifaddrs(ifp); 189 freeaddrinfo(res); 190 191 return count; 192 } 193 194 void 195 __rpc_freebroadifs(broadlist_t *list) 196 { 197 struct broadif *bip, *next; 198 199 bip = TAILQ_FIRST(list); 200 201 while (bip != NULL) { 202 next = TAILQ_NEXT(bip, link); 203 free(bip); 204 bip = next; 205 } 206 } 207 208 int 209 /*ARGSUSED*/ 210 __rpc_broadenable(int af, int s, struct broadif *bip) 211 { 212 int o = 1; 213 214 #if 0 215 if (af == AF_INET6) { 216 fprintf(stderr, "set v6 multicast if to %d\n", bip->index); 217 if (_setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_IF, &bip->index, 218 sizeof bip->index) < 0) 219 return -1; 220 } else 221 #endif 222 if (_setsockopt(s, SOL_SOCKET, SO_BROADCAST, &o, sizeof o) < 0) 223 return -1; 224 225 return 0; 226 } 227 228 229 enum clnt_stat 230 rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp, 231 eachresult, inittime, waittime, nettype) 232 rpcprog_t prog; /* program number */ 233 rpcvers_t vers; /* version number */ 234 rpcproc_t proc; /* procedure number */ 235 xdrproc_t xargs; /* xdr routine for args */ 236 caddr_t argsp; /* pointer to args */ 237 xdrproc_t xresults; /* xdr routine for results */ 238 caddr_t resultsp; /* pointer to results */ 239 resultproc_t eachresult; /* call with each result obtained */ 240 int inittime; /* how long to wait initially */ 241 int waittime; /* maximum time to wait */ 242 const char *nettype; /* transport type */ 243 { 244 enum clnt_stat stat = RPC_SUCCESS; /* Return status */ 245 XDR xdr_stream; /* XDR stream */ 246 XDR *xdrs = &xdr_stream; 247 struct rpc_msg msg; /* RPC message */ 248 struct timeval t; 249 char *outbuf = NULL; /* Broadcast msg buffer */ 250 char *inbuf = NULL; /* Reply buf */ 251 int inlen; 252 u_int maxbufsize = 0; 253 AUTH *sys_auth = authunix_create_default(); 254 int i; 255 void *handle; 256 char uaddress[1024]; /* A self imposed limit */ 257 char *uaddrp = uaddress; 258 int pmap_reply_flag; /* reply recvd from PORTMAP */ 259 /* An array of all the suitable broadcast transports */ 260 struct { 261 int fd; /* File descriptor */ 262 int af; 263 int proto; 264 struct netconfig *nconf; /* Netconfig structure */ 265 u_int asize; /* Size of the addr buf */ 266 u_int dsize; /* Size of the data buf */ 267 struct sockaddr_storage raddr; /* Remote address */ 268 broadlist_t nal; 269 } fdlist[MAXBCAST]; 270 struct pollfd pfd[MAXBCAST]; 271 size_t fdlistno = 0; 272 struct r_rpcb_rmtcallargs barg; /* Remote arguments */ 273 struct r_rpcb_rmtcallres bres; /* Remote results */ 274 size_t outlen; 275 struct netconfig *nconf; 276 int msec; 277 int pollretval; 278 int fds_found; 279 280 #ifdef PORTMAP 281 size_t outlen_pmap = 0; 282 u_long port; /* Remote port number */ 283 int pmap_flag = 0; /* UDP exists ? */ 284 char *outbuf_pmap = NULL; 285 struct rmtcallargs barg_pmap; /* Remote arguments */ 286 struct rmtcallres bres_pmap; /* Remote results */ 287 u_int udpbufsz = 0; 288 #endif /* PORTMAP */ 289 290 if (sys_auth == NULL) { 291 return (RPC_SYSTEMERROR); 292 } 293 /* 294 * initialization: create a fd, a broadcast address, and send the 295 * request on the broadcast transport. 296 * Listen on all of them and on replies, call the user supplied 297 * function. 298 */ 299 300 if (nettype == NULL) 301 nettype = "datagram_n"; 302 if ((handle = __rpc_setconf(nettype)) == NULL) { 303 return (RPC_UNKNOWNPROTO); 304 } 305 while ((nconf = __rpc_getconf(handle)) != NULL) { 306 int fd; 307 struct __rpc_sockinfo si; 308 309 if (nconf->nc_semantics != NC_TPI_CLTS) 310 continue; 311 if (fdlistno >= MAXBCAST) 312 break; /* No more slots available */ 313 if (!__rpc_nconf2sockinfo(nconf, &si)) 314 continue; 315 316 TAILQ_INIT(&fdlist[fdlistno].nal); 317 if (__rpc_getbroadifs(si.si_af, si.si_proto, si.si_socktype, 318 &fdlist[fdlistno].nal) == 0) 319 continue; 320 321 fd = _socket(si.si_af, si.si_socktype, si.si_proto); 322 if (fd < 0) { 323 stat = RPC_CANTSEND; 324 continue; 325 } 326 fdlist[fdlistno].af = si.si_af; 327 fdlist[fdlistno].proto = si.si_proto; 328 fdlist[fdlistno].fd = fd; 329 fdlist[fdlistno].nconf = nconf; 330 fdlist[fdlistno].asize = __rpc_get_a_size(si.si_af); 331 pfd[fdlistno].events = POLLIN | POLLPRI | 332 POLLRDNORM | POLLRDBAND; 333 pfd[fdlistno].fd = fdlist[fdlistno].fd = fd; 334 fdlist[fdlistno].dsize = __rpc_get_t_size(si.si_af, si.si_proto, 335 0); 336 337 if (maxbufsize <= fdlist[fdlistno].dsize) 338 maxbufsize = fdlist[fdlistno].dsize; 339 340 #ifdef PORTMAP 341 if (si.si_af == AF_INET && si.si_proto == IPPROTO_UDP) { 342 udpbufsz = fdlist[fdlistno].dsize; 343 if ((outbuf_pmap = malloc(udpbufsz)) == NULL) { 344 _close(fd); 345 stat = RPC_SYSTEMERROR; 346 goto done_broad; 347 } 348 pmap_flag = 1; 349 } 350 #endif /* PORTMAP */ 351 fdlistno++; 352 } 353 354 if (fdlistno == 0) { 355 if (stat == RPC_SUCCESS) 356 stat = RPC_UNKNOWNPROTO; 357 goto done_broad; 358 } 359 if (maxbufsize == 0) { 360 if (stat == RPC_SUCCESS) 361 stat = RPC_CANTSEND; 362 goto done_broad; 363 } 364 inbuf = malloc(maxbufsize); 365 outbuf = malloc(maxbufsize); 366 if ((inbuf == NULL) || (outbuf == NULL)) { 367 stat = RPC_SYSTEMERROR; 368 goto done_broad; 369 } 370 371 /* Serialize all the arguments which have to be sent */ 372 (void) gettimeofday(&t, NULL); 373 msg.rm_xid = __RPC_GETXID(&t); 374 msg.rm_direction = CALL; 375 msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; 376 msg.rm_call.cb_prog = RPCBPROG; 377 msg.rm_call.cb_vers = RPCBVERS; 378 msg.rm_call.cb_proc = RPCBPROC_CALLIT; 379 barg.prog = prog; 380 barg.vers = vers; 381 barg.proc = proc; 382 barg.args.args_val = argsp; 383 barg.xdr_args = xargs; 384 bres.addr = uaddrp; 385 bres.results.results_val = resultsp; 386 bres.xdr_res = xresults; 387 msg.rm_call.cb_cred = sys_auth->ah_cred; 388 msg.rm_call.cb_verf = sys_auth->ah_verf; 389 xdrmem_create(xdrs, outbuf, maxbufsize, XDR_ENCODE); 390 if ((!xdr_callmsg(xdrs, &msg)) || 391 (!xdr_rpcb_rmtcallargs(xdrs, 392 (struct rpcb_rmtcallargs *)(void *)&barg))) { 393 stat = RPC_CANTENCODEARGS; 394 goto done_broad; 395 } 396 outlen = xdr_getpos(xdrs); 397 xdr_destroy(xdrs); 398 399 #ifdef PORTMAP 400 /* Prepare the packet for version 2 PORTMAP */ 401 if (pmap_flag) { 402 msg.rm_xid++; /* One way to distinguish */ 403 msg.rm_call.cb_prog = PMAPPROG; 404 msg.rm_call.cb_vers = PMAPVERS; 405 msg.rm_call.cb_proc = PMAPPROC_CALLIT; 406 barg_pmap.prog = prog; 407 barg_pmap.vers = vers; 408 barg_pmap.proc = proc; 409 barg_pmap.args_ptr = argsp; 410 barg_pmap.xdr_args = xargs; 411 bres_pmap.port_ptr = &port; 412 bres_pmap.xdr_results = xresults; 413 bres_pmap.results_ptr = resultsp; 414 xdrmem_create(xdrs, outbuf_pmap, udpbufsz, XDR_ENCODE); 415 if ((! xdr_callmsg(xdrs, &msg)) || 416 (! xdr_rmtcall_args(xdrs, &barg_pmap))) { 417 stat = RPC_CANTENCODEARGS; 418 goto done_broad; 419 } 420 outlen_pmap = xdr_getpos(xdrs); 421 xdr_destroy(xdrs); 422 } 423 #endif /* PORTMAP */ 424 425 /* 426 * Basic loop: broadcast the packets to transports which 427 * support data packets of size such that one can encode 428 * all the arguments. 429 * Wait a while for response(s). 430 * The response timeout grows larger per iteration. 431 */ 432 for (msec = inittime; msec <= waittime; msec += msec) { 433 struct broadif *bip; 434 435 /* Broadcast all the packets now */ 436 for (i = 0; i < fdlistno; i++) { 437 if (fdlist[i].dsize < outlen) { 438 stat = RPC_CANTSEND; 439 continue; 440 } 441 for (bip = TAILQ_FIRST(&fdlist[i].nal); bip != NULL; 442 bip = TAILQ_NEXT(bip, link)) { 443 void *addr; 444 445 addr = &bip->broadaddr; 446 447 __rpc_broadenable(fdlist[i].af, fdlist[i].fd, 448 bip); 449 450 /* 451 * Only use version 3 if lowvers is not set 452 */ 453 454 if (!__rpc_lowvers) 455 if (_sendto(fdlist[i].fd, outbuf, 456 outlen, 0, (struct sockaddr*)addr, 457 (size_t)fdlist[i].asize) != 458 outlen) { 459 #ifdef RPC_DEBUG 460 perror("sendto"); 461 #endif 462 warnx("clnt_bcast: cannot send" 463 "broadcast packet"); 464 stat = RPC_CANTSEND; 465 continue; 466 }; 467 #ifdef RPC_DEBUG 468 if (!__rpc_lowvers) 469 fprintf(stderr, "Broadcast packet sent " 470 "for %s\n", 471 fdlist[i].nconf->nc_netid); 472 #endif 473 #ifdef PORTMAP 474 /* 475 * Send the version 2 packet also 476 * for UDP/IP 477 */ 478 if (pmap_flag && 479 fdlist[i].proto == IPPROTO_UDP) { 480 if (_sendto(fdlist[i].fd, outbuf_pmap, 481 outlen_pmap, 0, addr, 482 (size_t)fdlist[i].asize) != 483 outlen_pmap) { 484 warnx("clnt_bcast: " 485 "Cannot send broadcast packet"); 486 stat = RPC_CANTSEND; 487 continue; 488 } 489 } 490 #ifdef RPC_DEBUG 491 fprintf(stderr, "PMAP Broadcast packet " 492 "sent for %s\n", 493 fdlist[i].nconf->nc_netid); 494 #endif 495 #endif /* PORTMAP */ 496 } 497 /* End for sending all packets on this transport */ 498 } /* End for sending on all transports */ 499 500 if (eachresult == NULL) { 501 stat = RPC_SUCCESS; 502 goto done_broad; 503 } 504 505 /* 506 * Get all the replies from these broadcast requests 507 */ 508 recv_again: 509 510 switch (pollretval = _poll(pfd, fdlistno, msec)) { 511 case 0: /* timed out */ 512 stat = RPC_TIMEDOUT; 513 continue; 514 case -1: /* some kind of error - we ignore it */ 515 goto recv_again; 516 } /* end of poll results switch */ 517 518 for (i = fds_found = 0; 519 i < fdlistno && fds_found < pollretval; i++) { 520 bool_t done = FALSE; 521 522 if (pfd[i].revents == 0) 523 continue; 524 else if (pfd[i].revents & POLLNVAL) { 525 /* 526 * Something bad has happened to this descri- 527 * ptor. We can cause _poll() to ignore 528 * it simply by using a negative fd. We do that 529 * rather than compacting the pfd[] and fdlist[] 530 * arrays. 531 */ 532 pfd[i].fd = -1; 533 fds_found++; 534 continue; 535 } else 536 fds_found++; 537 #ifdef RPC_DEBUG 538 fprintf(stderr, "response for %s\n", 539 fdlist[i].nconf->nc_netid); 540 #endif 541 try_again: 542 inlen = _recvfrom(fdlist[i].fd, inbuf, fdlist[i].dsize, 543 0, (struct sockaddr *)(void *)&fdlist[i].raddr, 544 &fdlist[i].asize); 545 if (inlen < 0) { 546 if (errno == EINTR) 547 goto try_again; 548 warnx("clnt_bcast: Cannot receive reply to " 549 "broadcast"); 550 stat = RPC_CANTRECV; 551 continue; 552 } 553 if (inlen < sizeof (u_int32_t)) 554 continue; /* Drop that and go ahead */ 555 /* 556 * see if reply transaction id matches sent id. 557 * If so, decode the results. If return id is xid + 1 558 * it was a PORTMAP reply 559 */ 560 if (*((u_int32_t *)(void *)(inbuf)) == 561 *((u_int32_t *)(void *)(outbuf))) { 562 pmap_reply_flag = 0; 563 msg.acpted_rply.ar_verf = _null_auth; 564 msg.acpted_rply.ar_results.where = 565 (caddr_t)(void *)&bres; 566 msg.acpted_rply.ar_results.proc = 567 (xdrproc_t)xdr_rpcb_rmtcallres; 568 #ifdef PORTMAP 569 } else if (pmap_flag && 570 *((u_int32_t *)(void *)(inbuf)) == 571 *((u_int32_t *)(void *)(outbuf_pmap))) { 572 pmap_reply_flag = 1; 573 msg.acpted_rply.ar_verf = _null_auth; 574 msg.acpted_rply.ar_results.where = 575 (caddr_t)(void *)&bres_pmap; 576 msg.acpted_rply.ar_results.proc = 577 (xdrproc_t)xdr_rmtcallres; 578 #endif /* PORTMAP */ 579 } else 580 continue; 581 xdrmem_create(xdrs, inbuf, (u_int)inlen, XDR_DECODE); 582 if (xdr_replymsg(xdrs, &msg)) { 583 if ((msg.rm_reply.rp_stat == MSG_ACCEPTED) && 584 (msg.acpted_rply.ar_stat == SUCCESS)) { 585 struct netbuf taddr, *np; 586 struct sockaddr_in *sin; 587 588 #ifdef PORTMAP 589 if (pmap_flag && pmap_reply_flag) { 590 sin = (struct sockaddr_in *) 591 (void *)&fdlist[i].raddr; 592 sin->sin_port = 593 htons((u_short)port); 594 taddr.len = taddr.maxlen = 595 fdlist[i].raddr.ss_len; 596 taddr.buf = &fdlist[i].raddr; 597 done = (*eachresult)(resultsp, 598 &taddr, fdlist[i].nconf); 599 } else { 600 #endif /* PORTMAP */ 601 #ifdef RPC_DEBUG 602 fprintf(stderr, "uaddr %s\n", 603 uaddrp); 604 #endif 605 np = uaddr2taddr( 606 fdlist[i].nconf, uaddrp); 607 done = (*eachresult)(resultsp, 608 np, fdlist[i].nconf); 609 free(np); 610 #ifdef PORTMAP 611 } 612 #endif /* PORTMAP */ 613 } 614 /* otherwise, we just ignore the errors ... */ 615 } 616 /* else some kind of deserialization problem ... */ 617 618 xdrs->x_op = XDR_FREE; 619 msg.acpted_rply.ar_results.proc = (xdrproc_t) xdr_void; 620 (void) xdr_replymsg(xdrs, &msg); 621 (void) (*xresults)(xdrs, resultsp); 622 XDR_DESTROY(xdrs); 623 if (done) { 624 stat = RPC_SUCCESS; 625 goto done_broad; 626 } else { 627 goto recv_again; 628 } 629 } /* The recv for loop */ 630 } /* The giant for loop */ 631 632 done_broad: 633 if (inbuf) 634 (void) free(inbuf); 635 if (outbuf) 636 (void) free(outbuf); 637 #ifdef PORTMAP 638 if (outbuf_pmap) 639 (void) free(outbuf_pmap); 640 #endif /* PORTMAP */ 641 for (i = 0; i < fdlistno; i++) { 642 (void)_close(fdlist[i].fd); 643 __rpc_freebroadifs(&fdlist[i].nal); 644 } 645 AUTH_DESTROY(sys_auth); 646 (void) __rpc_endconf(handle); 647 648 return (stat); 649 } 650 651 652 enum clnt_stat 653 rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, 654 eachresult, nettype) 655 rpcprog_t prog; /* program number */ 656 rpcvers_t vers; /* version number */ 657 rpcproc_t proc; /* procedure number */ 658 xdrproc_t xargs; /* xdr routine for args */ 659 caddr_t argsp; /* pointer to args */ 660 xdrproc_t xresults; /* xdr routine for results */ 661 caddr_t resultsp; /* pointer to results */ 662 resultproc_t eachresult; /* call with each result obtained */ 663 const char *nettype; /* transport type */ 664 { 665 enum clnt_stat dummy; 666 667 dummy = rpc_broadcast_exp(prog, vers, proc, xargs, argsp, 668 xresults, resultsp, eachresult, 669 INITTIME, WAITTIME, nettype); 670 return (dummy); 671 } 672