Lines Matching refs:ai
191 static void *serialize_addrinfo(void *p, const struct addrinfo *ai, size_t *length, size_t maxlengt… in serialize_addrinfo() argument
196 assert(ai); in serialize_addrinfo()
200 cnl = ai->ai_canonname ? strlen(ai->ai_canonname)+1 : 0; in serialize_addrinfo()
201 l = sizeof(AddrInfoSerialization) + ai->ai_addrlen + cnl; in serialize_addrinfo()
207 .ai_flags = ai->ai_flags, in serialize_addrinfo()
208 .ai_family = ai->ai_family, in serialize_addrinfo()
209 .ai_socktype = ai->ai_socktype, in serialize_addrinfo()
210 .ai_protocol = ai->ai_protocol, in serialize_addrinfo()
211 .ai_addrlen = ai->ai_addrlen, in serialize_addrinfo()
216 memcpy((uint8_t*) p + sizeof(AddrInfoSerialization), ai->ai_addr, ai->ai_addrlen); in serialize_addrinfo()
217 memcpy_safe((char*) p + sizeof(AddrInfoSerialization) + ai->ai_addrlen, in serialize_addrinfo()
218 ai->ai_canonname, cnl); in serialize_addrinfo()
228 struct addrinfo *ai, in send_addrinfo_reply() argument
253 if (ret == 0 && ai) { in send_addrinfo_reply()
257 for (k = ai; k; k = k->ai_next) { in send_addrinfo_reply()
260 freeaddrinfo(ai); in send_addrinfo_reply()
266 if (ai) in send_addrinfo_reply()
267 freeaddrinfo(ai); in send_addrinfo_reply()
681 struct addrinfo *ai; in unserialize_addrinfo() local
698 ai = new(struct addrinfo, 1); in unserialize_addrinfo()
699 if (!ai) in unserialize_addrinfo()
702 *ai = (struct addrinfo) { in unserialize_addrinfo()
711 … ai->ai_addr = memdup((const uint8_t*) *p + sizeof(AddrInfoSerialization), s.ai_addrlen); in unserialize_addrinfo()
712 if (!ai->ai_addr) { in unserialize_addrinfo()
713 free(ai); in unserialize_addrinfo()
719 …ai->ai_canonname = memdup((const uint8_t*) *p + sizeof(AddrInfoSerialization) + s.ai_addrlen, s.ca… in unserialize_addrinfo()
720 if (!ai->ai_canonname) { in unserialize_addrinfo()
721 free(ai->ai_addr); in unserialize_addrinfo()
722 free(ai); in unserialize_addrinfo()
728 *ret_ai = ai; in unserialize_addrinfo()
775 struct addrinfo *ai = NULL; in handle_response() local
777 r = unserialize_addrinfo(&p, &l, &ai); in handle_response()
786 prev->ai_next = ai; in handle_response()
788 q->addrinfo = ai; in handle_response()
790 prev = ai; in handle_response()
1105 static void resolve_freeaddrinfo(struct addrinfo *ai) { in resolve_freeaddrinfo() argument
1106 while (ai) { in resolve_freeaddrinfo()
1107 struct addrinfo *next = ai->ai_next; in resolve_freeaddrinfo()
1109 free(ai->ai_addr); in resolve_freeaddrinfo()
1110 free(ai->ai_canonname); in resolve_freeaddrinfo()
1111 free(ai); in resolve_freeaddrinfo()
1112 ai = next; in resolve_freeaddrinfo()