Lines Matching +full:software +full:- +full:properties +full:- +full:common
4 Copyright 2004-2006 Lennart Poettering
6 PulseAudio is free software; you can redistribute it and/or modify
8 published by the Free Software Foundation; either version 2.1 of the
29 #include <avahi-client/client.h>
30 #include <avahi-client/lookup.h>
31 #include <avahi-common/alternative.h>
32 #include <avahi-common/error.h>
33 #include <avahi-common/domain.h>
34 #include <avahi-common/malloc.h>
38 #include <pulsecore/core-util.h>
43 #include <pulsecore/avahi-wrap.h>
46 PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Discovery");
50 #define SERVICE_TYPE_SINK "_pulse-sink._tcp"
51 #define SERVICE_TYPE_SOURCE "_non-monitor._sub._pulse-source._tcp"
78 (unsigned) t->interface + in tunnel_hash()
79 (unsigned) t->protocol + in tunnel_hash()
80 pa_idxset_string_hash_func(t->name) + in tunnel_hash()
81 pa_idxset_string_hash_func(t->type) + in tunnel_hash()
82 pa_idxset_string_hash_func(t->domain); in tunnel_hash()
89 if (ta->interface != tb->interface) in tunnel_compare()
91 if (ta->protocol != tb->protocol) in tunnel_compare()
93 if ((r = strcmp(ta->name, tb->name))) in tunnel_compare()
95 if ((r = strcmp(ta->type, tb->type))) in tunnel_compare()
97 if ((r = strcmp(ta->domain, tb->domain))) in tunnel_compare()
109 t->interface = interface; in tunnel_new()
110 t->protocol = protocol; in tunnel_new()
111 t->name = pa_xstrdup(name); in tunnel_new()
112 t->type = pa_xstrdup(type); in tunnel_new()
113 t->domain = pa_xstrdup(domain); in tunnel_new()
114 t->module_index = PA_IDXSET_INVALID; in tunnel_new()
120 pa_xfree(t->name); in tunnel_free()
121 pa_xfree(t->type); in tunnel_free()
122 pa_xfree(t->domain); in tunnel_free()
144 pa_log("Resolving of '%s' failed: %s", name, avahi_strerror(avahi_client_errno(u->client))); in resolver_cb()
150 char *properties = NULL; in resolver_cb() local
157 ss = u->core->default_sample_spec; in resolver_cb()
158 cm = u->core->default_channel_map; in resolver_cb()
160 for (l = txt; l; l = l->next) { in resolver_cb()
174 else if (pa_streq(key, "icon-name")) { in resolver_cb()
175 pa_xfree(properties); in resolver_cb()
176 properties = pa_sprintf_malloc("device.icon_name=%s", value); in resolver_cb()
192 pa_xfree(properties); in resolver_cb()
199 pa_xfree(properties); in resolver_cb()
212 pa_xfree(properties); in resolver_cb()
217 if (a->proto == AVAHI_PROTO_INET6 && in resolver_cb()
218 a->data.ipv6.address[0] == 0xfe && in resolver_cb()
219 (a->data.ipv6.address[1] & 0xc0) == 0x80) in resolver_cb()
222 module_name = pa_sprintf_malloc("module-tunnel-%s", t); in resolver_cb()
237 t, properties ? properties : "", in resolver_cb()
243 if (pa_module_load(&m, u->core, module_name, args) >= 0) { in resolver_cb()
244 tnl->module_index = m->index; in resolver_cb()
245 pa_hashmap_put(u->tunnels, tnl, tnl); in resolver_cb()
253 pa_xfree(properties); in resolver_cb()
285 if (!pa_hashmap_get(u->tunnels, t)) in browser_cb()
286 …if (!(avahi_service_resolver_new(u->client, interface, protocol, name, type, domain, AVAHI_PROTO_U… in browser_cb()
287 … pa_log("avahi_service_resolver_new() failed: %s", avahi_strerror(avahi_client_errno(u->client))); in browser_cb()
296 if ((t2 = pa_hashmap_get(u->tunnels, t))) { in browser_cb()
297 pa_module_unload_request_by_index(u->core, t2->module_index, true); in browser_cb()
298 pa_hashmap_remove(u->tunnels, t2); in browser_cb()
312 u->client = c; in client_callback()
319 if (!u->sink_browser) { in client_callback()
321 if (!(u->sink_browser = avahi_service_browser_new( in client_callback()
330 pa_module_unload_request(u->module, true); in client_callback()
334 if (!u->source_browser) { in client_callback()
336 if (!(u->source_browser = avahi_service_browser_new( in client_callback()
345 pa_module_unload_request(u->module, true); in client_callback()
357 …if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error… in client_callback()
359 pa_module_unload_request(u->module, true); in client_callback()
367 if (u->sink_browser) { in client_callback()
368 avahi_service_browser_free(u->sink_browser); in client_callback()
369 u->sink_browser = NULL; in client_callback()
372 if (u->source_browser) { in client_callback()
373 avahi_service_browser_free(u->source_browser); in client_callback()
374 u->source_browser = NULL; in client_callback()
389 if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { in pa__init()
394 m->userdata = u = pa_xnew(struct userdata, 1); in pa__init()
395 u->core = m->core; in pa__init()
396 u->module = m; in pa__init()
397 u->sink_browser = u->source_browser = NULL; in pa__init()
399 u->tunnels = pa_hashmap_new(tunnel_hash, tunnel_compare); in pa__init()
401 u->avahi_poll = pa_avahi_poll_new(m->core->mainloop); in pa__init()
403 …if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error… in pa__init()
418 return -1; in pa__init()
425 if (!(u = m->userdata)) in pa__done()
428 if (u->client) in pa__done()
429 avahi_client_free(u->client); in pa__done()
431 if (u->avahi_poll) in pa__done()
432 pa_avahi_poll_free(u->avahi_poll); in pa__done()
434 if (u->tunnels) { in pa__done()
437 while ((t = pa_hashmap_steal_first(u->tunnels))) { in pa__done()
438 pa_module_unload_request_by_index(u->core, t->module_index, true); in pa__done()
442 pa_hashmap_free(u->tunnels); in pa__done()