Commit 833c1aa4 authored by Olivier Crête's avatar Olivier Crête

candidate: Hide the internal implementation from API

This is slightly an API break, but it should never have been public.
parent 620eec94
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
#include "socket.h" #include "socket.h"
#include "stun/usages/turn.h" #include "stun/usages/turn.h"
#include "candidate.h" #include "candidate-priv.h"
#include "component.h" #include "component.h"
#include "conncheck.h" #include "conncheck.h"
#include "discovery.h" #include "discovery.h"
...@@ -2087,7 +2087,7 @@ pseudo_tcp_socket_write_packet (PseudoTcpSocket *psocket, ...@@ -2087,7 +2087,7 @@ pseudo_tcp_socket_write_packet (PseudoTcpSocket *psocket,
NiceAddress *addr; NiceAddress *addr;
sock = component->selected_pair.local->sockptr; sock = component->selected_pair.local->sockptr;
addr = &component->selected_pair.remote->addr; addr = &component->selected_pair.remote->c.addr;
if (nice_debug_is_enabled ()) { if (nice_debug_is_enabled ()) {
gchar tmpbuf[INET6_ADDRSTRLEN]; gchar tmpbuf[INET6_ADDRSTRLEN];
...@@ -2403,16 +2403,17 @@ void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id, ...@@ -2403,16 +2403,17 @@ void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id,
{ {
NiceComponent *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
NiceCandidateImpl *lc = (NiceCandidateImpl *) lcandidate;
if (!agent_find_component (agent, stream_id, component_id, if (!agent_find_component (agent, stream_id, component_id,
&stream, &component)) &stream, &component))
return; return;
if (((NiceSocket *)lcandidate->sockptr)->type == NICE_SOCKET_TYPE_UDP_TURN) { if (((NiceSocket *)lc->sockptr)->type == NICE_SOCKET_TYPE_UDP_TURN) {
nice_udp_turn_socket_set_peer (lcandidate->sockptr, &rcandidate->addr); nice_udp_turn_socket_set_peer (lc->sockptr, &rcandidate->addr);
} }
if(agent->reliable && !nice_socket_is_reliable (lcandidate->sockptr)) { if(agent->reliable && !nice_socket_is_reliable (lc->sockptr)) {
if (!component->tcp) if (!component->tcp)
pseudo_tcp_socket_create (agent, stream, component); pseudo_tcp_socket_create (agent, stream, component);
process_queued_tcp_packets (agent, stream, component); process_queued_tcp_packets (agent, stream, component);
...@@ -2468,7 +2469,7 @@ void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id, ...@@ -2468,7 +2469,7 @@ void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id,
agent_queue_signal (agent, signals[SIGNAL_NEW_SELECTED_PAIR], agent_queue_signal (agent, signals[SIGNAL_NEW_SELECTED_PAIR],
stream_id, component_id, lcandidate->foundation, rcandidate->foundation); stream_id, component_id, lcandidate->foundation, rcandidate->foundation);
if(agent->reliable && nice_socket_is_reliable (lcandidate->sockptr)) { if(agent->reliable && nice_socket_is_reliable (lc->sockptr)) {
agent_signal_socket_writable (agent, component); agent_signal_socket_writable (agent, component);
} }
} }
...@@ -2883,15 +2884,15 @@ nice_agent_set_relay_info(NiceAgent *agent, ...@@ -2883,15 +2884,15 @@ nice_agent_set_relay_info(NiceAgent *agent,
stream->gathering = TRUE; stream->gathering = TRUE;
for (i = component->local_candidates; i; i = i->next) { for (i = component->local_candidates; i; i = i->next) {
NiceCandidate *candidate = i->data; NiceCandidateImpl *c = i->data;
if (candidate->type == NICE_CANDIDATE_TYPE_HOST && if (c->c.type == NICE_CANDIDATE_TYPE_HOST &&
candidate->transport != NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE && c->c.transport != NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE &&
nice_address_ip_version (&candidate->addr) == nice_address_ip_version (&c->c.addr) ==
nice_address_ip_version (&turn->server)) nice_address_ip_version (&turn->server))
priv_add_new_candidate_discovery_turn (agent, priv_add_new_candidate_discovery_turn (agent,
candidate->sockptr, turn, stream, component_id, c->sockptr, turn, stream, component_id,
candidate->transport != NICE_CANDIDATE_TRANSPORT_UDP); c->c.transport != NICE_CANDIDATE_TRANSPORT_UDP);
} }
if (agent->discovery_unsched_items) if (agent->discovery_unsched_items)
...@@ -2990,13 +2991,13 @@ static void _upnp_mapped_external_port (GUPnPSimpleIgd *self, gchar *proto, ...@@ -2990,13 +2991,13 @@ static void _upnp_mapped_external_port (GUPnPSimpleIgd *self, gchar *proto,
for (j = stream->components; j; j = j->next) { for (j = stream->components; j; j = j->next) {
NiceComponent *component = j->data; NiceComponent *component = j->data;
for (k = component->local_candidates; k; k = k->next) { for (k = component->local_candidates; k; k = k->next) {
NiceCandidate *local_candidate = k->data; NiceCandidateImpl *local_candidate = k->data;
if (agent->force_relay && if (agent->force_relay &&
local_candidate->type != NICE_CANDIDATE_TYPE_RELAYED) local_candidate->c.type != NICE_CANDIDATE_TYPE_RELAYED)
continue; continue;
if (nice_address_equal (&localaddr, &local_candidate->base_addr)) { if (nice_address_equal (&localaddr, &local_candidate->c.base_addr)) {
discovery_add_server_reflexive_candidate ( discovery_add_server_reflexive_candidate (
agent, agent,
stream->id, stream->id,
...@@ -3153,7 +3154,7 @@ nice_agent_gather_candidates ( ...@@ -3153,7 +3154,7 @@ nice_agent_gather_candidates (
i && length < NICE_CANDIDATE_MAX_LOCAL_ADDRESSES; i && length < NICE_CANDIDATE_MAX_LOCAL_ADDRESSES;
i = i->next, length++) { i = i->next, length++) {
NiceAddress *addr = i->data; NiceAddress *addr = i->data;
NiceCandidate *host_candidate; NiceCandidateImpl *host_candidate;
#ifdef HAVE_GUPNP #ifdef HAVE_GUPNP
gchar local_ip[NICE_ADDRESS_STRING_LEN]; gchar local_ip[NICE_ADDRESS_STRING_LEN];
...@@ -3254,7 +3255,7 @@ nice_agent_gather_candidates ( ...@@ -3254,7 +3255,7 @@ nice_agent_gather_candidates (
#ifdef HAVE_GUPNP #ifdef HAVE_GUPNP
if (agent->upnp_enabled && agent->upnp && if (agent->upnp_enabled && agent->upnp &&
transport != NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE) { transport != NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE) {
NiceAddress *base_addr = nice_address_dup (&host_candidate->base_addr); NiceAddress *base_addr = nice_address_dup (&host_candidate->c.base_addr);
nice_debug ("Agent %p: Adding UPnP port %s:%d", agent, local_ip, nice_debug ("Agent %p: Adding UPnP port %s:%d", agent, local_ip,
nice_address_get_port (base_addr)); nice_address_get_port (base_addr));
gupnp_simple_igd_add_port (GUPNP_SIMPLE_IGD (agent->upnp), gupnp_simple_igd_add_port (GUPNP_SIMPLE_IGD (agent->upnp),
...@@ -3276,7 +3277,7 @@ nice_agent_gather_candidates ( ...@@ -3276,7 +3277,7 @@ nice_agent_gather_candidates (
if (nice_address_set_from_string (&stun_server, agent->stun_server_ip)) { if (nice_address_set_from_string (&stun_server, agent->stun_server_ip)) {
nice_address_set_port (&stun_server, agent->stun_server_port); nice_address_set_port (&stun_server, agent->stun_server_port);
if (nice_address_ip_version (&host_candidate->addr) == if (nice_address_ip_version (&host_candidate->c.addr) ==
nice_address_ip_version (&stun_server)) nice_address_ip_version (&stun_server))
priv_add_new_candidate_discovery_stun (agent, priv_add_new_candidate_discovery_stun (agent,
host_candidate->sockptr, host_candidate->sockptr,
...@@ -3289,7 +3290,7 @@ nice_agent_gather_candidates ( ...@@ -3289,7 +3290,7 @@ nice_agent_gather_candidates (
if (agent->full_mode && component && if (agent->full_mode && component &&
transport != NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE) { transport != NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE) {
GList *item; GList *item;
int host_ip_version = nice_address_ip_version (&host_candidate->addr); int host_ip_version = nice_address_ip_version (&host_candidate->c.addr);
for (item = component->turn_servers; item; item = item->next) { for (item = component->turn_servers; item; item = item->next) {
TurnServer *turn = item->data; TurnServer *turn = item->data;
...@@ -3303,7 +3304,7 @@ nice_agent_gather_candidates ( ...@@ -3303,7 +3304,7 @@ nice_agent_gather_candidates (
turn, turn,
stream, stream,
cid, cid,
host_candidate->transport != NICE_CANDIDATE_TRANSPORT_UDP); host_candidate->c.transport != NICE_CANDIDATE_TRANSPORT_UDP);
} }
} }
} }
...@@ -3561,8 +3562,8 @@ static void priv_update_pair_foundations (NiceAgent *agent, ...@@ -3561,8 +3562,8 @@ static void priv_update_pair_foundations (NiceAgent *agent,
agent, pair, pair->foundation); agent, pair, pair->foundation);
if (pair->state == NICE_CHECK_SUCCEEDED) if (pair->state == NICE_CHECK_SUCCEEDED)
conn_check_unfreeze_related (agent, pair); conn_check_unfreeze_related (agent, pair);
if (component->selected_pair.local == pair->local && if ((NiceCandidate *) component->selected_pair.local == pair->local &&
component->selected_pair.remote == pair->remote) { (NiceCandidate *) component->selected_pair.remote == pair->remote) {
gchar priority[NICE_CANDIDATE_PAIR_PRIORITY_MAX_SIZE]; gchar priority[NICE_CANDIDATE_PAIR_PRIORITY_MAX_SIZE];
/* the foundation update of the selected pair also implies /* the foundation update of the selected pair also implies
...@@ -3625,6 +3626,7 @@ static gboolean priv_add_remote_candidate ( ...@@ -3625,6 +3626,7 @@ static gboolean priv_add_remote_candidate (
NiceStream *stream; NiceStream *stream;
NiceComponent *component; NiceComponent *component;
NiceCandidate *candidate; NiceCandidate *candidate;
NiceCandidateImpl *c;
CandidateCheckPair *pair; CandidateCheckPair *pair;
if (transport == NICE_CANDIDATE_TRANSPORT_UDP && if (transport == NICE_CANDIDATE_TRANSPORT_UDP &&
...@@ -3640,6 +3642,7 @@ static gboolean priv_add_remote_candidate ( ...@@ -3640,6 +3642,7 @@ static gboolean priv_add_remote_candidate (
/* step: check whether the candidate already exists */ /* step: check whether the candidate already exists */
candidate = nice_component_find_remote_candidate (component, addr, transport); candidate = nice_component_find_remote_candidate (component, addr, transport);
c = (NiceCandidateImpl *) candidate;
/* If it was a discovered remote peer reflexive candidate, then it should /* If it was a discovered remote peer reflexive candidate, then it should
* be updated according to RFC 5245 section 7.2.1.3 */ * be updated according to RFC 5245 section 7.2.1.3 */
...@@ -3650,7 +3653,7 @@ static gboolean priv_add_remote_candidate ( ...@@ -3650,7 +3653,7 @@ static gboolean priv_add_remote_candidate (
/* The updated candidate is no more peer reflexive, so its /* The updated candidate is no more peer reflexive, so its
* sockptr can be cleared * sockptr can be cleared
*/ */
candidate->sockptr = NULL; c->sockptr = NULL;
/* If it got there, the next one will also be ran, so the foundation /* If it got there, the next one will also be ran, so the foundation
* will be set. * will be set.
*/ */
...@@ -3710,8 +3713,8 @@ static gboolean priv_add_remote_candidate ( ...@@ -3710,8 +3713,8 @@ static gboolean priv_add_remote_candidate (
pair = priv_get_highest_priority_nominated_pair (agent, pair = priv_get_highest_priority_nominated_pair (agent,
stream_id, component_id); stream_id, component_id);
if (pair && if (pair &&
(pair->local != component->selected_pair.local || (pair->local != (NiceCandidate *) component->selected_pair.local ||
pair->remote != component->selected_pair.remote)) { pair->remote != (NiceCandidate *) component->selected_pair.remote)) {
/* If we have (at least) one pair with the nominated flag set, it /* If we have (at least) one pair with the nominated flag set, it
* implies that this pair (or another) is set as the selected pair * implies that this pair (or another) is set as the selected pair
* for this component. In other words, this is really an *update* * for this component. In other words, this is really an *update*
...@@ -4041,11 +4044,11 @@ agent_recv_message_unlocked ( ...@@ -4041,11 +4044,11 @@ agent_recv_message_unlocked (
* the socket we do the recv on to the topmost socket * the socket we do the recv on to the topmost socket
*/ */
for (cand_i = component->local_candidates; cand_i; cand_i = cand_i->next) { for (cand_i = component->local_candidates; cand_i; cand_i = cand_i->next) {
NiceCandidate *cand = cand_i->data; NiceCandidateImpl *cand = cand_i->data;
if (cand->type == NICE_CANDIDATE_TYPE_RELAYED && if (cand->c.type == NICE_CANDIDATE_TYPE_RELAYED &&
cand->stream_id == stream->id && cand->c.stream_id == stream->id &&
cand->component_id == component->id && cand->c.component_id == component->id &&
nice_socket_is_based_on(cand->sockptr, nicesock)) { nice_socket_is_based_on(cand->sockptr, nicesock)) {
nice_debug ("Agent %p : Packet received from a TURN socket.", nice_debug ("Agent %p : Packet received from a TURN socket.",
agent); agent);
...@@ -4268,11 +4271,11 @@ agent_recv_message_unlocked ( ...@@ -4268,11 +4271,11 @@ agent_recv_message_unlocked (
is_turn = TRUE; is_turn = TRUE;
for (i = component->local_candidates; i; i = i->next) { for (i = component->local_candidates; i; i = i->next) {
NiceCandidate *cand = i->data; NiceCandidateImpl *cand = i->data;
if (cand->type == NICE_CANDIDATE_TYPE_RELAYED && if (cand->c.type == NICE_CANDIDATE_TYPE_RELAYED &&
cand->turn == turn && cand->turn == turn &&
cand->stream_id == stream->id && cand->c.stream_id == stream->id &&
nice_socket_is_based_on (cand->sockptr, nicesock)) { nice_socket_is_based_on (cand->sockptr, nicesock)) {
retval = nice_udp_turn_socket_parse_recv_message (cand->sockptr, &nicesock, retval = nice_udp_turn_socket_parse_recv_message (cand->sockptr, &nicesock,
message); message);
...@@ -5073,11 +5076,11 @@ nice_agent_send_messages_nonblocking_internal ( ...@@ -5073,11 +5076,11 @@ nice_agent_send_messages_nonblocking_internal (
if (component->selected_pair.local != NULL) { if (component->selected_pair.local != NULL) {
if (nice_debug_is_enabled ()) { if (nice_debug_is_enabled ()) {
gchar tmpbuf[INET6_ADDRSTRLEN]; gchar tmpbuf[INET6_ADDRSTRLEN];
nice_address_to_string (&component->selected_pair.remote->addr, tmpbuf); nice_address_to_string (&component->selected_pair.remote->c.addr, tmpbuf);
nice_debug_verbose ("Agent %p : s%d:%d: sending %u messages to " nice_debug_verbose ("Agent %p : s%d:%d: sending %u messages to "
"[%s]:%d", agent, stream_id, component_id, n_messages, tmpbuf, "[%s]:%d", agent, stream_id, component_id, n_messages, tmpbuf,
nice_address_get_port (&component->selected_pair.remote->addr)); nice_address_get_port (&component->selected_pair.remote->c.addr));
} }
if(agent->reliable && if(agent->reliable &&
...@@ -5104,7 +5107,7 @@ nice_agent_send_messages_nonblocking_internal ( ...@@ -5104,7 +5107,7 @@ nice_agent_send_messages_nonblocking_internal (
NiceAddress *addr; NiceAddress *addr;
sock = component->selected_pair.local->sockptr; sock = component->selected_pair.local->sockptr;
addr = &component->selected_pair.remote->addr; addr = &component->selected_pair.remote->c.addr;
if (nice_socket_is_reliable (sock)) { if (nice_socket_is_reliable (sock)) {
guint i; guint i;
...@@ -5849,7 +5852,7 @@ nice_agent_set_selected_pair ( ...@@ -5849,7 +5852,7 @@ nice_agent_set_selected_pair (
/* step: set the selected pair */ /* step: set the selected pair */
nice_component_update_selected_pair (agent, component, &pair); nice_component_update_selected_pair (agent, component, &pair);
agent_signal_new_selected_pair (agent, stream_id, component_id, agent_signal_new_selected_pair (agent, stream_id, component_id,
pair.local, pair.remote); (NiceCandidate *) pair.local, (NiceCandidate *) pair.remote);
ret = TRUE; ret = TRUE;
...@@ -5880,8 +5883,8 @@ nice_agent_get_selected_pair (NiceAgent *agent, guint stream_id, ...@@ -5880,8 +5883,8 @@ nice_agent_get_selected_pair (NiceAgent *agent, guint stream_id,
goto done; goto done;
if (component->selected_pair.local && component->selected_pair.remote) { if (component->selected_pair.local && component->selected_pair.remote) {
*local = component->selected_pair.local; *local = (NiceCandidate *) component->selected_pair.local;
*remote = component->selected_pair.remote; *remote = (NiceCandidate *) component->selected_pair.remote;
ret = TRUE; ret = TRUE;
} }
...@@ -5918,11 +5921,11 @@ nice_agent_get_selected_socket (NiceAgent *agent, guint stream_id, ...@@ -5918,11 +5921,11 @@ nice_agent_get_selected_socket (NiceAgent *agent, guint stream_id,
if (!component->selected_pair.local || !component->selected_pair.remote) if (!component->selected_pair.local || !component->selected_pair.remote)
goto done; goto done;
if (component->selected_pair.local->type == NICE_CANDIDATE_TYPE_RELAYED) if (component->selected_pair.local->c.type == NICE_CANDIDATE_TYPE_RELAYED)
goto done; goto done;
/* ICE-TCP requires RFC4571 framing, even if unreliable */ /* ICE-TCP requires RFC4571 framing, even if unreliable */
if (component->selected_pair.local->transport != NICE_CANDIDATE_TRANSPORT_UDP) if (component->selected_pair.local->c.transport != NICE_CANDIDATE_TRANSPORT_UDP)
goto done; goto done;
nice_socket = (NiceSocket *)component->selected_pair.local->sockptr; nice_socket = (NiceSocket *)component->selected_pair.local->sockptr;
...@@ -6063,9 +6066,9 @@ nice_agent_set_selected_remote_candidate ( ...@@ -6063,9 +6066,9 @@ nice_agent_set_selected_remote_candidate (
{ {
NiceComponent *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
NiceCandidate *lcandidate = NULL; NiceCandidateImpl *lcandidate = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
NiceCandidate *local = NULL, *remote = NULL; NiceCandidateImpl *local = NULL, *remote = NULL;
guint64 priority; guint64 priority;
g_return_val_if_fail (NICE_IS_AGENT (agent), FALSE); g_return_val_if_fail (NICE_IS_AGENT (agent), FALSE);
...@@ -6101,7 +6104,7 @@ nice_agent_set_selected_remote_candidate ( ...@@ -6101,7 +6104,7 @@ nice_agent_set_selected_remote_candidate (
stream->id, component->id); stream->id, component->id);
/* Revert back to previous selected pair */ /* Revert back to previous selected pair */
/* FIXME: by doing this, we lose the keepalive tick */ /* FIXME: by doing this, we lose the keepalive tick */
component->selected_pair.local = local; component->selected_pair.local = (NiceCandidateImpl *) local;
component->selected_pair.remote = remote; component->selected_pair.remote = remote;
component->selected_pair.priority = priority; component->selected_pair.priority = priority;
goto done; goto done;
...@@ -6122,7 +6125,7 @@ nice_agent_set_selected_remote_candidate ( ...@@ -6122,7 +6125,7 @@ nice_agent_set_selected_remote_candidate (
NICE_COMPONENT_STATE_READY); NICE_COMPONENT_STATE_READY);
agent_signal_new_selected_pair (agent, stream_id, component_id, agent_signal_new_selected_pair (agent, stream_id, component_id,
lcandidate, candidate); (NiceCandidate *) lcandidate, candidate);
ret = TRUE; ret = TRUE;
...@@ -6173,7 +6176,7 @@ nice_agent_set_stream_tos (NiceAgent *agent, ...@@ -6173,7 +6176,7 @@ nice_agent_set_stream_tos (NiceAgent *agent,
NiceComponent *component = i->data; NiceComponent *component = i->data;
for (j = component->local_candidates; j; j = j->next) { for (j = component->local_candidates; j; j = j->next) {
NiceCandidate *local_candidate = j->data; NiceCandidateImpl *local_candidate = j->data;
_priv_set_socket_tos (agent, local_candidate->sockptr, tos); _priv_set_socket_tos (agent, local_candidate->sockptr, tos);
} }
......
/*
* This file is part of the Nice GLib ICE library.
*
* (C) 2006-2020 Collabora Ltd.
* Contact: Youness Alaoui
* Contact: Olivier Crete
* (C) 2006-2009 Nokia Corporation. All rights reserved.
* Contact: Kai Vehmanen
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Nice GLib ICE library.
*
* The Initial Developers of the Original Code are Collabora Ltd and Nokia
* Corporation. All Rights Reserved.
*
* Contributors:
* Dafydd Harries, Collabora Ltd.
* Youness Alaoui, Collabora Ltd.
* Kai Vehmanen, Nokia
*
* Alternatively, the contents of this file may be used under the terms of the
* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
* case the provisions of LGPL are applicable instead of those above. If you
* wish to allow use of your version of this file only under the terms of the
* LGPL and not to allow others to use your version of this file under the
* MPL, indicate your decision by deleting the provisions above and replace
* them with the notice and other provisions required by the LGPL. If you do
* not delete the provisions above, a recipient may use your version of this
* file under either the MPL or the LGPL.
*/
#ifndef __LIBNICE_CANDIDATE_PRIV_H__
#define __LIBNICE_CANDIDATE_PRIV_H__
#include <glib.h>
#include <glib-object.h>
#include "candidate.h"
#include "socket/socket.h"
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_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
typedef struct _NiceCandidateImpl NiceCandidateImpl;
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
* @decoded_password: The base64 decoded TURN password
* @decoded_username_len: The length of @decoded_username
* @decoded_password_len: The length of @decoded_password
* @type: The #NiceRelayType of the server
* @preference: A unique identifier used to compute priority
*
* A structure to store the TURN relay settings
*/
struct _TurnServer
{
gint ref_count;
NiceAddress server;
gchar *username;
gchar *password;
guint8 *decoded_username;
guint8 *decoded_password;
gsize decoded_username_len;
gsize decoded_password_len;
NiceRelayType type;
guint preference;
};
/**
* NiceCandidateImpl:
* @c: The #NiceCandidate
* @turn: The #TurnServer settings if the candidate is
* of type %NICE_CANDIDATE_TYPE_RELAYED
* @sockptr: The underlying socket
* @keepalive_next_tick: The timestamp for the next keepalive
*
* A structure to represent an ICE candidate
*/
struct _NiceCandidateImpl
{
NiceCandidate c;
TurnServer *turn;
NiceSocket *sockptr;
guint64 keepalive_next_tick; /* next tick timestamp */
};
G_END_DECLS
#endif /* __LIBNICE_CANDIDATE_H__ */
\ No newline at end of file
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "agent.h" #include "agent.h"
#include "component.h" #include "component.h"
#include "interfaces.h" #include "interfaces.h"
#include "candidate-priv.h"
G_DEFINE_BOXED_TYPE (NiceCandidate, nice_candidate, nice_candidate_copy, G_DEFINE_BOXED_TYPE (NiceCandidate, nice_candidate, nice_candidate_copy,
nice_candidate_free); nice_candidate_free);
...@@ -65,17 +66,17 @@ G_DEFINE_BOXED_TYPE (NiceCandidate, nice_candidate, nice_candidate_copy, ...@@ -65,17 +66,17 @@ G_DEFINE_BOXED_TYPE (NiceCandidate, nice_candidate, nice_candidate_copy,
NICEAPI_EXPORT NiceCandidate * NICEAPI_EXPORT NiceCandidate *
nice_candidate_new (NiceCandidateType type) nice_candidate_new (NiceCandidateType type)
{ {
NiceCandidate *candidate; NiceCandidateImpl *c;
candidate = g_slice_new0 (NiceCandidate); c = g_slice_new0 (NiceCandidateImpl);
candidate->type = type; c->c.type = type;
return candidate; return (NiceCandidate *) c;
} }
NICEAPI_EXPORT void NICEAPI_EXPORT void
nice_candidate_free (NiceCandidate *candidate) nice_candidate_free (NiceCandidate *candidate)
{ {
NiceCandidateImpl *c = (NiceCandidateImpl *) candidate;
/* better way of checking if socket is allocated? */ /* better way of checking if socket is allocated? */
if (candidate->username) if (candidate->username)
...@@ -84,10 +85,10 @@ nice_candidate_free (NiceCandidate *candidate) ...@@ -84,10 +85,10 @@ nice_candidate_free (NiceCandidate *candidate)
if (candidate->password) if (candidate->password)
g_free (candidate->password); g_free (candidate->password);
if (candidate->turn) if (c->turn)
turn_server_unref (candidate->turn); turn_server_unref (c->turn);
g_slice_free (NiceCandidate, candidate); g_slice_free (NiceCandidateImpl, c);
} }
...@@ -199,6 +200,7 @@ nice_candidate_ip_local_preference (const NiceCandidate *candidate) ...@@ -199,6 +200,7 @@ nice_candidate_ip_local_preference (const NiceCandidate *candidate)
static guint16 static guint16
nice_candidate_ice_local_preference (const NiceCandidate *candidate) nice_candidate_ice_local_preference (const NiceCandidate *candidate)
{ {
const NiceCandidateImpl *c = (NiceCandidateImpl *) candidate;
guint direction_preference = 0; guint direction_preference = 0;
guint turn_preference = 0; guint turn_preference = 0;
...@@ -235,8 +237,8 @@ nice_candidate_ice_local_preference (const NiceCandidate *candidate) ...@@ -235,8 +237,8 @@ nice_candidate_ice_local_preference (const NiceCandidate *candidate)
* creation time. * creation time.
*/ */
if (candidate->type == NICE_CANDIDATE_TYPE_RELAYED) { if (candidate->type == NICE_CANDIDATE_TYPE_RELAYED) {
g_assert (candidate->turn); g_assert (c->turn);
turn_preference = candidate->turn->preference; turn_preference = c->turn->preference;
} }
return nice_candidate_ice_local_preference_full (direction_preference, return nice_candidate_ice_local_preference_full (direction_preference,
...@@ -267,6 +269,7 @@ nice_candidate_ms_ice_local_preference_full (guint transport_preference, ...@@ -267,6 +269,7 @@ nice_candidate_ms_ice_local_preference_full (guint transport_preference,
static guint32 static guint32
nice_candidate_ms_ice_local_preference (const NiceCandidate *candidate) nice_candidate_ms_ice_local_preference (const NiceCandidate *candidate)
{ {
const NiceCandidateImpl *c = (NiceCandidateImpl *) candidate;
guint transport_preference = 0; guint transport_preference = 0;
guint direction_preference = 0; guint direction_preference = 0;
guint turn_preference = 0; guint turn_preference = 0;
...@@ -292,8 +295,8 @@ nice_candidate_ms_ice_local_preference (const NiceCandidate *candidate) ...@@ -292,8 +295,8 @@ nice_candidate_ms_ice_local_preference (const NiceCandidate *candidate)
* creation time. * creation time.
*/ */
if (candidate->type == NICE_CANDIDATE_TYPE_RELAYED) { if (candidate->type == NICE_CANDIDATE_TYPE_RELAYED) {
g_assert (candidate->turn); g_assert (c->turn);
turn_preference = candidate->turn->preference; turn_preference = c->turn->preference;
} }
return nice_candidate_ms_ice_local_preference_full(transport_preference, return nice_candidate_ms_ice_local_preference_full(transport_preference,
...@@ -305,6 +308,7 @@ static guint8 ...@@ -305,6 +308,7 @@ static guint8
nice_candidate_ice_type_preference (const NiceCandidate *candidate, nice_candidate_ice_type_preference (const NiceCandidate *candidate,
gboolean reliable, gboolean nat_assisted) gboolean reliable, gboolean nat_assisted)
{ {
const NiceCandidateImpl *c = (NiceCandidateImpl *) candidate;
guint8 type_preference; guint8 type_preference;
switch (candidate->type) switch (candidate->type)
...@@ -322,7 +326,7 @@ nice_candidate_ice_type_preference (const NiceCandidate *candidate, ...@@ -322,7 +326,7 @@ nice_candidate_ice_type_preference (const NiceCandidate *candidate,
type_preference = NICE_CANDIDATE_TYPE_PREF_SERVER_REFLEXIVE; type_preference = NICE_CANDIDATE_TYPE_PREF_SERVER_REFLEXIVE;
break; break;
case NICE_CANDIDATE_TYPE_RELAYED: case NICE_CANDIDATE_TYPE_RELAYED:
if (candidate->turn->type == NICE_RELAY_TYPE_TURN_UDP) if (c->turn->type == NICE_RELAY_TYPE_TURN_UDP)
type_preference = NICE_CANDIDATE_TYPE_PREF_RELAYED_UDP; type_preference = NICE_CANDIDATE_TYPE_PREF_RELAYED_UDP;
else else
type_preference = NICE_CANDIDATE_TYPE_PREF_RELAYED; type_preference = NICE_CANDIDATE_TYPE_PREF_RELAYED;
...@@ -400,18 +404,19 @@ nice_candidate_pair_priority_to_string (guint64 prio, gchar *string) ...@@ -400,18 +404,19 @@ nice_candidate_pair_priority_to_string (guint64 prio, gchar *string)
NICEAPI_EXPORT NiceCandidate * NICEAPI_EXPORT NiceCandidate *
nice_candidate_copy (const NiceCandidate *candidate) nice_candidate_copy (const NiceCandidate *candidate)
{ {
NiceCandidate *copy; const NiceCandidateImpl *c = (NiceCandidateImpl *)candidate;
NiceCandidateImpl *copy;
g_return_val_if_fail (candidate != NULL, NULL); g_return_val_if_fail (c != NULL, NULL);
copy = nice_candidate_new (candidate->type); copy = (NiceCandidateImpl *) nice_candidate_new (candidate->type);
memcpy (copy, candidate, sizeof(NiceCandidate)); memcpy (copy, candidate, sizeof(NiceCandidateImpl));
copy->turn = NULL; copy->turn = NULL;
copy->username = g_strdup (copy->username); copy->c.username = g_strdup (copy->c.username);
copy->password = g_strdup (copy->password); copy->c.password = g_strdup (copy->c.password);
return copy; return (NiceCandidate *) copy;
} }
NICEAPI_EXPORT gboolean NICEAPI_EXPORT gboolean
......
...@@ -59,19 +59,6 @@ ...@@ -59,19 +59,6 @@
G_BEGIN_DECLS 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_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 */ /* Max foundation size '1*32ice-char' plus terminating NULL, ICE ID-19 */
/** /**
...@@ -150,37 +137,6 @@ typedef enum { ...@@ -150,37 +137,6 @@ typedef enum {
typedef struct _NiceCandidate NiceCandidate; typedef struct _NiceCandidate NiceCandidate;
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
* @decoded_password: The base64 decoded TURN password
* @decoded_username_len: The length of @decoded_username
* @decoded_password_len: The length of @decoded_password
* @type: The #NiceRelayType of the server
* @preference: A unique identifier used to compute priority
*
* A structure to store the TURN relay settings
*/
struct _TurnServer
{
gint ref_count;
NiceAddress server;
gchar *username;
gchar *password;
guint8 *decoded_username;
guint8 *decoded_password;
gsize decoded_username_len;
gsize decoded_password_len;
NiceRelayType type;
guint preference;
};
/** /**
* NiceCandidate: * NiceCandidate:
...@@ -196,10 +152,6 @@ struct _TurnServer ...@@ -196,10 +152,6 @@ struct _TurnServer
* by nice_agent_set_local_credentials() or nice_agent_set_remote_credentials()) * by nice_agent_set_local_credentials() or nice_agent_set_remote_credentials())
* @password: The candidate-specific password to use (overrides the one set * @password: The candidate-specific password to use (overrides the one set
* by nice_agent_set_local_credentials() or nice_agent_set_remote_credentials()) * by nice_agent_set_local_credentials() or nice_agent_set_remote_credentials())
* @turn: The #TurnServer settings if the candidate is
* of type %NICE_CANDIDATE_TYPE_RELAYED
* @sockptr: The underlying socket
* @keepalive_next_tick: The timestamp for the next keepalive
* *
* A structure to represent an ICE candidate * A structure to represent an ICE candidate
<note> <note>
...@@ -223,9 +175,6 @@ struct _NiceCandidate ...@@ -223,9 +175,6 @@ struct _NiceCandidate
gchar foundation[NICE_CANDIDATE_MAX_FOUNDATION]; gchar foundation[NICE_CANDIDATE_MAX_FOUNDATION];
gchar *username; /* pointer to a nul-terminated username string */ gchar *username; /* pointer to a nul-terminated username string */
gchar *password; /* pointer to a nul-terminated password string */ gchar *password; /* pointer to a nul-terminated password string */
TurnServer *turn;
gpointer sockptr;
guint64 keepalive_next_tick; /* next tick timestamp */
}; };
/** /**
......
...@@ -177,7 +177,7 @@ nice_component_remove_socket (NiceAgent *agent, NiceComponent *cmp, ...@@ -177,7 +177,7 @@ nice_component_remove_socket (NiceAgent *agent, NiceComponent *cmp,
conn_check_prune_socket (agent, stream, cmp, nsocket); conn_check_prune_socket (agent, stream, cmp, nsocket);
for (i = cmp->local_candidates; i;) { for (i = cmp->local_candidates; i;) {
NiceCandidate *candidate = i->data; NiceCandidateImpl *candidate = (NiceCandidateImpl *) i->data;
GSList *next = i->next; GSList *next = i->next;
if (!nice_socket_is_based_on (candidate->sockptr, nsocket)) { if (!nice_socket_is_based_on (candidate->sockptr, nsocket)) {
...@@ -194,12 +194,11 @@ nice_component_remove_socket (NiceAgent *agent, NiceComponent *cmp, ...@@ -194,12 +194,11 @@ nice_component_remove_socket (NiceAgent *agent, NiceComponent *cmp,
refresh_prune_candidate (agent, candidate); refresh_prune_candidate (agent, candidate);
if (candidate->sockptr != nsocket && stream) { if (candidate->sockptr != nsocket && stream) {
discovery_prune_socket (agent, candidate->sockptr); discovery_prune_socket (agent, candidate->sockptr);
conn_check_prune_socket (agent, stream, cmp, conn_check_prune_socket (agent, stream, cmp, candidate->sockptr);
candidate->sockptr);
nice_component_detach_socket (cmp, candidate->sockptr); nice_component_detach_socket (cmp, candidate->sockptr);
} }
agent_remove_local_candidate (agent, candidate); agent_remove_local_candidate (agent, (NiceCandidate *) candidate);
nice_candidate_free (candidate); nice_candidate_free ((NiceCandidate *) candidate);
cmp->local_candidates = g_slist_delete_link (cmp->local_candidates, i); cmp->local_candidates = g_slist_delete_link (cmp->local_candidates, i);
i = next; i = next;
...@@ -209,7 +208,7 @@ nice_component_remove_socket (NiceAgent *agent, NiceComponent *cmp, ...@@ -209,7 +208,7 @@ nice_component_remove_socket (NiceAgent *agent, NiceComponent *cmp,
* peer-reflexive remote candidate * peer-reflexive remote candidate
*/ */
for (i = cmp->remote_candidates; i;) { for (i = cmp->remote_candidates; i;) {
NiceCandidate *candidate = i->data; NiceCandidateImpl *candidate = i->data;
GSList *next = i->next; GSList *next = i->next;
if (candidate->sockptr != nsocket) { if (candidate->sockptr != nsocket) {
...@@ -226,7 +225,7 @@ nice_component_remove_socket (NiceAgent *agent, NiceComponent *cmp, ...@@ -226,7 +225,7 @@ nice_component_remove_socket (NiceAgent *agent, NiceComponent *cmp,
if (stream) if (stream)
conn_check_prune_socket (agent, stream, cmp, candidate->sockptr); conn_check_prune_socket (agent, stream, cmp, candidate->sockptr);
nice_candidate_free (candidate); nice_candidate_free ((NiceCandidate *) candidate);
cmp->remote_candidates = g_slist_delete_link (cmp->remote_candidates, i); cmp->remote_candidates = g_slist_delete_link (cmp->remote_candidates, i);
i = next; i = next;
...@@ -236,16 +235,16 @@ nice_component_remove_socket (NiceAgent *agent, NiceComponent *cmp, ...@@ -236,16 +235,16 @@ nice_component_remove_socket (NiceAgent *agent, NiceComponent *cmp,
} }
static gboolean static gboolean
on_candidate_refreshes_pruned (NiceAgent *agent, NiceCandidate *candidate) on_candidate_refreshes_pruned (NiceAgent *agent, NiceCandidateImpl *candidate)
{ {
NiceComponent *component; NiceComponent *component;
if (agent_find_component (agent, candidate->stream_id, if (agent_find_component (agent, candidate->c.stream_id,
candidate->component_id, NULL, &component)) { candidate->c.component_id, NULL, &component)) {
nice_component_detach_socket (component, candidate->sockptr); nice_component_detach_socket (component, candidate->sockptr);
} }
nice_candidate_free (candidate); nice_candidate_free ((NiceCandidate *) candidate);
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
...@@ -263,10 +262,10 @@ nice_component_clean_turn_servers (NiceAgent *agent, NiceComponent *cmp) ...@@ -263,10 +262,10 @@ nice_component_clean_turn_servers (NiceAgent *agent, NiceComponent *cmp)
cmp->turn_servers = NULL; cmp->turn_servers = NULL;
for (i = cmp->local_candidates; i;) { for (i = cmp->local_candidates; i;) {
NiceCandidate *candidate = i->data; NiceCandidateImpl *candidate = i->data;
GSList *next = i->next; GSList *next = i->next;
if (candidate->type != NICE_CANDIDATE_TYPE_RELAYED) { if (candidate->c.type != NICE_CANDIDATE_TYPE_RELAYED) {
i = next; i = next;
continue; continue;
} }
...@@ -290,7 +289,7 @@ nice_component_clean_turn_servers (NiceAgent *agent, NiceComponent *cmp) ...@@ -290,7 +289,7 @@ nice_component_clean_turn_servers (NiceAgent *agent, NiceComponent *cmp)
cmp->selected_pair.priority = 0; cmp->selected_pair.priority = 0;
cmp->turn_candidate = candidate; cmp->turn_candidate = candidate;
} else { } else {
agent_remove_local_candidate (agent, candidate); agent_remove_local_candidate (agent, (NiceCandidate *) candidate);
relay_candidates = g_slist_append(relay_candidates, candidate); relay_candidates = g_slist_append(relay_candidates, candidate);
} }
cmp->local_candidates = g_slist_delete_link (cmp->local_candidates, i); cmp->local_candidates = g_slist_delete_link (cmp->local_candidates, i);
...@@ -298,7 +297,7 @@ nice_component_clean_turn_servers (NiceAgent *agent, NiceComponent *cmp) ...@@ -298,7 +297,7 @@ nice_component_clean_turn_servers (NiceAgent *agent, NiceComponent *cmp)
} }
for (i = relay_candidates; i; i = i->next) { for (i = relay_candidates; i; i = i->next) {
NiceCandidate * candidate = i->data; NiceCandidateImpl * candidate = i->data;
discovery_prune_socket (agent, candidate->sockptr); discovery_prune_socket (agent, candidate->sockptr);
if (stream) { if (stream) {
...@@ -350,7 +349,7 @@ nice_component_close (NiceAgent *agent, NiceComponent *cmp) ...@@ -350,7 +349,7 @@ nice_component_close (NiceAgent *agent, NiceComponent *cmp)
cmp->restart_candidate = NULL; cmp->restart_candidate = NULL;
if (cmp->turn_candidate) if (cmp->turn_candidate)
nice_candidate_free (cmp->turn_candidate), nice_candidate_free ((NiceCandidate *) cmp->turn_candidate),
cmp->turn_candidate = NULL; cmp->turn_candidate = NULL;
while (cmp->local_candidates) { while (cmp->local_candidates) {
...@@ -405,23 +404,24 @@ nice_component_find_pair (NiceComponent *cmp, NiceAgent *agent, const gchar *lfo ...@@ -405,23 +404,24 @@ nice_component_find_pair (NiceComponent *cmp, NiceAgent *agent, const gchar *lfo
CandidatePair result = { 0, }; CandidatePair result = { 0, };
for (i = cmp->local_candidates; i; i = i->next) { for (i = cmp->local_candidates; i; i = i->next) {
NiceCandidate *candidate = i->data; NiceCandidateImpl *candidate = i->data;
if (strncmp (candidate->foundation, lfoundation, NICE_CANDIDATE_MAX_FOUNDATION) == 0) { if (strncmp (candidate->c.foundation, lfoundation, NICE_CANDIDATE_MAX_FOUNDATION) == 0) {
result.local = candidate; result.local = candidate;
break; break;
} }
} }
for (i = cmp->remote_candidates; i; i = i->next) { for (i = cmp->remote_candidates; i; i = i->next) {
NiceCandidate *candidate = i->data; NiceCandidateImpl *candidate = i->data;
if (strncmp (candidate->foundation, rfoundation, NICE_CANDIDATE_MAX_FOUNDATION) == 0) { if (strncmp (candidate->c.foundation, rfoundation, NICE_CANDIDATE_MAX_FOUNDATION) == 0) {
result.remote = candidate; result.remote = candidate;
break; break;
} }
} }
if (result.local && result.remote) { if (result.local && result.remote) {
result.priority = agent_candidate_pair_priority (agent, result.local, result.remote); result.priority = agent_candidate_pair_priority (agent,
(NiceCandidate *) result.local, (NiceCandidate *) result.remote);
if (pair) if (pair)
*pair = result; *pair = result;
return TRUE; return TRUE;
...@@ -446,7 +446,7 @@ nice_component_restart (NiceComponent *cmp) ...@@ -446,7 +446,7 @@ nice_component_restart (NiceComponent *cmp)
/* note: do not remove the remote candidate that is /* note: do not remove the remote candidate that is
* currently part of the 'selected pair', see ICE * currently part of the 'selected pair', see ICE
* 9.1.1.1. "ICE Restarts" (ID-19) */ * 9.1.1.1. "ICE Restarts" (ID-19) */
if (candidate == cmp->selected_pair.remote) { if (candidate == (NiceCandidate *) cmp->selected_pair.remote) {
if (cmp->restart_candidate) if (cmp->restart_candidate)
nice_candidate_free (cmp->restart_candidate); nice_candidate_free (cmp->restart_candidate);
cmp->restart_candidate = candidate; cmp->restart_candidate = candidate;
...@@ -483,8 +483,8 @@ nice_component_update_selected_pair (NiceAgent *agent, NiceComponent *component, ...@@ -483,8 +483,8 @@ nice_component_update_selected_pair (NiceAgent *agent, NiceComponent *component,
nice_candidate_pair_priority_to_string (pair->priority, priority); nice_candidate_pair_priority_to_string (pair->priority, priority);
nice_debug ("setting SELECTED PAIR for component %u: %s:%s (prio:%s).", nice_debug ("setting SELECTED PAIR for component %u: %s:%s (prio:%s).",
component->id, pair->local->foundation, component->id, pair->local->c.foundation,
pair->remote->foundation, priority); pair->remote->c.foundation, priority);
if (component->selected_pair.local && if (component->selected_pair.local &&
component->selected_pair.local == component->turn_candidate) { component->selected_pair.local == component->turn_candidate) {
...@@ -505,7 +505,8 @@ nice_component_update_selected_pair (NiceAgent *agent, NiceComponent *component, ...@@ -505,7 +505,8 @@ nice_component_update_selected_pair (NiceAgent *agent, NiceComponent *component,
component->selected_pair.priority = pair->priority; component->selected_pair.priority = pair->priority;
component->selected_pair.stun_priority = pair->stun_priority; component->selected_pair.stun_priority = pair->stun_priority;
nice_component_add_valid_candidate (agent, component, pair->remote); nice_component_add_valid_candidate (agent, component,
(NiceCandidate *) pair->remote);
} }
/* /*
...@@ -538,7 +539,7 @@ nice_component_find_remote_candidate (NiceComponent *component, const NiceAddres ...@@ -538,7 +539,7 @@ nice_component_find_remote_candidate (NiceComponent *component, const NiceAddres
* this candidate. * this candidate.
*/ */
NiceCandidate * NiceCandidateImpl *
nice_component_set_selected_remote_candidate (NiceComponent *component, nice_component_set_selected_remote_candidate (NiceComponent *component,
NiceAgent *agent, NiceCandidate *candidate) NiceAgent *agent, NiceCandidate *candidate)
{ {
...@@ -581,8 +582,8 @@ nice_component_set_selected_remote_candidate (NiceComponent *component, ...@@ -581,8 +582,8 @@ nice_component_set_selected_remote_candidate (NiceComponent *component,
nice_component_clear_selected_pair (component); nice_component_clear_selected_pair (component);
component->selected_pair.local = local; component->selected_pair.local = (NiceCandidateImpl *) local;
component->selected_pair.remote = remote; component->selected_pair.remote = (NiceCandidateImpl *) remote;
component->selected_pair.priority = priority; component->selected_pair.priority = priority;
/* Get into fallback mode where packets from any source is accepted once /* Get into fallback mode where packets from any source is accepted once
...@@ -590,7 +591,7 @@ nice_component_set_selected_remote_candidate (NiceComponent *component, ...@@ -590,7 +591,7 @@ nice_component_set_selected_remote_candidate (NiceComponent *component,
*/ */
component->fallback_mode = TRUE; component->fallback_mode = TRUE;
return local; return (NiceCandidateImpl *) local;
} }
static gint static gint
...@@ -1631,8 +1632,8 @@ nice_component_get_sockets (NiceComponent *component) ...@@ -1631,8 +1632,8 @@ nice_component_get_sockets (NiceComponent *component)
GSList *item; GSList *item;
for (item = component->local_candidates; item; item = item->next) { for (item = component->local_candidates; item; item = item->next) {
NiceCandidate *cand = item->data; NiceCandidateImpl *c = item->data;
NiceSocket *nicesock = cand->sockptr; NiceSocket *nicesock = c->sockptr;
if (nicesock->fileno && !g_ptr_array_find (array, nicesock->fileno, NULL)) if (nicesock->fileno && !g_ptr_array_find (array, nicesock->fileno, NULL))
g_ptr_array_add (array, g_object_ref (nicesock->fileno)); g_ptr_array_add (array, g_object_ref (nicesock->fileno));
......
...@@ -46,7 +46,7 @@ typedef struct _NiceComponent NiceComponent; ...@@ -46,7 +46,7 @@ typedef struct _NiceComponent NiceComponent;
#include "agent.h" #include "agent.h"
#include "agent-priv.h" #include "agent-priv.h"
#include "candidate.h" #include "candidate-priv.h"
#include "stun/stunagent.h" #include "stun/stunagent.h"
#include "stun/usages/timer.h" #include "stun/usages/timer.h"
#include "pseudotcp.h" #include "pseudotcp.h"
...@@ -80,8 +80,8 @@ struct _CandidatePairKeepalive ...@@ -80,8 +80,8 @@ struct _CandidatePairKeepalive
struct _CandidatePair struct _CandidatePair
{ {
NiceCandidate *local; NiceCandidateImpl *local;
NiceCandidate *remote; NiceCandidateImpl *remote;
guint64 priority; /* candidate pair priority */ guint64 priority; /* candidate pair priority */
guint32 stun_priority; guint32 stun_priority;
CandidatePairKeepalive keepalive; CandidatePairKeepalive keepalive;
...@@ -168,7 +168,7 @@ struct _NiceComponent { ...@@ -168,7 +168,7 @@ struct _NiceComponent {
see ICE 11.1. "Sending Media" (ID-19) */ see ICE 11.1. "Sending Media" (ID-19) */
gboolean fallback_mode; /* in this case, accepts packets from all, ignore candidate validation */ gboolean fallback_mode; /* in this case, accepts packets from all, ignore candidate validation */
NiceCandidate *restart_candidate; /* for storing active remote candidate during a restart */ NiceCandidate *restart_candidate; /* for storing active remote candidate during a restart */
NiceCandidate *turn_candidate; /* for storing active turn candidate if turn servers have been cleared */ NiceCandidateImpl *turn_candidate; /* for storing active turn candidate if turn servers have been cleared */
/* I/O handling. The main context must always be non-NULL, and is used for all /* I/O handling. The main context must always be non-NULL, and is used for all
* socket recv() operations. All io_callback emissions are invoked in this * socket recv() operations. All io_callback emissions are invoked in this
* context too. * context too.
...@@ -253,7 +253,7 @@ NiceCandidate * ...@@ -253,7 +253,7 @@ NiceCandidate *
nice_component_find_remote_candidate (NiceComponent *component, nice_component_find_remote_candidate (NiceComponent *component,
const NiceAddress *addr, NiceCandidateTransport transport); const NiceAddress *addr, NiceCandidateTransport transport);
NiceCandidate * NiceCandidateImpl *
nice_component_set_selected_remote_candidate (NiceComponent *component, nice_component_set_selected_remote_candidate (NiceComponent *component,
NiceAgent *agent, NiceCandidate *candidate); NiceAgent *agent, NiceCandidate *candidate);
......
...@@ -1277,7 +1277,7 @@ static gboolean priv_conn_keepalive_retransmissions_tick_agent_locked ( ...@@ -1277,7 +1277,7 @@ static gboolean priv_conn_keepalive_retransmissions_tick_agent_locked (
} }
case STUN_USAGE_TIMER_RETURN_RETRANSMIT: case STUN_USAGE_TIMER_RETURN_RETRANSMIT:
/* Retransmit */ /* Retransmit */
agent_socket_send (pair->local->sockptr, &pair->remote->addr, agent_socket_send (pair->local->sockptr, &pair->remote->c.addr,
stun_message_length (&pair->keepalive.stun_message), stun_message_length (&pair->keepalive.stun_message),
(gchar *)pair->keepalive.stun_buffer); (gchar *)pair->keepalive.stun_buffer);
...@@ -1416,7 +1416,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) ...@@ -1416,7 +1416,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
CandidatePair *p = &component->selected_pair; CandidatePair *p = &component->selected_pair;
/* Disable keepalive checks on TCP candidates unless explicitly enabled */ /* Disable keepalive checks on TCP candidates unless explicitly enabled */
if (p->local->transport != NICE_CANDIDATE_TRANSPORT_UDP && if (p->local->c.transport != NICE_CANDIDATE_TRANSPORT_UDP &&
!agent->keepalive_conncheck) !agent->keepalive_conncheck)
continue; continue;
...@@ -1432,11 +1432,12 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) ...@@ -1432,11 +1432,12 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
uint8_t uname[NICE_STREAM_MAX_UNAME]; uint8_t uname[NICE_STREAM_MAX_UNAME];
size_t uname_len = size_t uname_len =
priv_create_username (agent, agent_find_stream (agent, stream->id), priv_create_username (agent, agent_find_stream (agent, stream->id),
component->id, p->remote, p->local, uname, sizeof (uname), component->id, (NiceCandidate *) p->remote,
FALSE); (NiceCandidate *) p->local, uname, sizeof (uname), FALSE);
uint8_t *password = NULL; uint8_t *password = NULL;
size_t password_len = priv_get_password (agent, size_t password_len = priv_get_password (agent,
agent_find_stream (agent, stream->id), p->remote, &password); agent_find_stream (agent, stream->id),
(NiceCandidate *) p->remote, &password);
if (p->keepalive.stun_message.buffer != NULL) { if (p->keepalive.stun_message.buffer != NULL) {
nice_debug ("Agent %p: Keepalive for s%u:c%u still" nice_debug ("Agent %p: Keepalive for s%u:c%u still"
...@@ -1447,11 +1448,11 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) ...@@ -1447,11 +1448,11 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
if (nice_debug_is_enabled ()) { if (nice_debug_is_enabled ()) {
gchar tmpbuf[INET6_ADDRSTRLEN]; gchar tmpbuf[INET6_ADDRSTRLEN];
nice_address_to_string (&p->remote->addr, tmpbuf); nice_address_to_string (&p->remote->c.addr, tmpbuf);
nice_debug ("Agent %p : Keepalive STUN-CC REQ to '%s:%u', " nice_debug ("Agent %p : Keepalive STUN-CC REQ to '%s:%u', "
"(c-id:%u), username='%.*s' (%" G_GSIZE_FORMAT "), " "(c-id:%u), username='%.*s' (%" G_GSIZE_FORMAT "), "
"password='%.*s' (%" G_GSIZE_FORMAT "), priority=%08x.", "password='%.*s' (%" G_GSIZE_FORMAT "), priority=%08x.",
agent, tmpbuf, nice_address_get_port (&p->remote->addr), agent, tmpbuf, nice_address_get_port (&p->remote->c.addr),
component->id, (int) uname_len, uname, uname_len, component->id, (int) uname_len, uname, uname_len,
(int) password_len, password, password_len, (int) password_len, password, password_len,
p->stun_priority); p->stun_priority);
...@@ -1478,7 +1479,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) ...@@ -1478,7 +1479,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
agent->media_after_tick = FALSE; agent->media_after_tick = FALSE;
/* send the conncheck */ /* send the conncheck */
agent_socket_send (p->local->sockptr, &p->remote->addr, agent_socket_send (p->local->sockptr, &p->remote->c.addr,
buf_len, (gchar *)p->keepalive.stun_buffer); buf_len, (gchar *)p->keepalive.stun_buffer);
p->keepalive.stream_id = stream->id; p->keepalive.stream_id = stream->id;
...@@ -1502,22 +1503,22 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) ...@@ -1502,22 +1503,22 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
sizeof(p->keepalive.stun_buffer)); sizeof(p->keepalive.stun_buffer));
if (buf_len > 0) { if (buf_len > 0) {
agent_socket_send (p->local->sockptr, &p->remote->addr, buf_len, agent_socket_send (p->local->sockptr, &p->remote->c.addr, buf_len,
(gchar *)p->keepalive.stun_buffer); (gchar *)p->keepalive.stun_buffer);
p->keepalive.next_tick = now + 1000 * NICE_AGENT_TIMER_TR_DEFAULT; p->keepalive.next_tick = now + 1000 * NICE_AGENT_TIMER_TR_DEFAULT;
if (agent->compatibility == NICE_COMPATIBILITY_OC2007R2) { if (agent->compatibility == NICE_COMPATIBILITY_OC2007R2) {
ms_ice2_legacy_conncheck_send (&p->keepalive.stun_message, ms_ice2_legacy_conncheck_send (&p->keepalive.stun_message,
p->local->sockptr, &p->remote->addr); p->local->sockptr, &p->remote->c.addr);
} }
if (nice_debug_is_enabled ()) { if (nice_debug_is_enabled ()) {
gchar tmpbuf[INET6_ADDRSTRLEN]; gchar tmpbuf[INET6_ADDRSTRLEN];
nice_address_to_string (&p->local->base_addr, tmpbuf); nice_address_to_string (&p->local->c.base_addr, tmpbuf);
nice_debug ("Agent %p : resending STUN to keep the " nice_debug ("Agent %p : resending STUN to keep the "
"selected base address %s:%u alive in s%d/c%d.", agent, "selected base address %s:%u alive in s%d/c%d.", agent,
tmpbuf, nice_address_get_port (&p->local->base_addr), tmpbuf, nice_address_get_port (&p->local->c.base_addr),
stream->id, component->id); stream->id, component->id);
} }
...@@ -1555,10 +1556,10 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) ...@@ -1555,10 +1556,10 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
&stun_message, stun_buffer, sizeof(stun_buffer)); &stun_message, stun_buffer, sizeof(stun_buffer));
for (k = component->local_candidates; k; k = k->next) { for (k = component->local_candidates; k; k = k->next) {
NiceCandidate *candidate = (NiceCandidate *) k->data; NiceCandidateImpl *candidate = (NiceCandidateImpl *) k->data;
if (candidate->type == NICE_CANDIDATE_TYPE_HOST && if (candidate->c.type == NICE_CANDIDATE_TYPE_HOST &&
candidate->transport == NICE_CANDIDATE_TRANSPORT_UDP && candidate->c.transport == NICE_CANDIDATE_TRANSPORT_UDP &&
nice_address_ip_version (&candidate->addr) == nice_address_ip_version (&candidate->c.addr) ==
nice_address_ip_version (&stun_server)) { nice_address_ip_version (&stun_server)) {
if (candidate->keepalive_next_tick) { if (candidate->keepalive_next_tick) {
...@@ -1571,10 +1572,10 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) ...@@ -1571,10 +1572,10 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
/* send the conncheck */ /* send the conncheck */
if (nice_debug_is_enabled ()) { if (nice_debug_is_enabled ()) {
gchar tmpbuf[INET6_ADDRSTRLEN]; gchar tmpbuf[INET6_ADDRSTRLEN];
nice_address_to_string (&candidate->addr, tmpbuf); nice_address_to_string (&candidate->c.addr, tmpbuf);
nice_debug ("Agent %p : resending STUN to keep the local " nice_debug ("Agent %p : resending STUN to keep the local "
"candidate %s:%u alive in s%d/c%d.", agent, "candidate %s:%u alive in s%d/c%d.", agent,
tmpbuf, nice_address_get_port (&candidate->addr), tmpbuf, nice_address_get_port (&candidate->c.addr),
stream->id, component->id); stream->id, component->id);
} }
agent_socket_send (candidate->sockptr, &stun_server, agent_socket_send (candidate->sockptr, &stun_server,
...@@ -1829,6 +1830,7 @@ local_candidate_and_socket_compatible (NiceAgent *agent, ...@@ -1829,6 +1830,7 @@ local_candidate_and_socket_compatible (NiceAgent *agent,
{ {
gboolean ret = TRUE; gboolean ret = TRUE;
NiceCandidateTransport transport; NiceCandidateTransport transport;
NiceCandidateImpl *lc = (NiceCandidateImpl *) lcand;
g_assert (socket); g_assert (socket);
g_assert (lcand); g_assert (lcand);
...@@ -1839,14 +1841,14 @@ local_candidate_and_socket_compatible (NiceAgent *agent, ...@@ -1839,14 +1841,14 @@ local_candidate_and_socket_compatible (NiceAgent *agent,
* socket is the tcp connect related socket */ * socket is the tcp connect related socket */
if (ret && transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE && if (ret && transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE &&
nice_address_get_port (&lcand->addr) > 0) nice_address_get_port (&lcand->addr) > 0)
ret = (lcand->sockptr == socket); ret = (lc->sockptr == socket);
} else if (socket->type == NICE_SOCKET_TYPE_UDP_TURN) } else if (socket->type == NICE_SOCKET_TYPE_UDP_TURN)
/* Socket of type udp-turn will match a unique local candidate /* Socket of type udp-turn will match a unique local candidate
* by its sockptr value. An an udp-turn socket doesn't carry enough * by its sockptr value. An an udp-turn socket doesn't carry enough
* information when base socket is udp-turn-over-tcp to disambiguate * information when base socket is udp-turn-over-tcp to disambiguate
* between a tcp-act and a tcp-pass local candidate. * between a tcp-act and a tcp-pass local candidate.
*/ */
ret = (lcand->sockptr == socket); ret = (lc->sockptr == socket);
return ret; return ret;
} }
...@@ -2076,8 +2078,8 @@ conn_check_update_selected_pair (NiceAgent *agent, NiceComponent *component, ...@@ -2076,8 +2078,8 @@ conn_check_update_selected_pair (NiceAgent *agent, NiceComponent *component,
"(prio:%s).", agent, component->id, "(prio:%s).", agent, component->id,
pair->local->foundation, pair->remote->foundation, priority); pair->local->foundation, pair->remote->foundation, priority);
cpair.local = pair->local; cpair.local = (NiceCandidateImpl *) pair->local;
cpair.remote = pair->remote; cpair.remote = (NiceCandidateImpl *) pair->remote;
cpair.priority = pair->priority; cpair.priority = pair->priority;
cpair.stun_priority = pair->stun_priority; cpair.stun_priority = pair->stun_priority;
...@@ -2301,8 +2303,8 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Nice ...@@ -2301,8 +2303,8 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Nice
* the agent's list of checks. * the agent's list of checks.
*/ */
static CandidateCheckPair *priv_add_new_check_pair (NiceAgent *agent, static CandidateCheckPair *priv_add_new_check_pair (NiceAgent *agent,
guint stream_id, NiceComponent *component, NiceCandidate *local, guint stream_id, NiceComponent *component, NiceCandidateImpl *local,
NiceCandidate *remote, NiceCheckState initial_state) NiceCandidateImpl *remote, NiceCheckState initial_state)
{ {
NiceStream *stream; NiceStream *stream;
CandidateCheckPair *pair; CandidateCheckPair *pair;
...@@ -2311,7 +2313,8 @@ static CandidateCheckPair *priv_add_new_check_pair (NiceAgent *agent, ...@@ -2311,7 +2313,8 @@ static CandidateCheckPair *priv_add_new_check_pair (NiceAgent *agent,
g_assert (local != NULL); g_assert (local != NULL);
g_assert (remote != NULL); g_assert (remote != NULL);
priority = agent_candidate_pair_priority (agent, local, remote); priority = agent_candidate_pair_priority (agent, (NiceCandidate *) local,
(NiceCandidate *) remote);
if (component->selected_pair.priority && if (component->selected_pair.priority &&
priority < component->selected_pair.priority) { priority < component->selected_pair.priority) {
...@@ -2330,20 +2333,22 @@ static CandidateCheckPair *priv_add_new_check_pair (NiceAgent *agent, ...@@ -2330,20 +2333,22 @@ static CandidateCheckPair *priv_add_new_check_pair (NiceAgent *agent,
pair = g_slice_new0 (CandidateCheckPair); pair = g_slice_new0 (CandidateCheckPair);
pair->stream_id = stream_id; pair->stream_id = stream_id;
pair->component_id = component->id;; pair->component_id = component->id;
pair->local = local; pair->local = (NiceCandidate *) local;
pair->remote = remote; pair->remote = (NiceCandidate *) remote;
/* note: we use the remote sockptr only in the case /* note: we use the remote sockptr only in the case
* of TCP transport * of TCP transport
*/ */
if (local->transport == NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE && if (local->c.transport == NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE &&
remote->type == NICE_CANDIDATE_TYPE_PEER_REFLEXIVE) remote->c.type == NICE_CANDIDATE_TYPE_PEER_REFLEXIVE)
pair->sockptr = (NiceSocket *) remote->sockptr; pair->sockptr = remote->sockptr;
else else
pair->sockptr = (NiceSocket *) local->sockptr; pair->sockptr = local->sockptr;
g_snprintf (pair->foundation, NICE_CANDIDATE_PAIR_MAX_FOUNDATION, "%s:%s", local->foundation, remote->foundation); g_snprintf (pair->foundation, NICE_CANDIDATE_PAIR_MAX_FOUNDATION, "%s:%s",
local->c.foundation, remote->c.foundation);
pair->priority = agent_candidate_pair_priority (agent, local, remote); pair->priority = agent_candidate_pair_priority (agent,
(NiceCandidate *) local, (NiceCandidate *) remote);
nice_debug ("Agent %p : creating a new pair", agent); nice_debug ("Agent %p : creating a new pair", agent);
SET_PAIR_STATE (agent, pair, initial_state); SET_PAIR_STATE (agent, pair, initial_state);
{ {
...@@ -2355,7 +2360,7 @@ static CandidateCheckPair *priv_add_new_check_pair (NiceAgent *agent, ...@@ -2355,7 +2360,7 @@ static CandidateCheckPair *priv_add_new_check_pair (NiceAgent *agent,
tmpbuf1, nice_address_get_port (&pair->local->addr), tmpbuf1, nice_address_get_port (&pair->local->addr),
tmpbuf2, nice_address_get_port (&pair->remote->addr)); tmpbuf2, nice_address_get_port (&pair->remote->addr));
} }
pair->stun_priority = stun_request_priority (agent, local); pair->stun_priority = stun_request_priority (agent, (NiceCandidate *) local);
stream->conncheck_list = g_slist_insert_sorted (stream->conncheck_list, pair, stream->conncheck_list = g_slist_insert_sorted (stream->conncheck_list, pair,
(GCompareFunc)conn_check_compare); (GCompareFunc)conn_check_compare);
...@@ -2404,8 +2409,8 @@ static CandidateCheckPair *priv_conn_check_add_for_candidate_pair_matched ( ...@@ -2404,8 +2409,8 @@ static CandidateCheckPair *priv_conn_check_add_for_candidate_pair_matched (
{ {
CandidateCheckPair *pair; CandidateCheckPair *pair;
pair = priv_add_new_check_pair (agent, stream_id, component, local, remote, pair = priv_add_new_check_pair (agent, stream_id, component,
initial_state); (NiceCandidateImpl *) local, (NiceCandidateImpl *) remote, initial_state);
if (pair) { if (pair) {
if (component->state == NICE_COMPONENT_STATE_CONNECTED || if (component->state == NICE_COMPONENT_STATE_CONNECTED ||
component->state == NICE_COMPONENT_STATE_READY) { component->state == NICE_COMPONENT_STATE_READY) {
...@@ -3169,9 +3174,10 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *str ...@@ -3169,9 +3174,10 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *str
} }
for (i = component->local_candidates; i ; i = i->next) { for (i = component->local_candidates; i ; i = i->next) {
local = i->data; NiceCandidateImpl *lc = i->data;
if (local->sockptr == local_socket) local = i->data;
break; if (lc->sockptr == local_socket)
break;
} }
if (i) { if (i) {
...@@ -3284,14 +3290,14 @@ static int priv_store_pending_check (NiceAgent *agent, NiceComponent *component, ...@@ -3284,14 +3290,14 @@ static int priv_store_pending_check (NiceAgent *agent, NiceComponent *component,
* *
* @return created pair, or NULL on fatal (memory allocation) errors * @return created pair, or NULL on fatal (memory allocation) errors
*/ */
static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint stream_id, NiceComponent *component, NiceCandidate *local_cand, CandidateCheckPair *parent_pair) static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint stream_id, NiceComponent *component, NiceCandidateImpl *local_cand, CandidateCheckPair *parent_pair)
{ {
CandidateCheckPair *pair = g_slice_new0 (CandidateCheckPair); CandidateCheckPair *pair = g_slice_new0 (CandidateCheckPair);
NiceStream *stream = agent_find_stream (agent, stream_id); NiceStream *stream = agent_find_stream (agent, stream_id);
pair->stream_id = stream_id; pair->stream_id = stream_id;
pair->component_id = component->id;; pair->component_id = component->id;;
pair->local = local_cand; pair->local = (NiceCandidate *) local_cand;
pair->remote = parent_pair->remote; pair->remote = parent_pair->remote;
pair->sockptr = local_cand->sockptr; pair->sockptr = local_cand->sockptr;
parent_pair->discovered_pair = pair; parent_pair->discovered_pair = pair;
...@@ -3308,7 +3314,7 @@ static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint ...@@ -3308,7 +3314,7 @@ static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint
tmpbuf2, nice_address_get_port (&pair->remote->addr)); tmpbuf2, nice_address_get_port (&pair->remote->addr));
} }
g_snprintf (pair->foundation, NICE_CANDIDATE_PAIR_MAX_FOUNDATION, "%s:%s", g_snprintf (pair->foundation, NICE_CANDIDATE_PAIR_MAX_FOUNDATION, "%s:%s",
local_cand->foundation, parent_pair->remote->foundation); local_cand->c.foundation, parent_pair->remote->foundation);
if (agent->controlling_mode == TRUE) if (agent->controlling_mode == TRUE)
pair->priority = nice_candidate_pair_priority (pair->local->priority, pair->priority = nice_candidate_pair_priority (pair->local->priority,
...@@ -3466,7 +3472,7 @@ static CandidateCheckPair *priv_process_response_check_for_reflexive(NiceAgent * ...@@ -3466,7 +3472,7 @@ static CandidateCheckPair *priv_process_response_check_for_reflexive(NiceAgent *
"Constructing a Valid Pair") */ "Constructing a Valid Pair") */
if (local_cand) if (local_cand)
new_pair = priv_add_peer_reflexive_pair (agent, stream->id, component, new_pair = priv_add_peer_reflexive_pair (agent, stream->id, component,
local_cand, p); (NiceCandidateImpl *) local_cand, p);
/* note: this is same as "adding to VALID LIST" in the spec /* note: this is same as "adding to VALID LIST" in the spec
text */ text */
if (new_pair) if (new_pair)
...@@ -3815,7 +3821,7 @@ priv_calc_turn_timeout (guint lifetime) ...@@ -3815,7 +3821,7 @@ priv_calc_turn_timeout (guint lifetime)
static void static void
priv_add_new_turn_refresh (NiceAgent *agent, CandidateDiscovery *cdisco, priv_add_new_turn_refresh (NiceAgent *agent, CandidateDiscovery *cdisco,
NiceCandidate *relay_cand, guint lifetime) NiceCandidateImpl *relay_cand, guint lifetime)
{ {
CandidateRefresh *cand; CandidateRefresh *cand;
...@@ -3974,7 +3980,7 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage * ...@@ -3974,7 +3980,7 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
res == STUN_USAGE_TURN_RETURN_MAPPED_SUCCESS) { res == STUN_USAGE_TURN_RETURN_MAPPED_SUCCESS) {
/* case: successful allocate, create a new local candidate */ /* case: successful allocate, create a new local candidate */
NiceAddress niceaddr; NiceAddress niceaddr;
NiceCandidate *relay_cand; NiceCandidateImpl *relay_cand;
nice_address_set_from_sockaddr (&niceaddr, &relayaddr.addr); nice_address_set_from_sockaddr (&niceaddr, &relayaddr.addr);
...@@ -4422,8 +4428,8 @@ static gboolean conn_check_handle_renomination (NiceAgent *agent, NiceStream *st ...@@ -4422,8 +4428,8 @@ static gboolean conn_check_handle_renomination (NiceAgent *agent, NiceStream *st
* selected pair's priority so this pair gets SELECTED! * selected pair's priority so this pair gets SELECTED!
*/ */
if (component->selected_pair.priority && if (component->selected_pair.priority &&
component->selected_pair.remote && component->selected_pair.remote != remote_candidate && component->selected_pair.remote && component->selected_pair.remote != (NiceCandidateImpl *) remote_candidate &&
component->selected_pair.local && component->selected_pair.local != local_candidate) { component->selected_pair.local && component->selected_pair.local != (NiceCandidateImpl *) local_candidate) {
for (lst = stream->conncheck_list; lst; lst = lst->next) { for (lst = stream->conncheck_list; lst; lst = lst->next) {
CandidateCheckPair *pair = lst->data; CandidateCheckPair *pair = lst->data;
if (pair->local == local_candidate && pair->remote == remote_candidate) { if (pair->local == local_candidate && pair->remote == remote_candidate) {
...@@ -4851,8 +4857,8 @@ conn_check_prune_socket (NiceAgent *agent, NiceStream *stream, NiceComponent *co ...@@ -4851,8 +4857,8 @@ conn_check_prune_socket (NiceAgent *agent, NiceStream *stream, NiceComponent *co
CandidateCheckPair *p = l->data; CandidateCheckPair *p = l->data;
GSList *next = l->next; GSList *next = l->next;
if ((p->local != NULL && p->local->sockptr == sock) || if ((p->local != NULL && ((NiceCandidateImpl*) p->local)->sockptr == sock) ||
(p->remote != NULL && p->remote->sockptr == sock) || (p->remote != NULL && ((NiceCandidateImpl*)p->remote)->sockptr == sock) ||
(p->sockptr == sock)) { (p->sockptr == sock)) {
nice_debug ("Agent %p : Retransmissions failed, giving up on pair %p", nice_debug ("Agent %p : Retransmissions failed, giving up on pair %p",
agent, p); agent, p);
......
...@@ -225,6 +225,7 @@ static gboolean refresh_remove_async (NiceAgent *agent, gpointer pointer) ...@@ -225,6 +225,7 @@ static gboolean refresh_remove_async (NiceAgent *agent, gpointer pointer)
gsize password_len; gsize password_len;
size_t buffer_len = 0; size_t buffer_len = 0;
CandidateRefresh *cand = (CandidateRefresh *) pointer; CandidateRefresh *cand = (CandidateRefresh *) pointer;
NiceCandidateImpl *c = (NiceCandidateImpl *) cand->candidate;
StunUsageTurnCompatibility turn_compat = agent_to_turn_compatibility (agent); StunUsageTurnCompatibility turn_compat = agent_to_turn_compatibility (agent);
nice_debug ("Agent %p : Sending request to remove TURN allocation " nice_debug ("Agent %p : Sending request to remove TURN allocation "
...@@ -240,17 +241,17 @@ static gboolean refresh_remove_async (NiceAgent *agent, gpointer pointer) ...@@ -240,17 +241,17 @@ static gboolean refresh_remove_async (NiceAgent *agent, gpointer pointer)
g_source_unref (cand->destroy_source); g_source_unref (cand->destroy_source);
cand->destroy_source = NULL; cand->destroy_source = NULL;
username = (uint8_t *)cand->candidate->turn->username; username = (uint8_t *)c->turn->username;
username_len = (size_t) strlen (cand->candidate->turn->username); username_len = (size_t) strlen (c->turn->username);
password = (uint8_t *)cand->candidate->turn->password; password = (uint8_t *)c->turn->password;
password_len = (size_t) strlen (cand->candidate->turn->password); password_len = (size_t) strlen (c->turn->password);
if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN || if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN ||
turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) { turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) {
username = cand->candidate->turn->decoded_username; username = c->turn->decoded_username;
password = cand->candidate->turn->decoded_password; password = c->turn->decoded_password;
username_len = cand->candidate->turn->decoded_username_len; username_len = c->turn->decoded_username_len;
password_len = cand->candidate->turn->decoded_password_len; password_len = c->turn->decoded_password_len;
} }
buffer_len = stun_usage_turn_create_refresh (&cand->stun_agent, buffer_len = stun_usage_turn_create_refresh (&cand->stun_agent,
...@@ -366,7 +367,7 @@ void refresh_prune_stream_async (NiceAgent *agent, NiceStream *stream, ...@@ -366,7 +367,7 @@ void refresh_prune_stream_async (NiceAgent *agent, NiceStream *stream,
* situations when an error is detected in socket communication that prevents * situations when an error is detected in socket communication that prevents
* sending more requests to the server. * sending more requests to the server.
*/ */
void refresh_prune_candidate (NiceAgent *agent, NiceCandidate *candidate) void refresh_prune_candidate (NiceAgent *agent, NiceCandidateImpl *candidate)
{ {
GSList *i; GSList *i;
...@@ -387,8 +388,8 @@ void refresh_prune_candidate (NiceAgent *agent, NiceCandidate *candidate) ...@@ -387,8 +388,8 @@ void refresh_prune_candidate (NiceAgent *agent, NiceCandidate *candidate)
* closes the associated port allocations on TURN server. Invokes 'function' * closes the associated port allocations on TURN server. Invokes 'function'
* when the process finishes. * when the process finishes.
*/ */
void refresh_prune_candidate_async (NiceAgent *agent, NiceCandidate *candidate, void refresh_prune_candidate_async (NiceAgent *agent,
NiceTimeoutLockedCallback function) NiceCandidateImpl *candidate, NiceTimeoutLockedCallback function)
{ {
GSList *refreshes = NULL; GSList *refreshes = NULL;
GSList *i; GSList *i;
...@@ -485,37 +486,38 @@ priv_compare_turn_servers (TurnServer *turn1, TurnServer *turn2) ...@@ -485,37 +486,38 @@ priv_compare_turn_servers (TurnServer *turn1, TurnServer *turn2)
static void priv_assign_foundation (NiceAgent *agent, NiceCandidate *candidate) static void priv_assign_foundation (NiceAgent *agent, NiceCandidate *candidate)
{ {
GSList *i, *j, *k; GSList *i, *j, *k;
NiceCandidateImpl *c = (NiceCandidateImpl *) candidate;
for (i = agent->streams; i; i = i->next) { for (i = agent->streams; i; i = i->next) {
NiceStream *stream = i->data; NiceStream *stream = i->data;
for (j = stream->components; j; j = j->next) { for (j = stream->components; j; j = j->next) {
NiceComponent *component = j->data; NiceComponent *component = j->data;
for (k = component->local_candidates; k; k = k->next) { for (k = component->local_candidates; k; k = k->next) {
NiceCandidate *n = k->data; NiceCandidateImpl *n = k->data;
/* note: candidate must not on the local candidate list */ /* note: candidate must not on the local candidate list */
g_assert (candidate != n); g_assert (c != n);
if (candidate->type == n->type && if (candidate->type == n->c.type &&
candidate->transport == n->transport && candidate->transport == n->c.transport &&
nice_address_equal_no_port (&candidate->base_addr, &n->base_addr) && nice_address_equal_no_port (&candidate->base_addr, &n->c.base_addr) &&
(candidate->type != NICE_CANDIDATE_TYPE_RELAYED || (candidate->type != NICE_CANDIDATE_TYPE_RELAYED ||
priv_compare_turn_servers (candidate->turn, n->turn)) && priv_compare_turn_servers (c->turn, n->turn)) &&
!(agent->compatibility == NICE_COMPATIBILITY_GOOGLE && !(agent->compatibility == NICE_COMPATIBILITY_GOOGLE &&
n->type == NICE_CANDIDATE_TYPE_RELAYED)) { n->c.type == NICE_CANDIDATE_TYPE_RELAYED)) {
/* note: currently only one STUN server per stream at a /* note: currently only one STUN server per stream at a
* time is supported, so there is no need to check * time is supported, so there is no need to check
* for candidates that would otherwise share the * for candidates that would otherwise share the
* foundation, but have different STUN servers */ * foundation, but have different STUN servers */
g_strlcpy (candidate->foundation, n->foundation, g_strlcpy (candidate->foundation, n->c.foundation,
NICE_CANDIDATE_MAX_FOUNDATION); NICE_CANDIDATE_MAX_FOUNDATION);
if (n->username) { if (n->c.username) {
g_free (candidate->username); g_free (candidate->username);
candidate->username = g_strdup (n->username); candidate->username = g_strdup (n->c.username);
} }
if (n->password) { if (n->c.password) {
g_free (candidate->password); g_free (candidate->password);
candidate->password = g_strdup (n->password); candidate->password = g_strdup (n->c.password);
} }
return; return;
} }
...@@ -673,9 +675,10 @@ HostCandidateResult discovery_add_local_host_candidate ( ...@@ -673,9 +675,10 @@ HostCandidateResult discovery_add_local_host_candidate (
NiceAddress *address, NiceAddress *address,
NiceCandidateTransport transport, NiceCandidateTransport transport,
gboolean accept_duplicate, gboolean accept_duplicate,
NiceCandidate **outcandidate) NiceCandidateImpl **outcandidate)
{ {
NiceCandidate *candidate; NiceCandidate *candidate;
NiceCandidateImpl *c;
NiceComponent *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
NiceSocket *nicesock = NULL; NiceSocket *nicesock = NULL;
...@@ -686,6 +689,7 @@ HostCandidateResult discovery_add_local_host_candidate ( ...@@ -686,6 +689,7 @@ HostCandidateResult discovery_add_local_host_candidate (
return res; return res;
candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_HOST); candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_HOST);
c = (NiceCandidateImpl *) candidate;
candidate->transport = transport; candidate->transport = transport;
candidate->stream_id = stream_id; candidate->stream_id = stream_id;
candidate->component_id = component_id; candidate->component_id = component_id;
...@@ -727,7 +731,7 @@ HostCandidateResult discovery_add_local_host_candidate ( ...@@ -727,7 +731,7 @@ HostCandidateResult discovery_add_local_host_candidate (
goto errors; goto errors;
} }
candidate->sockptr = nicesock; c->sockptr = nicesock;
candidate->addr = nicesock->addr; candidate->addr = nicesock->addr;
candidate->base_addr = nicesock->addr; candidate->base_addr = nicesock->addr;
...@@ -745,7 +749,7 @@ HostCandidateResult discovery_add_local_host_candidate ( ...@@ -745,7 +749,7 @@ HostCandidateResult discovery_add_local_host_candidate (
_priv_set_socket_tos (agent, nicesock, stream->tos); _priv_set_socket_tos (agent, nicesock, stream->tos);
nice_component_attach_socket (component, nicesock); nice_component_attach_socket (component, nicesock);
*outcandidate = candidate; *outcandidate = c;
return HOST_CANDIDATE_SUCCESS; return HOST_CANDIDATE_SUCCESS;
...@@ -773,6 +777,7 @@ discovery_add_server_reflexive_candidate ( ...@@ -773,6 +777,7 @@ discovery_add_server_reflexive_candidate (
gboolean nat_assisted) gboolean nat_assisted)
{ {
NiceCandidate *candidate; NiceCandidate *candidate;
NiceCandidateImpl *c;
NiceComponent *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
gboolean result = FALSE; gboolean result = FALSE;
...@@ -781,13 +786,14 @@ discovery_add_server_reflexive_candidate ( ...@@ -781,13 +786,14 @@ discovery_add_server_reflexive_candidate (
return NULL; return NULL;
candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE); candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE);
c = (NiceCandidateImpl *) candidate;
candidate->transport = transport; candidate->transport = transport;
candidate->stream_id = stream_id; candidate->stream_id = stream_id;
candidate->component_id = component_id; candidate->component_id = component_id;
candidate->addr = *address; candidate->addr = *address;
/* step: link to the base candidate+socket */ /* step: link to the base candidate+socket */
candidate->sockptr = base_socket; c->sockptr = base_socket;
candidate->base_addr = base_socket->addr; candidate->base_addr = base_socket->addr;
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) { if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
...@@ -859,7 +865,7 @@ discovery_discover_tcp_server_reflexive_candidates ( ...@@ -859,7 +865,7 @@ discovery_discover_tcp_server_reflexive_candidates (
component_id, component_id,
address, address,
c->transport, c->transport,
c->sockptr, ((NiceCandidateImpl *) c)->sockptr,
FALSE); FALSE);
} }
} }
...@@ -871,7 +877,7 @@ discovery_discover_tcp_server_reflexive_candidates ( ...@@ -871,7 +877,7 @@ discovery_discover_tcp_server_reflexive_candidates (
* *
* @return pointer to the created candidate, or NULL on error * @return pointer to the created candidate, or NULL on error
*/ */
NiceCandidate* NiceCandidateImpl *
discovery_add_relay_candidate ( discovery_add_relay_candidate (
NiceAgent *agent, NiceAgent *agent,
guint stream_id, guint stream_id,
...@@ -882,6 +888,7 @@ discovery_add_relay_candidate ( ...@@ -882,6 +888,7 @@ discovery_add_relay_candidate (
TurnServer *turn) TurnServer *turn)
{ {
NiceCandidate *candidate; NiceCandidate *candidate;
NiceCandidateImpl *c;
NiceComponent *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
NiceSocket *relay_socket = NULL; NiceSocket *relay_socket = NULL;
...@@ -890,11 +897,12 @@ discovery_add_relay_candidate ( ...@@ -890,11 +897,12 @@ discovery_add_relay_candidate (
return NULL; return NULL;
candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_RELAYED); candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_RELAYED);
c = (NiceCandidateImpl *) candidate;
candidate->transport = transport; candidate->transport = transport;
candidate->stream_id = stream_id; candidate->stream_id = stream_id;
candidate->component_id = component_id; candidate->component_id = component_id;
candidate->addr = *address; candidate->addr = *address;
candidate->turn = turn_server_ref (turn); c->turn = turn_server_ref (turn);
/* step: link to the base candidate+socket */ /* step: link to the base candidate+socket */
relay_socket = nice_udp_turn_socket_new (agent->main_context, address, relay_socket = nice_udp_turn_socket_new (agent->main_context, address,
...@@ -904,7 +912,7 @@ discovery_add_relay_candidate ( ...@@ -904,7 +912,7 @@ discovery_add_relay_candidate (
if (!relay_socket) if (!relay_socket)
goto errors; goto errors;
candidate->sockptr = relay_socket; c->sockptr = relay_socket;
candidate->base_addr = base_socket->addr; candidate->base_addr = base_socket->addr;
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) { if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
...@@ -936,7 +944,7 @@ discovery_add_relay_candidate ( ...@@ -936,7 +944,7 @@ discovery_add_relay_candidate (
nice_component_attach_socket (component, relay_socket); nice_component_attach_socket (component, relay_socket);
agent_signal_new_candidate (agent, candidate); agent_signal_new_candidate (agent, candidate);
return candidate; return c;
errors: errors:
nice_candidate_free (candidate); nice_candidate_free (candidate);
...@@ -963,6 +971,7 @@ discovery_add_peer_reflexive_candidate ( ...@@ -963,6 +971,7 @@ discovery_add_peer_reflexive_candidate (
NiceCandidate *remote) NiceCandidate *remote)
{ {
NiceCandidate *candidate; NiceCandidate *candidate;
NiceCandidateImpl *c;
NiceComponent *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
gboolean result; gboolean result;
...@@ -971,6 +980,7 @@ discovery_add_peer_reflexive_candidate ( ...@@ -971,6 +980,7 @@ discovery_add_peer_reflexive_candidate (
return NULL; return NULL;
candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_PEER_REFLEXIVE); candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_PEER_REFLEXIVE);
c = (NiceCandidateImpl *) candidate;
if (local) if (local)
candidate->transport = local->transport; candidate->transport = local->transport;
else if (remote) else if (remote)
...@@ -985,7 +995,7 @@ discovery_add_peer_reflexive_candidate ( ...@@ -985,7 +995,7 @@ discovery_add_peer_reflexive_candidate (
candidate->stream_id = stream_id; candidate->stream_id = stream_id;
candidate->component_id = component_id; candidate->component_id = component_id;
candidate->addr = *address; candidate->addr = *address;
candidate->sockptr = base_socket; c->sockptr = base_socket;
candidate->base_addr = base_socket->addr; candidate->base_addr = base_socket->addr;
/* We don't ensure priority uniqueness in this case, since the /* We don't ensure priority uniqueness in this case, since the
* discovered candidate receives the same priority than its * discovered candidate receives the same priority than its
...@@ -1058,8 +1068,10 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate ( ...@@ -1058,8 +1068,10 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
NiceCandidate *remote) NiceCandidate *remote)
{ {
NiceCandidate *candidate; NiceCandidate *candidate;
NiceCandidateImpl *c;
candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_PEER_REFLEXIVE); candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_PEER_REFLEXIVE);
c = (NiceCandidateImpl *) candidate;
candidate->addr = *remote_address; candidate->addr = *remote_address;
candidate->base_addr = *remote_address; candidate->base_addr = *remote_address;
...@@ -1074,7 +1086,7 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate ( ...@@ -1074,7 +1086,7 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
else else
candidate->transport = NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE; candidate->transport = NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE;
} }
candidate->sockptr = nicesock; c->sockptr = nicesock;
candidate->stream_id = stream->id; candidate->stream_id = stream->id;
candidate->component_id = component->id; candidate->component_id = component->id;
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "stream.h" #include "stream.h"
#include "agent.h" #include "agent.h"
#include "candidate-priv.h"
typedef struct typedef struct
{ {
...@@ -67,7 +68,7 @@ typedef struct ...@@ -67,7 +68,7 @@ typedef struct
{ {
NiceSocket *nicesock; /* existing socket to use */ NiceSocket *nicesock; /* existing socket to use */
NiceAddress server; /* STUN/TURN server address */ NiceAddress server; /* STUN/TURN server address */
NiceCandidate *candidate; /* candidate to refresh */ NiceCandidateImpl *candidate; /* candidate to refresh */
guint stream_id; guint stream_id;
guint component_id; guint component_id;
StunAgent stun_agent; StunAgent stun_agent;
...@@ -90,8 +91,8 @@ void refresh_prune_agent_async (NiceAgent *agent, ...@@ -90,8 +91,8 @@ void refresh_prune_agent_async (NiceAgent *agent,
NiceTimeoutLockedCallback function, gpointer user_data); NiceTimeoutLockedCallback function, gpointer user_data);
void refresh_prune_stream_async (NiceAgent *agent, NiceStream *stream, void refresh_prune_stream_async (NiceAgent *agent, NiceStream *stream,
NiceTimeoutLockedCallback function); NiceTimeoutLockedCallback function);
void refresh_prune_candidate (NiceAgent *agent, NiceCandidate *candidate); void refresh_prune_candidate (NiceAgent *agent, NiceCandidateImpl *candidate);
void refresh_prune_candidate_async (NiceAgent *agent, NiceCandidate *candidate, void refresh_prune_candidate_async (NiceAgent *agent, NiceCandidateImpl *cand,
NiceTimeoutLockedCallback function); NiceTimeoutLockedCallback function);
...@@ -116,9 +117,9 @@ discovery_add_local_host_candidate ( ...@@ -116,9 +117,9 @@ discovery_add_local_host_candidate (
NiceAddress *address, NiceAddress *address,
NiceCandidateTransport transport, NiceCandidateTransport transport,
gboolean accept_duplicate, gboolean accept_duplicate,
NiceCandidate **candidate); NiceCandidateImpl **candidate);
NiceCandidate* NiceCandidateImpl*
discovery_add_relay_candidate ( discovery_add_relay_candidate (
NiceAgent *agent, NiceAgent *agent,
guint stream_id, guint stream_id,
......
...@@ -88,7 +88,6 @@ NiceAgentClass ...@@ -88,7 +88,6 @@ NiceAgentClass
NiceCandidate NiceCandidate
NiceCandidateType NiceCandidateType
NiceCandidateTransport NiceCandidateTransport
TurnServer
NiceRelayType NiceRelayType
NICE_CANDIDATE_MAX_FOUNDATION NICE_CANDIDATE_MAX_FOUNDATION
NICE_CANDIDATE_MAX_TURN_SERVERS NICE_CANDIDATE_MAX_TURN_SERVERS
...@@ -120,6 +119,7 @@ NICE_CANDIDATE_DIRECTION_MS_PREF_ACTIVE ...@@ -120,6 +119,7 @@ NICE_CANDIDATE_DIRECTION_MS_PREF_ACTIVE
NICE_CANDIDATE_DIRECTION_MS_PREF_PASSIVE NICE_CANDIDATE_DIRECTION_MS_PREF_PASSIVE
NICE_CANDIDATE_TRANSPORT_MS_PREF_TCP NICE_CANDIDATE_TRANSPORT_MS_PREF_TCP
NICE_CANDIDATE_TRANSPORT_MS_PREF_UDP NICE_CANDIDATE_TRANSPORT_MS_PREF_UDP
TurnServer
</SECTION> </SECTION>
<SECTION> <SECTION>
......
...@@ -8,6 +8,7 @@ ignore_headers = [ ...@@ -8,6 +8,7 @@ ignore_headers = [
'agent-priv.h', 'agent-priv.h',
'iostream.h', 'iostream.h',
'inputstream.h', 'inputstream.h',
'candidate-priv.h',
'outputstream.h', 'outputstream.h',
'gstnice.h', 'gstnice.h',
'gstnicesrc.h', 'gstnicesrc.h',
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#endif #endif
#include "agent.h" #include "agent.h"
#include "candidate-priv.h"
#include "socket/socket.h" #include "socket/socket.h"
...@@ -223,7 +224,7 @@ static void set_candidates (NiceAgent *from, guint from_stream, ...@@ -223,7 +224,7 @@ static void set_candidates (NiceAgent *from, guint from_stream,
*/ */
for (item1 = cands; item1; item1 = item1->next) { for (item1 = cands; item1; item1 = item1->next) {
NiceCandidate *cand = item1->data; NiceCandidateImpl *cand = item1->data;
NiceSocket *nicesock = cand->sockptr; NiceSocket *nicesock = cand->sockptr;
g_assert (nicesock); g_assert (nicesock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment