Lines Matching refs:ai

118  *    lwres_freeaddrinfo(). ai is a pointer to a struct addrinfo created by
180 struct addrinfo *ai, *ai_list;
310 ai = ai_alloc(AF_INET, sizeof(struct sockaddr_in));
311 if (ai == NULL)
313 ai->ai_socktype = socktype;
314 ai->ai_protocol = protocol;
315 SIN(ai->ai_addr)->sin_port = port;
316 ai->ai_next = ai_list;
317 ai_list = ai;
321 ai = ai_alloc(AF_INET6, sizeof(struct sockaddr_in6));
322 if (ai == NULL) {
326 ai->ai_socktype = socktype;
327 ai->ai_protocol = protocol;
328 SIN6(ai->ai_addr)->sin6_port = port;
329 ai->ai_next = ai_list;
330 ai_list = ai;
424 ai = ai_clone(ai_list, family);
425 if (ai == NULL)
427 ai_list = ai;
428 ai->ai_socktype = socktype;
429 SIN(ai->ai_addr)->sin_port = port;
430 memmove((char *)ai->ai_addr + addroff, abuf, addrsize);
433 if (ai->ai_family == AF_INET6)
434 SIN6(ai->ai_addr)->sin6_scope_id =
437 if (lwres_getnameinfo(ai->ai_addr,
438 ai->ai_addrlen, nbuf, sizeof(nbuf),
441 ai->ai_canonname = strdup(nbuf);
442 if (ai->ai_canonname == NULL) {
448 ai->ai_canonname = NULL;
563 struct addrinfo *ai;
575 ai = ai_clone(*aip, AF_INET);
576 if (ai == NULL)
579 *aip = ai;
580 ai->ai_socktype = socktype;
581 SIN(ai->ai_addr)->sin_port = port;
582 memmove(&SIN(ai->ai_addr)->sin_addr, v4_loop, 4);
594 ai = ai_clone(*aip, AF_INET);
595 if (ai == NULL)
597 *aip = ai;
598 ai->ai_socktype = socktype;
599 SIN(ai->ai_addr)->sin_port = port;
600 memmove(&SIN(ai->ai_addr)->sin_addr,
603 ai->ai_canonname = strdup(by->realname);
604 if (ai->ai_canonname == NULL)
626 struct addrinfo *ai;
639 ai = ai_clone(*aip, AF_INET6);
640 if (ai == NULL)
643 *aip = ai;
644 ai->ai_socktype = socktype;
645 SIN6(ai->ai_addr)->sin6_port = port;
646 memmove(&SIN6(ai->ai_addr)->sin6_addr, v6_loop, 16);
658 ai = ai_clone(*aip, AF_INET6);
659 if (ai == NULL)
661 *aip = ai;
662 ai->ai_socktype = socktype;
663 SIN6(ai->ai_addr)->sin6_port = port;
664 memmove(&SIN6(ai->ai_addr)->sin6_addr,
667 ai->ai_canonname = strdup(by->realname);
668 if (ai->ai_canonname == NULL)
686 lwres_freeaddrinfo(struct addrinfo *ai) {
689 while (ai != NULL) {
690 ai_next = ai->ai_next;
691 if (ai->ai_addr != NULL)
692 free(ai->ai_addr);
693 if (ai->ai_canonname)
694 free(ai->ai_canonname);
695 free(ai);
696 ai = ai_next;
703 struct addrinfo *ai;
709 ai = ai_alloc(AF_LOCAL, sizeof(*slocal));
710 if (ai == NULL)
713 slocal = SLOCAL(ai->ai_addr);
716 ai->ai_socktype = socktype;
718 * ai->ai_flags, ai->ai_protocol, ai->ai_canonname,
719 * and ai->ai_next were initialized to zero.
722 *res = ai;
739 struct addrinfo *ai;
741 ai = (struct addrinfo *)calloc(1, sizeof(*ai));
742 if (ai == NULL)
745 ai->ai_addr = SA(calloc(1, addrlen));
746 if (ai->ai_addr == NULL) {
747 free(ai);
750 ai->ai_addrlen = addrlen;
751 ai->ai_family = family;
752 ai->ai_addr->sa_family = family;
754 ai->ai_addr->sa_len = addrlen;
756 return (ai);
761 struct addrinfo *ai;
763 ai = ai_alloc(family, ((family == AF_INET6) ?
766 if (ai == NULL) {
771 return (ai);
773 ai->ai_flags = oai->ai_flags;
774 ai->ai_socktype = oai->ai_socktype;
775 ai->ai_protocol = oai->ai_protocol;
776 ai->ai_canonname = NULL;
777 ai->ai_next = oai;
778 return (ai);