[PATCH] Add MS-TURN TCP support
Eion Robb
eion at robbmob.com
Wed Mar 11 14:42:31 EDT 2015
Unless the patch is only targeting libpurple 3.x, wouldn't you need to make
sure that PURPLE_MEDIA_NETWORK_PROTOCOL_TCP still exists for backwards API
compatibility?
On 12/03/2015 1:14 am, "David Woodhouse" <dwmw2 at infradead.org> wrote:
> After positive feedback on IRC and a little bit more research and
> improvements of my own to fix the farstream01/gstreamer0x build I've
> committed this version:
>
> From 2655b18eab7fab0eebed2b2c369e8e725c386c89 Mon Sep 17 00:00:00 2001
> From: Jakub Adam <jakub.adam at ktknet.cz>
> Date: Wed, 23 Apr 2014 07:31:30 +0200
> Subject: [PATCH] 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]
> ---
> 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(-)
>
> diff --git a/configure.ac b/configure.ac
> index 675e613..2b3ae5c 100644
> --- 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
> index ba39127..b5b3194 100644
> --- a/libpurple/media/backend-fs2.c
> +++ b/libpurple/media/backend-fs2.c
> @@ -226,10 +226,17 @@
> purple_media_network_protocol_to_fs(PurpleMediaNetworkProtocol protocol)
> 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(FsNetworkProtocol protocol)
> 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
> index 4626938..af6f8ee 100644
> --- 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
> index e420ad4..b93e809 100644
> --- 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
> index 6b0f13d..37be1d7 100644
> --- 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(JingleTransport *transport)
>
> 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
> index f4f2a91..5397601 100644
> --- a/libpurple/protocols/jabber/google/google_session.c
> +++ b/libpurple/protocols/jabber/google/google_session.c
> @@ -657,7 +657,7 @@ google_session_handle_candidates(JabberStream *js,
> GoogleSession *session, Purp
> 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"),
> --
> 2.1.0
>
>
>
> --
> dwmw2
>
> _______________________________________________
> Devel mailing list
> Devel at pidgin.im
> https://pidgin.im/cgi-bin/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pidgin.im/pipermail/devel/attachments/20150312/978960bd/attachment.html>
More information about the Devel
mailing list