Lines Matching refs:hp

218 	struct hostent *hp;  in getipnodebyname()  local
283 hp = gethostbyname2(name, af); in getipnodebyname()
284 hp = _hpcopy(hp, errp); in getipnodebyname()
287 hp = _hpreorder(hp); in getipnodebyname()
289 if (af == AF_INET6 && ((flags & AI_ALL) || hp == NULL) && in getipnodebyname()
292 if (hp == NULL) in getipnodebyname()
296 hp = _hpmapv6(hp2, errp); in getipnodebyname()
298 if (hp2 && strcmp(hp->h_name, hp2->h_name) == 0) { in getipnodebyname()
299 struct hostent *hpb = hp; in getipnodebyname()
300 hp = _hpmerge(hpb, hp2, errp); in getipnodebyname()
307 if (hp == NULL) in getipnodebyname()
311 return _hpsort(hp, statp); in getipnodebyname()
317 struct hostent *hp; in getipnodebyaddr() local
378 hp = gethostbyaddr(src, len, af); in getipnodebyaddr()
379 if (hp == NULL) in getipnodebyaddr()
383 return (_hpcopy(hp, errp)); in getipnodebyaddr()
400 _hpcopy(struct hostent *hp, int *errp) in _hpcopy() argument
409 if (hp == NULL) in _hpcopy()
410 return hp; in _hpcopy()
414 if (hp->h_name != NULL) in _hpcopy()
415 size += strlen(hp->h_name) + 1; in _hpcopy()
416 if ((pp = hp->h_aliases) != NULL) { in _hpcopy()
428 addrsize = ALIGN(hp->h_length); in _hpcopy()
429 if ((pp = hp->h_addr_list) != NULL) { in _hpcopy()
442 if (hp->h_name != NULL) { in _hpcopy()
444 strcpy(cp, hp->h_name); in _hpcopy()
449 if ((pp = hp->h_aliases) != NULL) { in _hpcopy()
460 nhp->h_addrtype = hp->h_addrtype; in _hpcopy()
461 nhp->h_length = hp->h_length; in _hpcopy()
463 if ((pp = hp->h_addr_list) != NULL) { in _hpcopy()
467 memcpy(cp, *pp, hp->h_length); in _hpcopy()
481 struct hostent *hp, hpbuf; in _hpaddr() local
484 hp = &hpbuf; in _hpaddr()
485 hp->h_name = (char *)name; in _hpaddr()
486 hp->h_aliases = NULL; in _hpaddr()
487 hp->h_addrtype = af; in _hpaddr()
488 hp->h_length = ADDRLEN(af); in _hpaddr()
489 hp->h_addr_list = addrs; in _hpaddr()
492 return (_hpcopy(hp, errp)); in _hpaddr()
505 struct hostent *hp, hpbuf; in _hpmerge() local
515 hp = &hpbuf; in _hpmerge()
516 hp->h_name = (hp1->h_name != NULL ? hp1->h_name : hp2->h_name); in _hpmerge()
517 hp->h_aliases = aliases; in _hpmerge()
533 hp->h_addrtype = AF_INET6; in _hpmerge()
534 hp->h_length = sizeof(struct in6_addr); in _hpmerge()
536 hp->h_addrtype = hp1->h_addrtype; in _hpmerge()
537 hp->h_length = hp1->h_length; in _hpmerge()
540 hp->h_addr_list = addrs; in _hpmerge()
545 if (HP(i)->h_length == hp->h_length) { in _hpmerge()
558 return (_hpcopy(hp, errp)); in _hpmerge()
567 _hpmapv6(struct hostent *hp, int *errp) in _hpmapv6() argument
571 if (hp == NULL) in _hpmapv6()
573 if (hp->h_addrtype == AF_INET6) in _hpmapv6()
574 return _hpcopy(hp, errp); in _hpmapv6()
579 return _hpmerge(&hp6, hp, errp); in _hpmapv6()
587 _hpsort(struct hostent *hp, res_state statp) in _hpsort() argument
595 if (hp == NULL || hp->h_addr_list[1] == NULL || nsort == 0) in _hpsort()
596 return hp; in _hpsort()
597 for (i = 0; (ap = (u_char *)hp->h_addr_list[i]); i++) { in _hpsort()
601 hp->h_addrtype) in _hpsort()
609 for (n = 0; n < hp->h_length; n++) { in _hpsort()
613 if (n == hp->h_length) in _hpsort()
619 pp = (u_char **)hp->h_addr_list; in _hpsort()
632 return hp; in _hpsort()
640 _hpreorder(struct hostent *hp) in _hpreorder() argument
648 if (hp == NULL) in _hpreorder()
649 return hp; in _hpreorder()
651 switch (hp->h_addrtype) { in _hpreorder()
658 return hp; in _hpreorder()
662 for (n = 0; hp->h_addr_list[n] != NULL; n++) in _hpreorder()
669 return hp; in _hpreorder()
673 return hp; /* give up reordering */ in _hpreorder()
681 return hp; in _hpreorder()
685 ap = hp->h_addr_list[i]; in _hpreorder()
688 switch (hp->h_addrtype) { in _hpreorder()
722 hp->h_addr_list[i] = aio[i].aio_h_addr; in _hpreorder()
727 return hp; in _hpreorder()