/pidgin/main: 5e2587c3b805: Add MS-TURN TCP support
Jakub Adam
jakub.adam at ktknet.cz
Wed Mar 11 08:11:29 EDT 2015
Changeset: 5e2587c3b80502286fd169cc5d330c628605a907
Author: Jakub Adam <jakub.adam at ktknet.cz>
Date: 2014-04-23 07:31 +0200
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/5e2587c3b805
Description:
Add MS-TURN TCP support
The old TCP support never worked. Older versions of farstream defined
FS_NETWORK_PROTOCOL_TCP but there were even *tests* to ensure that any
attempt to use it would result in FS_ERROR_INVALID_ARGUMENTS.
This adds the three variants of TCP support that are now supported in
farstream 0.2.6 onwards, and bumps the requirement in configure.ac
accordingly.
Olivier says the Google ones should probably be passive. Since they
never worked anyway, I'm not going to lose too much sleep over them.
[dwmw2: reworked to remain compatible with the farstream 0.1 build]
diffstat:
configure.ac | 2 +-
libpurple/media/backend-fs2.c | 26 ++++++++++++++++-----
libpurple/media/enum-types.c | 12 +++++++--
libpurple/media/enum-types.h | 4 ++-
libpurple/protocols/jabber/google/google_p2p.c | 2 +-
libpurple/protocols/jabber/google/google_session.c | 2 +-
6 files changed, 35 insertions(+), 13 deletions(-)
diffs (117 lines):
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1138,7 +1138,7 @@ AC_ARG_ENABLE(farstream,
enable_farstream="$enableval", enable_farstream="yes")
if test "x$enable_farstream" != "xno"; then
if test "x$with_gstreamer" == "x1.0"; then
- PKG_CHECK_MODULES(FARSTREAM, [farstream-0.2], [
+ PKG_CHECK_MODULES(FARSTREAM, [farstream-0.2 >= 0.2.6], [
AC_SUBST(FARSTREAM_CFLAGS)
AC_SUBST(FARSTREAM_LIBS)
], [
diff --git a/libpurple/media/backend-fs2.c b/libpurple/media/backend-fs2.c
--- a/libpurple/media/backend-fs2.c
+++ b/libpurple/media/backend-fs2.c
@@ -226,10 +226,17 @@ purple_media_network_protocol_to_fs(Purp
switch (protocol) {
case PURPLE_MEDIA_NETWORK_PROTOCOL_UDP:
return FS_NETWORK_PROTOCOL_UDP;
- case PURPLE_MEDIA_NETWORK_PROTOCOL_TCP:
- return FS_NETWORK_PROTOCOL_TCP;
+#if GST_CHECK_VERSION(1,0,0)
+ case PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE:
+ return FS_NETWORK_PROTOCOL_TCP_PASSIVE;
+ case PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_ACTIVE:
+ return FS_NETWORK_PROTOCOL_TCP_ACTIVE;
+ case PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_SO:
+ return FS_NETWORK_PROTOCOL_TCP_SO;
+#endif
+ default:
+ g_return_val_if_reached(FS_NETWORK_PROTOCOL_TCP);
}
- g_return_val_if_reached(FS_NETWORK_PROTOCOL_TCP);
}
static PurpleMediaNetworkProtocol
@@ -238,10 +245,17 @@ purple_media_network_protocol_from_fs(Fs
switch (protocol) {
case FS_NETWORK_PROTOCOL_UDP:
return PURPLE_MEDIA_NETWORK_PROTOCOL_UDP;
- case FS_NETWORK_PROTOCOL_TCP:
- return PURPLE_MEDIA_NETWORK_PROTOCOL_TCP;
+#if GST_CHECK_VERSION(1,0,0)
+ case FS_NETWORK_PROTOCOL_TCP_PASSIVE:
+ return PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE;
+ case FS_NETWORK_PROTOCOL_TCP_ACTIVE:
+ return PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_ACTIVE;
+ case FS_NETWORK_PROTOCOL_TCP_SO:
+ return PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_SO;
+#endif
+ default:
+ g_return_val_if_reached(PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE);
}
- g_return_val_if_reached(PURPLE_MEDIA_NETWORK_PROTOCOL_TCP);
}
#if GST_CHECK_VERSION(1,0,0)
diff --git a/libpurple/media/enum-types.c b/libpurple/media/enum-types.c
--- a/libpurple/media/enum-types.c
+++ b/libpurple/media/enum-types.c
@@ -140,9 +140,15 @@ purple_media_network_protocol_get_type()
{ PURPLE_MEDIA_NETWORK_PROTOCOL_UDP,
"PURPLE_MEDIA_NETWORK_PROTOCOL_UDP",
"udp" },
- { PURPLE_MEDIA_NETWORK_PROTOCOL_TCP,
- "PURPLE_MEDIA_NETWORK_PROTOCOL_TCP",
- "tcp" },
+ { PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE,
+ "PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE",
+ "tcp passive" },
+ { PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_ACTIVE,
+ "PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_ACTIVE",
+ "tcp active" },
+ { PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_SO,
+ "PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_SO",
+ "tcp so" },
{ 0, NULL, NULL }
};
type = g_enum_register_static("PurpleMediaNetworkProtocol",
diff --git a/libpurple/media/enum-types.h b/libpurple/media/enum-types.h
--- a/libpurple/media/enum-types.h
+++ b/libpurple/media/enum-types.h
@@ -103,7 +103,9 @@ typedef enum {
*/
typedef enum {
PURPLE_MEDIA_NETWORK_PROTOCOL_UDP,
- PURPLE_MEDIA_NETWORK_PROTOCOL_TCP
+ PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE,
+ PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_ACTIVE,
+ PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_SO,
} PurpleMediaNetworkProtocol;
/**
diff --git a/libpurple/protocols/jabber/google/google_p2p.c b/libpurple/protocols/jabber/google/google_p2p.c
--- a/libpurple/protocols/jabber/google/google_p2p.c
+++ b/libpurple/protocols/jabber/google/google_p2p.c
@@ -319,7 +319,7 @@ jingle_google_p2p_get_remote_candidates(
PURPLE_MEDIA_CANDIDATE_TYPE_RELAY : 0,
!strcmp(candidate->protocol, "udp") ?
PURPLE_MEDIA_NETWORK_PROTOCOL_UDP :
- PURPLE_MEDIA_NETWORK_PROTOCOL_TCP,
+ PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE,
candidate->address, candidate->port);
g_object_set(new_candidate,
"username", candidate->username,
diff --git a/libpurple/protocols/jabber/google/google_session.c b/libpurple/protocols/jabber/google/google_session.c
--- a/libpurple/protocols/jabber/google/google_session.c
+++ b/libpurple/protocols/jabber/google/google_session.c
@@ -657,7 +657,7 @@ google_session_handle_candidates(JabberS
candidate_type,
purple_strequal(protocol, "udp") ?
PURPLE_MEDIA_NETWORK_PROTOCOL_UDP :
- PURPLE_MEDIA_NETWORK_PROTOCOL_TCP,
+ PURPLE_MEDIA_NETWORK_PROTOCOL_TCP_PASSIVE,
address,
atoi(port));
g_object_set(info, "username", purple_xmlnode_get_attrib(cand, "username"),
More information about the Commits
mailing list