Mercurial > pidgin
changeset 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 | 0a6f1f796d21 |
children | dfb6fbd89ac2 |
files | libpurple/protocols/jabber/jingle/iceudp.c libpurple/protocols/jabber/jingle/iceudp.h libpurple/protocols/jabber/jingle/rtp.c |
diffstat | 3 files changed, 25 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jingle/iceudp.c Tue Feb 24 08:25:23 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/iceudp.c Tue Feb 24 23:36:51 2009 +0000 @@ -78,6 +78,7 @@ 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 @@ 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 @@ 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 @@ 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"); }
--- a/libpurple/protocols/jabber/jingle/iceudp.h Tue Feb 24 08:25:23 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/iceudp.h Tue Feb 24 23:36:51 2009 +0000 @@ -72,6 +72,8 @@ guint port; guint priority; gchar *protocol; + gchar *reladdr; + guint relport; gchar *type; gchar *username;
--- a/libpurple/protocols/jabber/jingle/rtp.c Tue Feb 24 08:25:23 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/rtp.c Tue Feb 24 23:36:51 2009 +0000 @@ -217,6 +217,8 @@ 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 @@ 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;