Mercurial > pidgin.yaz
annotate src/stun.c @ 12753:ddae10386677
[gaim-migrate @ 15100]
Always add an IP address in the Via Header.
committer: Tailor Script <tailor@pidgin.im>
author | Thomas Butter <tbutter> |
---|---|
date | Sat, 07 Jan 2006 18:23:50 +0000 |
parents | cf0d9e207cdc |
children | 6ef1cdc26b40 |
rev | line source |
---|---|
11225 | 1 /** |
2 * @file stun.c STUN (RFC3489) Implementation | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
11336 | 7 * STUN implementation inspired by jstun [http://jstun.javawi.de/] |
8 * | |
11225 | 9 * Gaim is the legal property of its developers, whose names are too numerous |
10 * to list here. Please refer to the COPYRIGHT file distributed with this | |
11 * source distribution. | |
12 * | |
13 * This program is free software; you can redistribute it and/or modify | |
14 * it under the terms of the GNU General Public License as published by | |
15 * the Free Software Foundation; either version 2 of the License, or | |
16 * (at your option) any later version. | |
17 * | |
18 * This program is distributed in the hope that it will be useful, | |
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 * GNU General Public License for more details. | |
22 * | |
23 * You should have received a copy of the GNU General Public License | |
24 * along with this program; if not, write to the Free Software | |
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
26 * | |
27 */ | |
28 | |
11898 | 29 #include "internal.h" |
30 | |
11364
e1840eb860e7
[gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11354
diff
changeset
|
31 #ifndef _WIN32 |
11225 | 32 #include <net/if.h> |
33 #include <sys/ioctl.h> | |
11364
e1840eb860e7
[gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11354
diff
changeset
|
34 #endif |
11225 | 35 |
12700
cf0d9e207cdc
[gaim-migrate @ 15043]
Richard Laager <rlaager@wiktel.com>
parents:
12686
diff
changeset
|
36 /* Solaris */ |
cf0d9e207cdc
[gaim-migrate @ 15043]
Richard Laager <rlaager@wiktel.com>
parents:
12686
diff
changeset
|
37 #if defined (__SVR4) && defined (__sun) |
cf0d9e207cdc
[gaim-migrate @ 15043]
Richard Laager <rlaager@wiktel.com>
parents:
12686
diff
changeset
|
38 #include <sys/sockio.h> |
cf0d9e207cdc
[gaim-migrate @ 15043]
Richard Laager <rlaager@wiktel.com>
parents:
12686
diff
changeset
|
39 #endif |
cf0d9e207cdc
[gaim-migrate @ 15043]
Richard Laager <rlaager@wiktel.com>
parents:
12686
diff
changeset
|
40 |
11225 | 41 #include "debug.h" |
42 #include "account.h" | |
11424 | 43 #include "dnssrv.h" |
11429 | 44 #include "proxy.h" |
11225 | 45 #include "stun.h" |
46 #include "prefs.h" | |
47 | |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
48 struct stun_header { |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
49 short type; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
50 short len; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
51 int transid[4]; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
52 }; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
53 |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
54 struct stun_attrib { |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
55 short type; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
56 short len; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
57 }; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
58 |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
59 struct stun_change { |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
60 struct stun_header hdr; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
61 struct stun_attrib attrib; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
62 char value[4]; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
63 }; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
64 |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
65 static GaimStunNatDiscovery nattype = {-1, 0, "\0"}; |
11225 | 66 |
67 static GSList *callbacks = 0; | |
68 static int fd = -1; | |
11354 | 69 static gint incb = -1; |
70 static gint timeout = -1; | |
71 static struct stun_header *packet; | |
72 static int packetsize = 0; | |
73 static int test = 0; | |
74 static int retry = 0; | |
75 static struct sockaddr_in addr; | |
11225 | 76 |
77 static void do_callbacks() { | |
78 while(callbacks) { | |
79 StunCallback cb = callbacks->data; | |
11336 | 80 if(cb) |
81 cb(&nattype); | |
11225 | 82 callbacks = g_slist_remove(callbacks, cb); |
83 } | |
84 } | |
85 | |
11354 | 86 static gboolean timeoutfunc(void *blah) { |
87 if(retry > 2) { | |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
88 if(test == 2) |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
89 nattype.type = GAIM_STUN_NAT_TYPE_SYMMETRIC; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
90 |
11354 | 91 /* remove input */ |
92 gaim_input_remove(incb); | |
11431
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
93 |
11354 | 94 /* set unknown */ |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
95 nattype.status = GAIM_STUN_STATUS_UNKNOWN; |
11354 | 96 |
97 /* callbacks */ | |
98 do_callbacks(); | |
99 | |
100 return FALSE; | |
101 } | |
102 retry++; | |
103 sendto(fd, packet, packetsize, 0, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)); | |
104 return TRUE; | |
105 } | |
106 | |
107 #ifdef NOTYET | |
108 static void do_test2() { | |
109 struct stun_change data; | |
11431
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
110 data.hdr.type = htons(0x0001); |
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
111 data.hdr.len = 0; |
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
112 data.hdr.transid[0] = rand(); |
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
113 data.hdr.transid[1] = ntohl(((int)'g' << 24) + ((int)'a' << 16) + ((int)'i' << 8) + (int)'m'); |
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
114 data.hdr.transid[2] = rand(); |
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
115 data.hdr.transid[3] = rand(); |
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
116 data.attrib.type = htons(0x003); |
11354 | 117 data.attrib.len = htons(4); |
118 data.value[3] = 6; | |
119 packet = (struct stun_header*)&data; | |
120 packetsize = sizeof(struct stun_change); | |
121 retry = 0; | |
122 test = 2; | |
123 sendto(fd, packet, packetsize, 0, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)); | |
11431
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
124 timeout = gaim_timeout_add(500, (GSourceFunc)timeoutfunc, NULL); |
11354 | 125 } |
126 #endif | |
127 | |
11225 | 128 static void reply_cb(gpointer data, gint source, GaimInputCondition cond) { |
11336 | 129 char buffer[1024]; |
11225 | 130 char *tmp; |
131 int len; | |
132 struct in_addr in; | |
133 struct stun_attrib *attrib; | |
134 struct stun_header *hdr; | |
11300
dd1a5969b2e5
[gaim-migrate @ 13500]
Richard Laager <rlaager@wiktel.com>
parents:
11229
diff
changeset
|
135 struct ifconf ifc; |
dd1a5969b2e5
[gaim-migrate @ 13500]
Richard Laager <rlaager@wiktel.com>
parents:
11229
diff
changeset
|
136 struct ifreq *ifr; |
dd1a5969b2e5
[gaim-migrate @ 13500]
Richard Laager <rlaager@wiktel.com>
parents:
11229
diff
changeset
|
137 struct sockaddr_in *sinptr; |
11431
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
138 |
11336 | 139 len = recv(source, buffer, 1024, 0); |
11225 | 140 |
141 hdr = (struct stun_header*)buffer; | |
11371
6e02e20e3a58
[gaim-migrate @ 13596]
Richard Laager <rlaager@wiktel.com>
parents:
11364
diff
changeset
|
142 if(hdr->transid[0]!=packet->transid[0] || hdr->transid[1]!=packet->transid[1] || hdr->transid[2]!=packet->transid[2] || hdr->transid[3]!=packet->transid[3]) { /* wrong transaction */ |
6e02e20e3a58
[gaim-migrate @ 13596]
Richard Laager <rlaager@wiktel.com>
parents:
11364
diff
changeset
|
143 gaim_debug_info("stun", "got wrong transid\n"); |
11225 | 144 return; |
145 } | |
11431
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
146 if(test==1) { |
11354 | 147 tmp = buffer + sizeof(struct stun_header); |
148 while(buffer+len > tmp) { | |
11225 | 149 |
11354 | 150 attrib = (struct stun_attrib*) tmp; |
151 if(attrib->type == htons(0x0001) && attrib->len == htons(8)) { | |
152 memcpy(&in.s_addr, tmp+sizeof(struct stun_attrib)+2+2, 4); | |
153 strcpy(nattype.publicip, inet_ntoa(in)); | |
154 } | |
155 tmp += sizeof(struct stun_attrib) + attrib->len; | |
11225 | 156 } |
11371
6e02e20e3a58
[gaim-migrate @ 13596]
Richard Laager <rlaager@wiktel.com>
parents:
11364
diff
changeset
|
157 gaim_debug_info("stun", "got public ip %s\n", nattype.publicip); |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
158 nattype.status = GAIM_STUN_STATUS_DISCOVERED; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
159 nattype.type = GAIM_STUN_NAT_TYPE_UNKNOWN_NAT; |
11354 | 160 |
11371
6e02e20e3a58
[gaim-migrate @ 13596]
Richard Laager <rlaager@wiktel.com>
parents:
11364
diff
changeset
|
161 /* is it a NAT? */ |
11225 | 162 |
11354 | 163 ifc.ifc_len = sizeof(buffer); |
164 ifc.ifc_req = (struct ifreq *) buffer; | |
165 ioctl(source, SIOCGIFCONF, &ifc); | |
11225 | 166 |
11354 | 167 tmp = buffer; |
168 while(tmp < buffer + ifc.ifc_len) { | |
169 ifr = (struct ifreq *) tmp; | |
11225 | 170 |
11364
e1840eb860e7
[gaim-migrate @ 13588]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11354
diff
changeset
|
171 tmp += sizeof(struct ifreq); |
11225 | 172 |
11354 | 173 if(ifr->ifr_addr.sa_family == AF_INET) { |
11371
6e02e20e3a58
[gaim-migrate @ 13596]
Richard Laager <rlaager@wiktel.com>
parents:
11364
diff
changeset
|
174 /* we only care about ipv4 interfaces */ |
11354 | 175 sinptr = (struct sockaddr_in *) &ifr->ifr_addr; |
176 if(sinptr->sin_addr.s_addr == in.s_addr) { | |
11371
6e02e20e3a58
[gaim-migrate @ 13596]
Richard Laager <rlaager@wiktel.com>
parents:
11364
diff
changeset
|
177 /* no NAT */ |
6e02e20e3a58
[gaim-migrate @ 13596]
Richard Laager <rlaager@wiktel.com>
parents:
11364
diff
changeset
|
178 gaim_debug_info("stun", "no nat"); |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
179 nattype.type = GAIM_STUN_NAT_TYPE_PUBLIC_IP; |
11354 | 180 } |
11225 | 181 } |
182 } | |
11354 | 183 gaim_timeout_remove(timeout); |
11225 | 184 |
11354 | 185 #ifdef NOTYET |
186 do_test2(); | |
187 #endif | |
188 return; | |
189 } else if(test == 2) { | |
190 do_callbacks(); | |
191 gaim_input_remove(incb); | |
192 gaim_timeout_remove(timeout); | |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
193 nattype.type = GAIM_STUN_NAT_TYPE_FULL_CONE; |
11354 | 194 } |
11336 | 195 } |
11424 | 196 |
11429 | 197 static void hbn_cb(GSList *hosts, gpointer edata, const char *error_message) { |
11354 | 198 static struct stun_header data; |
11424 | 199 int ret; |
11425 | 200 |
11429 | 201 if(!hosts) return; |
202 if(!hosts->data) return; | |
11425 | 203 |
11225 | 204 if((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
205 nattype.status = GAIM_STUN_STATUS_UNKNOWN; |
11424 | 206 do_callbacks(); |
207 return; | |
11225 | 208 } |
209 | |
210 addr.sin_family = AF_INET; | |
211 addr.sin_port = htons(12108); | |
212 addr.sin_addr.s_addr = INADDR_ANY; | |
213 while( ((ret = bind(fd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in))) < 0 ) && ntohs(addr.sin_port) < 12208) { | |
214 addr.sin_port = htons(ntohs(addr.sin_port)+1); | |
215 } | |
216 if( ret < 0 ) { | |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
217 nattype.status = GAIM_STUN_STATUS_UNKNOWN; |
11431
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
218 do_callbacks(); |
11424 | 219 return; |
11225 | 220 } |
221 incb = gaim_input_add(fd, GAIM_INPUT_READ, reply_cb, NULL); | |
222 | |
11429 | 223 ret = GPOINTER_TO_INT(hosts->data); |
224 hosts = g_slist_remove(hosts, hosts->data); | |
225 memcpy(&addr, hosts->data, sizeof(struct sockaddr_in)); | |
226 g_free(hosts->data); | |
227 hosts = g_slist_remove(hosts, hosts->data); | |
228 while(hosts) { | |
229 hosts = g_slist_remove(hosts, hosts->data); | |
230 g_free(hosts->data); | |
231 hosts = g_slist_remove(hosts, hosts->data); | |
232 } | |
11431
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
233 |
11225 | 234 data.type = htons(0x0001); |
235 data.len = 0; | |
11354 | 236 data.transid[0] = rand(); |
237 data.transid[1] = ntohl(((int)'g' << 24) + ((int)'a' << 16) + ((int)'i' << 8) + (int)'m'); | |
238 data.transid[2] = rand(); | |
239 data.transid[3] = rand(); | |
11431
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
240 |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
241 if(sendto(fd, &data, sizeof(struct stun_header), 0, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < sizeof(struct stun_header)) { |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
242 nattype.status = GAIM_STUN_STATUS_UNKNOWN; |
11431
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
243 do_callbacks(); |
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
244 return; |
11225 | 245 } |
11354 | 246 test = 1; |
247 packet = &data; | |
248 packetsize = sizeof(struct stun_header); | |
249 timeout = gaim_timeout_add(500, (GSourceFunc)timeoutfunc, NULL); | |
11429 | 250 } |
251 | |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
252 static void do_test1(GaimSrvResponse *resp, int results, gpointer sdata) { |
11431
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
253 const char *servername = sdata; |
11429 | 254 int port = 3478; |
11431
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
255 |
11429 | 256 if(results) { |
257 servername = resp[0].hostname; | |
258 port = resp[0].port; | |
259 } | |
260 gaim_debug_info("stun", "got %d SRV responses, server: %s, port: %d\n", results, servername, port); | |
261 | |
262 gaim_gethostbyname_async(servername, port, hbn_cb, NULL); | |
11424 | 263 g_free(resp); |
11225 | 264 } |
11424 | 265 |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
266 GaimStunNatDiscovery *gaim_stun_discover(StunCallback cb) { |
11431
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
267 const char *servername = gaim_prefs_get_string("/core/network/stun_server"); |
11424 | 268 |
269 gaim_debug_info("stun", "using server %s\n", servername); | |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
270 |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
271 if(nattype.status == GAIM_STUN_STATUS_DISCOVERING) { |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
272 if(cb) |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
273 callbacks = g_slist_append(callbacks, cb); |
11424 | 274 return NULL; |
275 } | |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
276 |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
277 if(nattype.status != GAIM_STUN_STATUS_UNDISCOVERED) { |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
278 if(cb) |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
279 cb(&nattype); |
11424 | 280 return &nattype; |
281 } | |
282 | |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
283 if(!servername || (strlen(servername) < 2)) { |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
284 nattype.status = GAIM_STUN_STATUS_UNKNOWN; |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
285 if(cb) |
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
286 cb(&nattype); |
11424 | 287 return &nattype; |
288 } | |
289 callbacks = g_slist_append(callbacks, cb); | |
12686
5f65a0cca87c
[gaim-migrate @ 15029]
Richard Laager <rlaager@wiktel.com>
parents:
11898
diff
changeset
|
290 gaim_srv_resolve("stun", "udp", servername, do_test1, |
11431
d2e44c8085e0
[gaim-migrate @ 13668]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11429
diff
changeset
|
291 (gpointer) servername); |
11424 | 292 return &nattype; |
293 } | |
294 | |
295 void gaim_stun_init() { | |
296 gaim_prefs_add_string("/core/network/stun_server", ""); | |
297 } |