Mercurial > audlegacy-plugins
annotate src/daap/xmms2-daap/daap_mdns_dnssd.c @ 3202:478934734761
use alsa-ng instead.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Tue, 18 Aug 2009 17:54:08 +0900 |
parents | 7b3290336f3b |
children |
rev | line source |
---|---|
1407
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
1 /** XMMS2 transform for accessing DAAP music shares. |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
2 * |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
3 * Copyright (C) 2006-2007 XMMS2 Team |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
4 * |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
6 * modify it under the terms of the GNU General Public License |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
7 * as published by the Free Software Foundation; either version 2 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
8 * of the License, or (at your option) any later version. |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
9 * |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
13 * GNU General Public License for more details. |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
14 */ |
1448 | 15 #ifdef DAAP_MDNS_DNSSD |
1407
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
16 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
17 #include <glib.h> |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
18 #include <dns_sd.h> |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
19 #include <string.h> |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
20 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
21 #include "daap_mdns_browse.h" |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
22 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
23 typedef struct GMDNS_t GMDNS; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
24 typedef struct GMDNSServer_t GMDNSServer; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
25 typedef struct GMDNSUserData_t GMDNSUserData; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
26 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
27 typedef void (*GMDNSFunc)(GMDNS *, gint, GMDNSServer *, gpointer); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
28 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
29 struct GMDNS_t { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
30 GMutex *mutex; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
31 GSList *service_list; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
32 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
33 GMDNSFunc callback; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
34 gpointer user_data; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
35 GMDNSUserData *browse_ud; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
36 }; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
37 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
38 struct GMDNSUserData_t { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
39 GMDNS *mdns; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
40 GMDNSServer *server; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
41 GPollFD *fd; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
42 GSource *source; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
43 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
44 DNSServiceRef client; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
45 }; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
46 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
47 struct GMDNSServer_t { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
48 gchar *mdnsname; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
49 gchar *hostname; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
50 gchar *address; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
51 GHashTable *txtvalues; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
52 guint16 port; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
53 }; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
54 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
55 enum { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
56 G_MDNS_SERVER_ADD, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
57 G_MDNS_SERVER_REMOVE |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
58 }; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
59 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
60 static void g_mdns_user_data_destroy (GMDNSUserData *ud); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
61 static void g_mdns_server_destroy (GMDNSServer *server); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
62 static gboolean g_mdns_poll_add (GMDNS *mdns, GMDNSUserData *ud, DNSServiceRef client); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
63 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
64 static GMDNS *g_mdns; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
65 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
66 static void |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
67 qr_reply (DNSServiceRef sdRef, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
68 DNSServiceFlags flags, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
69 uint32_t ifIndex, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
70 DNSServiceErrorType errorCode, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
71 const char *fullname, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
72 uint16_t rrtype, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
73 uint16_t rrclass, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
74 uint16_t rdlen, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
75 const void *rdata, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
76 uint32_t ttl, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
77 void *context) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
78 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
79 GMDNSUserData *ud = context; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
80 gchar addr[1000]; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
81 const guchar *rd = (guchar *)rdata; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
82 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
83 g_return_if_fail (ud); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
84 g_return_if_fail (rrtype == kDNSServiceType_A); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
85 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
86 g_snprintf (addr, 1000, "%d.%d.%d.%d", rd[0], rd[1], rd[2], rd[3]); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
87 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
88 ud->server->address = g_strdup (addr); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
89 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
90 g_print ("adding server %s %s", ud->server->mdnsname, ud->server->address); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
91 g_mutex_lock (ud->mdns->mutex); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
92 ud->mdns->service_list = g_slist_prepend (ud->mdns->service_list, ud->server); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
93 g_mutex_unlock (ud->mdns->mutex); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
94 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
95 if (ud->mdns->callback) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
96 ud->mdns->callback (ud->mdns, G_MDNS_SERVER_ADD, ud->server, ud->mdns->user_data); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
97 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
98 g_mdns_user_data_destroy (ud); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
99 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
100 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
101 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
102 static void |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
103 resolve_reply (DNSServiceRef client, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
104 DNSServiceFlags flags, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
105 uint32_t ifIndex, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
106 DNSServiceErrorType errorCode, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
107 const char *fullname, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
108 const char *hosttarget, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
109 uint16_t opaqueport, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
110 uint16_t txtLen, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
111 const char *txtRecord, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
112 void *context) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
113 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
114 GMDNSUserData *ud = context; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
115 GMDNSUserData *ud2; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
116 DNSServiceErrorType err; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
117 gint i; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
118 union { guint16 s; guchar b[2]; } portu = { opaqueport }; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
119 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
120 g_return_if_fail (ud); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
121 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
122 ud->server->port = ((guint16) portu.b[0]) << 8 | portu.b[1]; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
123 ud->server->hostname = g_strdup (hosttarget); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
124 ud->server->txtvalues = g_hash_table_new_full (g_str_hash, g_str_equal, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
125 g_free, g_free); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
126 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
127 for (i = 0; i < TXTRecordGetCount (txtLen, txtRecord); i++) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
128 gchar key[256]; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
129 const void *txt_value; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
130 gchar *value; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
131 guint8 vallen; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
132 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
133 err = TXTRecordGetItemAtIndex (txtLen, txtRecord, i, 256, key, &vallen, &txt_value); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
134 if (err != kDNSServiceErr_NoError) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
135 g_warning ("error parsing TXT records!"); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
136 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
137 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
138 value = g_malloc (vallen + 1); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
139 g_strlcpy (value, txt_value, vallen + 1); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
140 g_hash_table_insert (ud->server->txtvalues, g_strdup (key), value); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
141 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
142 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
143 ud2 = g_new0 (GMDNSUserData, 1); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
144 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
145 err = DNSServiceQueryRecord (&ud2->client, 0, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
146 kDNSServiceInterfaceIndexAny, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
147 ud->server->hostname, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
148 kDNSServiceType_A, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
149 kDNSServiceClass_IN, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
150 qr_reply, ud2); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
151 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
152 if (err != kDNSServiceErr_NoError) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
153 g_warning ("Error from QueryRecord!"); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
154 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
155 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
156 g_mdns_poll_add (ud->mdns, ud2, ud2->client); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
157 ud2->server = ud->server; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
158 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
159 g_mdns_user_data_destroy (ud); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
160 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
161 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
162 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
163 static void |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
164 browse_reply (DNSServiceRef client, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
165 DNSServiceFlags flags, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
166 uint32_t ifIndex, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
167 DNSServiceErrorType errorCode, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
168 const char *replyName, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
169 const char *replyType, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
170 const char *replyDomain, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
171 void *context) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
172 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
173 DNSServiceErrorType err; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
174 GMDNSServer *server; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
175 GMDNSUserData *ud = context; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
176 GMDNSUserData *ud2; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
177 gboolean remove = (flags & kDNSServiceFlagsAdd) ? FALSE : TRUE; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
178 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
179 if (!remove) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
180 server = g_new0 (GMDNSServer, 1); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
181 server->mdnsname = g_strdup (replyName); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
182 ud2 = g_new0 (GMDNSUserData, 1); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
183 err = DNSServiceResolve (&ud2->client, 0, kDNSServiceInterfaceIndexAny, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
184 server->mdnsname, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
185 "_daap._tcp", "local", |
1448 | 186 (DNSServiceResolveReply)resolve_reply, ud2); |
1407
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
187 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
188 if (err != kDNSServiceErr_NoError) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
189 g_warning ("Couldn't do ServiceResolv"); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
190 g_free (server->mdnsname); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
191 g_free (server); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
192 return; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
193 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
194 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
195 ud2->server = server; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
196 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
197 g_mdns_poll_add (ud->mdns, ud2, ud2->client); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
198 } else { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
199 GSList *n, *nxt; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
200 g_mutex_lock (ud->mdns->mutex); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
201 for (n = ud->mdns->service_list; n; n = nxt) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
202 nxt = g_slist_next (n); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
203 GMDNSServer *server = n->data; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
204 if (strcmp (server->mdnsname, replyName) == 0) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
205 n = ud->mdns->service_list = g_slist_remove (ud->mdns->service_list, server); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
206 g_mutex_unlock (ud->mdns->mutex); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
207 if (ud->mdns->callback) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
208 ud->mdns->callback (ud->mdns, G_MDNS_SERVER_REMOVE, server, ud->mdns->user_data); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
209 g_mdns_server_destroy (server); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
210 g_mutex_lock (ud->mdns->mutex); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
211 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
212 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
213 g_mutex_unlock (ud->mdns->mutex); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
214 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
215 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
216 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
217 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
218 static void |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
219 g_mdns_server_destroy (GMDNSServer *server) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
220 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
221 g_return_if_fail (server); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
222 if (server->hostname) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
223 g_free (server->hostname); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
224 if (server->mdnsname) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
225 g_free (server->mdnsname); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
226 if (server->address) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
227 g_free (server->address); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
228 if (server->txtvalues) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
229 g_hash_table_destroy (server->txtvalues); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
230 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
231 g_free (server); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
232 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
233 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
234 static gboolean |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
235 g_mdns_source_prepare (GSource *source, gint *timeout_) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
236 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
237 /* No timeout here */ |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
238 return FALSE; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
239 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
240 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
241 static gboolean |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
242 g_mdns_source_check (GSource *source) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
243 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
244 /* Maybe check for errors here? */ |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
245 return TRUE; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
246 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
247 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
248 static gboolean |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
249 g_mdns_source_dispatch (GSource *source, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
250 GSourceFunc callback, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
251 gpointer user_data) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
252 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
253 GMDNSUserData *ud = user_data; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
254 DNSServiceErrorType err; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
255 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
256 if ((ud->fd->revents & G_IO_ERR) || (ud->fd->revents & G_IO_HUP)) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
257 return FALSE; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
258 } else if (ud->fd->revents & G_IO_IN) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
259 err = DNSServiceProcessResult (ud->client); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
260 if (err != kDNSServiceErr_NoError) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
261 g_warning ("DNSServiceProcessResult returned error"); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
262 return FALSE; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
263 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
264 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
265 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
266 return TRUE; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
267 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
268 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
269 static GSourceFuncs g_mdns_poll_funcs = { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
270 g_mdns_source_prepare, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
271 g_mdns_source_check, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
272 g_mdns_source_dispatch, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
273 NULL |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
274 }; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
275 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
276 static void |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
277 g_mdns_user_data_destroy (GMDNSUserData *ud) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
278 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
279 g_return_if_fail (ud); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
280 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
281 g_source_remove_poll (ud->source, ud->fd); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
282 g_free (ud->fd); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
283 g_source_destroy (ud->source); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
284 DNSServiceRefDeallocate (ud->client); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
285 g_free (ud); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
286 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
287 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
288 static gboolean |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
289 g_mdns_poll_add (GMDNS *mdns, GMDNSUserData *ud, DNSServiceRef client) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
290 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
291 ud->fd = g_new0 (GPollFD, 1); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
292 ud->fd->fd = DNSServiceRefSockFD (client); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
293 ud->client = client; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
294 ud->mdns = mdns; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
295 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
296 if (ud->fd->fd == -1) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
297 g_free (ud->fd); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
298 g_free (ud); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
299 return FALSE; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
300 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
301 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
302 ud->fd->events = G_IO_IN | G_IO_HUP | G_IO_ERR; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
303 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
304 ud->source = g_source_new (&g_mdns_poll_funcs, sizeof (GSource)); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
305 g_source_set_callback (ud->source, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
306 (GSourceFunc) g_mdns_source_dispatch, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
307 ud, NULL); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
308 g_source_add_poll (ud->source, ud->fd); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
309 g_source_attach (ud->source, NULL); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
310 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
311 return TRUE; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
312 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
313 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
314 /** |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
315 * Browse for a service. The callback will be called |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
316 * when it's fully resloved and queried |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
317 */ |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
318 static gboolean |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
319 g_mdns_browse (GMDNS *mdns, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
320 gchar *service, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
321 GMDNSFunc callback, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
322 gpointer user_data) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
323 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
324 DNSServiceErrorType err; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
325 DNSServiceRef client; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
326 GMDNSUserData *ud; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
327 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
328 g_return_val_if_fail (!mdns->browse_ud, FALSE); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
329 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
330 ud = g_new0 (GMDNSUserData, 1); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
331 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
332 err = DNSServiceBrowse (&client, 0, kDNSServiceInterfaceIndexAny, |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
333 service, 0, browse_reply, ud); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
334 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
335 if (err != kDNSServiceErr_NoError) { |
1448 | 336 g_warning ("Couldn't setup mDNS poller, error = %d",err); |
1407
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
337 return FALSE; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
338 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
339 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
340 g_mdns_poll_add (mdns, ud, client); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
341 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
342 mdns->callback = callback; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
343 mdns->user_data = user_data; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
344 mdns->browse_ud = ud; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
345 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
346 return TRUE; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
347 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
348 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
349 /** |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
350 * Remove updates for browsing. Make sure to |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
351 * call this before you initialize a new browsing |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
352 */ |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
353 static gboolean |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
354 g_mdns_stop_browsing (GMDNS *mdns) |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
355 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
356 g_return_val_if_fail (mdns, FALSE); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
357 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
358 g_mdns_user_data_destroy (mdns->browse_ud); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
359 mdns->callback = NULL; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
360 mdns->user_data = NULL; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
361 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
362 return TRUE; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
363 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
364 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
365 /** |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
366 * Return the full list of services |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
367 * the list is threadsafe but not the entries |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
368 * so it might be removed while you using it. |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
369 */ |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
370 GSList * |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
371 daap_mdns_get_server_list () |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
372 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
373 GSList *ret=NULL, *n; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
374 daap_mdns_server_t *server; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
375 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
376 g_mutex_lock (g_mdns->mutex); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
377 for (n = g_mdns->service_list; n; n = g_slist_next (n)) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
378 GMDNSServer *s = n->data; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
379 server = g_new0 (daap_mdns_server_t, 1); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
380 server->mdns_hostname = s->mdnsname; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
381 server->server_name = s->hostname; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
382 server->port = s->port; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
383 server->address = s->address; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
384 ret = g_slist_append (ret, server); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
385 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
386 g_mutex_unlock (g_mdns->mutex); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
387 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
388 return ret; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
389 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
390 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
391 /** |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
392 * Free resources held by GMDNS |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
393 */ |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
394 void |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
395 daap_mdns_destroy () |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
396 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
397 GSList *n; |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
398 g_return_if_fail (g_mdns); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
399 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
400 g_mdns_stop_browsing (g_mdns); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
401 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
402 g_mutex_lock (g_mdns->mutex); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
403 for (n = g_mdns->service_list; n; n = g_slist_next (n)) { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
404 g_mdns_server_destroy (n->data); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
405 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
406 g_mutex_unlock (g_mdns->mutex); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
407 g_mutex_free (g_mdns->mutex); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
408 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
409 g_free (g_mdns); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
410 } |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
411 |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
412 gboolean |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
413 daap_mdns_initialize () |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
414 { |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
415 g_mdns = g_new0 (GMDNS, 1); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
416 g_mdns->mutex = g_mutex_new (); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
417 return g_mdns_browse (g_mdns, "_daap._tcp", NULL, NULL); |
776dd8fc2b38
DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
418 } |
1448 | 419 #endif |