Lines Matching refs:ai
105 freeaddrinfo(struct addrinfo *ai) in freeaddrinfo() argument
109 for(; ai != NULL;) { in freeaddrinfo()
110 next = ai->ai_next; in freeaddrinfo()
111 free(ai); in freeaddrinfo()
112 ai = next; in freeaddrinfo()
121 struct addrinfo *ai; in malloc_ai() local
123 ai = calloc(1, sizeof(*ai) + sizeof(struct sockaddr_in)); in malloc_ai()
124 if (ai == NULL) in malloc_ai()
127 ai->ai_addr = (struct sockaddr *)(ai + 1); in malloc_ai()
129 ai->ai_addrlen = sizeof(struct sockaddr_in); in malloc_ai()
130 ai->ai_addr->sa_family = ai->ai_family = AF_INET; in malloc_ai()
132 ((struct sockaddr_in *)(ai)->ai_addr)->sin_port = port; in malloc_ai()
133 ((struct sockaddr_in *)(ai)->ai_addr)->sin_addr.s_addr = addr; in malloc_ai()
137 ai->ai_socktype = hints->ai_socktype; in malloc_ai()
139 ai->ai_socktype = SOCK_STREAM; in malloc_ai()
142 ai->ai_protocol = hints->ai_protocol; in malloc_ai()
144 return (ai); in malloc_ai()