Lines Matching refs:r

56 static void finish(AvahiSHostNameResolver *r, AvahiResolverEvent event) {  in finish()  argument
57 assert(r); in finish()
59 if (r->time_event) { in finish()
60 avahi_time_event_free(r->time_event); in finish()
61 r->time_event = NULL; in finish()
68 assert(r->address_record); in finish()
70 switch (r->address_record->key->type) { in finish()
73 a.data.ipv4 = r->address_record->data.a.address; in finish()
78 a.data.ipv6 = r->address_record->data.aaaa.address; in finish()
85r->callback(r, r->interface, r->protocol, AVAHI_RESOLVER_FOUND, r->address_record->key->name, &a, in finish()
92r->callback(r, r->interface, r->protocol, event, r->host_name, NULL, r->flags, r->userdata); in finish()
98 AvahiSHostNameResolver *r = userdata; in time_event_callback() local
101 assert(r); in time_event_callback()
103 avahi_server_set_errno(r->server, AVAHI_ERR_TIMEOUT); in time_event_callback()
104 finish(r, AVAHI_RESOLVER_FAILURE); in time_event_callback()
107 static void start_timeout(AvahiSHostNameResolver *r) { in start_timeout() argument
109 assert(r); in start_timeout()
111 if (r->time_event) in start_timeout()
116 r->time_event = avahi_time_event_new(r->server->time_event_queue, &tv, time_event_callback, r); in start_timeout()
128 AvahiSHostNameResolver *r = userdata; in record_browser_callback() local
131 assert(r); in record_browser_callback()
139 if (r->interface > 0 && interface != r->interface) in record_browser_callback()
142 if (r->protocol != AVAHI_PROTO_UNSPEC && protocol != r->protocol) in record_browser_callback()
145 if (r->interface <= 0) in record_browser_callback()
146 r->interface = interface; in record_browser_callback()
148 if (r->protocol == AVAHI_PROTO_UNSPEC) in record_browser_callback()
149 r->protocol = protocol; in record_browser_callback()
151 if (!r->address_record) { in record_browser_callback()
152 r->address_record = avahi_record_ref(record); in record_browser_callback()
153 r->flags = flags; in record_browser_callback()
155 finish(r, AVAHI_RESOLVER_FOUND); in record_browser_callback()
164 if (r->address_record && avahi_record_equal_no_ttl(record, r->address_record)) { in record_browser_callback()
165 avahi_record_unref(r->address_record); in record_browser_callback()
166 r->address_record = NULL; in record_browser_callback()
168 r->flags = flags; in record_browser_callback()
172 if (r->record_browser_aaaa) in record_browser_callback()
173 avahi_s_record_browser_restart(r->record_browser_aaaa); in record_browser_callback()
174 if (r->record_browser_a) in record_browser_callback()
175 avahi_s_record_browser_restart(r->record_browser_a); in record_browser_callback()
177 start_timeout(r); in record_browser_callback()
191 if (r->record_browser_aaaa) in record_browser_callback()
192 avahi_s_record_browser_free(r->record_browser_aaaa); in record_browser_callback()
193 if (r->record_browser_a) in record_browser_callback()
194 avahi_s_record_browser_free(r->record_browser_a); in record_browser_callback()
196 r->record_browser_a = r->record_browser_aaaa = NULL; in record_browser_callback()
197 r->flags = flags; in record_browser_callback()
199 finish(r, AVAHI_RESOLVER_FAILURE); in record_browser_callback()
214 AvahiSHostNameResolver *r; in avahi_s_host_name_resolver_new() local
227 if (!(r = avahi_new(AvahiSHostNameResolver, 1))) { in avahi_s_host_name_resolver_new()
232 r->server = server; in avahi_s_host_name_resolver_new()
233 r->host_name = avahi_normalize_name_strdup(host_name); in avahi_s_host_name_resolver_new()
234 r->callback = callback; in avahi_s_host_name_resolver_new()
235 r->userdata = userdata; in avahi_s_host_name_resolver_new()
236 r->address_record = NULL; in avahi_s_host_name_resolver_new()
237 r->interface = interface; in avahi_s_host_name_resolver_new()
238 r->protocol = protocol; in avahi_s_host_name_resolver_new()
239 r->flags = 0; in avahi_s_host_name_resolver_new()
241 r->record_browser_a = r->record_browser_aaaa = NULL; in avahi_s_host_name_resolver_new()
243 r->time_event = NULL; in avahi_s_host_name_resolver_new()
245 AVAHI_LLIST_PREPEND(AvahiSHostNameResolver, resolver, server->host_name_resolvers, r); in avahi_s_host_name_resolver_new()
247 r->record_browser_aaaa = r->record_browser_a = NULL; in avahi_s_host_name_resolver_new()
251r->record_browser_a = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_bro… in avahi_s_host_name_resolver_new()
254 if (!r->record_browser_a) in avahi_s_host_name_resolver_new()
260r->record_browser_aaaa = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_… in avahi_s_host_name_resolver_new()
263 if (!r->record_browser_aaaa) in avahi_s_host_name_resolver_new()
267 assert(r->record_browser_aaaa || r->record_browser_a); in avahi_s_host_name_resolver_new()
269 start_timeout(r); in avahi_s_host_name_resolver_new()
271 return r; in avahi_s_host_name_resolver_new()
274 avahi_s_host_name_resolver_free(r); in avahi_s_host_name_resolver_new()
278 void avahi_s_host_name_resolver_free(AvahiSHostNameResolver *r) { in avahi_s_host_name_resolver_free() argument
279 assert(r); in avahi_s_host_name_resolver_free()
281 AVAHI_LLIST_REMOVE(AvahiSHostNameResolver, resolver, r->server->host_name_resolvers, r); in avahi_s_host_name_resolver_free()
283 if (r->record_browser_a) in avahi_s_host_name_resolver_free()
284 avahi_s_record_browser_free(r->record_browser_a); in avahi_s_host_name_resolver_free()
286 if (r->record_browser_aaaa) in avahi_s_host_name_resolver_free()
287 avahi_s_record_browser_free(r->record_browser_aaaa); in avahi_s_host_name_resolver_free()
289 if (r->time_event) in avahi_s_host_name_resolver_free()
290 avahi_time_event_free(r->time_event); in avahi_s_host_name_resolver_free()
292 if (r->address_record) in avahi_s_host_name_resolver_free()
293 avahi_record_unref(r->address_record); in avahi_s_host_name_resolver_free()
295 avahi_free(r->host_name); in avahi_s_host_name_resolver_free()
296 avahi_free(r); in avahi_s_host_name_resolver_free()