comparison libpurple/protocols/jabber/jingle/iceudp.c @ 26119:36c7efb85220

Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Tue, 24 Feb 2009 23:36:51 +0000
parents 84ea07648377
children dfb6fbd89ac2
comparison
equal deleted inserted replaced
26118:0a6f1f796d21 26119:36c7efb85220
76 { 76 {
77 g_free(candidate->foundation); 77 g_free(candidate->foundation);
78 g_free(candidate->id); 78 g_free(candidate->id);
79 g_free(candidate->ip); 79 g_free(candidate->ip);
80 g_free(candidate->protocol); 80 g_free(candidate->protocol);
81 g_free(candidate->reladdr);
81 g_free(candidate->type); 82 g_free(candidate->type);
82 83
83 g_free(candidate->username); 84 g_free(candidate->username);
84 g_free(candidate->password); 85 g_free(candidate->password);
85 } 86 }
300 301
301 const gchar *username = xmlnode_get_attrib(iceudp, "ufrag"); 302 const gchar *username = xmlnode_get_attrib(iceudp, "ufrag");
302 const gchar *password = xmlnode_get_attrib(iceudp, "pwd"); 303 const gchar *password = xmlnode_get_attrib(iceudp, "pwd");
303 304
304 for (; candidate; candidate = xmlnode_get_next_twin(candidate)) { 305 for (; candidate; candidate = xmlnode_get_next_twin(candidate)) {
306 const gchar *relport =
307 xmlnode_get_attrib(candidate, "rel-port");
305 iceudp_candidate = jingle_iceudp_candidate_new( 308 iceudp_candidate = jingle_iceudp_candidate_new(
306 atoi(xmlnode_get_attrib(candidate, "component")), 309 atoi(xmlnode_get_attrib(candidate, "component")),
307 xmlnode_get_attrib(candidate, "foundation"), 310 xmlnode_get_attrib(candidate, "foundation"),
308 atoi(xmlnode_get_attrib(candidate, "generation")), 311 atoi(xmlnode_get_attrib(candidate, "generation")),
309 xmlnode_get_attrib(candidate, "id"), 312 xmlnode_get_attrib(candidate, "id"),
312 atoi(xmlnode_get_attrib(candidate, "port")), 315 atoi(xmlnode_get_attrib(candidate, "port")),
313 atoi(xmlnode_get_attrib(candidate, "priority")), 316 atoi(xmlnode_get_attrib(candidate, "priority")),
314 xmlnode_get_attrib(candidate, "protocol"), 317 xmlnode_get_attrib(candidate, "protocol"),
315 xmlnode_get_attrib(candidate, "type"), 318 xmlnode_get_attrib(candidate, "type"),
316 username, password); 319 username, password);
320 iceudp_candidate->reladdr = g_strdup(
321 xmlnode_get_attrib(candidate, "rel-addr"));
322 iceudp_candidate->relport =
323 relport != NULL ? atoi(relport) : 0;
317 jingle_iceudp_add_remote_candidate(JINGLE_ICEUDP(transport), iceudp_candidate); 324 jingle_iceudp_add_remote_candidate(JINGLE_ICEUDP(transport), iceudp_candidate);
318 } 325 }
319 326
320 return transport; 327 return transport;
321 } 328 }
355 xmlnode_set_attrib(xmltransport, "network", network); 362 xmlnode_set_attrib(xmltransport, "network", network);
356 xmlnode_set_attrib(xmltransport, "port", port); 363 xmlnode_set_attrib(xmltransport, "port", port);
357 xmlnode_set_attrib(xmltransport, "priority", priority); 364 xmlnode_set_attrib(xmltransport, "priority", priority);
358 xmlnode_set_attrib(xmltransport, "protocol", candidate->protocol); 365 xmlnode_set_attrib(xmltransport, "protocol", candidate->protocol);
359 366
367 if (candidate->reladdr != NULL &&
368 (strcmp(candidate->ip, candidate->reladdr) ||
369 (candidate->port != candidate->relport))) {
370 gchar *relport = g_strdup_printf("%d",
371 candidate->relport);
372 xmlnode_set_attrib(xmltransport, "rel-addr",
373 candidate->reladdr);
374 xmlnode_set_attrib(xmltransport, "rel-port",
375 relport);
376 g_free(relport);
377 }
378
360 if (action == JINGLE_SESSION_ACCEPT) { 379 if (action == JINGLE_SESSION_ACCEPT) {
361 /* XXX: fix this, it's dummy data */ 380 /* XXX: fix this, it's dummy data */
362 xmlnode_set_attrib(xmltransport, "rel-addr", "10.0.1.1");
363 xmlnode_set_attrib(xmltransport, "rel-port", "8998");
364 xmlnode_set_attrib(xmltransport, "rem-addr", "192.0.2.1"); 381 xmlnode_set_attrib(xmltransport, "rem-addr", "192.0.2.1");
365 xmlnode_set_attrib(xmltransport, "rem-port", "3478"); 382 xmlnode_set_attrib(xmltransport, "rem-port", "3478");
366 } 383 }
367 384
368 xmlnode_set_attrib(xmltransport, "type", candidate->type); 385 xmlnode_set_attrib(xmltransport, "type", candidate->type);