...
 
Commits (892)
......@@ -42,6 +42,7 @@ ltmain.sh
missing
stamp-h.in
stamp-h1
test-driver
# top level stuff
debian
......@@ -65,8 +66,10 @@ agent/test-fallback
agent/test-fullmode
agent/test-restart
agent/test-thread
agent/agent-signals-marshal.h
agent/agent-signals-marshal.c
agent/Nice-*.gir
agent/Nice-*.typelib
agent/agent-enum-types.c
agent/agent-enum-types.h
# stun/ stuff
......@@ -92,6 +95,7 @@ stun/tests/test-conncheck
stun/tests/test-format
stun/tests/test-hmac
stun/tests/test-parse
stun/usages/.dirstamp
# local/ stuff
local/liblocal.la
......@@ -132,9 +136,9 @@ tests/test-add-remove-stream
tests/test-address
tests/test-bsd
tests/test-build-io-stream
tests/test-dribble
tests/test-fallback
tests/test-fullmode
tests/test-icetcp
tests/test-io-stream-cancelling
tests/test-io-stream-closing-read
tests/test-io-stream-closing-write
......@@ -142,11 +146,24 @@ tests/test-io-stream-thread
tests/test-io-stream-pollable
tests/test-send-recv
tests/test-mainloop
tests/test-new-trickle
tests/test-priority
tests/test-pseudotcp
tests/test-pseudotcp-fin
tests/test-pseudotcp-fuzzy
tests/test-pseudotcp-fin
tests/test-restart
tests/test-tcp
tests/test-thread
tests/test-new-dribble
tests/test-trickle
tests/test-nomination
tests/test-credentials
tests/test-different-number-streams
tests/test-drop-invalid
tests/test-gstreamer
tests/test-socket-is-based-on
tests/test-turn
tests/test-udp-turn-fragmentation
# examples/ stuff
examples/simple-example
......@@ -166,6 +183,7 @@ docs/reference/libnice/tmpl
docs/reference/libnice/xml
# win32 stuff
win32/vs9/libnice.def
win32/vs9/*.user
win32/vs9/libnice.ncb
win32/vs9/libnice.suo
......@@ -173,3 +191,9 @@ win32/vs9/libnice/
glib/
*.exe
ar-lib
# Code coverage
lcov/
# Meson builddir
_build/
stages:
- build
- test
- deploy
build autotools:
stage: build
image: registry.freedesktop.org/libnice/libnice/centos7/autotools-build
except:
- schedules
script:
- ifconfig
- export BUILD_ID="libnice-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID"
- export PREFIX="$(pwd)/prefix-$BUILD_ID"
- export MAKEFLAGS="-j4"
- mkdir "$PREFIX"
- ./autogen.sh --prefix="$PREFIX" --enable-compile-warnings=error --enable-gtk-doc --enable-introspection
- make
- make install
artifacts:
untracked: true
test autotools:
stage: test
image: registry.freedesktop.org/libnice/libnice/centos7/autotools-build
except:
- schedules
dependencies:
- build autotools
script:
- ifconfig
- make check
artifacts:
when: always
paths:
- config.log
- nice/test-suite.log
- random/test-suite.log
- tests/test-suite.log
- stun/tests/test-suite.log
- docs/reference/libnice/test-suite.log
test autotools valgrind:
extends: test autotools
allow_failure: true
script:
- ifconfig
- make check-valgrind
distcheck autotools:
stage: test
image: registry.freedesktop.org/libnice/libnice/centos7/autotools-build
except:
- schedules
dependencies:
- build autotools
script:
- ifconfig
- make distcheck
artifacts:
paths:
- libnice-*.tar.gz
build meson:
stage: build
image: registry.freedesktop.org/libnice/libnice/centos7/meson-build
variables:
PREFIX: "${CI_PROJECT_DIR}/libnice-prefix"
except:
- schedules
before_script:
- mkdir -p "${CI_PROJECT_DIR}"
script:
## && true to make gitlab-ci happy
- source scl_source enable rh-python36 && true
- meson --werror --warnlevel 2 -Dgtk_doc=enabled --prefix=$PREFIX build/
- ninja-build -C build/
artifacts:
paths:
- build/
build msys2:
image: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v6'
stage: 'build'
tags:
- 'docker'
- 'windows'
- '1607'
variables:
MESON_ARGS: >
--prefix=${CI_PROJECT_DIR}/libnice-prefix
# Make sure any failure in PowerShell scripts is fatal
ErrorActionPreference: 'Stop'
WarningPreference: 'Stop'
before_script:
- pip3 install -U meson
script:
# For some reason, options are separated by newline instead of space, so we
# have to replace them first.
- $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
- $env:PATH += ";C:\msys64\usr\bin;C:\msys64\mingw64/bin;C:\msys64\mingw32/bin"
# Build and run the tests.
# This is part of the same job due to a bug in the gitlab-runner
# that prevents us from exporting artifacts with docker-windows
# executors. It has since been fixed in gitlab 12.1, but
# we are blocked from upgrading currently.
#
# Gitlab Runner issue: https://gitlab.com/gitlab-org/gitlab-runner/issues/4291
# Blocked upgrade issue: https://gitlab.freedesktop.org/gstreamer/gst-ci/issues/6#note_192780
- C:\msys64\usr\bin\bash -c "meson build $env:MESON_ARGS &&
ninja -C build &&
meson test -C build --print-errorlogs --suite libnice"
.build msvc:
extends: build msys2
script:
# For some reason, options are separated by newline instead of space, so we
# have to replace them first.
- $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
# Build and run the tests.
# This is part of the same job due to a bug in the gitlab-runner
# that prevents us from exporting artifacts with docker-windows
# executors. It has since been fixed in gitlab 12.1, but
# we are blocked from upgrading currently.
#
# Gitlab Runner issue: https://gitlab.com/gitlab-org/gitlab-runner/issues/4291
# Blocked upgrade issue: https://gitlab.freedesktop.org/gstreamer/gst-ci/issues/6#note_192780
- New-Item -Path subprojects -Name openssl.wrap -Value "[wrap-git]`r`ndirectory=openssl`r`nurl=https://gitlab.freedesktop.org/libnice/openssl-binaries-for-ci.git`r`nrevision=1.1.1c`r`n"
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
meson subprojects download &&
meson wrap promote subprojects\glib\subprojects\libffi.wrap &&
meson wrap promote subprojects\glib\subprojects\zlib.wrap &&
meson wrap promote subprojects\glib\subprojects\proxy-libintl.wrap &&
meson subprojects download"
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
meson build $env:MESON_ARGS &&
ninja -C build &&
meson test -C build --print-errorlogs --suite libnice"
build msvc amd64:
extends: .build msvc
variables:
ARCH: 'amd64'
build msvc x86:
extends: .build msvc
variables:
ARCH: 'x86'
test meson:
stage: test
image: registry.freedesktop.org/libnice/libnice/centos7/meson-build
allow_failure: true
dependencies:
- build meson
except:
- schedules
script:
- ifconfig
- source scl_source enable rh-python36 && true
- meson test -C build/ --print-errorlogs
artifacts:
when: on_failure
paths:
- build/meson-logs/
test valgrind meson:
extends: test meson
script:
- ifconfig
- source scl_source enable rh-python36 && true
- meson test -C build/ --setup valgrind --print-errorlogs
doc-and-install meson:
stage: test
image: registry.freedesktop.org/libnice/libnice/centos7/meson-build
dependencies:
- build meson
except:
- schedules
variables:
PREFIX: "${CI_PROJECT_DIR}/libnice-prefix"
script:
- source scl_source enable rh-python36 && true
- ninja-build -C build/ libnice-doc
- ninja-build -C build/ install
- ls -lR ${PREFIX}
artifacts:
paths:
- build/docs/reference/libnice/html/
submit-to-coverity:
stage: test
image: registry.freedesktop.org/libnice/libnice/centos7/autotools-build
variables:
COVERITY_PROJECT: libnice
only:
- schedules
dependencies: []
script:
- curl -v https://scan.coverity.com/download/linux64 -o coverity_tool.tgz --form token="${COVERITY_TOKEN}" --form project="${COVERITY_PROJECT}" && tar xf coverity_tool.tgz && rm coverity_tool.tgz
- mv cov-analysis-linux64-* cov-analysis-linux64
- ./autogen.sh --prefix="$PREFIX" --disable-gtk-doc --disable-introspection
- make clean
- export PATH="$PATH:${CI_PROJECT_DIR}/cov-analysis-linux64/bin"
- echo $PATH
- cov-build --dir cov-int make -j4
- tar czvf libnice.tgz cov-int
- curl --form token=$COVERITY_TOKEN --form email=olivier.crete@ocrete.ca --form file=@libnice.tgz --form version="${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}" --form description="CI weekly run" https://scan.coverity.com/builds?project=libnice
pages:
stage: deploy
dependencies:
- doc-and-install meson
only:
- tags
artifacts:
paths:
- public
script:
- mv build/docs/reference/libnice/html/ public/
......@@ -17,11 +17,11 @@ SUBDIRS = \
agent \
nice \
gst \
docs \
tests \
docs \
examples
DISTCHECK_CONFIGURE_FLAGS = --disable-assert -enable-gtk-doc
DISTCHECK_CONFIGURE_FLAGS = --disable-assert -enable-gtk-doc --enable-introspection
EXTRA_DIST = \
COPYING.LGPL \
......@@ -30,8 +30,10 @@ EXTRA_DIST = \
common.mk \
scripts/lcov.mk \
scripts/lcov.sh \
scripts/valgrind.sh \
win32
scripts/valgrind-test-driver \
m4/introspection.m4 \
meson.build \
meson_options.txt
MAINTAINERCLEANFILES = ar-lib
......
libnice 0.1.5 (2014-03-06)
libnice 0.1.16 (2019-05-09)
===========================
Add API to make it easier to implement ICE trickle
Add async closing of agent, to cleanly close TURN allocations
Add Google non-standard NOMINATION STUN attribute
Fix tests on Windows
Fix some racy tests
libnice 0.1.15 (2018-12-27)
===========================
Add support for Regular Nomination
Removal of the global lock over all agents
Add method to compare candidate targets
Added optional Meson build system, future releases will remove autotools
Renamed all members of PseudoTcpState enum (compile-time API change)
Now drops all packets from addresses that have not been validated by an ICE check
Multiple improvements to ICE interoperability
Improved RFC compliance
Improved OC2007 compatibility mode alternate-server support
libnice 0.1.14 (2017-04-03)
===========================
Improved RFC compliance
Split verbose logs into a separate option
Numerous bug fixes
Use GnuTLS for hash functions
Implement NewReno in PseudoTCP
Requires GLib 2.44 GnuTLS 2.12
libnice 0.1.13 (2015-04-28)
===========================
Fix build on non-Windows platforms that don't have getifaddrs()
Fix build regression on Windows
libnice 0.1.12 (2015-04-22)
===========================
Fix regression in SDP parser
Make examples work on Windows
Bug fixes on nicesrc
libnice 0.1.11 (2015-04-20)
===========================
API: nice_agent_set_local_credentials() for WebRTC
Nicesink: support GstBufferList
Better warnings on programming errors
Build fixes for Solaris and Windows
Bug and documentation fixes
libnice 0.1.10 (2015-01-28)
===========================
Fix bug on component change on the sink
libnice 0.1.9 (2015-01-28)
==========================
Make it possible to statically build the GStreamer plugins
Bug fixes, in particular fix compatibility with coTurn servers
Documentation fixes
libnice 0.1.8 (2014-10-09)
==========================
Added FIN-ACK behavior in the PseudoTCP
ICE-TCP, both standard mode and Microsoft compatible
Microsoft compatible TURN-TCP
API: nice_address_equal_no_port() to compare NiceAddresses ignoring the port
API: nice_agent_get_component_state() to get the current component state
API: agent:keepalive-conncheck to make the agent use conncheck as keepalives
and fail the connection if there is no answer
API: agent:ice-tcp, agent:udp-tcp to control ICE-UDP vs ICE-TCP behaviours
API: agent:bytestream-tcp to know if the send/receives in reliable mode create full packets or not
API: New signals agent::new-selected-pair-full, agent::new-candidate-full,
agent::new-remote-candidate-full which include the NiceCandidates directly
API: Deprecated agent::new-selected-pair and agent::new-candidate and
agent::new-remote-candidate signals
Now all signals are emitted at the function return time
libnice 0.1.7 (2014-05-05)
==========================
Fix undesired API change that broke Farstream unit testsx
libnice 0.1.6 (2014-04-28)
==========================
API: nice_agent_restart_stream() to do a ICE restart on a single strema
API: nice_component_state_to_string() to get a printable name for a component
state
API: nice_agent_forget_relays() to forget the relays set for a
specific component, along with nice_agent_restart_stream(), it allows
changing the current relay without dropping the connection.
It is now possible to add relays after the initial candidate gathering.
Many bug fixes
libnice 0.1.5 (2014-03-06)
==========================
API: nice_agent_recv() and nice_agent_recv_nonblocking() as an alternative to
the nice_agent_attach_recv()
......@@ -13,7 +102,6 @@ Improve PseudoTCP performance
Improve performance
Build fixes
libnice 0.1.4 (2013-02-22)
==========================
......@@ -33,7 +121,6 @@ Dribble mode: You can set remote candidates while gathering the local ones
Add support for GStreamer 1.0, will compile plugins for both 1.0 and 0.10 by default
Cache GSocketAddress in UdpBsdSocket, creating it is very slow
libnice 0.1.2 (2012-04-03)
==========================
......
......@@ -5,7 +5,7 @@ Nice: GLib ICE library
Copyright
---------
(C) 2006-2011 Collabora Ltd.
(C) 2006-2018 Collabora Ltd.
(C) 2006-2011 Nokia Corporation
License
......@@ -16,10 +16,12 @@ See the file COPYING.
Requirements
------------
glib >= 2.10
glib >= 2.54
pkg-config
gnutls >= 2.12.0 or OpenSSL
gupnp-igd >= 0.1.2 (optional)
gstreamer-0.10 >= 0.10.0 (optional)
gstreamer-1.0 (optional)
Build instructions
------------------
......@@ -30,9 +32,6 @@ Please refer to the INSTALL file for more details.
If you are building from git, you must first run the ./autogen.sh script
to generate the configure file for you.
To build on Windows, please refer to the README.win32 file for build instructions
using Microsoft Visual Studio.
Structure
---------
......@@ -50,7 +49,7 @@ Relevant standards
These standards are relevant to nice's current implementation.
ICE draft 15
ICE RFC 5245
http://tools.ietf.org/html/rfc5245
STUN
http://tools.ietf.org/html/rfc3489
......
Microsoft Visual Studio v9.0 (aka Microsoft Visual Studio 2008)
---------------------------------------------------------------
1) Download prerequisites (glib, zlib and gettext-runtime)
Go to http://www.gtk.org/download/win32.php
Download GLib Run-time and Dev packages. At time of writing GLib current version is 2.28.8.
Links are
http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib_2.28.8-1_win32.zip
http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib-dev_2.28.8-1_win32.zip
Download zlib and gettext-runtime Run-time package. At time of writing zlib current version is 1.2.5
and gettext-runtime current version is 0.18.1.1
Links are
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/zlib_1.2.5-2_win32.zip
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip
2) Put glib in the correct path
Create a folder glib under libnice root as in the following picture:
libnice
|--- agent
|--- docs
|--- glib <--------------
|--- gst
| ...
|--- tests
|--- win32
| AUTHORS
| ...
| TODO
Expand glib_<current-version>_win32.zip, glib-dev_<current-version>_win32.zip,
zlib_<current-version>_win32.zip and gettext-runtime_<current-version>_win32.zip under glib
folder.
The tree should be like the following picture:
libnice
|--- ...
|--- glib
|-------- bin
|-------- etc
|-------- include
|-------- lib
|-------- manifest
|-------- share
|-------- src
|--- ...
3) Generate agent-signals-marshal files
Launch script win32/dogenmarshal.cmd on the win32 folder to generate agent/agent-signals-marshal.h and
agent/agent-signals-marshal.c
4) Open win32/libnice.sln with Microsoft Visual Studio 2008
Build solution, output will be on libnice/win32/vs9/libnice/bin/Win32_Debug or libnice/win32/vs9/libnice/bin/Win32_Release
depending on the configuration chosen.
- High priority:
Refactor/cleanup conncheck.c and discovery.c
Finish GIO support for reliable transport
Add a nice_agent_create_source()
Implement SIP-style forking
Implement ICE-TCP (http://tools.ietf.org/html/draft-ietf-mmusic-ice-tcp-15) both for packetized content and streams
nice_socket_recv returns -1 means we must close the nice_socket and stop all connchecks/candidates and reelect if was eleected...
Bytestream mode (non packetized) for standard ICE-TCP
Standard (RFC 6062) TURN-TCP
Server reflexive candidates for ICE-TCP (aka STUN TCP)
Clear unused local sockets (freeing file descriptions in the process) on READY
TCP simultaneous-open (S-O)
- Low priority:
Add HTTP Digest support
......
......@@ -22,23 +22,23 @@ if WINDOWS
AM_CFLAGS += -DWINVER=0x0501 # _WIN32_WINNT_WINXP
endif
dist_noinst_DATA = agent-signals-marshal.list
noinst_LTLIBRARIES = libagent.la
agent-signals-marshal.h: agent-signals-marshal.list
glib-genmarshal --header --prefix=agent_marshal $? > $@
agent-signals-marshal.c: agent-signals-marshal.list
echo '#include "agent-signals-marshal.h"' > $@
glib-genmarshal --body --prefix=agent_marshal $? | \
sed -e 's/^}$$/(void)return_value;(void)invocation_hint;}/' >> $@
BUILT_SOURCES = \
agent-signals-marshal.h \
agent-signals-marshal.c
agent-enum-types.h \
agent-enum-types.c
CLEANFILES += $(BUILT_SOURCES)
noinst_LTLIBRARIES = libagent.la
pkginclude_HEADERS = \
agent.h \
candidate.h \
debug.h \
address.h \
interfaces.h \
pseudotcp.h \
$(NULL)
libagent_la_SOURCES = \
address.h \
address.c \
......@@ -69,24 +69,67 @@ libagent_la_SOURCES = \
outputstream.c \
$(BUILT_SOURCES)
agent-enum-types.h: $(pkginclude_HEADERS) Makefile
$(AM_V_GEN)$(GLIB_MKENUMS) \
--fhead "#ifndef __AGENT_ENUM_TYPES_H__\n#define __AGENT_ENUM_TYPES_H__ 1\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
--fprod "/* enumerations from \"@filename@\" */\n" \
--vhead "GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define NICE_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
--ftail "G_END_DECLS\n\n#endif /* !AGENT_ENUM_TYPES_H */" \
$(addprefix $(srcdir)/,$(pkginclude_HEADERS)) > $@
agent-enum-types.c: $(pkginclude_HEADERS) Makefile agent-enum-types.h
$(AM_V_GEN)$(GLIB_MKENUMS) \
--fhead "#include <config.h>\n#include <glib-object.h>\n#include \"agent.h\"\n#include \"pseudotcp.h\"\n#include \"agent-enum-types.h\"" \
--fprod "\n/* enumerations from \"@filename@\" */" \
--vhead "GType\n@enum_name@_get_type (void)\n{\n static GType type = 0;\n if (!type) {\n static const G@Type@Value values[] = {" \
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
--vtail " { 0, NULL, NULL }\n };\n type = g_@type@_register_static (\"@EnumName@\", values);\n }\n return type;\n}\n\n" \
$(addprefix $(srcdir)/,$(pkginclude_HEADERS)) > $@
libagent_la_LIBADD = \
$(top_builddir)/random/libnice-random.la \
$(top_builddir)/socket/libsocket.la \
$(top_builddir)/stun/libstun.la
$(top_builddir)/stun/libstun.la \
$(GLIB_LIBS) \
$(GUPNP_LIBS) \
$(NULL)
libagent_la_DEPENDENCIES = \
$(top_builddir)/random/libnice-random.la \
$(top_builddir)/socket/libsocket.la \
$(top_builddir)/stun/libstun.la
pkginclude_HEADERS = \
agent.h \
candidate.h \
debug.h \
address.h \
interfaces.h \
pseudotcp.h \
$(NULL)
if WINDOWS
libagent_la_LIBADD += -liphlpapi -lws2_32
endif
#
# GObject introspection
#
# We need --accept-unprefixed because of PseudoTcp and TurnServer.
#
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all --accept-unprefixed
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
if HAVE_INTROSPECTION
introspection_sources = $(pkginclude_HEADERS)
Nice-0.1.gir: libagent.la
Nice_0_1_gir_INCLUDES = GObject-2.0 Gio-2.0
Nice_0_1_gir_EXPORT_PACKAGES = nice
Nice_0_1_gir_CFLAGS = $(AM_CFLAGS)
Nice_0_1_gir_LIBS = libagent.la
Nice_0_1_gir_FILES = $(introspection_sources)
INTROSPECTION_GIRS += Nice-0.1.gir
girdir = $(datadir)/gir-1.0
gir_DATA = $(INTROSPECTION_GIRS)
typelibdir = $(libdir)/girepository-1.0
typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += $(gir_DATA) $(typelib_DATA)
endif
EXTRA_DIST = meson.build
......@@ -44,12 +44,23 @@
#include <string.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#include "address.h"
#ifdef G_OS_WIN32
#define inet_pton inet_pton_win32
#define inet_ntop inet_ntop_win32
/* Defined in recent versions of mingw:
* https://github.com/mirror/mingw-w64/commit/0f4899473c4ba2e34fa447b1931a04e38c1f105e
*/
#ifndef IN6_ARE_ADDR_EQUAL
#define IN6_ARE_ADDR_EQUAL(a, b) \
(memcmp ((const void *) (a), (const void *) (b), sizeof (struct in6_addr)) == 0)
#endif
static const char *
inet_ntop_win32 (int af, const void *src, char *dst, socklen_t cnt)
......@@ -74,36 +85,6 @@ inet_ntop_win32 (int af, const void *src, char *dst, socklen_t cnt)
return NULL;
}
static int
inet_pton_win32(int af, const char *src, void *dst)
{
struct addrinfo hints, *res, *ressave;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = af;
if (getaddrinfo(src, NULL, &hints, &res) != 0) {
return 0;
}
ressave = res;
while (res) {
if( res->ai_addr->sa_family == AF_INET) {
memcpy(dst, &((struct sockaddr_in *) res->ai_addr)->sin_addr,
sizeof(struct in_addr));
res = res->ai_next;
} else if(res->ai_addr->sa_family == AF_INET6) {
memcpy(dst, &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr,
sizeof(struct in_addr6));
res = res->ai_next;
}
}
freeaddrinfo(ressave);
return 1;
}
#endif
......@@ -189,18 +170,21 @@ nice_address_get_port (const NiceAddress *addr)
NICEAPI_EXPORT gboolean
nice_address_set_from_string (NiceAddress *addr, const gchar *str)
{
union
{
struct in_addr ipv4;
struct in6_addr ipv6;
} a;
if (inet_pton (AF_INET, str, &a.ipv4) > 0)
nice_address_set_ipv4 (addr, ntohl (a.ipv4.s_addr));
else if (inet_pton (AF_INET6, str, &a.ipv6) > 0)
nice_address_set_ipv6 (addr, a.ipv6.s6_addr);
else
return FALSE; /* Invalid address */
struct addrinfo hints;
struct addrinfo *res;
memset (&hints, 0, sizeof (hints));
/* AI_NUMERICHOST prevents getaddrinfo() from doing DNS resolution. */
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_NUMERICHOST;
if (getaddrinfo (str, NULL, &hints, &res) != 0)
return FALSE; /* invalid address */
nice_address_set_from_sockaddr (addr, res->ai_addr);
freeaddrinfo (res);
return TRUE;
}
......@@ -282,7 +266,8 @@ nice_address_equal (const NiceAddress *a, const NiceAddress *b)
case AF_INET6:
return IN6_ARE_ADDR_EQUAL (&a->s.ip6.sin6_addr, &b->s.ip6.sin6_addr)
&& (a->s.ip6.sin6_port == b->s.ip6.sin6_port)
&& (a->s.ip6.sin6_scope_id == b->s.ip6.sin6_scope_id);
&& (a->s.ip6.sin6_scope_id == 0 || b->s.ip6.sin6_scope_id == 0 ||
(a->s.ip6.sin6_scope_id == b->s.ip6.sin6_scope_id));
default:
g_return_val_if_reached (FALSE);
......@@ -331,7 +316,7 @@ ipv6_address_is_private (const guchar *addr)
{
return (
/* fe80::/10 */
((addr[0] == 0xfe) && ((addr[1] & 0xc) == 0x80)) ||
((addr[0] == 0xfe) && ((addr[1] & 0xc0) == 0x80)) ||
/* fc00::/7 */
((addr[0] & 0xfe) == 0xfc) ||
/* ::1 loopback */
......@@ -383,3 +368,24 @@ nice_address_ip_version (const NiceAddress *addr)
return 0;
}
}
NICEAPI_EXPORT gboolean
nice_address_equal_no_port (const NiceAddress *a, const NiceAddress *b)
{
if (a->s.addr.sa_family != b->s.addr.sa_family)
return FALSE;
switch (a->s.addr.sa_family)
{
case AF_INET:
return (a->s.ip4.sin_addr.s_addr == b->s.ip4.sin_addr.s_addr);
case AF_INET6:
return IN6_ARE_ADDR_EQUAL (&a->s.ip6.sin6_addr, &b->s.ip6.sin6_addr)
&& (a->s.ip6.sin6_scope_id == 0 || b->s.ip6.sin6_scope_id == 0 ||
(a->s.ip6.sin6_scope_id == b->s.ip6.sin6_scope_id));
default:
g_return_val_if_reached (FALSE);
}
}
......@@ -37,8 +37,8 @@
* file under either the MPL or the LGPL.
*/
#ifndef _ADDRESS_H
#define _ADDRESS_H
#ifndef __LIBNICE_ADDRESS_H__
#define __LIBNICE_ADDRESS_H__
/**
* SECTION:address
......@@ -67,9 +67,6 @@ G_BEGIN_DECLS
/**
* NiceAddress:
* @addr: Generic sockaddr address
* @ip4: IPv4 sockaddr address
* @ip6: IPv6 sockaddr address
*
* The #NiceAddress structure that represents an IPv4 or IPv6 address.
*/
......@@ -235,12 +232,29 @@ nice_address_copy_to_sockaddr (const NiceAddress *addr, struct sockaddr *sin);
* @b: Second #NiceAddress to compare
*
* Compares two #NiceAddress structures to see if they contain the same address
* and the same port.
*
* Returns: %TRUE if @a and @b are the same address, %FALSE if they are different
*/
gboolean
nice_address_equal (const NiceAddress *a, const NiceAddress *b);
/**
* nice_address_equal_no_port:
* @a: First #NiceAddress to compare
* @b: Second #NiceAddress to compare
*
* Compares two #NiceAddress structures to see if they contain the same address,
* ignoring the port.
*
* Returns: %TRUE if @a and @b are the same address, %FALSE if they
* are different
*
* Since: 0.1.8
*/
gboolean
nice_address_equal_no_port (const NiceAddress *a, const NiceAddress *b);
/**
* nice_address_to_string:
* @addr: The #NiceAddress to query
......@@ -289,5 +303,5 @@ nice_address_ip_version (const NiceAddress *addr);
G_END_DECLS
#endif /* _ADDRESS_H */
#endif /* __LIBNICE_ADDRESS_H__ */
......@@ -106,7 +106,6 @@ nice_input_message_iter_compare (const NiceInputMessageIter *a,
#define NICE_AGENT_TIMER_TA_DEFAULT 20 /* timer Ta, msecs (impl. defined) */
#define NICE_AGENT_TIMER_TR_DEFAULT 25000 /* timer Tr, msecs (impl. defined) */
#define NICE_AGENT_TIMER_TR_MIN 15000 /* timer Tr, msecs (ICE ID-19) */
#define NICE_AGENT_MAX_CONNECTIVITY_CHECKS_DEFAULT 100 /* see spec 5.7.3 (ID-19) */
......@@ -114,12 +113,22 @@ nice_input_message_iter_compare (const NiceInputMessageIter *a,
* MTU and estimated typical sizes of ICE STUN packet */
#define MAX_STUN_DATAGRAM_PAYLOAD 1300
#define NICE_COMPONENT_MAX_VALID_CANDIDATES 50 /* maximum number of validates remote candidates to keep, the number is arbitrary but hopefully large enough */
/* A convenient macro to test if the agent is compatible with RFC5245
* or OC2007R2. Specifically these two modes share the support
* of the regular or aggressive nomination mode */
#define NICE_AGENT_IS_COMPATIBLE_WITH_RFC5245_OR_OC2007R2(obj) \
((obj)->compatibility == NICE_COMPATIBILITY_RFC5245 || \
(obj)->compatibility == NICE_COMPATIBILITY_OC2007R2)
struct _NiceAgent
{
GObject parent; /* gobject pointer */
GMutex agent_mutex; /* Mutex used for thread-safe lib */
gboolean full_mode; /* property: full-mode */
GTimeVal next_check_tv; /* property: next conncheck timestamp */
gchar *stun_server_ip; /* property: STUN server IP */
guint stun_server_port; /* property: STUN server port */
gchar *proxy_ip; /* property: Proxy server IP */
......@@ -127,9 +136,16 @@ struct _NiceAgent
NiceProxyType proxy_type; /* property: Proxy type */
gchar *proxy_username; /* property: Proxy username */
gchar *proxy_password; /* property: Proxy password */
gboolean controlling_mode; /* property: controlling-mode */
gboolean saved_controlling_mode;/* property: controlling-mode */
guint timer_ta; /* property: timer Ta */
guint max_conn_checks; /* property: max connectivity checks */
gboolean force_relay; /* property: force relay */
guint stun_max_retransmissions; /* property: stun max retransmissions, Rc */
guint stun_initial_timeout; /* property: stun initial timeout, RTO */
guint stun_reliable_timeout; /* property: stun reliable timeout */
NiceNominationMode nomination_mode; /* property: Nomination mode */
gboolean support_renomination; /* property: support RENOMINATION STUN attribute */
guint idle_timeout; /* property: conncheck timeout before stop */
GSList *local_addresses; /* list of NiceAddresses for local
interfaces */
......@@ -139,6 +155,7 @@ struct _NiceAgent
guint next_stream_id; /* id of next created candidate */
NiceRNG *rng; /* random number generator */
GSList *discovery_list; /* list of CandidateDiscovery items */
GSList *triggered_check_queue; /* pairs in the triggered check list */
guint discovery_unsched_items; /* number of discovery items unscheduled */
GSource *discovery_timer_source; /* source of discovery timer */
GSource *conncheck_timer_source; /* source of conncheck timer */
......@@ -147,19 +164,27 @@ struct _NiceAgent
guint64 tie_breaker; /* tie breaker (ICE sect 5.2
"Determining Role" ID-19) */
NiceCompatibility compatibility; /* property: Compatibility mode */
StunAgent stun_agent; /* STUN agent */
gboolean media_after_tick; /* Received media after keepalive tick */
#ifdef HAVE_GUPNP
GUPnPSimpleIgdThread* upnp; /* GUPnP Single IGD agent */
gboolean upnp_enabled; /* whether UPnP discovery is enabled */
guint upnp_timeout; /* UPnP discovery timeout */
GSList *upnp_mapping; /* list of Candidates being mapped */
GSList *upnp_mapping; /* NiceAddresses of cands being mapped */
GSource *upnp_timer_source; /* source of upnp timeout timer */
#endif
gchar *software_attribute; /* SOFTWARE attribute */
gboolean reliable; /* property: reliable */
gboolean keepalive_conncheck; /* property: keepalive_conncheck */
GQueue pending_signals;
guint16 rfc4571_expecting_length;
gboolean use_ice_udp;
gboolean use_ice_tcp;
gboolean use_ice_trickle;
guint conncheck_ongoing_idle_delay; /* ongoing delay before timer stop */
gboolean controlling_mode; /* controlling mode used by the
conncheck */
/* XXX: add pointer to internal data struct for ABI-safe extensions */
};
......@@ -168,24 +193,24 @@ agent_find_component (
NiceAgent *agent,
guint stream_id,
guint component_id,
Stream **stream,
Component **component);
NiceStream **stream,
NiceComponent **component) G_GNUC_WARN_UNUSED_RESULT;
Stream *agent_find_stream (NiceAgent *agent, guint stream_id);
NiceStream *agent_find_stream (NiceAgent *agent, guint stream_id);
void agent_gathering_done (NiceAgent *agent);
void agent_signal_gathering_done (NiceAgent *agent);
void agent_lock (void);
void agent_unlock (void);
void agent_lock (NiceAgent *agent);
void agent_unlock (NiceAgent *agent);
void agent_unlock_and_emit (NiceAgent *agent);
void agent_signal_new_selected_pair (
NiceAgent *agent,
guint stream_id,
guint component_id,
const gchar *local_foundation,
const gchar *remote_foundation);
NiceCandidate *lcandidate,
NiceCandidate *rcandidate);
void agent_signal_component_state_change (
NiceAgent *agent,
......@@ -199,18 +224,32 @@ void agent_signal_new_candidate (
void agent_signal_new_remote_candidate (NiceAgent *agent, NiceCandidate *candidate);
void agent_signal_initial_binding_request_received (NiceAgent *agent, Stream *stream);
void agent_signal_initial_binding_request_received (NiceAgent *agent, NiceStream *stream);
guint64 agent_candidate_pair_priority (NiceAgent *agent, NiceCandidate *local, NiceCandidate *remote);
GSource *agent_timeout_add_with_context (NiceAgent *agent, guint interval, GSourceFunc function, gpointer data);
typedef gboolean (*NiceTimeoutLockedCallback)(NiceAgent *agent,
gpointer user_data);
void agent_timeout_add_with_context (NiceAgent *agent, GSource **out,
const gchar *name, guint interval, NiceTimeoutLockedCallback function,
gpointer data);
void agent_timeout_add_seconds_with_context (NiceAgent *agent, GSource **out,
const gchar *name, guint interval, NiceTimeoutLockedCallback function,
gpointer data);
StunUsageIceCompatibility agent_to_ice_compatibility (NiceAgent *agent);
StunUsageTurnCompatibility agent_to_turn_compatibility (NiceAgent *agent);
NiceTurnSocketCompatibility agent_to_turn_socket_compatibility (NiceAgent *agent);
void agent_remove_local_candidate (NiceAgent *agent,
NiceCandidate *candidate);
void nice_agent_init_stun_agent (NiceAgent *agent, StunAgent *stun_agent);
void _priv_set_socket_tos (NiceAgent *agent, NiceSocket *sock, gint tos);
void _tcp_sock_is_writable (NiceSocket *sock, gpointer user_data);
gboolean
component_io_cb (
GSocket *gsocket,
......@@ -229,6 +268,34 @@ compact_output_message (const NiceOutputMessage *message, gsize *buffer_length);
gsize
output_message_get_size (const NiceOutputMessage *message);
gsize
input_message_get_size (const NiceInputMessage *message);
gssize agent_socket_send (NiceSocket *sock, const NiceAddress *addr, gsize len,
const gchar *buf);
guint32
nice_candidate_jingle_priority (NiceCandidate *candidate);
guint32
nice_candidate_msn_priority (NiceCandidate *candidate);
guint32
nice_candidate_ice_priority_full (guint type_pref, guint local_pref,
guint component_id);
guint32
nice_candidate_ice_priority (const NiceCandidate *candidate,
gboolean reliable, gboolean nat_assisted);
guint32
nice_candidate_ms_ice_priority (const NiceCandidate *candidate,
gboolean reliable, gboolean nat_assisted);
guint64
nice_candidate_pair_priority (guint32 o_prio, guint32 a_prio);
/*
* nice_debug_init:
*
......@@ -240,10 +307,22 @@ void nice_debug_init (void);
#ifdef NDEBUG
static inline gboolean nice_debug_is_enabled (void) { return FALSE; }
static inline gboolean nice_debug_is_verbose (void) { return FALSE; }
static inline void nice_debug (const char *fmt, ...) { }
static inline void nice_debug_verbose (const char *fmt, ...) { }
#else
gboolean nice_debug_is_enabled (void);
gboolean nice_debug_is_verbose (void);
void nice_debug (const char *fmt, ...) G_GNUC_PRINTF (1, 2);
void nice_debug_verbose (const char *fmt, ...) G_GNUC_PRINTF (1, 2);
#endif
#if !GLIB_CHECK_VERSION(2, 59, 0)
#if __GNUC__ > 6
#define G_GNUC_FALLTHROUGH __attribute__((fallthrough))
#else
#define G_GNUC_FALLTHROUGH
#endif /* __GNUC__ */
#endif
#endif /*_NICE_AGENT_PRIV_H */
# component-status-changed
VOID:UINT,UINT,UINT
# new-selected-pair
VOID:UINT,UINT,STRING,STRING
# new-candidate
VOID:UINT,UINT,STRING
# candidate-gathering-done
# initial-binding-request-received
VOID:UINT
# reliable-transport-writable
VOID:UINT,UINT
This diff is collapsed.
This diff is collapsed.
......@@ -52,6 +52,10 @@
#include "agent.h"
#include "component.h"
#include "interfaces.h"
G_DEFINE_BOXED_TYPE (NiceCandidate, nice_candidate, nice_candidate_copy,
nice_candidate_free);
/* (ICE 4.1.1 "Gathering Candidates") ""Every candidate is a transport
* address. It also has a type and a base. Three types are defined and
......@@ -80,6 +84,9 @@ nice_candidate_free (NiceCandidate *candidate)
if (candidate->password)
g_free (candidate->password);
if (candidate->turn)
turn_server_unref (candidate->turn);
g_slice_free (NiceCandidate, candidate);
}
......@@ -130,28 +137,192 @@ nice_candidate_ice_priority_full (
(0x100 - component_id));
}
static guint32
nice_candidate_ice_local_preference_full (guint direction_preference,
guint other_preference)
{
return (0x2000 * direction_preference +
other_preference);
}
guint32
nice_candidate_ice_priority (const NiceCandidate *candidate)
static guint8
nice_candidate_ip_local_preference (const NiceCandidate *candidate)
{
guint8 preference = 0;
gchar ip_string[INET6_ADDRSTRLEN];
GList/*<owned gchar*>*/ *ips = NULL;
GList/*<unowned gchar*>*/ *iter;
/* Ensure otherwise identical host candidates with only different IP addresses
* (multihomed host) get assigned different priorities. Position of the IP in
* the list obtained from nice_interfaces_get_local_ips() serves here as the
* distinguishing value of other_preference. Reflexive and relayed candidates
* are likewise differentiated by their base address.
*
* This is required by RFC 5245 Section 4.1.2.1:
* https://tools.ietf.org/html/rfc5245#section-4.1.2.1
*/
if (candidate->type == NICE_CANDIDATE_TYPE_HOST) {
nice_address_to_string (&candidate->addr, ip_string);
} else {
nice_address_to_string (&candidate->base_addr, ip_string);
}
ips = nice_interfaces_get_local_ips (TRUE);
for (iter = ips; iter; iter = g_list_next (iter)) {
if (g_strcmp0 (ip_string, iter->data) == 0) {
break;
}
++preference;
}
g_list_free_full (ips, g_free);
return preference;
}
static guint16
nice_candidate_ice_local_preference (const NiceCandidate *candidate)
{
guint direction_preference;
switch (candidate->transport)
{
case NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE:
if (candidate->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE ||
candidate->type == NICE_CANDIDATE_TYPE_HOST)
direction_preference = 4;
else
direction_preference = 6;
break;
case NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE:
if (candidate->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE ||
candidate->type == NICE_CANDIDATE_TYPE_HOST)
direction_preference = 2;
else
direction_preference = 4;
break;
case NICE_CANDIDATE_TRANSPORT_TCP_SO:
if (candidate->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE ||
candidate->type == NICE_CANDIDATE_TYPE_HOST)
direction_preference = 6;
else
direction_preference = 2;
break;
case NICE_CANDIDATE_TRANSPORT_UDP:
default:
return 1;
break;
}
return nice_candidate_ice_local_preference_full (direction_preference,
nice_candidate_ip_local_preference (candidate));
}
static guint32
nice_candidate_ms_ice_local_preference_full (guint transport_preference,
guint direction_preference, guint other_preference)
{
return 0x1000 * transport_preference +
0x200 * direction_preference +
0x1 * other_preference;
}
static guint32
nice_candidate_ms_ice_local_preference (const NiceCandidate *candidate)
{
guint8 transport_preference = 0;
guint8 direction_preference = 0;
switch (candidate->transport)
{
case NICE_CANDIDATE_TRANSPORT_TCP_SO:
case NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE:
transport_preference = NICE_CANDIDATE_TRANSPORT_MS_PREF_TCP;
direction_preference = NICE_CANDIDATE_DIRECTION_MS_PREF_ACTIVE;
break;
case NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE:
transport_preference = NICE_CANDIDATE_TRANSPORT_MS_PREF_TCP;
direction_preference = NICE_CANDIDATE_DIRECTION_MS_PREF_PASSIVE;
break;
case NICE_CANDIDATE_TRANSPORT_UDP:
default:
transport_preference = NICE_CANDIDATE_TRANSPORT_MS_PREF_UDP;
break;
}
return nice_candidate_ms_ice_local_preference_full(transport_preference,
direction_preference, nice_candidate_ip_local_preference (candidate));
}
static guint8
nice_candidate_ice_type_preference (const NiceCandidate *candidate,
gboolean reliable, gboolean nat_assisted)
{
guint8 type_preference;
switch (candidate->type)
{
case NICE_CANDIDATE_TYPE_HOST:
type_preference = NICE_CANDIDATE_TYPE_PREF_HOST; break;
type_preference = NICE_CANDIDATE_TYPE_PREF_HOST;
break;
case NICE_CANDIDATE_TYPE_PEER_REFLEXIVE:
type_preference = NICE_CANDIDATE_TYPE_PREF_PEER_REFLEXIVE; break;
type_preference = NICE_CANDIDATE_TYPE_PREF_PEER_REFLEXIVE;
break;
case NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE:
type_preference = NICE_CANDIDATE_TYPE_PREF_SERVER_REFLEXIVE; break;
if (nat_assisted)
type_preference = NICE_CANDIDATE_TYPE_PREF_NAT_ASSISTED;
else
type_preference = NICE_CANDIDATE_TYPE_PREF_SERVER_REFLEXIVE;
break;
case NICE_CANDIDATE_TYPE_RELAYED:
type_preference = NICE_CANDIDATE_TYPE_PREF_RELAYED; break;
if (candidate->turn->type == NICE_RELAY_TYPE_TURN_UDP)
type_preference = NICE_CANDIDATE_TYPE_PREF_RELAYED_UDP;
else
type_preference = NICE_CANDIDATE_TYPE_PREF_RELAYED;
break;
default:
type_preference = 0; break;
type_preference = 0;
break;
}
/* return _candidate_ice_priority (type_preference, 1, candidate->component_id); */
return nice_candidate_ice_priority_full (type_preference, 1, candidate->component_id);
if ((reliable && candidate->transport == NICE_CANDIDATE_TRANSPORT_UDP) ||
(!reliable && candidate->transport != NICE_CANDIDATE_TRANSPORT_UDP)) {
type_preference = type_preference / 2;
}
return type_preference;
}
guint32
nice_candidate_ice_priority (const NiceCandidate *candidate,
gboolean reliable, gboolean nat_assisted)
{
guint8 type_preference;
guint16 local_preference;
type_preference = nice_candidate_ice_type_preference (candidate, reliable,
nat_assisted);
local_preference = nice_candidate_ice_local_preference (candidate);
return nice_candidate_ice_priority_full (type_preference, local_preference,
candidate->component_id);
}
guint32
nice_candidate_ms_ice_priority (const NiceCandidate *candidate,
gboolean reliable, gboolean nat_assisted)
{
guint8 type_preference;
guint16 local_preference;
type_preference = nice_candidate_ice_type_preference (candidate, reliable,
nat_assisted);
local_preference = nice_candidate_ms_ice_local_preference (candidate);
return nice_candidate_ice_priority_full (type_preference, local_preference,
candidate->component_id);
}
/*
......@@ -163,8 +334,11 @@ nice_candidate_pair_priority (guint32 o_prio, guint32 a_prio)
{
guint32 max = o_prio > a_prio ? o_prio : a_prio;
guint32 min = o_prio < a_prio ? o_prio : a_prio;
/* These two constants are here explictly to make some version of GCC happy */
const guint64 one = 1;
const guint64 thirtytwo = 32;
return ((guint64)1 << 32) * min + 2 * max + (o_prio > a_prio ? 1 : 0);
return (one << thirtytwo) * min + 2 * max + (o_prio > a_prio ? 1 : 0);
}
/*
......@@ -173,12 +347,27 @@ nice_candidate_pair_priority (guint32 o_prio, guint32 a_prio)
NICEAPI_EXPORT NiceCandidate *
nice_candidate_copy (const NiceCandidate *candidate)
{
NiceCandidate *copy = nice_candidate_new (candidate->type);
NiceCandidate *copy;
g_return_val_if_fail (candidate != NULL, NULL);
copy = nice_candidate_new (candidate->type);
memcpy (copy, candidate, sizeof(NiceCandidate));
copy->turn = NULL;
copy->username = g_strdup (copy->username);
copy->password = g_strdup (copy->password);
return copy;
}
NICEAPI_EXPORT gboolean
nice_candidate_equal_target (const NiceCandidate *candidate1,
const NiceCandidate *candidate2)
{
g_return_val_if_fail (candidate1 != NULL, FALSE);
g_return_val_if_fail (candidate2 != NULL, FALSE);
return (candidate1->transport == candidate2->transport &&
nice_address_equal (&candidate1->addr, &candidate2->addr));
}
......@@ -37,8 +37,11 @@
* file under either the MPL or the LGPL.
*/
#ifndef _CANDIDATE_H
#define _CANDIDATE_H
#ifndef __LIBNICE_CANDIDATE_H__
#define __LIBNICE_CANDIDATE_H__
#include <glib.h>
#include <glib-object.h>
/**
......@@ -56,11 +59,19 @@
G_BEGIN_DECLS
/* Constants for determining candidate priorities */
#define NICE_CANDIDATE_TYPE_PREF_HOST 120
#define NICE_CANDIDATE_TYPE_PREF_PEER_REFLEXIVE 110
#define NICE_CANDIDATE_TYPE_PREF_NAT_ASSISTED 105
#define NICE_CANDIDATE_TYPE_PREF_SERVER_REFLEXIVE 100
#define NICE_CANDIDATE_TYPE_PREF_RELAYED 60
#define NICE_CANDIDATE_TYPE_PREF_RELAYED_UDP 30
#define NICE_CANDIDATE_TYPE_PREF_RELAYED 20
/* Priority preference constants for MS-ICE compatibility */
#define NICE_CANDIDATE_TRANSPORT_MS_PREF_UDP 15
#define NICE_CANDIDATE_TRANSPORT_MS_PREF_TCP 6
#define NICE_CANDIDATE_DIRECTION_MS_PREF_PASSIVE 2
#define NICE_CANDIDATE_DIRECTION_MS_PREF_ACTIVE 5
/* Max foundation size '1*32ice-char' plus terminating NULL, ICE ID-19 */
/**
......@@ -91,12 +102,18 @@ typedef enum
/**
* NiceCandidateTransport:
* @NICE_CANDIDATE_TRANSPORT_UDP: UDP transport
* @NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE: TCP Active transport
* @NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE: TCP Passive transport
* @NICE_CANDIDATE_TRANSPORT_TCP_SO: TCP Simultaneous-Open transport
*
* An enum representing the type of transport to use
*/
typedef enum
{
NICE_CANDIDATE_TRANSPORT_UDP,
NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE,
NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE,
NICE_CANDIDATE_TRANSPORT_TCP_SO,
} NiceCandidateTransport;
/**
......@@ -120,19 +137,30 @@ typedef struct _TurnServer TurnServer;
/**
* TurnServer:
* @ref_count: Reference count for the structure.
* @server: The #NiceAddress of the TURN server
* @username: The TURN username
* @password: The TURN password
* @decoded_username: The base64 decoded TURN username