/pidgin/main: fcecf7f838e2: Add MS-TURN TCP support

Jakub Adam jakub.adam at ktknet.cz
Thu Mar 12 21:17:46 EDT 2015


Changeset: fcecf7f838e266dc2c3bfd306df58ade3fc3ac93
Author:	 Jakub Adam <jakub.adam at ktknet.cz>
Date:	 2014-04-23 07:31 +0200
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/fcecf7f838e2

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_session.c |   2 +-
 5 files changed, 34 insertions(+), 12 deletions(-)

diffs (105 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -868,7 +868,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
@@ -225,10 +225,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
@@ -237,10 +244,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
@@ -145,9 +145,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
@@ -82,7 +82,9 @@ typedef enum {
 /** Media network protocols */
 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;
 
 /** Media session types */
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", xmlnode_get_attrib(cand, "username"),



More information about the Commits mailing list