Lines Matching refs:l

60 static void lookup_handle_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, …
61 static void lookup_drop_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, Av…
89 AvahiSRBLookup *l; in lookup_new() local
99 if (!(l = avahi_new(AvahiSRBLookup, 1))) in lookup_new()
102 l->ref = 1; in lookup_new()
103 l->record_browser = b; in lookup_new()
104 l->interface = interface; in lookup_new()
105 l->protocol = protocol; in lookup_new()
106 l->key = avahi_key_ref(key); in lookup_new()
107 l->wide_area = NULL; in lookup_new()
108 l->multicast = NULL; in lookup_new()
109 l->cname_lookups = NULL; in lookup_new()
110 l->flags = flags; in lookup_new()
112 transport_flags_from_domain(b->server, &l->flags, key->name); in lookup_new()
114 AVAHI_LLIST_PREPEND(AvahiSRBLookup, lookups, b->lookups, l); in lookup_new()
118 return l; in lookup_new()
121 static void lookup_unref(AvahiSRBLookup *l) { in lookup_unref() argument
122 assert(l); in lookup_unref()
123 assert(l->ref >= 1); in lookup_unref()
125 if (--l->ref >= 1) in lookup_unref()
128 AVAHI_LLIST_REMOVE(AvahiSRBLookup, lookups, l->record_browser->lookups, l); in lookup_unref()
129 l->record_browser->n_lookups --; in lookup_unref()
131 if (l->wide_area) { in lookup_unref()
132 avahi_wide_area_lookup_free(l->wide_area); in lookup_unref()
133 l->wide_area = NULL; in lookup_unref()
136 if (l->multicast) { in lookup_unref()
137 avahi_multicast_lookup_free(l->multicast); in lookup_unref()
138 l->multicast = NULL; in lookup_unref()
141 while (l->cname_lookups) { in lookup_unref()
142 lookup_unref(l->cname_lookups->data); in lookup_unref()
143 l->cname_lookups = avahi_rlist_remove_by_link(l->cname_lookups, l->cname_lookups); in lookup_unref()
146 avahi_key_unref(l->key); in lookup_unref()
147 avahi_free(l); in lookup_unref()
150 static AvahiSRBLookup* lookup_ref(AvahiSRBLookup *l) { in lookup_ref() argument
151 assert(l); in lookup_ref()
152 assert(l->ref >= 1); in lookup_ref()
154 l->ref++; in lookup_ref()
155 return l; in lookup_ref()
165 AvahiSRBLookup *l; in lookup_find() local
169 for (l = b->lookups; l; l = l->lookups_next) { in lookup_find()
171 if ((l->interface == AVAHI_IF_UNSPEC || l->interface == interface) && in lookup_find()
172 (l->interface == AVAHI_PROTO_UNSPEC || l->protocol == protocol) && in lookup_find()
173 l->flags == flags && in lookup_find()
174 avahi_key_equal(l->key, key)) in lookup_find()
176 return l; in lookup_find()
203 AvahiSRBLookup *l = userdata; in lookup_wide_area_callback() local
207 assert(l); in lookup_wide_area_callback()
208 assert(l->ref >= 1); in lookup_wide_area_callback()
210 b = l->record_browser; in lookup_wide_area_callback()
215 lookup_ref(l); in lookup_wide_area_callback()
224 … lookup_handle_cname(l, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_LOOKUP_USE_WIDE_AREA, r); in lookup_wide_area_callback()
227 assert(avahi_key_equal(r->key, l->key)); in lookup_wide_area_callback()
245 lookup_unref(l); in lookup_wide_area_callback()
258 AvahiSRBLookup *l = userdata; in lookup_multicast_callback() local
262 assert(l); in lookup_multicast_callback()
264 b = l->record_browser; in lookup_multicast_callback()
269 lookup_ref(l); in lookup_multicast_callback()
278 lookup_handle_cname(l, interface, protocol, b->flags, r); in lookup_multicast_callback()
295 lookup_drop_cname(l, interface, protocol, 0, r); in lookup_multicast_callback()
298 assert(avahi_key_equal(b->key, l->key)); in lookup_multicast_callback()
316 lookup_unref(l); in lookup_multicast_callback()
319 static int lookup_start(AvahiSRBLookup *l) { in lookup_start() argument
320 assert(l); in lookup_start()
322 assert(!(l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) != !(l->flags & AVAHI_LOOKUP_USE_MULTICAST)); in lookup_start()
323 assert(!l->wide_area && !l->multicast); in lookup_start()
325 if (l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) { in lookup_start()
327 …if (!(l->wide_area = avahi_wide_area_lookup_new(l->record_browser->server->wide_area_lookup_engine… in lookup_start()
331 assert(l->flags & AVAHI_LOOKUP_USE_MULTICAST); in lookup_start()
333l->multicast = avahi_multicast_lookup_new(l->record_browser->server->multicast_lookup_engine, l->i… in lookup_start()
340 static int lookup_scan_cache(AvahiSRBLookup *l) { in lookup_scan_cache() argument
343 assert(l); in lookup_scan_cache()
345 assert(!(l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) != !(l->flags & AVAHI_LOOKUP_USE_MULTICAST)); in lookup_scan_cache()
348 if (l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) { in lookup_scan_cache()
349 …int) avahi_wide_area_scan_cache(l->record_browser->server->wide_area_lookup_engine, l->key, lookup… in lookup_scan_cache()
352 assert(l->flags & AVAHI_LOOKUP_USE_MULTICAST); in lookup_scan_cache()
353 …_engine_scan_cache(l->record_browser->server->multicast_lookup_engine, l->interface, l->protocol, in lookup_scan_cache()
360 AvahiSRBLookup *l; in lookup_add() local
365 if ((l = lookup_find(b, interface, protocol, flags, key))) in lookup_add()
366 return lookup_ref(l); in lookup_add()
368 if (!(l = lookup_new(b, interface, protocol, flags, key))) in lookup_add()
371 return l; in lookup_add()
374 static int lookup_go(AvahiSRBLookup *l) { in lookup_go() argument
376 assert(l); in lookup_go()
378 if (l->record_browser->dead) in lookup_go()
381 lookup_ref(l); in lookup_go()
384 n = lookup_scan_cache(l); in lookup_go()
387 if (!l->record_browser->dead && l->ref > 1) { in lookup_go()
389 if ((l->flags & AVAHI_LOOKUP_USE_MULTICAST) || n == 0) in lookup_go()
392 if (lookup_start(l) < 0) in lookup_go()
396 lookup_unref(l); in lookup_go()
401 static void lookup_handle_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, … in lookup_handle_cname() argument
405 assert(l); in lookup_handle_cname()
411 … k = avahi_key_new(r->data.ptr.name, l->record_browser->key->clazz, l->record_browser->key->type); in lookup_handle_cname()
412 n = lookup_add(l->record_browser, interface, protocol, flags, k); in lookup_handle_cname()
420 l->cname_lookups = avahi_rlist_prepend(l->cname_lookups, lookup_ref(n)); in lookup_handle_cname()
426 static void lookup_drop_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, Av… in lookup_drop_cname() argument
434 … k = avahi_key_new(r->data.ptr.name, l->record_browser->key->clazz, l->record_browser->key->type); in lookup_drop_cname()
436 for (rl = l->cname_lookups; rl; rl = rl->rlist_next) { in lookup_drop_cname()
451 l->cname_lookups = avahi_rlist_remove_by_link(l->cname_lookups, rl); in lookup_drop_cname()