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