Lines Matching refs:aquery

63 static void next_lookup(struct addr_query *aquery);
66 static void end_aquery(struct addr_query *aquery, int status,
74 struct addr_query *aquery; in ares_gethostbyaddr() local
82 if ((family == AF_INET && addrlen != sizeof(aquery->addr.addrV4)) || in ares_gethostbyaddr()
83 (family == AF_INET6 && addrlen != sizeof(aquery->addr.addrV6))) in ares_gethostbyaddr()
89 aquery = malloc(sizeof(struct addr_query)); in ares_gethostbyaddr()
90 if (!aquery) in ares_gethostbyaddr()
95 aquery->channel = channel; in ares_gethostbyaddr()
97 memcpy(&aquery->addr.addrV4, addr, sizeof(aquery->addr.addrV4)); in ares_gethostbyaddr()
99 memcpy(&aquery->addr.addrV6, addr, sizeof(aquery->addr.addrV6)); in ares_gethostbyaddr()
100 aquery->addr.family = family; in ares_gethostbyaddr()
101 aquery->callback = callback; in ares_gethostbyaddr()
102 aquery->arg = arg; in ares_gethostbyaddr()
103 aquery->remaining_lookups = channel->lookups; in ares_gethostbyaddr()
104 aquery->timeouts = 0; in ares_gethostbyaddr()
106 next_lookup(aquery); in ares_gethostbyaddr()
109 static void next_lookup(struct addr_query *aquery) in next_lookup() argument
116 for (p = aquery->remaining_lookups; *p; p++) in next_lookup()
121 ptr_rr_name(name, &aquery->addr); in next_lookup()
122 aquery->remaining_lookups = p + 1; in next_lookup()
123 ares_query(aquery->channel, name, C_IN, T_PTR, addr_callback, in next_lookup()
124 aquery); in next_lookup()
127 status = file_lookup(&aquery->addr, &host); in next_lookup()
134 end_aquery(aquery, status, host); in next_lookup()
140 end_aquery(aquery, ARES_ENOTFOUND, NULL); in next_lookup()
146 struct addr_query *aquery = (struct addr_query *) arg; in addr_callback() local
150 aquery->timeouts += timeouts; in addr_callback()
153 if (aquery->addr.family == AF_INET) in addr_callback()
155 addrlen = sizeof(aquery->addr.addrV4); in addr_callback()
156 status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV4, in addr_callback()
161 addrlen = sizeof(aquery->addr.addrV6); in addr_callback()
162 status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV6, in addr_callback()
165 end_aquery(aquery, status, host); in addr_callback()
168 end_aquery(aquery, status, NULL); in addr_callback()
170 next_lookup(aquery); in addr_callback()
173 static void end_aquery(struct addr_query *aquery, int status, in end_aquery() argument
176 aquery->callback(aquery->arg, status, aquery->timeouts, host); in end_aquery()
179 free(aquery); in end_aquery()