Mercurial > pidgin.yaz
annotate libpurple/protocols/bonjour/mdns_win32.c @ 17743:9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 05 Jun 2007 22:27:07 +0000 |
parents | c921f901c7ea |
children | bbe9248337ea |
rev | line source |
---|---|
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
1 /* |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
2 * This program is free software; you can redistribute it and/or modify |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
3 * it under the terms of the GNU General Public License as published by |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
4 * the Free Software Foundation; either version 2 of the License, or |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
5 * (at your option) any later version. |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
6 * |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
7 * This program is distributed in the hope that it will be useful, |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
10 * GNU Library General Public License for more details. |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
11 * |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
12 * You should have received a copy of the GNU General Public License |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
13 * along with this program; if not, write to the Free Software |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
15 */ |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
16 |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
17 #include "mdns_win32.h" |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
18 |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
19 #include "debug.h" |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
20 |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
21 /* data structure for the resolve callback */ |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
22 typedef struct _ResolveCallbackArgs |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
23 { |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
24 DNSServiceRef resolver; |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
25 int resolver_fd; |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
26 |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
27 PurpleDnsQueryData *query; |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
28 gchar *fqn; |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
29 |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
30 BonjourBuddy* buddy; |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
31 } ResolveCallbackArgs; |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
32 |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
33 static void |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
34 _mdns_parse_text_record(BonjourBuddy* buddy, const char* record, uint16_t record_len) |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
35 { |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
36 const char *txt_entry; |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
37 uint8_t txt_len; |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
38 int i; |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
39 |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
40 for (i = 0; buddy_TXT_records[i] != NULL; i++) { |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
41 txt_entry = TXTRecordGetValuePtr(record_len, record, buddy_TXT_records[i], &txt_len); |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
42 if (txt_entry != NULL) |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
43 set_bonjour_buddy_value(buddy, buddy_TXT_records[i], txt_entry, txt_len); |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
44 } |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
45 } |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
46 |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
47 static void DNSSD_API |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
48 _mdns_text_record_query_callback(DNSServiceRef DNSServiceRef, DNSServiceFlags flags, |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
49 uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *fullname, |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
50 uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
51 uint32_t ttl, void *context) |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
52 { |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
53 if (kDNSServiceErr_NoError != errorCode) |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
54 purple_debug_error("bonjour", "text record query - callback error.\n"); |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
55 else if (flags & kDNSServiceFlagsAdd) |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
56 { |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
57 BonjourBuddy *buddy = (BonjourBuddy*)context; |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
58 _mdns_parse_text_record(buddy, rdata, rdlen); |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
59 bonjour_buddy_add_to_purple(buddy); |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
60 } |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
61 } |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
62 |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
63 static void |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
64 _mdns_resolve_host_callback(GSList *hosts, gpointer data, const char *error_message) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
65 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
66 ResolveCallbackArgs* args = (ResolveCallbackArgs*)data; |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
67 |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
68 if (!hosts || !hosts->data) |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
69 purple_debug_error("bonjour", "host resolution - callback error.\n"); |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
70 else |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
71 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
72 struct sockaddr_in *addr = (struct sockaddr_in*)g_slist_nth_data(hosts, 1); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
73 BonjourBuddy* buddy = args->buddy; |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
74 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
75 buddy->ip = inet_ntoa(addr->sin_addr); |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
76 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
77 /* finally, set up the continuous txt record watcher, and add the buddy to purple */ |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
78 |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
79 if (kDNSServiceErr_NoError == DNSServiceQueryRecord(&buddy->txt_query, 0, 0, args->fqn, |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
80 kDNSServiceType_TXT, kDNSServiceClass_IN, _mdns_text_record_query_callback, buddy)) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
81 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
82 gint fd = DNSServiceRefSockFD(buddy->txt_query); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
83 buddy->txt_query_fd = purple_input_add(fd, PURPLE_INPUT_READ, _mdns_handle_event, buddy->txt_query); |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
84 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
85 bonjour_buddy_add_to_purple(buddy); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
86 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
87 else |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
88 bonjour_buddy_delete(buddy); |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
89 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
90 } |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
91 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
92 /* free the hosts list*/ |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
93 g_slist_free(hosts); |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
94 |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
95 /* free the remaining args memory */ |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
96 purple_dnsquery_destroy(args->query); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
97 g_free(args->fqn); |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
98 g_free(args); |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
99 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
100 |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
101 static void DNSSD_API |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
102 _mdns_service_resolve_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
103 const char *fullname, const char *hosttarget, uint16_t port, uint16_t txtLen, const char *txtRecord, void *context) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
104 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
105 ResolveCallbackArgs *args = (ResolveCallbackArgs*)context; |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
106 |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
107 /* remove the input fd and destroy the service ref */ |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
108 purple_input_remove(args->resolver_fd); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
109 DNSServiceRefDeallocate(args->resolver); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
110 |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
111 if (kDNSServiceErr_NoError != errorCode) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
112 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
113 purple_debug_error("bonjour", "service resolver - callback error.\n"); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
114 bonjour_buddy_delete(args->buddy); |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
115 g_free(args); |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
116 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
117 else |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
118 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
119 args->buddy->port_p2pj = port; |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
120 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
121 /* parse the text record */ |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
122 _mdns_parse_text_record(args->buddy, txtRecord, txtLen); |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
123 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
124 /* set more arguments, and start the host resolver */ |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
125 args->fqn = g_strdup(fullname); |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
126 |
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
127 if (!(args->query = |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
128 purple_dnsquery_a(hosttarget, port, _mdns_resolve_host_callback, args))) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
129 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
130 purple_debug_error("bonjour", "service resolver - host resolution failed.\n"); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
131 bonjour_buddy_delete(args->buddy); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
132 g_free(args->fqn); |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
133 g_free(args); |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
134 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
135 } |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
136 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
137 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
138 |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
139 static void DNSSD_API |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
140 _mdns_service_register_callback(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
141 const char *name, const char *regtype, const char *domain, void *context) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
142 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
143 /* we don't actually care about anything said in this callback - this is only here because Bonjour for windows is broken */ |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
144 if (kDNSServiceErr_NoError != errorCode) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
145 purple_debug_error("bonjour", "service advertisement - callback error.\n"); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
146 else |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
147 purple_debug_info("bonjour", "service advertisement - callback.\n"); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
148 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
149 |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
150 void DNSSD_API |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
151 _mdns_service_browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
152 DNSServiceErrorType errorCode, const char *serviceName, const char *regtype, const char *replyDomain, void *context) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
153 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
154 PurpleAccount *account = (PurpleAccount*)context; |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
155 PurpleBuddy *gb = NULL; |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
156 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
157 if (kDNSServiceErr_NoError != errorCode) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
158 purple_debug_error("bonjour", "service browser - callback error"); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
159 else if (flags & kDNSServiceFlagsAdd) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
160 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
161 /* A presence service instance has been discovered... check it isn't us! */ |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
162 if (g_ascii_strcasecmp(serviceName, account->username) != 0) |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
163 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
164 /* OK, lets go ahead and resolve it to add to the buddy list */ |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
165 ResolveCallbackArgs *args = g_new0(ResolveCallbackArgs, 1); |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
166 args->buddy = bonjour_buddy_new(serviceName, account); |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
167 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
168 if (kDNSServiceErr_NoError != DNSServiceResolve(&args->resolver, 0, 0, serviceName, regtype, replyDomain, _mdns_service_resolve_callback, args)) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
169 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
170 bonjour_buddy_delete(args->buddy); |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
171 g_free(args); |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
172 purple_debug_error("bonjour", "service browser - failed to resolve service.\n"); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
173 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
174 else |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
175 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
176 /* get a file descriptor for this service ref, and add it to the input list */ |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
177 gint resolver_fd = DNSServiceRefSockFD(args->resolver); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
178 args->resolver_fd = purple_input_add(resolver_fd, PURPLE_INPUT_READ, _mdns_handle_event, args->resolver); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
179 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
180 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
181 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
182 else |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
183 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
184 /* A peer has sent a goodbye packet, remove them from the buddy list */ |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
185 purple_debug_info("bonjour", "service browser - remove notification\n"); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
186 gb = purple_find_buddy(account, serviceName); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
187 if (gb != NULL) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
188 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
189 bonjour_buddy_delete(gb->proto_data); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
190 purple_blist_remove_buddy(gb); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
191 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
192 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
193 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
194 |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
195 int |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
196 _mdns_publish(BonjourDnsSd *data, PublishType type) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
197 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
198 TXTRecordRef dns_data; |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
199 char portstring[6]; |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
200 int ret = 0; |
17739
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
201 const char *jid, *aim, *email; |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
202 DNSServiceErrorType set_ret; |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
203 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
204 TXTRecordCreate(&dns_data, 256, NULL); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
205 |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
206 /* Convert the port to a string */ |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
207 snprintf(portstring, sizeof(portstring), "%d", data->port_p2pj); |
17739
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
208 |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
209 jid = purple_account_get_string(data->account, "jid", NULL); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
210 aim = purple_account_get_string(data->account, "AIM", NULL); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
211 email = purple_account_get_string(data->account, "email", NULL); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
212 |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
213 /* We should try to follow XEP-0174, but some clients have "issues", so we humor them. |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
214 * See http://telepathy.freedesktop.org/wiki/SalutInteroperability |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
215 */ |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
216 |
17739
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
217 /* Needed by iChat */ |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
218 set_ret = TXTRecordSetValue(&dns_data, "txtvers", 1, "1"); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
219 /* Needed by Gaim/Pidgin <= 2.0.1 (remove at some point) */ |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
220 if (set_ret == kDNSServiceErr_NoError) |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
221 set_ret = TXTRecordSetValue(&dns_data, "1st", strlen(data->first), data->first); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
222 /* Needed by Gaim/Pidgin <= 2.0.1 (remove at some point) */ |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
223 if (set_ret == kDNSServiceErr_NoError) |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
224 set_ret = TXTRecordSetValue(&dns_data, "last", strlen(data->last), data->last); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
225 /* Needed by Adium */ |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
226 if (set_ret == kDNSServiceErr_NoError) |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
227 set_ret = TXTRecordSetValue(&dns_data, "port.p2pj", strlen(portstring), portstring); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
228 /* Needed by iChat, Gaim/Pidgin <= 2.0.1 */ |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
229 if (set_ret == kDNSServiceErr_NoError) |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
230 set_ret = TXTRecordSetValue(&dns_data, "status", strlen(data->status), data->status); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
231 if (set_ret == kDNSServiceErr_NoError) |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
232 set_ret = TXTRecordSetValue(&dns_data, "ver", strlen(VERSION), VERSION); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
233 /* Currently always set to "!" since we don't support AV and wont ever be in a conference */ |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
234 if (set_ret == kDNSServiceErr_NoError) |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
235 set_ret = TXTRecordSetValue(&dns_data, "vc", strlen(data->vc), data->vc); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
236 if (set_ret == kDNSServiceErr_NoError && email != NULL && *email != '\0') |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
237 set_ret = TXTRecordSetValue(&dns_data, "email", strlen(email), email); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
238 if (set_ret == kDNSServiceErr_NoError && jid != NULL && *jid != '\0') |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
239 set_ret = TXTRecordSetValue(&dns_data, "jid", strlen(jid), jid); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
240 /* Nonstandard, but used by iChat */ |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
241 if (set_ret == kDNSServiceErr_NoError && aim != NULL && *aim != '\0') |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
242 set_ret = TXTRecordSetValue(&dns_data, "AIM", strlen(aim), aim); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
243 if (set_ret == kDNSServiceErr_NoError && data->msg != NULL && *data->msg != '\0') |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
244 set_ret = TXTRecordSetValue(&dns_data, "msg", strlen(data->msg), data->msg); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
245 if (set_ret == kDNSServiceErr_NoError && data->phsh != NULL && *data->phsh != '\0') |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
246 set_ret = TXTRecordSetValue(&dns_data, "phsh", strlen(data->phsh), data->phsh); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
247 |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
248 /* TODO: ext, nick, node */ |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
249 |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
250 if (set_ret != kDNSServiceErr_NoError) |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
251 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
252 purple_debug_error("bonjour", "Unable to allocate memory for text record.\n"); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
253 ret = -1; |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
254 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
255 else |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
256 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
257 DNSServiceErrorType err = kDNSServiceErr_NoError; |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
258 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
259 /* OK, we're done constructing the text record, (re)publish the service */ |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
260 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
261 switch (type) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
262 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
263 case PUBLISH_START: |
17739
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
264 err = DNSServiceRegister(&data->advertisement, 0, 0, purple_account_get_username(data->account), ICHAT_SERVICE, |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
265 NULL, NULL, data->port_p2pj, TXTRecordGetLength(&dns_data), TXTRecordGetBytesPtr(&dns_data), |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
266 _mdns_service_register_callback, NULL); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
267 break; |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
268 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
269 case PUBLISH_UPDATE: |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
270 err = DNSServiceUpdateRecord(data->advertisement, NULL, 0, TXTRecordGetLength(&dns_data), TXTRecordGetBytesPtr(&dns_data), 0); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
271 break; |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
272 } |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
273 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
274 if (kDNSServiceErr_NoError != err) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
275 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
276 purple_debug_error("bonjour", "Failed to publish presence service.\n"); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
277 ret = -1; |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
278 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
279 else if (PUBLISH_START == type) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
280 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
281 /* hack: Bonjour on windows is broken. We don't care about the callback but we have to listen anyway */ |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
282 gint advertisement_fd = DNSServiceRefSockFD(data->advertisement); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
283 data->advertisement_fd = purple_input_add(advertisement_fd, PURPLE_INPUT_READ, _mdns_handle_event, data->advertisement); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
284 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
285 } |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
286 |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
287 /* Free the memory used by temp data */ |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
288 TXTRecordDeallocate(&dns_data); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
289 return ret; |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
290 } |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
291 |
17743
9ccec98b8ca9
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17742
diff
changeset
|
292 void |
17733
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
293 _mdns_handle_event(gpointer data, gint source, PurpleInputCondition condition) |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
294 { |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
295 DNSServiceProcessResult((DNSServiceRef)data); |
d7b50cac1c7a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
296 } |