Lines Matching refs:ai
146 free_addrinfo(struct addrinfo *ai) in free_addrinfo() argument
148 if (ai == NULL) in free_addrinfo()
151 free(ai->ai_addr); in free_addrinfo()
152 free(ai->ai_canonname); in free_addrinfo()
153 free_addrinfo(ai->ai_next); in free_addrinfo()
157 sdump_addrinfo(struct addrinfo *ai, char *buffer, size_t buflen) in sdump_addrinfo() argument
162 ai->ai_flags, ai->ai_family, ai->ai_socktype, ai->ai_protocol, in sdump_addrinfo()
163 ai->ai_addrlen); in sdump_addrinfo()
170 ai->ai_canonname == NULL ? "(null)" : ai->ai_canonname); in sdump_addrinfo()
176 if (ai->ai_addr == NULL) { in sdump_addrinfo()
183 for (i = 0; i < (int)ai->ai_addrlen; i++) { in sdump_addrinfo()
185 i + 1 != (int)ai->ai_addrlen ? "%d." : "%d", in sdump_addrinfo()
186 ((unsigned char *)ai->ai_addr)[i]); in sdump_addrinfo()
197 if (ai->ai_next != NULL) { in sdump_addrinfo()
204 sdump_addrinfo(ai->ai_next, buffer, buflen); in sdump_addrinfo()
243 addrinfo_read_snapshot_ai(struct addrinfo *ai, char *line) in addrinfo_read_snapshot_ai() argument
251 memset(ai, 0, sizeof(struct addrinfo)); in addrinfo_read_snapshot_ai()
258 pi = &ai->ai_flags + i; in addrinfo_read_snapshot_ai()
264 ai->ai_addrlen = (socklen_t)strtol(s, &ts, 10); in addrinfo_read_snapshot_ai()
270 ai->ai_canonname = strdup(s); in addrinfo_read_snapshot_ai()
271 ATF_REQUIRE(ai->ai_canonname != NULL); in addrinfo_read_snapshot_ai()
276 ai->ai_addr = calloc(1, ai->ai_addrlen); in addrinfo_read_snapshot_ai()
277 ATF_REQUIRE(ai->ai_addr != NULL); in addrinfo_read_snapshot_ai()
279 (unsigned char *)ai->ai_addr, in addrinfo_read_snapshot_ai()
280 ai->ai_addrlen); in addrinfo_read_snapshot_ai()
297 free_addrinfo(ai); in addrinfo_read_snapshot_ai()
298 ai = NULL; in addrinfo_read_snapshot_ai()
306 addrinfo_read_snapshot_func(struct addrinfo *ai, char *line) in addrinfo_read_snapshot_func() argument
321 rv = addrinfo_read_snapshot_ai(ai, s); in addrinfo_read_snapshot_func()
325 ai2 = ai; in addrinfo_read_snapshot_func()
332 free_addrinfo(ai); in addrinfo_read_snapshot_func()
333 ai = NULL; in addrinfo_read_snapshot_func()
344 addrinfo_test_correctness(struct addrinfo *ai, void *mdata __unused) in addrinfo_test_correctness() argument
348 dump_addrinfo(ai); in addrinfo_test_correctness()
350 if (ai == NULL) in addrinfo_test_correctness()
353 if (!(ai->ai_family >= 0 && ai->ai_family < AF_MAX)) in addrinfo_test_correctness()
356 if (ai->ai_socktype != 0 && ai->ai_socktype != SOCK_STREAM && in addrinfo_test_correctness()
357 ai->ai_socktype != SOCK_DGRAM && ai->ai_socktype != SOCK_RAW) in addrinfo_test_correctness()
360 if (ai->ai_protocol != 0 && ai->ai_protocol != IPPROTO_UDP && in addrinfo_test_correctness()
361 ai->ai_protocol != IPPROTO_TCP) in addrinfo_test_correctness()
364 if ((ai->ai_flags & ~(AI_CANONNAME | AI_NUMERICHOST | AI_PASSIVE)) != 0) in addrinfo_test_correctness()
367 if (ai->ai_addrlen != ai->ai_addr->sa_len || in addrinfo_test_correctness()
368 ai->ai_family != ai->ai_addr->sa_family) in addrinfo_test_correctness()
381 addrinfo_read_hostlist_func(struct addrinfo *ai, char *line) in addrinfo_read_hostlist_func() argument
398 clone_addrinfo(ai, result); in addrinfo_read_hostlist_func()
404 memset(ai, 0, sizeof(struct addrinfo)); in addrinfo_read_hostlist_func()