277{
280 XDR *xdrs = &xdr_stream;
285 int inlen;
286 u_int maxbufsize = 0;
290 char uaddress[1024];
291 char *uaddrp = uaddress;
292 int pmap_reply_flag;
293
294 struct {
296 int af;
302 broadlist_t nal;
305 size_t fdlistno = 0;
308 size_t outlen;
310 int msec;
311 int pollretval;
312 int fds_found;
313
314#ifdef PORTMAP
315 size_t outlen_pmap = 0;
317 int pmap_flag = 0;
318 char *outbuf_pmap =
NULL;
322#endif
323
324 if (sys_auth ==
NULL) {
326 }
327
328
329
330
331
332
333
335 nettype = "datagram_n";
338 }
342
344 continue;
346 break;
348 continue;
349
351 if (__rpc_getbroadifs(si.si_af, si.si_proto, si.si_socktype,
352 &fdlist[fdlistno].nal) == 0)
353 continue;
354
355 fd =
socket(si.si_af, si.si_socktype, si.si_proto);
358 continue;
359 }
360 fdlist[fdlistno].af = si.si_af;
361 fdlist[fdlistno].proto = si.si_proto;
362 fdlist[fdlistno].fd =
fd;
363 fdlist[fdlistno].nconf = nconf;
367 pfd[fdlistno].fd = fdlist[fdlistno].fd =
fd;
369 0);
370
371 if (maxbufsize <= fdlist[fdlistno].dsize)
372 maxbufsize = fdlist[fdlistno].dsize;
373
374#ifdef PORTMAP
376 udpbufsz = fdlist[fdlistno].dsize;
377 if ((outbuf_pmap =
malloc(udpbufsz)) ==
NULL) {
380 goto done_broad;
381 }
382 pmap_flag = 1;
383 }
384#endif
385 fdlistno++;
386 }
387
388 if (fdlistno == 0) {
391 goto done_broad;
392 }
393 if (maxbufsize == 0) {
396 goto done_broad;
397 }
399 outbuf =
malloc(maxbufsize);
402 goto done_broad;
403 }
404
405
414 barg.vers = vers;
416 barg.args.args_val = argsp;
417 barg.xdr_args = xargs;
418 bres.addr = uaddrp;
419 bres.results.results_val = resultsp;
420 bres.xdr_res = xresults;
428 goto done_broad;
429 }
432
433#ifdef PORTMAP
434
435 if (pmap_flag) {
440 barg_pmap.prog =
prog;
441 barg_pmap.vers = vers;
442 barg_pmap.proc =
proc;
443 barg_pmap.args_ptr = argsp;
444 barg_pmap.xdr_args = xargs;
445 bres_pmap.port_ptr = &
port;
446 bres_pmap.xdr_results = xresults;
447 bres_pmap.results_ptr = resultsp;
452 goto done_broad;
453 }
456 }
457#endif
458
459
460
461
462
463
464
465
466 for (msec = inittime; msec <= waittime; msec += msec) {
468
469
470 for (
i = 0;
i < fdlistno;
i++) {
471 if (fdlist[
i].dsize < outlen) {
473 continue;
474 }
478
480
482 bip);
483
484
485
486
487
491 (
size_t)fdlist[
i].asize) !=
492 outlen) {
493#ifdef RPC_DEBUG
495#endif
496 warnx(
"clnt_bcast: cannot send"
497 "broadcast packet");
499 continue;
500 };
501#ifdef RPC_DEBUG
504 "for %s\n",
506#endif
507#ifdef PORTMAP
508
509
510
511
512 if (pmap_flag &&
515 outlen_pmap, 0,
addr,
516 (
size_t)fdlist[
i].asize) !=
517 outlen_pmap) {
519 "Cannot send broadcast packet");
521 continue;
522 }
523 }
524#ifdef RPC_DEBUG
526 "sent for %s\n",
528#endif
529#endif
530 }
531
532 }
533
534 if (eachresult ==
NULL) {
536 goto done_broad;
537 }
538
539
540
541
542 recv_again:
543
544 switch (pollretval =
poll(
pfd, fdlistno, msec)) {
545 case 0:
547 continue;
548 case -1:
549 goto recv_again;
550 }
551
552 for (
i = fds_found = 0;
553 i < fdlistno && fds_found < pollretval;
i++) {
555
556 if (
pfd[
i].revents == 0)
557 continue;
559
560
561
562
563
564
565
567 fds_found++;
568 continue;
569 } else
570 fds_found++;
571#ifdef RPC_DEBUG
574#endif
575 try_again:
577 0, (
struct sockaddr *)(
void *)&fdlist[
i].raddr,
579 if (inlen < 0) {
581 goto try_again;
582 warnx(
"clnt_bcast: Cannot receive reply to "
583 "broadcast");
585 continue;
586 }
588 continue;
589
590
591
592
593
596 pmap_reply_flag = 0;
598 msg.acpted_rply.ar_results.where =
600 msg.acpted_rply.ar_results.proc =
602#ifdef PORTMAP
603 } else if (pmap_flag &&
606 pmap_reply_flag = 1;
608 msg.acpted_rply.ar_results.where =
610 msg.acpted_rply.ar_results.proc =
612#endif
613 } else
614 continue;
620#ifdef PORTMAP
623
624 if (pmap_flag && pmap_reply_flag) {
628 taddr.len = taddr.maxlen =
629 sizeof(fdlist[
i].raddr);
630 taddr.buf = &fdlist[
i].raddr;
631 done = (*eachresult)(resultsp,
632 &taddr, fdlist[
i].nconf);
633 } else {
634#endif
635#ifdef RPC_DEBUG
637 uaddrp);
638#endif
640 fdlist[
i].nconf, uaddrp);
641 done = (*eachresult)(resultsp,
642 np, fdlist[
i].nconf);
644#ifdef PORTMAP
645 }
646#endif
647 }
648
649 }
650
651
655 (
void) (*xresults)(xdrs, resultsp);
657 if (done) {
659 goto done_broad;
660 } else {
661 goto recv_again;
662 }
663 }
664 }
665
666done_broad:
669 if (outbuf)
671#ifdef PORTMAP
672 if (outbuf_pmap)
674#endif
675 for (
i = 0;
i < fdlistno;
i++) {
678 }
681
683}
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
#define gettimeofday(tv, tz)
#define AUTH_DESTROY(auth)
AUTH * authunix_create_default()
void __rpc_freebroadifs(broadlist_t *list)
int __rpc_broadenable(int af, int s, struct broadif *bip)
INT WSAAPI recvfrom(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags, OUT LPSOCKADDR from, IN OUT INT FAR *fromlen)
INT WSAAPI sendto(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags, IN CONST struct sockaddr *to, IN INT tolen)
GLenum const GLvoid * addr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
#define memcpy(s1, s2, n)
bool_t xdr_rmtcallres(XDR *xdrs, struct rmtcallres *crp)
bool_t xdr_rmtcall_args(XDR *xdrs, struct rmtcallargs *cap)
bool_t xdr_callmsg(XDR *xdrs, struct rpc_msg *cmsg)
struct opaque_auth _null_auth
void * __rpc_setconf(char *nettype) const
u_int __rpc_get_t_size(int af, int proto, int size)
struct netconfig * __rpc_getconf(void *vhandle)
void __rpc_endconf(void *vhandle)
int __rpc_nconf2sockinfo(const struct netconfig *nconf, struct __rpc_sockinfo *sip)
struct netbuf * uaddr2taddr(const struct netconfig *nconf, const char *uaddr)
bool_t xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg)
bool_t xdr_rpcb_rmtcallres(XDR *xdrs, struct rpcb_rmtcallres *p)
bool_t xdr_rpcb_rmtcallargs(XDR *xdrs, struct rpcb_rmtcallargs *p)
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
__BEGIN_DECLS u_int __rpc_get_a_size(int)
#define __RPC_GETXID(now)
static PIXELFORMATDESCRIPTOR pfd
struct opaque_auth ah_cred
struct opaque_auth ah_verf
struct sockaddr_storage broadaddr
unsigned long nc_semantics
#define XDR_DESTROY(xdrs)
bool_t(* xdrproc_t)(XDR *,...)
#define xdr_destroy(xdrs)
void xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op)