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
This diff is collapsed.
/*
* 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);
......
This diff is collapsed.
This diff is collapsed.
...@@ -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