pidgin.vv: 8ce57872: Use the correct values for Jingle Ice-Ud...
maiku at soc.pidgin.im
maiku at soc.pidgin.im
Wed Feb 25 00:25:26 EST 2009
-----------------------------------------------------------------
Revision: 8ce5787256971183877a26ede853ff16e1f94a7b
Ancestor: ef36bf6ea65f4599818d1e448a5e8f5591f873e0
Author: maiku at soc.pidgin.im
Date: 2009-02-24T23:36:51
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/8ce5787256971183877a26ede853ff16e1f94a7b
Modified files:
libpurple/protocols/jabber/jingle/iceudp.c
libpurple/protocols/jabber/jingle/iceudp.h
libpurple/protocols/jabber/jingle/rtp.c
ChangeLog:
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/iceudp.c c8b0e47119ee73fadcfa9b0ca6d9588192821849
+++ libpurple/protocols/jabber/jingle/iceudp.c 712a327a056b829960e6c964bc6318f1538b9c12
@@ -78,6 +78,7 @@ jingle_iceudp_candidate_free(JingleIceUd
g_free(candidate->id);
g_free(candidate->ip);
g_free(candidate->protocol);
+ g_free(candidate->reladdr);
g_free(candidate->type);
g_free(candidate->username);
@@ -302,6 +303,8 @@ jingle_iceudp_parse_internal(xmlnode *ic
const gchar *password = xmlnode_get_attrib(iceudp, "pwd");
for (; candidate; candidate = xmlnode_get_next_twin(candidate)) {
+ const gchar *relport =
+ xmlnode_get_attrib(candidate, "rel-port");
iceudp_candidate = jingle_iceudp_candidate_new(
atoi(xmlnode_get_attrib(candidate, "component")),
xmlnode_get_attrib(candidate, "foundation"),
@@ -314,6 +317,10 @@ jingle_iceudp_parse_internal(xmlnode *ic
xmlnode_get_attrib(candidate, "protocol"),
xmlnode_get_attrib(candidate, "type"),
username, password);
+ iceudp_candidate->reladdr = g_strdup(
+ xmlnode_get_attrib(candidate, "rel-addr"));
+ iceudp_candidate->relport =
+ relport != NULL ? atoi(relport) : 0;
jingle_iceudp_add_remote_candidate(JINGLE_ICEUDP(transport), iceudp_candidate);
}
@@ -357,10 +364,20 @@ jingle_iceudp_to_xml_internal(JingleTran
xmlnode_set_attrib(xmltransport, "priority", priority);
xmlnode_set_attrib(xmltransport, "protocol", candidate->protocol);
+ if (candidate->reladdr != NULL &&
+ (strcmp(candidate->ip, candidate->reladdr) ||
+ (candidate->port != candidate->relport))) {
+ gchar *relport = g_strdup_printf("%d",
+ candidate->relport);
+ xmlnode_set_attrib(xmltransport, "rel-addr",
+ candidate->reladdr);
+ xmlnode_set_attrib(xmltransport, "rel-port",
+ relport);
+ g_free(relport);
+ }
+
if (action == JINGLE_SESSION_ACCEPT) {
/* XXX: fix this, it's dummy data */
- xmlnode_set_attrib(xmltransport, "rel-addr", "10.0.1.1");
- xmlnode_set_attrib(xmltransport, "rel-port", "8998");
xmlnode_set_attrib(xmltransport, "rem-addr", "192.0.2.1");
xmlnode_set_attrib(xmltransport, "rem-port", "3478");
}
============================================================
--- libpurple/protocols/jabber/jingle/iceudp.h 05e048ce2b3640c8dbf077ecc9614639289812eb
+++ libpurple/protocols/jabber/jingle/iceudp.h 202e736fc53ba124543e94b5b8a1e3a75316da3b
@@ -72,6 +72,8 @@ struct _JingleIceUdpCandidate
guint port;
guint priority;
gchar *protocol;
+ gchar *reladdr;
+ guint relport;
gchar *type;
gchar *username;
============================================================
--- libpurple/protocols/jabber/jingle/rtp.c fa5b563b7a59cd2c1a697e8c2d933eb10dcbf88e
+++ libpurple/protocols/jabber/jingle/rtp.c 16842fb8edc7839fbe40232aab566700bfe22b63
@@ -217,6 +217,8 @@ jingle_rtp_candidates_to_transport(Jingl
candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX ? "prflx" :
candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_RELAY ? "relay" : "",
candidate->username, candidate->password);
+ iceudp_candidate->reladdr = g_strdup(candidate->base_ip);
+ iceudp_candidate->relport = candidate->base_port;
jingle_iceudp_add_local_candidate(JINGLE_ICEUDP(transport), iceudp_candidate);
g_free(id);
}
@@ -261,6 +263,8 @@ jingle_rtp_transport_to_candidates(Jingl
PURPLE_MEDIA_CANDIDATE_TYPE_RELAY : 0,
PURPLE_MEDIA_NETWORK_PROTOCOL_UDP,
candidate->ip, candidate->port);
+ new_candidate->base_ip = g_strdup(candidate->reladdr);
+ new_candidate->base_port = candidate->relport;
new_candidate->username = g_strdup(candidate->username);
new_candidate->password = g_strdup(candidate->password);
new_candidate->priority = candidate->priority;
More information about the Commits
mailing list