Olivier Crête [Fri, 11 Jul 2014 21:59:27 +0000 (17:59 -0400)]
tcp-passive: Relay the tcp writable callback up
Otherwise, the caller gets a callback from an unexpected source.
Philip Withnall [Fri, 4 Jul 2014 13:39:29 +0000 (14:39 +0100)]
agent: Fix an old-style function definition in the Windows code
Philip Withnall [Fri, 4 Jul 2014 13:38:36 +0000 (14:38 +0100)]
agent: Add debugging when parsing addresses
Philip Withnall [Fri, 4 Jul 2014 11:31:32 +0000 (12:31 +0100)]
agent: Switch to GetAdapterAddresses() to find local IPs on Windows
The old GetIpAddrTable() function only returned IPv4 addresses. In order
to support IPv6 addresses, we need to use GetAdapterAddresses(), which
is available from Windows XP or Server 2003 onwards.
Philip Withnall [Fri, 4 Jul 2014 10:50:29 +0000 (11:50 +0100)]
agent: Use getaddrinfo() to parse addresses from strings
Rather than using inet_pton(), which doesn’t support IPv6 link-local
scope IDs, use getaddrinfo(). This is supported on all platforms
(POSIX.1-2001, and Windows winsock).
Philip Withnall [Fri, 4 Jul 2014 10:41:52 +0000 (11:41 +0100)]
agent: Use getnameinfo() instead of inet_ntop() to stringify addresses
inet_ntop() drops IPv6 link-local scope IDs on the floor, which means
libnice doesn’t generate any IPv6 candidates for link-local connections,
meaning that it will theoretically fail to negotiate a connection on an
IPv6-only network where the two peers are local.
Fix that by using getnameinfo() to convert sockaddrs to strings, which
preserves the scope ID.
There are no portability concerns — getnameinfo() is POSIX.1-2001, and
isn’t used on Windows (although it is supported, surprisingly).
Olivier Crête [Mon, 7 Jul 2014 23:38:13 +0000 (19:38 -0400)]
outputstream: Always try sending
Otherwise we're never woken up when it's again possible to send
Olivier Crête [Mon, 7 Jul 2014 23:34:38 +0000 (19:34 -0400)]
outputstream: Fix reference leak
Olivier Crête [Mon, 7 Jul 2014 20:01:49 +0000 (16:01 -0400)]
agent: Factor our writability signal
Olivier Crête [Wed, 2 Jul 2014 18:10:36 +0000 (14:10 -0400)]
introspection: Rename gir file to match library version
Philip Withnall [Wed, 2 Jul 2014 13:48:07 +0000 (14:48 +0100)]
socket: Avoid g_main_context_ref(NULL) calls using the default context
If (agent->main_context == NULL) the sockets are created with a NULL
main context, which they then try to ref. That does not end well.
Philip Withnall [Mon, 30 Jun 2014 19:09:30 +0000 (20:09 +0100)]
examples: Remove unnecessary dynamic type casts
We know the agent is a GObject — there is no need to check it at
runtime. This also improves Tartan’s static analysis of signal
connections.
Philip Withnall [Mon, 30 Jun 2014 19:04:16 +0000 (20:04 +0100)]
agent: Add a missing precondition assertion
Spotted by Tartan.
Philip Withnall [Mon, 30 Jun 2014 16:51:56 +0000 (17:51 +0100)]
docs: Remove some private symbols from the documentation sections file
Philip Withnall [Mon, 30 Jun 2014 16:51:45 +0000 (17:51 +0100)]
agent: Add a missing field documentation comment
Philip Withnall [Mon, 30 Jun 2014 16:51:33 +0000 (17:51 +0100)]
agent: Fix typos in documentation
Philip Withnall [Mon, 30 Jun 2014 16:38:35 +0000 (17:38 +0100)]
build: Add the lcov directory to .gitignore
Philip Withnall [Mon, 30 Jun 2014 16:37:17 +0000 (17:37 +0100)]
agent: Add missing #includes to candidate.h
Philip Withnall [Mon, 30 Jun 2014 16:35:39 +0000 (17:35 +0100)]
agent: Mark nice_agent_attach_recv() as (skip)
This removes it from the introspected bindings. It is unintrospectable
because it specifies a callback (@func) which persists after the
nice_agent_attach_recv() call returns. This is only supported by
gobject-introspection if a full closure with GDestroyNotify callback for
the user is passed in too.
Philip Withnall [Mon, 30 Jun 2014 16:35:19 +0000 (17:35 +0100)]
agent: Fix a typo in a documentation comment
Philip Withnall [Mon, 30 Jun 2014 16:34:53 +0000 (17:34 +0100)]
agent: Add missing (element-type) annotations to gtk-doc comments
These make the GSLists usable from introspection.
Philip Withnall [Mon, 30 Jun 2014 16:34:19 +0000 (17:34 +0100)]
agent: Fix badly formatted gtk-doc comments
Philip Withnall [Mon, 30 Jun 2014 16:30:21 +0000 (17:30 +0100)]
build: Add GObject introspection support
This bumps our autoconf requirement to 2.62 (from 2.59c) and disables
automake portability warnings.
It does not introduce a hard dependency on gobject-introspection; but if
available, it requires version 1.30.0. Support can be enabled with
--enable-introspection, and is required to make distcheck.
The generated introspection file has not been checked thoroughly, and
may expose internal symbols. A lot of new annotations are needed to make
many of the symbols usable.
Philip Withnall [Mon, 30 Jun 2014 16:28:09 +0000 (17:28 +0100)]
nice: Expose UPnP support in nice.pc.in
It might be useful for dependent packages to check whether libnice was
compiled with UPnP support, so expose that as a variable in the
pkg-config file, set to ‘true’ if supported, and the empty string
otherwise.
Philip Withnall [Mon, 30 Jun 2014 16:27:10 +0000 (17:27 +0100)]
nice: Auto-substitute pkg-config requirements in nice.pc.in
The requirements in the pkg-config file were outdated and incomplete. It
makes a lot more sense to automatically substitute them in from the
checks in configure.ac.
Olivier Crête [Mon, 7 Jul 2014 19:12:38 +0000 (15:12 -0400)]
interfaces: License was meant to be the same as the rest
Olivier Crête [Fri, 27 Jun 2014 14:14:05 +0000 (10:14 -0400)]
Require automake 1.12
We use macros from 1.12 anyway.
Olivier Crête [Sat, 17 May 2014 06:57:15 +0000 (15:57 +0900)]
agent: Separate reliability from ice-tcp vs ice-udp
We want ICE-TCP to not have reliable behavior unless the agent
is reliable otherwise it will confuse existing VoIP applications.
Olivier Crête [Sat, 17 May 2014 06:44:45 +0000 (15:44 +0900)]
agent: Only deal with pseudotcp if actually using PseudoTCP
PseudoTCP is only used if both the pseudotcp socket exists and the
underlying transport is unreliable.
Olivier Crête [Sat, 17 May 2014 05:49:46 +0000 (01:49 -0400)]
discovery: Make it less likely that a locally assigned remote foundation clashes with the remote one.
Olivier Crête [Sat, 17 May 2014 05:31:57 +0000 (01:31 -0400)]
discovery: Compare turn server when assigning foundations
The RFC says that "for reflexive and relayed candidates, the STUN or TURN servers
used to obtain them have the same IP address."
Olivier Crête [Sat, 17 May 2014 05:31:13 +0000 (01:31 -0400)]
discovery: Use nice_address_equal_no_port()
Olivier Crête [Sat, 17 May 2014 05:30:10 +0000 (01:30 -0400)]
discovery: Compare tranports (TCP vs UDP) while assigning remote foundations
Olivier Crête [Sat, 17 May 2014 05:29:14 +0000 (01:29 -0400)]
address: add nice_address_equal_no_port() to compare addresses ignoring ports
Olivier Crête [Sat, 17 May 2014 04:59:17 +0000 (00:59 -0400)]
agent: Add new-selected-pair-full
This signal include the whole candidate as the foundation is ambiguous.
Olivier Crête [Sat, 17 May 2014 04:50:44 +0000 (00:50 -0400)]
signal
Olivier Crête [Sat, 17 May 2014 03:10:07 +0000 (23:10 -0400)]
TODO: Update to match current state
Olivier Crête [Sat, 17 May 2014 04:23:14 +0000 (00:23 -0400)]
gitignore: Add test-driver from recent automake
Olivier Crête [Sat, 17 May 2014 04:03:04 +0000 (00:03 -0400)]
agent: Add new-candidate-full and new-remote-candidate-full signals
These signals include the actual candidate instead of just the foundation
which is not unique.
Olivier Crête [Sat, 17 May 2014 04:02:33 +0000 (00:02 -0400)]
candidate: Add Boxed type
Olivier Crête [Fri, 16 May 2014 16:04:30 +0000 (12:04 -0400)]
stunmessage: Accept NULL terminated buffers for fast speed validation
Olivier Crête [Thu, 15 May 2014 21:48:30 +0000 (17:48 -0400)]
discovery: Differentiate socket creation failure from other errors
If the socket can't be bound, then trying another port makes sense,
otherwise it doesn't.
Youness Alaoui [Fri, 25 Apr 2014 11:24:42 +0000 (07:24 -0400)]
Add TCP server reflexive candidates
For TCP server reflexive candidates, since STUN can't work on TCP
candidates, we will use STUN on UDP or TCP and once we get an
externally mapped address, we will create a server reflexive candidate
for all local TCP candidates that share the same base address, and use
the same mapped port as the base addresse's port.
Youness Alaoui [Fri, 25 Apr 2014 10:55:02 +0000 (06:55 -0400)]
Signal reliable-transport-writable when ice-tcp socket is writable
Youness Alaoui [Fri, 25 Apr 2014 10:40:40 +0000 (06:40 -0400)]
Add a nice_socket_can_send and nice_socket_set_writable_callback APIs
Youness Alaoui [Fri, 25 Apr 2014 10:13:33 +0000 (06:13 -0400)]
Call g_socket_check_connect_result before g_socket_is_connected
If we don't call check_connect_result on an outbound connection,
then is_connected will always return FALSE. That's why we check
both conditions to make sure g_socket_is_connected returns the
correct result, otherwise we end up closing valid connections
Youness Alaoui [Fri, 25 Apr 2014 08:32:32 +0000 (04:32 -0400)]
Bind to a local random port for tcp-bsd
Youness Alaoui [Fri, 25 Apr 2014 08:32:09 +0000 (04:32 -0400)]
Change argument names for tcp-bsd
Jakub Adam [Thu, 24 Apr 2014 11:12:26 +0000 (13:12 +0200)]
Set local address of TCP-BSD socket
Jakub Adam [Thu, 24 Apr 2014 10:38:56 +0000 (12:38 +0200)]
nice_tcp_bsd_socket_new: rename addr -> remote_addr
Youness Alaoui [Thu, 24 Apr 2014 02:32:53 +0000 (22:32 -0400)]
Add a bytestream-tcp property that is read-only for now
Youness Alaoui [Thu, 24 Apr 2014 02:29:32 +0000 (22:29 -0400)]
Only enable ice-tcp for RFC and OC2007 compatibility modes
Youness Alaoui [Thu, 24 Apr 2014 01:21:08 +0000 (21:21 -0400)]
Add documentation for ice-udp and ice-tcp properties
Youness Alaoui [Sat, 19 Apr 2014 06:34:12 +0000 (02:34 -0400)]
Only generate ms-turn candidates for ice-tcp base host addresses
The issue here was that there would be a new turn discovery for UDP
and for TCP-ACTIVE host candidates and we'd get 2 relayed addresses
with the same base_addr causing two relayed candidates to have the
same foundation. This causes farstream to duplicate candidates
since we only expose the foundation when we signal new-candidate.
This will also help later for adding turn-tcp support.
Youness Alaoui [Sat, 19 Apr 2014 04:52:18 +0000 (00:52 -0400)]
Move the rfc4571 handling for OC2007 into udp-turn
In the case of OC2007, we must consider that the turn control messages
are framed with rfc4571 and udp-turn-over-tcp only adds a single guint16
to represent turn-control or end-to-end indication. Otherwise, we will
have issues with double-framing when we do the allocate directly on
the udp-turn-over-tcp but we'd have no framing once we add the udp-turn
socket layer on top of udp-turn-over-tcp
Youness Alaoui [Sat, 19 Apr 2014 04:51:00 +0000 (00:51 -0400)]
Do not parse turn data more than once if we have multiple relays
Youness Alaoui [Sat, 19 Apr 2014 04:48:13 +0000 (00:48 -0400)]
Do the recv on relayed socket
With OC2007 compat, doing a recv on the attached socket (udp-turn-over-tcp)
will cause the RFC4571 to be unframed before doing the parse_recv on the
udp-turn socket, which will fail. And even if that didn't fail, it
would still cause the resulting data to be rfc4571 since the unframing
in the agent happens before the parse_recv
Youness Alaoui [Sat, 19 Apr 2014 04:47:08 +0000 (00:47 -0400)]
Error tcp socket when it fails to connect
Youness Alaoui [Sat, 19 Apr 2014 01:51:14 +0000 (21:51 -0400)]
Return the right value in agent_socket_send when framing
Youness Alaoui [Sat, 19 Apr 2014 01:47:16 +0000 (21:47 -0400)]
Allocate request is sent on UDP-TURN-OVER-TCP socket and is also framed
The UDP-TURN socket layer is only added at the end after we discover
the relay candidate with Allocate, but until then, we use the
UDP-TURN-OVER-TCP socket layer directly, so we need to do the rfc
framing for that as well, otherwise, it won't work.
Youness Alaoui [Sat, 19 Apr 2014 01:46:16 +0000 (21:46 -0400)]
Only create one relay/upnp request for ice-tcp depending on active or passive type
Youness Alaoui [Sat, 19 Apr 2014 01:44:30 +0000 (21:44 -0400)]
Only use pseudossl for OC2007 if turn type is TLS
Youness Alaoui [Sat, 19 Apr 2014 01:43:40 +0000 (21:43 -0400)]
Wrap socket_send in udp-turn to avoid if/else on reliable everywhere
Youness Alaoui [Sat, 19 Apr 2014 01:41:55 +0000 (21:41 -0400)]
Check real received size for pseuddossl handshake
Youness Alaoui [Thu, 17 Apr 2014 00:56:56 +0000 (20:56 -0400)]
Send reliable-transport-writable on reliable ice-tcp and drop bogus 'ice-tcp unsupported'
Youness Alaoui [Wed, 16 Apr 2014 23:03:19 +0000 (19:03 -0400)]
Add some informative debug messaging
Youness Alaoui [Wed, 16 Apr 2014 22:51:54 +0000 (18:51 -0400)]
Add support for ICE-TCP
This is a massive commit that can't be split. We add ice-tcp support
into the agent by creating local host tcp-active/tcp-passive candidates.
We also need to find the local and remote candidates whenever we discover
a peer-reflexive because their data is important to setup the peer-reflexive
so a few changes were added to look for the local or remote candidate.
For TCP-ACTIVE remote peer-reflexive candidates, we can't add conncheck
pairs normally because TCP-PASSIVE (local) do not generate candidate pairs,
and we also can't have a connection from any local host, so we can only create
a single candidatepair with the local/remote that are connected.
The pair->socket of a candidate check pair will hold the connected tcp socket
(through connect for ACT or accept for PASS) and we will either have a
remote or a local peer-reflexive which will create a new candidate pair,
we cannot trigger checks on the initial candidate pair, we must only do it
on the new check pairs. but in the case of a tcp-passive, we don't get a new
local peer-reflexive candidate, so there is no new candidate with a new NiceSocket, so
when we get a triggered check, we need to match it to the candidate check pair
or when we select a pair, it will still use the original TCP-PASS socket.
We must store the new connected tcp socket in the peer reflexive candidates
since they represent that unique peer-reflx candidate's connection
Youness Alaoui [Wed, 16 Apr 2014 22:49:25 +0000 (18:49 -0400)]
Do not retransmit triggered checks if reliable transport
Youness Alaoui [Wed, 16 Apr 2014 22:47:44 +0000 (18:47 -0400)]
Small refactor for conncheck add_pair function
Youness Alaoui [Wed, 16 Apr 2014 01:07:16 +0000 (21:07 -0400)]
Print info on selected pair
Youness Alaoui [Tue, 15 Apr 2014 23:49:45 +0000 (19:49 -0400)]
Store connections in tcp-passive to allow sending
In the case of TCP-ACTIVE, we don't have a problem, because the new
socket will generate a peer-reflexive candidate with the right
sockptr, and all sends will go through it, but for TCP-PASSIVE, there
is no peer reflexive candidates, so once the pair is selected, the local
candidate will point to the TCP-PASSIVE candidate with the TCP_PASSIVE
socket type which will cause all sends to fail, so we need to proxy
them to the child connections
Youness Alaoui [Tue, 15 Apr 2014 23:19:31 +0000 (19:19 -0400)]
Fix RFC4571 n_buffers when reading and frame outgoing STUN messages
Youness Alaoui [Tue, 15 Apr 2014 00:56:53 +0000 (20:56 -0400)]
Fix SDP generation for TCP candidates
Youness Alaoui [Mon, 14 Apr 2014 23:05:26 +0000 (19:05 -0400)]
Do not create a socket_source if fileno is NULL
Youness Alaoui [Sat, 12 Apr 2014 04:34:42 +0000 (00:34 -0400)]
Add support for RFC4571 framing (packetized mode) for ICE-TCP candidates
Youness Alaoui [Sat, 12 Apr 2014 03:13:57 +0000 (23:13 -0400)]
Disable reliable mode for test-fullmode, we already have pseudotcp unit tests
Youness Alaoui [Sat, 12 Apr 2014 03:11:04 +0000 (23:11 -0400)]
Add RFC4571 framing to ice-tcp for MS-TURN
Data and STUN messages sent over TCP MUST follow the framing method
specified in [RFC4571] section 2. We will frame every outgoing packet
and split it into 62KB frames when sending, and on reception, we will
unframe the rfc4571. For now, we only unframe for udp-turn tcp-act/pass
candidates, which means only for MS-TURN over TCP.
We still need to do the unframing for real ice-tcp candidates, then add
support for reading the data in a serialized way.
Youness Alaoui [Fri, 11 Apr 2014 21:36:02 +0000 (17:36 -0400)]
Set pair->sockptr when discovering peer-reflexive candidates
Fixes Issue #1
Youness Alaoui [Fri, 11 Apr 2014 04:14:22 +0000 (00:14 -0400)]
Add tcp-passive and tcp-active socket layers with unit test
Youness Alaoui [Fri, 11 Apr 2014 04:11:49 +0000 (00:11 -0400)]
Add a nice_socket_recv convenience function similar to nice_socket_send
Youness Alaoui [Fri, 11 Apr 2014 03:47:59 +0000 (23:47 -0400)]
Refactor tcp-bsd to ease integration of tcp-act/tcp-passive
Youness Alaoui [Fri, 11 Apr 2014 01:32:19 +0000 (21:32 -0400)]
Make socket reliable in case of tcp-act/tcp-pass and move logic for ms-turn
Youness Alaoui [Thu, 10 Apr 2014 02:13:08 +0000 (22:13 -0400)]
Factor out the add_to_be_sent into a helper API for sockets
The add_to_be_sent was duplicated in http/socks5/pseudossl/tcp-bsd and
had some small differences. It's better to factor it out so bug fixes
get applied to all of them and code is cleaner.
Youness Alaoui [Thu, 10 Apr 2014 01:15:06 +0000 (21:15 -0400)]
Do not allow message_offset to become negative when queuing messages
Youness Alaoui [Thu, 10 Apr 2014 00:35:33 +0000 (20:35 -0400)]
Use reliable TCP for ms-turn since it generates tcp candidates
Youness Alaoui [Wed, 9 Apr 2014 23:54:24 +0000 (19:54 -0400)]
Do not return the socket to the app if we use ice-tcp, even in unreliable case
Youness Alaoui [Wed, 9 Apr 2014 23:47:54 +0000 (19:47 -0400)]
Add support for MS-ICE2 candidate priorization for OC2007R2 compatibility
Youness Alaoui [Wed, 9 Apr 2014 03:58:01 +0000 (23:58 -0400)]
Rename turn files and API to be UDP specific
The TURN-TCP RFC is very different from TURN-UDP, the current turn and tcp-turn
files were only for UDP TURN RFC and UDP TURN using TCP transport.
When we implement TCP-TURN, we'll need a different algorithm, so I
renamed the files and API to avoid any confusion.
Youness Alaoui [Wed, 9 Apr 2014 03:56:39 +0000 (23:56 -0400)]
Fix crash when discovering peer reflexive candidates in RFC compat
Youness Alaoui [Wed, 9 Apr 2014 03:55:00 +0000 (23:55 -0400)]
test-fullmode: protect against ready->connected->ready state change and accept data reception on connected state
Youness Alaoui [Wed, 9 Apr 2014 02:11:19 +0000 (22:11 -0400)]
Make OC2007 relay candidates use TCP_ACTIVE and TCP_PASSIVE candidate types when using TCP TURN
Youness Alaoui [Wed, 9 Apr 2014 01:42:02 +0000 (21:42 -0400)]
Do not add server-reflexive from TURN if using a TCP connection
Youness Alaoui [Wed, 9 Apr 2014 01:31:11 +0000 (21:31 -0400)]
Remove priority functions from public header file and move to agent-priv.h
Youness Alaoui [Wed, 9 Apr 2014 01:26:42 +0000 (21:26 -0400)]
Change priority algorithm for better values
Now we will always give a handicap to UDP candidates, but still give
relays the lower priority. We have the following priorities now :
In reliable mode :
TCP Host : 120
TCP peer-refl : 110
TCP nat-assist : 105
TCP srv-refl : 100
UDP Host : 60
UDP peer-refl : 55
UDP nat-assist : 52
UDP srv-refl : 50
TCP relay : 10
UDP relay : 5
In unreliable mode :
UDP Host : 120
UDP peer-refl : 110
UDP nat-assist : 105
UDP srv-refl : 100
TCP Host : 60
TCP peer-refl : 55
TCP nat-assist : 52
TCP srv-refl : 50
UDP relay : 10
TCP relay : 5
Youness Alaoui [Wed, 9 Apr 2014 00:48:15 +0000 (20:48 -0400)]
test-priority: Unit test various configurations of candidate priorities
Youness Alaoui [Wed, 9 Apr 2014 00:26:09 +0000 (20:26 -0400)]
Fix peer reflexive priority depending on transport and compatibility
Youness Alaoui [Wed, 9 Apr 2014 00:21:55 +0000 (20:21 -0400)]
Add support for ice-tcp priorities, udp-tunneled and nat-assisted priorities
Youness Alaoui [Tue, 8 Apr 2014 23:10:36 +0000 (19:10 -0400)]
Use nice_candidate_ice_priority instead of _full variant when possible
Youness Alaoui [Tue, 8 Apr 2014 07:58:15 +0000 (03:58 -0400)]
Add support for MS-TURN in OC2007 compatibility turn usage
Youness Alaoui [Tue, 8 Apr 2014 07:57:43 +0000 (03:57 -0400)]
Do not enable keepalives for tcp candidates