Commit 008739a5 authored by Philip Withnall's avatar Philip Withnall

agent: Correctly namespace Component and its methods

Remove all references to the old, unnamespaced versions. This should
cause no functional changes.
Reviewed-by: default avatarOlivier Crête <olivier.crete@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D309
parent 529bc193
...@@ -172,7 +172,7 @@ agent_find_component ( ...@@ -172,7 +172,7 @@ agent_find_component (
guint stream_id, guint stream_id,
guint component_id, guint component_id,
NiceStream **stream, NiceStream **stream,
Component **component); NiceComponent **component);
NiceStream *agent_find_stream (NiceAgent *agent, guint stream_id); NiceStream *agent_find_stream (NiceAgent *agent, guint stream_id);
......
...@@ -144,7 +144,7 @@ static void pseudo_tcp_socket_closed (PseudoTcpSocket *sock, guint32 err, ...@@ -144,7 +144,7 @@ static void pseudo_tcp_socket_closed (PseudoTcpSocket *sock, guint32 err,
gpointer user_data); gpointer user_data);
static PseudoTcpWriteResult pseudo_tcp_socket_write_packet (PseudoTcpSocket *sock, static PseudoTcpWriteResult pseudo_tcp_socket_write_packet (PseudoTcpSocket *sock,
const gchar *buffer, guint32 len, gpointer user_data); const gchar *buffer, guint32 len, gpointer user_data);
static void adjust_tcp_clock (NiceAgent *agent, NiceStream *stream, Component *component); static void adjust_tcp_clock (NiceAgent *agent, NiceStream *stream, NiceComponent *component);
static void nice_agent_dispose (GObject *object); static void nice_agent_dispose (GObject *object);
static void nice_agent_get_property (GObject *object, static void nice_agent_get_property (GObject *object,
...@@ -318,10 +318,10 @@ agent_find_component ( ...@@ -318,10 +318,10 @@ agent_find_component (
guint stream_id, guint stream_id,
guint component_id, guint component_id,
NiceStream **stream, NiceStream **stream,
Component **component) NiceComponent **component)
{ {
NiceStream *s; NiceStream *s;
Component *c; NiceComponent *c;
s = agent_find_stream (agent, stream_id); s = agent_find_stream (agent, stream_id);
...@@ -1220,7 +1220,7 @@ nice_agent_reset_all_stun_agents (NiceAgent *agent, gboolean only_software) ...@@ -1220,7 +1220,7 @@ nice_agent_reset_all_stun_agents (NiceAgent *agent, gboolean only_software)
for (component_item = stream->components; component_item; for (component_item = stream->components; component_item;
component_item = component_item->next) { component_item = component_item->next) {
Component *component = component_item->data; NiceComponent *component = component_item->data;
if (only_software) if (only_software)
stun_agent_set_software (&component->stun_agent, stun_agent_set_software (&component->stun_agent,
...@@ -1356,7 +1356,7 @@ nice_agent_set_property ( ...@@ -1356,7 +1356,7 @@ nice_agent_set_property (
static void static void
agent_signal_socket_writable (NiceAgent *agent, Component *component) agent_signal_socket_writable (NiceAgent *agent, NiceComponent *component)
{ {
g_cancellable_cancel (component->tcp_writable_cancellable); g_cancellable_cancel (component->tcp_writable_cancellable);
...@@ -1365,7 +1365,7 @@ static void ...@@ -1365,7 +1365,7 @@ static void
} }
static void static void
pseudo_tcp_socket_create (NiceAgent *agent, NiceStream *stream, Component *component) pseudo_tcp_socket_create (NiceAgent *agent, NiceStream *stream, NiceComponent *component)
{ {
PseudoTcpCallbacks tcp_callbacks = {component, PseudoTcpCallbacks tcp_callbacks = {component,
pseudo_tcp_socket_opened, pseudo_tcp_socket_opened,
...@@ -1380,7 +1380,7 @@ pseudo_tcp_socket_create (NiceAgent *agent, NiceStream *stream, Component *compo ...@@ -1380,7 +1380,7 @@ pseudo_tcp_socket_create (NiceAgent *agent, NiceStream *stream, Component *compo
} }
static void priv_pseudo_tcp_error (NiceAgent *agent, NiceStream *stream, static void priv_pseudo_tcp_error (NiceAgent *agent, NiceStream *stream,
Component *component) NiceComponent *component)
{ {
if (component->tcp_writable_cancellable) { if (component->tcp_writable_cancellable) {
g_cancellable_cancel (component->tcp_writable_cancellable); g_cancellable_cancel (component->tcp_writable_cancellable);
...@@ -1390,7 +1390,7 @@ static void priv_pseudo_tcp_error (NiceAgent *agent, NiceStream *stream, ...@@ -1390,7 +1390,7 @@ static void priv_pseudo_tcp_error (NiceAgent *agent, NiceStream *stream,
if (component->tcp) { if (component->tcp) {
agent_signal_component_state_change (agent, stream->id, agent_signal_component_state_change (agent, stream->id,
component->id, NICE_COMPONENT_STATE_FAILED); component->id, NICE_COMPONENT_STATE_FAILED);
component_detach_all_sockets (component); nice_component_detach_all_sockets (component);
pseudo_tcp_socket_close (component->tcp, TRUE); pseudo_tcp_socket_close (component->tcp, TRUE);
} }
...@@ -1404,7 +1404,7 @@ static void priv_pseudo_tcp_error (NiceAgent *agent, NiceStream *stream, ...@@ -1404,7 +1404,7 @@ static void priv_pseudo_tcp_error (NiceAgent *agent, NiceStream *stream,
static void static void
pseudo_tcp_socket_opened (PseudoTcpSocket *sock, gpointer user_data) pseudo_tcp_socket_opened (PseudoTcpSocket *sock, gpointer user_data)
{ {
Component *component = user_data; NiceComponent *component = user_data;
NiceAgent *agent = component->agent; NiceAgent *agent = component->agent;
NiceStream *stream = component->stream; NiceStream *stream = component->stream;
...@@ -1565,7 +1565,7 @@ done: ...@@ -1565,7 +1565,7 @@ done:
static void static void
pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data) pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data)
{ {
Component *component = user_data; NiceComponent *component = user_data;
NiceAgent *agent = component->agent; NiceAgent *agent = component->agent;
NiceStream *stream = component->stream; NiceStream *stream = component->stream;
gboolean has_io_callback; gboolean has_io_callback;
...@@ -1579,11 +1579,11 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data) ...@@ -1579,11 +1579,11 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data)
component->tcp_readable = TRUE; component->tcp_readable = TRUE;
has_io_callback = component_has_io_callback (component); has_io_callback = nice_component_has_io_callback (component);
/* Only dequeue pseudo-TCP data if we can reliably inform the client. The /* Only dequeue pseudo-TCP data if we can reliably inform the client. The
* agent lock is held here, so has_io_callback can only change during * agent lock is held here, so has_io_callback can only change during
* component_emit_io_callback(), after which it’s re-queried. This ensures * nice_component_emit_io_callback(), after which it’s re-queried. This ensures
* no data loss of packets already received and dequeued. */ * no data loss of packets already received and dequeued. */
if (has_io_callback) { if (has_io_callback) {
do { do {
...@@ -1626,7 +1626,7 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data) ...@@ -1626,7 +1626,7 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data)
break; break;
} }
component_emit_io_callback (component, buf, len); nice_component_emit_io_callback (component, buf, len);
if (!agent_find_component (agent, stream_id, component_id, if (!agent_find_component (agent, stream_id, component_id,
&stream, &component)) { &stream, &component)) {
...@@ -1638,7 +1638,7 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data) ...@@ -1638,7 +1638,7 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data)
goto out; goto out;
} }
has_io_callback = component_has_io_callback (component); has_io_callback = nice_component_has_io_callback (component);
} while (has_io_callback); } while (has_io_callback);
} else if (component->recv_messages != NULL) { } else if (component->recv_messages != NULL) {
gint n_valid_messages; gint n_valid_messages;
...@@ -1690,7 +1690,7 @@ out: ...@@ -1690,7 +1690,7 @@ out:
static void static void
pseudo_tcp_socket_writable (PseudoTcpSocket *sock, gpointer user_data) pseudo_tcp_socket_writable (PseudoTcpSocket *sock, gpointer user_data)
{ {
Component *component = user_data; NiceComponent *component = user_data;
NiceAgent *agent = component->agent; NiceAgent *agent = component->agent;
NiceStream *stream = component->stream; NiceStream *stream = component->stream;
...@@ -1704,7 +1704,7 @@ static void ...@@ -1704,7 +1704,7 @@ static void
pseudo_tcp_socket_closed (PseudoTcpSocket *sock, guint32 err, pseudo_tcp_socket_closed (PseudoTcpSocket *sock, guint32 err,
gpointer user_data) gpointer user_data)
{ {
Component *component = user_data; NiceComponent *component = user_data;
NiceAgent *agent = component->agent; NiceAgent *agent = component->agent;
NiceStream *stream = component->stream; NiceStream *stream = component->stream;
...@@ -1718,7 +1718,7 @@ static PseudoTcpWriteResult ...@@ -1718,7 +1718,7 @@ static PseudoTcpWriteResult
pseudo_tcp_socket_write_packet (PseudoTcpSocket *psocket, pseudo_tcp_socket_write_packet (PseudoTcpSocket *psocket,
const gchar *buffer, guint32 len, gpointer user_data) const gchar *buffer, guint32 len, gpointer user_data)
{ {
Component *component = user_data; NiceComponent *component = user_data;
if (component->selected_pair.local != NULL) { if (component->selected_pair.local != NULL) {
NiceSocket *sock; NiceSocket *sock;
...@@ -1759,7 +1759,7 @@ pseudo_tcp_socket_write_packet (PseudoTcpSocket *psocket, ...@@ -1759,7 +1759,7 @@ pseudo_tcp_socket_write_packet (PseudoTcpSocket *psocket,
static gboolean static gboolean
notify_pseudo_tcp_socket_clock (gpointer user_data) notify_pseudo_tcp_socket_clock (gpointer user_data)
{ {
Component *component = user_data; NiceComponent *component = user_data;
NiceStream *stream; NiceStream *stream;
NiceAgent *agent; NiceAgent *agent;
...@@ -1784,7 +1784,7 @@ notify_pseudo_tcp_socket_clock (gpointer user_data) ...@@ -1784,7 +1784,7 @@ notify_pseudo_tcp_socket_clock (gpointer user_data)
} }
static void static void
adjust_tcp_clock (NiceAgent *agent, NiceStream *stream, Component *component) adjust_tcp_clock (NiceAgent *agent, NiceStream *stream, NiceComponent *component)
{ {
if (!pseudo_tcp_socket_is_closed (component->tcp)) { if (!pseudo_tcp_socket_is_closed (component->tcp)) {
guint64 timeout = component->last_clock_timeout; guint64 timeout = component->last_clock_timeout;
...@@ -1818,7 +1818,7 @@ adjust_tcp_clock (NiceAgent *agent, NiceStream *stream, Component *component) ...@@ -1818,7 +1818,7 @@ adjust_tcp_clock (NiceAgent *agent, NiceStream *stream, Component *component)
void void
_tcp_sock_is_writable (NiceSocket *sock, gpointer user_data) _tcp_sock_is_writable (NiceSocket *sock, gpointer user_data)
{ {
Component *component = user_data; NiceComponent *component = user_data;
NiceAgent *agent = component->agent; NiceAgent *agent = component->agent;
NiceStream *stream = component->stream; NiceStream *stream = component->stream;
...@@ -1863,7 +1863,7 @@ void agent_gathering_done (NiceAgent *agent) ...@@ -1863,7 +1863,7 @@ void agent_gathering_done (NiceAgent *agent)
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) {
Component *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; NiceCandidate *local_candidate = k->data;
...@@ -1938,7 +1938,7 @@ agent_signal_initial_binding_request_received (NiceAgent *agent, ...@@ -1938,7 +1938,7 @@ agent_signal_initial_binding_request_received (NiceAgent *agent,
* Must be called with the agent lock held. */ * Must be called with the agent lock held. */
static void static void
process_queued_tcp_packets (NiceAgent *agent, NiceStream *stream, process_queued_tcp_packets (NiceAgent *agent, NiceStream *stream,
Component *component) NiceComponent *component)
{ {
GOutputVector *vec; GOutputVector *vec;
guint stream_id = stream->id; guint stream_id = stream->id;
...@@ -1991,7 +1991,7 @@ process_queued_tcp_packets (NiceAgent *agent, NiceStream *stream, ...@@ -1991,7 +1991,7 @@ process_queued_tcp_packets (NiceAgent *agent, NiceStream *stream,
void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id, void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id,
guint component_id, NiceCandidate *lcandidate, NiceCandidate *rcandidate) guint component_id, NiceCandidate *lcandidate, NiceCandidate *rcandidate)
{ {
Component *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
if (!agent_find_component (agent, stream_id, component_id, if (!agent_find_component (agent, stream_id, component_id,
...@@ -2105,7 +2105,7 @@ nice_component_state_to_string (NiceComponentState state) ...@@ -2105,7 +2105,7 @@ nice_component_state_to_string (NiceComponentState state)
void agent_signal_component_state_change (NiceAgent *agent, guint stream_id, guint component_id, NiceComponentState new_state) void agent_signal_component_state_change (NiceAgent *agent, guint stream_id, guint component_id, NiceComponentState new_state)
{ {
NiceComponentState old_state; NiceComponentState old_state;
Component *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
g_return_if_fail (new_state < NICE_COMPONENT_STATE_LAST); g_return_if_fail (new_state < NICE_COMPONENT_STATE_LAST);
...@@ -2209,7 +2209,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent, ...@@ -2209,7 +2209,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
NiceStream *stream, guint component_id, gboolean turn_tcp) NiceStream *stream, guint component_id, gboolean turn_tcp)
{ {
CandidateDiscovery *cdisco; CandidateDiscovery *cdisco;
Component *component = nice_stream_find_component_by_id (stream, component_id); NiceComponent *component = nice_stream_find_component_by_id (stream, component_id);
NiceAddress local_address; NiceAddress local_address;
/* note: no need to check for redundant candidates, as this is /* note: no need to check for redundant candidates, as this is
...@@ -2231,7 +2231,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent, ...@@ -2231,7 +2231,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
new_socket = nice_udp_bsd_socket_new (&addr); new_socket = nice_udp_bsd_socket_new (&addr);
if (new_socket) { if (new_socket) {
_priv_set_socket_tos (agent, new_socket, stream->tos); _priv_set_socket_tos (agent, new_socket, stream->tos);
component_attach_socket (component, new_socket); nice_component_attach_socket (component, new_socket);
nicesock = new_socket; nicesock = new_socket;
} }
} }
...@@ -2325,7 +2325,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent, ...@@ -2325,7 +2325,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
cdisco->nicesock = nice_udp_turn_over_tcp_socket_new (nicesock, cdisco->nicesock = nice_udp_turn_over_tcp_socket_new (nicesock,
agent_to_turn_socket_compatibility (agent)); agent_to_turn_socket_compatibility (agent));
component_attach_socket (component, cdisco->nicesock); nice_component_attach_socket (component, cdisco->nicesock);
} }
cdisco->turn = turn_server_ref (turn); cdisco->turn = turn_server_ref (turn);
...@@ -2386,7 +2386,7 @@ nice_agent_add_stream ( ...@@ -2386,7 +2386,7 @@ nice_agent_add_stream (
if (agent->reliable) { if (agent->reliable) {
nice_debug ("Agent %p : reliable stream", agent); nice_debug ("Agent %p : reliable stream", agent);
for (i = 0; i < n_components; i++) { for (i = 0; i < n_components; i++) {
Component *component = nice_stream_find_component_by_id (stream, i + 1); NiceComponent *component = nice_stream_find_component_by_id (stream, i + 1);
if (component) { if (component) {
pseudo_tcp_socket_create (agent, stream, component); pseudo_tcp_socket_create (agent, stream, component);
} else { } else {
...@@ -2412,7 +2412,7 @@ nice_agent_set_relay_info(NiceAgent *agent, ...@@ -2412,7 +2412,7 @@ nice_agent_set_relay_info(NiceAgent *agent,
NiceRelayType type) NiceRelayType type)
{ {
Component *component = NULL; NiceComponent *component = NULL;
NiceStream *stream = NULL; NiceStream *stream = NULL;
gboolean ret = TRUE; gboolean ret = TRUE;
TurnServer *turn; TurnServer *turn;
...@@ -2566,7 +2566,7 @@ static void _upnp_mapped_external_port (GUPnPSimpleIgd *self, gchar *proto, ...@@ -2566,7 +2566,7 @@ static void _upnp_mapped_external_port (GUPnPSimpleIgd *self, gchar *proto,
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) {
Component *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; NiceCandidate *local_candidate = k->data;
...@@ -2715,7 +2715,7 @@ nice_agent_gather_candidates ( ...@@ -2715,7 +2715,7 @@ nice_agent_gather_candidates (
#endif #endif
for (cid = 1; cid <= stream->n_components; cid++) { for (cid = 1; cid <= stream->n_components; cid++) {
Component *component = nice_stream_find_component_by_id (stream, cid); NiceComponent *component = nice_stream_find_component_by_id (stream, cid);
enum { enum {
ADD_HOST_MIN = 0, ADD_HOST_MIN = 0,
ADD_HOST_UDP = ADD_HOST_MIN, ADD_HOST_UDP = ADD_HOST_MIN,
...@@ -2851,7 +2851,7 @@ nice_agent_gather_candidates ( ...@@ -2851,7 +2851,7 @@ nice_agent_gather_candidates (
/* Only signal the new candidates after we're sure that the gathering was /* Only signal the new candidates after we're sure that the gathering was
* succesfful. But before sending gathering-done */ * succesfful. But before sending gathering-done */
for (cid = 1; cid <= stream->n_components; cid++) { for (cid = 1; cid <= stream->n_components; cid++) {
Component *component = nice_stream_find_component_by_id (stream, cid); NiceComponent *component = nice_stream_find_component_by_id (stream, cid);
for (i = component->local_candidates; i; i = i->next) { for (i = component->local_candidates; i; i = i->next) {
NiceCandidate *candidate = i->data; NiceCandidate *candidate = i->data;
agent_signal_new_candidate (agent, candidate); agent_signal_new_candidate (agent, candidate);
...@@ -2880,9 +2880,9 @@ nice_agent_gather_candidates ( ...@@ -2880,9 +2880,9 @@ nice_agent_gather_candidates (
if (ret == FALSE) { if (ret == FALSE) {
priv_stop_upnp (agent); priv_stop_upnp (agent);
for (cid = 1; cid <= stream->n_components; cid++) { for (cid = 1; cid <= stream->n_components; cid++) {
Component *component = nice_stream_find_component_by_id (stream, cid); NiceComponent *component = nice_stream_find_component_by_id (stream, cid);
component_free_socket_sources (component); nice_component_free_socket_sources (component);
for (i = component->local_candidates; i; i = i->next) { for (i = component->local_candidates; i; i = i->next) {
NiceCandidate *candidate = i->data; NiceCandidate *candidate = i->data;
...@@ -2998,7 +2998,7 @@ nice_agent_set_port_range (NiceAgent *agent, guint stream_id, guint component_id ...@@ -2998,7 +2998,7 @@ nice_agent_set_port_range (NiceAgent *agent, guint stream_id, guint component_id
guint min_port, guint max_port) guint min_port, guint max_port)
{ {
NiceStream *stream; NiceStream *stream;
Component *component; NiceComponent *component;
g_return_if_fail (NICE_IS_AGENT (agent)); g_return_if_fail (NICE_IS_AGENT (agent));
g_return_if_fail (stream_id >= 1); g_return_if_fail (stream_id >= 1);
...@@ -3050,14 +3050,14 @@ static gboolean priv_add_remote_candidate ( ...@@ -3050,14 +3050,14 @@ static gboolean priv_add_remote_candidate (
const gchar *password, const gchar *password,
const gchar *foundation) const gchar *foundation)
{ {
Component *component; NiceComponent *component;
NiceCandidate *candidate; NiceCandidate *candidate;
if (!agent_find_component (agent, stream_id, component_id, NULL, &component)) if (!agent_find_component (agent, stream_id, component_id, NULL, &component))
return FALSE; return FALSE;
/* step: check whether the candidate already exists */ /* step: check whether the candidate already exists */
candidate = component_find_remote_candidate(component, addr, transport); candidate = nice_component_find_remote_candidate (component, addr, transport);
if (candidate && candidate->type == type) { if (candidate && candidate->type == type) {
if (nice_debug_is_enabled ()) { if (nice_debug_is_enabled ()) {
gchar tmpbuf[INET6_ADDRSTRLEN]; gchar tmpbuf[INET6_ADDRSTRLEN];
...@@ -3243,7 +3243,7 @@ nice_agent_get_local_credentials ( ...@@ -3243,7 +3243,7 @@ nice_agent_get_local_credentials (
static int static int
_set_remote_candidates_locked (NiceAgent *agent, NiceStream *stream, _set_remote_candidates_locked (NiceAgent *agent, NiceStream *stream,
Component *component, const GSList *candidates) NiceComponent *component, const GSList *candidates)
{ {
const GSList *i; const GSList *i;
int added = 0; int added = 0;
...@@ -3286,7 +3286,7 @@ nice_agent_set_remote_candidates (NiceAgent *agent, guint stream_id, guint compo ...@@ -3286,7 +3286,7 @@ nice_agent_set_remote_candidates (NiceAgent *agent, guint stream_id, guint compo
{ {
int added = 0; int added = 0;
NiceStream *stream; NiceStream *stream;
Component *component; NiceComponent *component;
g_return_val_if_fail (NICE_IS_AGENT (agent), 0); g_return_val_if_fail (NICE_IS_AGENT (agent), 0);
g_return_val_if_fail (stream_id >= 1, 0); g_return_val_if_fail (stream_id >= 1, 0);
...@@ -3346,7 +3346,7 @@ static RecvStatus ...@@ -3346,7 +3346,7 @@ static RecvStatus
agent_recv_message_unlocked ( agent_recv_message_unlocked (
NiceAgent *agent, NiceAgent *agent,
NiceStream *stream, NiceStream *stream,
Component *component, NiceComponent *component,
NiceSocket *nicesock, NiceSocket *nicesock,
NiceInputMessage *message) NiceInputMessage *message)
{ {
...@@ -3427,7 +3427,7 @@ agent_recv_message_unlocked ( ...@@ -3427,7 +3427,7 @@ agent_recv_message_unlocked (
new_socket = nice_tcp_passive_socket_accept (nicesock); new_socket = nice_tcp_passive_socket_accept (nicesock);
if (new_socket) { if (new_socket) {
_priv_set_socket_tos (agent, new_socket, stream->tos); _priv_set_socket_tos (agent, new_socket, stream->tos);
component_attach_socket (component, new_socket); nice_component_attach_socket (component, new_socket);
} }
retval = 0; retval = 0;
} else { } else {
...@@ -3928,7 +3928,7 @@ nice_input_message_iter_compare (const NiceInputMessageIter *a, ...@@ -3928,7 +3928,7 @@ nice_input_message_iter_compare (const NiceInputMessageIter *a,
* *
* Must be called with the io_mutex held. */ * Must be called with the io_mutex held. */
static gint static gint
pending_io_messages_recv_messages (Component *component, gboolean reliable, pending_io_messages_recv_messages (NiceComponent *component, gboolean reliable,
NiceInputMessage *messages, guint n_messages, NiceInputMessageIter *iter) NiceInputMessage *messages, guint n_messages, NiceInputMessageIter *iter)
{ {
gsize len; gsize len;
...@@ -4003,7 +4003,7 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent, ...@@ -4003,7 +4003,7 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent,
{ {
GMainContext *context; GMainContext *context;
NiceStream *stream; NiceStream *stream;
Component *component; NiceComponent *component;
gint n_valid_messages = -1; gint n_valid_messages = -1;
GSource *cancellable_source = NULL; GSource *cancellable_source = NULL;
gboolean received_enough = FALSE, error_reported = FALSE; gboolean received_enough = FALSE, error_reported = FALSE;
...@@ -4066,8 +4066,8 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent, ...@@ -4066,8 +4066,8 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent,
component->recv_messages == NULL); component->recv_messages == NULL);
/* Set the component’s receive buffer. */ /* Set the component’s receive buffer. */
context = component_dup_io_context (component); context = nice_component_dup_io_context (component);
component_set_io_callback (component, NULL, NULL, messages, n_messages, nice_component_set_io_callback (component, NULL, NULL, messages, n_messages,
&child_error); &child_error);
/* Add the cancellable as a source. */ /* Add the cancellable as a source. */
...@@ -4175,7 +4175,7 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent, ...@@ -4175,7 +4175,7 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent,
nice_input_message_iter_get_n_valid_messages ( nice_input_message_iter_get_n_valid_messages (
&component->recv_messages_iter); /* grab before resetting the iter */ &component->recv_messages_iter); /* grab before resetting the iter */
component_set_io_callback (component, NULL, NULL, NULL, 0, NULL); nice_component_set_io_callback (component, NULL, NULL, NULL, 0, NULL);
recv_error: recv_error:
/* Tidy up. Below this point, @component may be %NULL. */ /* Tidy up. Below this point, @component may be %NULL. */
...@@ -4328,7 +4328,7 @@ nice_agent_send_messages_nonblocking_internal ( ...@@ -4328,7 +4328,7 @@ nice_agent_send_messages_nonblocking_internal (
GError **error) GError **error)
{ {
NiceStream *stream; NiceStream *stream;
Component *component; NiceComponent *component;
gint n_sent = -1; /* is in bytes if allow_partial is TRUE, gint n_sent = -1; /* is in bytes if allow_partial is TRUE,
otherwise in messages */ otherwise in messages */
GError *child_error = NULL; GError *child_error = NULL;
...@@ -4574,7 +4574,7 @@ nice_agent_get_local_candidates ( ...@@ -4574,7 +4574,7 @@ nice_agent_get_local_candidates (
guint stream_id, guint stream_id,
guint component_id) guint component_id)
{ {
Component *component; NiceComponent *component;
GSList * ret = NULL; GSList * ret = NULL;
GSList * item = NULL; GSList * item = NULL;
...@@ -4603,7 +4603,7 @@ nice_agent_get_remote_candidates ( ...@@ -4603,7 +4603,7 @@ nice_agent_get_remote_candidates (
guint stream_id, guint stream_id,
guint component_id) guint component_id)
{ {
Component *component; NiceComponent *component;
GSList *ret = NULL, *item = NULL; GSList *ret = NULL, *item = NULL;
g_return_val_if_fail (NICE_IS_AGENT (agent), NULL); g_return_val_if_fail (NICE_IS_AGENT (agent), NULL);
...@@ -4755,7 +4755,7 @@ gboolean ...@@ -4755,7 +4755,7 @@ gboolean
component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data) component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data)
{ {
SocketSource *socket_source = user_data; SocketSource *socket_source = user_data;
Component *component; NiceComponent *component;
NiceAgent *agent; NiceAgent *agent;
NiceStream *stream; NiceStream *stream;
gboolean has_io_callback; gboolean has_io_callback;
...@@ -4790,21 +4790,22 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data) ...@@ -4790,21 +4790,22 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data)
stream->id, component->id, NICE_COMPONENT_STATE_FAILED); stream->id, component->id, NICE_COMPONENT_STATE_FAILED);
} }
component_detach_socket (component, socket_source->socket); nice_component_detach_socket (component, socket_source->socket);
agent_unlock (); agent_unlock ();
g_object_unref (agent); g_object_unref (agent);
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
has_io_callback = component_has_io_callback (component); has_io_callback = nice_component_has_io_callback (component);
/* Choose which receive buffer to use. If we’re reading for /* Choose which receive buffer to use. If we’re reading for
* nice_agent_attach_recv(), use a local static buffer. If we’re reading for * nice_agent_attach_recv(), use a local static buffer. If we’re reading for
* nice_agent_recv_messages(), use the buffer provided by the client. * nice_agent_recv_messages(), use the buffer provided by the client.
* *
* has_io_callback cannot change throughout this function, as we operate * has_io_callback cannot change throughout this function, as we operate
* entirely with the agent lock held, and component_set_io_callback() would * entirely with the agent lock held, and nice_component_set_io_callback()
* need to take the agent lock to change the Component’s io_callback. */ * would need to take the agent lock to change the Component’s
* io_callback. */
g_assert (!has_io_callback || component->recv_messages == NULL); g_assert (!has_io_callback || component->recv_messages == NULL);
if (agent->reliable && !nice_socket_is_reliable (socket_source->socket)) { if (agent->reliable && !nice_socket_is_reliable (socket_source->socket)) {
...@@ -4869,7 +4870,7 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data) ...@@ -4869,7 +4870,7 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data)
break; break;
} }
has_io_callback = component_has_io_callback (component); has_io_callback = nice_component_has_io_callback (component);
} }
} else if (has_io_callback) { } else if (has_io_callback) {
while (has_io_callback) { while (has_io_callback) {
...@@ -4896,13 +4897,13 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data) ...@@ -4896,13 +4897,13 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data)
} }
if (retval == RECV_SUCCESS && local_message.length > 0) if (retval == RECV_SUCCESS && local_message.length > 0)
component_emit_io_callback (component, local_buf, local_message.length); nice_component_emit_io_callback (component, local_buf, local_message.length);
if (g_source_is_destroyed (g_main_current_source ())) { if (g_source_is_destroyed (g_main_current_source ())) {
nice_debug ("Component IO source disappeared during the callback"); nice_debug ("Component IO source disappeared during the callback");
goto out; goto out;
} }
has_io_callback = component_has_io_callback (component); has_io_callback = nice_component_has_io_callback (component);
} }
} else if (component->recv_messages != NULL) { } else if (component->recv_messages != NULL) {
RecvStatus retval; RecvStatus retval;
...@@ -4977,7 +4978,7 @@ nice_agent_attach_recv ( ...@@ -4977,7 +4978,7 @@ nice_agent_attach_recv (
NiceAgentRecvFunc func, NiceAgentRecvFunc func,
gpointer data) gpointer data)
{ {
Component *component = NULL; NiceComponent *component = NULL;
NiceStream *stream = NULL; NiceStream *stream = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
...@@ -5000,8 +5001,8 @@ nice_agent_attach_recv ( ...@@ -5000,8 +5001,8 @@ nice_agent_attach_recv (
ctx = g_main_context_default (); ctx = g_main_context_default ();
/* Set the component’s I/O context. */ /* Set the component’s I/O context. */
component_set_io_context (component, ctx); nice_component_set_io_context (component, ctx);
component_set_io_callback (component, func, data, NULL, 0, NULL); nice_component_set_io_callback (component, func, data, NULL, 0, NULL);
ret = TRUE; ret = TRUE;
if (func) { if (func) {
...@@ -5029,7 +5030,7 @@ nice_agent_set_selected_pair ( ...@@ -5029,7 +5030,7 @@ nice_agent_set_selected_pair (
const gchar *lfoundation, const gchar *lfoundation,
const gchar *rfoundation) const gchar *rfoundation)
{ {
Component *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
CandidatePair pair; CandidatePair pair;
gboolean ret = FALSE; gboolean ret = FALSE;
...@@ -5047,7 +5048,7 @@ nice_agent_set_selected_pair ( ...@@ -5047,7 +5048,7 @@ nice_agent_set_selected_pair (
goto done; goto done;
} }
if (!component_find_pair (component, agent, lfoundation, rfoundation, &pair)){ if (!nice_component_find_pair (component, agent, lfoundation, rfoundation, &pair)){
goto done; goto done;
} }
...@@ -5076,7 +5077,7 @@ nice_agent_set_selected_pair ( ...@@ -5076,7 +5077,7 @@ nice_agent_set_selected_pair (
NICE_COMPONENT_STATE_READY); NICE_COMPONENT_STATE_READY);
/* step: set the selected pair */ /* step: set the selected pair */
component_update_selected_pair (component, &pair); nice_component_update_selected_pair (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); pair.local, pair.remote);
...@@ -5091,7 +5092,7 @@ NICEAPI_EXPORT gboolean ...@@ -5091,7 +5092,7 @@ NICEAPI_EXPORT gboolean
nice_agent_get_selected_pair (NiceAgent *agent, guint stream_id, nice_agent_get_selected_pair (NiceAgent *agent, guint stream_id,
guint component_id, NiceCandidate **local, NiceCandidate **remote) guint component_id, NiceCandidate **local, NiceCandidate **remote)
{ {
Component *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
gboolean ret = FALSE; gboolean ret = FALSE;
...@@ -5124,7 +5125,7 @@ NICEAPI_EXPORT GSocket * ...@@ -5124,7 +5125,7 @@ NICEAPI_EXPORT GSocket *
nice_agent_get_selected_socket (NiceAgent *agent, guint stream_id, nice_agent_get_selected_socket (NiceAgent *agent, guint stream_id,
guint component_id) guint component_id)
{ {
Component *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
NiceSocket *nice_socket; NiceSocket *nice_socket;
GSocket *g_socket = NULL; GSocket *g_socket = NULL;
...@@ -5204,7 +5205,7 @@ nice_agent_set_selected_remote_candidate ( ...@@ -5204,7 +5205,7 @@ nice_agent_set_selected_remote_candidate (
guint component_id, guint component_id,
NiceCandidate *candidate) NiceCandidate *candidate)
{ {
Component *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
NiceCandidate *lcandidate = NULL; NiceCandidate *lcandidate = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
...@@ -5232,7 +5233,7 @@ nice_agent_set_selected_remote_candidate ( ...@@ -5232,7 +5233,7 @@ nice_agent_set_selected_remote_candidate (
priority = component->selected_pair.priority; priority = component->selected_pair.priority;
/* step: set the selected pair */ /* step: set the selected pair */
lcandidate = component_set_selected_remote_candidate (agent, component, lcandidate = nice_component_set_selected_remote_candidate (component, agent,
candidate); candidate);
if (!lcandidate) if (!lcandidate)
goto done; goto done;
...@@ -5312,7 +5313,7 @@ nice_agent_set_stream_tos (NiceAgent *agent, ...@@ -5312,7 +5313,7 @@ nice_agent_set_stream_tos (NiceAgent *agent,
stream->tos = tos; stream->tos = tos;
for (i = stream->components; i; i = i->next) { for (i = stream->components; i; i = i->next) {
Component *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; NiceCandidate *local_candidate = j->data;
...@@ -5415,14 +5416,14 @@ nice_agent_get_stream_name (NiceAgent *agent, guint stream_id) ...@@ -5415,14 +5416,14 @@ nice_agent_get_stream_name (NiceAgent *agent, guint stream_id)
static NiceCandidate * static NiceCandidate *
_get_default_local_candidate_locked (NiceAgent *agent, _get_default_local_candidate_locked (NiceAgent *agent,
NiceStream *stream, Component *component) NiceStream *stream, NiceComponent *component)
{ {
GSList *i; GSList *i;
NiceCandidate *default_candidate = NULL; NiceCandidate *default_candidate = NULL;
NiceCandidate *default_rtp_candidate = NULL; NiceCandidate *default_rtp_candidate = NULL;
if (component->id != NICE_COMPONENT_TYPE_RTP) { if (component->id != NICE_COMPONENT_TYPE_RTP) {
Component *rtp_component; NiceComponent *rtp_component;
if (!agent_find_component (agent, stream->id, NICE_COMPONENT_TYPE_RTP, if (!agent_find_component (agent, stream->id, NICE_COMPONENT_TYPE_RTP,
NULL, &rtp_component)) NULL, &rtp_component))
...@@ -5463,7 +5464,7 @@ nice_agent_get_default_local_candidate (NiceAgent *agent, ...@@ -5463,7 +5464,7 @@ nice_agent_get_default_local_candidate (NiceAgent *agent,
guint stream_id, guint component_id) guint stream_id, guint component_id)
{ {
NiceStream *stream = NULL; NiceStream *stream = NULL;
Component *component = NULL; NiceComponent *component = NULL;
NiceCandidate *default_candidate = NULL; NiceCandidate *default_candidate = NULL;
g_return_val_if_fail (NICE_IS_AGENT (agent), NULL); g_return_val_if_fail (NICE_IS_AGENT (agent), NULL);
...@@ -5578,7 +5579,7 @@ _generate_stream_sdp (NiceAgent *agent, NiceStream *stream, ...@@ -5578,7 +5579,7 @@ _generate_stream_sdp (NiceAgent *agent, NiceStream *stream,
/* Find default candidates */ /* Find default candidates */
for (i = stream->components; i; i = i->next) { for (i = stream->components; i; i = i->next) {
Component *component = i->data; NiceComponent *component = i->data;
NiceCandidate *default_candidate; NiceCandidate *default_candidate;
if (component->id == NICE_COMPONENT_TYPE_RTP) { if (component->id == NICE_COMPONENT_TYPE_RTP) {
...@@ -5607,7 +5608,7 @@ _generate_stream_sdp (NiceAgent *agent, NiceStream *stream, ...@@ -5607,7 +5608,7 @@ _generate_stream_sdp (NiceAgent *agent, NiceStream *stream,
g_string_append_printf (sdp, "a=ice-pwd:%s\n", stream->local_password); g_string_append_printf (sdp, "a=ice-pwd:%s\n", stream->local_password);
for (i = stream->components; i; i = i->next) { for (i = stream->components; i; i = i->next) {
Component *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 *candidate = j->data; NiceCandidate *candidate = j->data;
...@@ -5737,7 +5738,7 @@ nice_agent_parse_remote_sdp (NiceAgent *agent, const gchar *sdp) ...@@ -5737,7 +5738,7 @@ nice_agent_parse_remote_sdp (NiceAgent *agent, const gchar *sdp)
NICE_STREAM_MAX_PWD); NICE_STREAM_MAX_PWD);
} else if (g_str_has_prefix (sdp_lines[i], "a=candidate:")) { } else if (g_str_has_prefix (sdp_lines[i], "a=candidate:")) {
NiceCandidate *candidate = NULL; NiceCandidate *candidate = NULL;
Component *component = NULL; NiceComponent *component = NULL;
GSList *cands = NULL; GSList *cands = NULL;
gint added; gint added;
...@@ -5960,7 +5961,7 @@ nice_agent_get_io_stream (NiceAgent *agent, guint stream_id, ...@@ -5960,7 +5961,7 @@ nice_agent_get_io_stream (NiceAgent *agent, guint stream_id,
guint component_id) guint component_id)
{ {
GIOStream *iostream = NULL; GIOStream *iostream = NULL;
Component *component; NiceComponent *component;
g_return_val_if_fail (NICE_IS_AGENT (agent), NULL); g_return_val_if_fail (NICE_IS_AGENT (agent), NULL);
g_return_val_if_fail (stream_id >= 1, NULL); g_return_val_if_fail (stream_id >= 1, NULL);
...@@ -5987,7 +5988,7 @@ nice_agent_get_io_stream (NiceAgent *agent, guint stream_id, ...@@ -5987,7 +5988,7 @@ nice_agent_get_io_stream (NiceAgent *agent, guint stream_id,
NICEAPI_EXPORT gboolean NICEAPI_EXPORT gboolean
nice_agent_forget_relays (NiceAgent *agent, guint stream_id, guint component_id) nice_agent_forget_relays (NiceAgent *agent, guint stream_id, guint component_id)
{ {
Component *component; NiceComponent *component;
gboolean ret = TRUE; gboolean ret = TRUE;
g_return_val_if_fail (NICE_IS_AGENT (agent), FALSE); g_return_val_if_fail (NICE_IS_AGENT (agent), FALSE);
...@@ -6001,7 +6002,7 @@ nice_agent_forget_relays (NiceAgent *agent, guint stream_id, guint component_id) ...@@ -6001,7 +6002,7 @@ nice_agent_forget_relays (NiceAgent *agent, guint stream_id, guint component_id)
goto done; goto done;
} }
component_clean_turn_servers (component); nice_component_clean_turn_servers (component);
done: done:
agent_unlock_and_emit (agent); agent_unlock_and_emit (agent);
...@@ -6049,7 +6050,7 @@ nice_agent_get_component_state (NiceAgent *agent, ...@@ -6049,7 +6050,7 @@ nice_agent_get_component_state (NiceAgent *agent,
guint stream_id, guint component_id) guint stream_id, guint component_id)
{ {
NiceComponentState state = NICE_COMPONENT_STATE_FAILED; NiceComponentState state = NICE_COMPONENT_STATE_FAILED;
Component *component; NiceComponent *component;
agent_lock (); agent_lock ();
......
...@@ -79,9 +79,9 @@ static void ...@@ -79,9 +79,9 @@ static void
nice_component_finalize (GObject *obj); nice_component_finalize (GObject *obj);
static void static void
component_schedule_io_callback (Component *component); nice_component_schedule_io_callback (NiceComponent *component);
static void static void
component_deschedule_io_callback (Component *component); nice_component_deschedule_io_callback (NiceComponent *component);
void void
...@@ -92,7 +92,7 @@ incoming_check_free (IncomingCheck *icheck) ...@@ -92,7 +92,7 @@ incoming_check_free (IncomingCheck *icheck)
} }
/* Must *not* take the agent lock, since it’s called from within /* Must *not* take the agent lock, since it’s called from within
* component_set_io_context(), which holds the Component’s I/O lock. */ * nice_component_set_io_context(), which holds the Component’s I/O lock. */
static void static void
socket_source_attach (SocketSource *socket_source, GMainContext *context) socket_source_attach (SocketSource *socket_source, GMainContext *context)
{ {
...@@ -139,8 +139,8 @@ socket_source_free (SocketSource *source) ...@@ -139,8 +139,8 @@ socket_source_free (SocketSource *source)
g_slice_free (SocketSource, source); g_slice_free (SocketSource, source);
} }
Component * NiceComponent *
component_new (guint id, NiceAgent *agent, NiceStream *stream) nice_component_new (guint id, NiceAgent *agent, NiceStream *stream)
{ {
return g_object_new (NICE_TYPE_COMPONENT, return g_object_new (NICE_TYPE_COMPONENT,
"id", id, "id", id,
...@@ -150,7 +150,7 @@ component_new (guint id, NiceAgent *agent, NiceStream *stream) ...@@ -150,7 +150,7 @@ component_new (guint id, NiceAgent *agent, NiceStream *stream)
} }
void void
component_clean_turn_servers (Component *cmp) nice_component_clean_turn_servers (NiceComponent *cmp)
{ {
GSList *i; GSList *i;
...@@ -181,7 +181,7 @@ component_clean_turn_servers (Component *cmp) ...@@ -181,7 +181,7 @@ component_clean_turn_servers (Component *cmp)
discovery_prune_socket (cmp->agent, cmp->turn_candidate->sockptr); discovery_prune_socket (cmp->agent, cmp->turn_candidate->sockptr);
conn_check_prune_socket (cmp->agent, cmp->stream, cmp, conn_check_prune_socket (cmp->agent, cmp->stream, cmp,
cmp->turn_candidate->sockptr); cmp->turn_candidate->sockptr);
component_detach_socket (cmp, cmp->turn_candidate->sockptr); nice_component_detach_socket (cmp, cmp->turn_candidate->sockptr);
nice_candidate_free (cmp->turn_candidate); nice_candidate_free (cmp->turn_candidate);
} }
/* Bring the priority down to 0, so that it will be replaced /* Bring the priority down to 0, so that it will be replaced
...@@ -194,7 +194,7 @@ component_clean_turn_servers (Component *cmp) ...@@ -194,7 +194,7 @@ component_clean_turn_servers (Component *cmp)
discovery_prune_socket (cmp->agent, candidate->sockptr); discovery_prune_socket (cmp->agent, candidate->sockptr);
conn_check_prune_socket (cmp->agent, cmp->stream, cmp, conn_check_prune_socket (cmp->agent, cmp->stream, cmp,
candidate->sockptr); candidate->sockptr);
component_detach_socket (cmp, candidate->sockptr); nice_component_detach_socket (cmp, candidate->sockptr);
agent_remove_local_candidate (cmp->agent, candidate); agent_remove_local_candidate (cmp->agent, candidate);
nice_candidate_free (candidate); nice_candidate_free (candidate);
} }
...@@ -204,7 +204,7 @@ component_clean_turn_servers (Component *cmp) ...@@ -204,7 +204,7 @@ component_clean_turn_servers (Component *cmp)
} }
static void static void
component_clear_selected_pair (Component *component) nice_component_clear_selected_pair (NiceComponent *component)
{ {
if (component->selected_pair.keepalive.tick_source != NULL) { if (component->selected_pair.keepalive.tick_source != NULL) {
g_source_destroy (component->selected_pair.keepalive.tick_source); g_source_destroy (component->selected_pair.keepalive.tick_source);
...@@ -218,7 +218,7 @@ component_clear_selected_pair (Component *component) ...@@ -218,7 +218,7 @@ component_clear_selected_pair (Component *component)
/* Must be called with the agent lock held as it touches internal Component /* Must be called with the agent lock held as it touches internal Component
* state. */ * state. */
void void
component_close (Component *cmp) nice_component_close (NiceComponent *cmp)
{ {
IOCallbackData *data; IOCallbackData *data;
GOutputVector *vec; GOutputVector *vec;
...@@ -226,13 +226,13 @@ component_close (Component *cmp) ...@@ -226,13 +226,13 @@ component_close (Component *cmp)
/* Start closing the pseudo-TCP socket first. FIXME: There is a very big and /* Start closing the pseudo-TCP socket first. FIXME: There is a very big and
* reliably triggerable race here. pseudo_tcp_socket_close() does not block * reliably triggerable race here. pseudo_tcp_socket_close() does not block
* on the socket closing — it only sends the first packet of the FIN * on the socket closing — it only sends the first packet of the FIN
* handshake. component_close() will immediately afterwards close the * handshake. nice_component_close() will immediately afterwards close the
* underlying component sockets, aborting the handshake. * underlying component sockets, aborting the handshake.
* *
* On the principle that starting the FIN handshake is better than not * On the principle that starting the FIN handshake is better than not
* starting it, even if it’s later truncated, call pseudo_tcp_socket_close(). * starting it, even if it’s later truncated, call pseudo_tcp_socket_close().
* A long-term fix is needed in the form of making component_close() (and all * A long-term fix is needed in the form of making nice_component_close() (and
* its callers) async, so we can properly block on closure. */ * all its callers) async, so we can properly block on closure. */
if (cmp->tcp) { if (cmp->tcp) {
pseudo_tcp_socket_close (cmp->tcp, TRUE); pseudo_tcp_socket_close (cmp->tcp, TRUE);
} }
...@@ -255,12 +255,12 @@ component_close (Component *cmp) ...@@ -255,12 +255,12 @@ component_close (Component *cmp)
g_slist_free_full (cmp->remote_candidates, g_slist_free_full (cmp->remote_candidates,
(GDestroyNotify) nice_candidate_free); (GDestroyNotify) nice_candidate_free);
cmp->remote_candidates = NULL; cmp->remote_candidates = NULL;
component_free_socket_sources (cmp); nice_component_free_socket_sources (cmp);
g_slist_free_full (cmp->incoming_checks, g_slist_free_full (cmp->incoming_checks,
(GDestroyNotify) incoming_check_free); (GDestroyNotify) incoming_check_free);
cmp->incoming_checks = NULL; cmp->incoming_checks = NULL;
component_clean_turn_servers (cmp); nice_component_clean_turn_servers (cmp);
if (cmp->tcp_clock) { if (cmp->tcp_clock) {
g_source_destroy (cmp->tcp_clock); g_source_destroy (cmp->tcp_clock);
...@@ -275,7 +275,7 @@ component_close (Component *cmp) ...@@ -275,7 +275,7 @@ component_close (Component *cmp)
while ((data = g_queue_pop_head (&cmp->pending_io_messages)) != NULL) while ((data = g_queue_pop_head (&cmp->pending_io_messages)) != NULL)
io_callback_data_free (data); io_callback_data_free (data);
component_deschedule_io_callback (cmp); nice_component_deschedule_io_callback (cmp);
g_cancellable_cancel (cmp->stop_cancellable); g_cancellable_cancel (cmp->stop_cancellable);
...@@ -285,21 +285,13 @@ component_close (Component *cmp) ...@@ -285,21 +285,13 @@ component_close (Component *cmp)
} }
} }
/* Must be called with the agent lock released as it could dispose of
* NiceIOStreams. */
void
component_free (Component *cmp)
{
g_object_unref (cmp);
}
/* /*
* Finds a candidate pair that has matching foundation ids. * Finds a candidate pair that has matching foundation ids.
* *
* @return TRUE if pair found, pointer to pair stored at 'pair' * @return TRUE if pair found, pointer to pair stored at 'pair'
*/ */
gboolean gboolean
component_find_pair (Component *cmp, NiceAgent *agent, const gchar *lfoundation, const gchar *rfoundation, CandidatePair *pair) nice_component_find_pair (NiceComponent *cmp, NiceAgent *agent, const gchar *lfoundation, const gchar *rfoundation, CandidatePair *pair)
{ {
GSList *i; GSList *i;
CandidatePair result = { 0, }; CandidatePair result = { 0, };
...@@ -335,7 +327,7 @@ component_find_pair (Component *cmp, NiceAgent *agent, const gchar *lfoundation, ...@@ -335,7 +327,7 @@ component_find_pair (Component *cmp, NiceAgent *agent, const gchar *lfoundation,
* session. * session.
*/ */
void void
component_restart (Component *cmp) nice_component_restart (NiceComponent *cmp)
{ {
GSList *i; GSList *i;
...@@ -370,7 +362,8 @@ component_restart (Component *cmp) ...@@ -370,7 +362,8 @@ component_restart (Component *cmp)
* Changes the selected pair for the component to 'pair'. Does not * Changes the selected pair for the component to 'pair'. Does not
* emit the "selected-pair-changed" signal. * emit the "selected-pair-changed" signal.
*/ */
void component_update_selected_pair (Component *component, const CandidatePair *pair) void
nice_component_update_selected_pair (NiceComponent *component, const CandidatePair *pair)
{ {
g_assert (component); g_assert (component);
g_assert (pair); g_assert (pair);
...@@ -385,12 +378,12 @@ void component_update_selected_pair (Component *component, const CandidatePair * ...@@ -385,12 +378,12 @@ void component_update_selected_pair (Component *component, const CandidatePair *
component->turn_candidate->sockptr); component->turn_candidate->sockptr);
conn_check_prune_socket (component->agent, component->stream, component, conn_check_prune_socket (component->agent, component->stream, component,
component->turn_candidate->sockptr); component->turn_candidate->sockptr);
component_detach_socket (component, component->turn_candidate->sockptr); nice_component_detach_socket (component, component->turn_candidate->sockptr);
nice_candidate_free (component->turn_candidate); nice_candidate_free (component->turn_candidate);
component->turn_candidate = NULL; component->turn_candidate = NULL;
} }
component_clear_selected_pair (component); nice_component_clear_selected_pair (component);
component->selected_pair.local = pair->local; component->selected_pair.local = pair->local;
component->selected_pair.remote = pair->remote; component->selected_pair.remote = pair->remote;
...@@ -405,7 +398,7 @@ void component_update_selected_pair (Component *component, const CandidatePair * ...@@ -405,7 +398,7 @@ void component_update_selected_pair (Component *component, const CandidatePair *
* @return pointer to candidate or NULL if not found * @return pointer to candidate or NULL if not found
*/ */
NiceCandidate * NiceCandidate *
component_find_remote_candidate (const Component *component, const NiceAddress *addr, NiceCandidateTransport transport) nice_component_find_remote_candidate (NiceComponent *component, const NiceAddress *addr, NiceCandidateTransport transport)
{ {
GSList *i; GSList *i;
...@@ -429,8 +422,8 @@ component_find_remote_candidate (const Component *component, const NiceAddress * ...@@ -429,8 +422,8 @@ component_find_remote_candidate (const Component *component, const NiceAddress *
*/ */
NiceCandidate * NiceCandidate *
component_set_selected_remote_candidate (NiceAgent *agent, Component *component, nice_component_set_selected_remote_candidate (NiceComponent *component,
NiceCandidate *candidate) NiceAgent *agent, NiceCandidate *candidate)
{ {
NiceCandidate *local = NULL; NiceCandidate *local = NULL;
NiceCandidate *remote = NULL; NiceCandidate *remote = NULL;
...@@ -459,7 +452,7 @@ component_set_selected_remote_candidate (NiceAgent *agent, Component *component, ...@@ -459,7 +452,7 @@ component_set_selected_remote_candidate (NiceAgent *agent, Component *component,
if (local == NULL) if (local == NULL)
return NULL; return NULL;
remote = component_find_remote_candidate (component, &candidate->addr, remote = nice_component_find_remote_candidate (component, &candidate->addr,
candidate->transport); candidate->transport);
if (!remote) { if (!remote) {
...@@ -469,7 +462,7 @@ component_set_selected_remote_candidate (NiceAgent *agent, Component *component, ...@@ -469,7 +462,7 @@ component_set_selected_remote_candidate (NiceAgent *agent, Component *component,
agent_signal_new_remote_candidate (agent, remote); agent_signal_new_remote_candidate (agent, remote);
} }
component_clear_selected_pair (component); nice_component_clear_selected_pair (component);
component->selected_pair.local = local; component->selected_pair.local = local;
component->selected_pair.remote = remote; component->selected_pair.remote = remote;
...@@ -490,7 +483,7 @@ _find_socket_source (gconstpointer a, gconstpointer b) ...@@ -490,7 +483,7 @@ _find_socket_source (gconstpointer a, gconstpointer b)
/* This takes ownership of the socket. /* This takes ownership of the socket.
* It creates and attaches a source to the component’s context. */ * It creates and attaches a source to the component’s context. */
void void
component_attach_socket (Component *component, NiceSocket *nicesock) nice_component_attach_socket (NiceComponent *component, NiceSocket *nicesock)
{ {
GSList *l; GSList *l;
SocketSource *socket_source; SocketSource *socket_source;
...@@ -531,9 +524,9 @@ component_attach_socket (Component *component, NiceSocket *nicesock) ...@@ -531,9 +524,9 @@ component_attach_socket (Component *component, NiceSocket *nicesock)
/* Reattaches socket handles of @component to the main context. /* Reattaches socket handles of @component to the main context.
* *
* Must *not* take the agent lock, since it’s called from within * Must *not* take the agent lock, since it’s called from within
* component_set_io_context(), which holds the Component’s I/O lock. */ * nice_component_set_io_context(), which holds the Component’s I/O lock. */
static void static void
component_reattach_all_sockets (Component *component) nice_component_reattach_all_sockets (NiceComponent *component)
{ {
GSList *i; GSList *i;
...@@ -546,7 +539,7 @@ component_reattach_all_sockets (Component *component) ...@@ -546,7 +539,7 @@ component_reattach_all_sockets (Component *component)
} }
/** /**
* component_detach_socket: * nice_component_detach_socket:
* @component: a #Component * @component: a #Component
* @socket: the socket to detach the source for * @socket: the socket to detach the source for
* *
...@@ -556,7 +549,7 @@ component_reattach_all_sockets (Component *component) ...@@ -556,7 +549,7 @@ component_reattach_all_sockets (Component *component)
* If the @socket doesn’t exist in this @component, do nothing. * If the @socket doesn’t exist in this @component, do nothing.
*/ */
void void
component_detach_socket (Component *component, NiceSocket *nicesock) nice_component_detach_socket (NiceComponent *component, NiceSocket *nicesock)
{ {
GSList *l; GSList *l;
SocketSource *socket_source; SocketSource *socket_source;
...@@ -597,10 +590,10 @@ component_detach_socket (Component *component, NiceSocket *nicesock) ...@@ -597,10 +590,10 @@ component_detach_socket (Component *component, NiceSocket *nicesock)
* sockets themselves untouched. * sockets themselves untouched.
* *
* Must *not* take the agent lock, since it’s called from within * Must *not* take the agent lock, since it’s called from within
* component_set_io_context(), which holds the Component’s I/O lock. * nice_component_set_io_context(), which holds the Component’s I/O lock.
*/ */
void void
component_detach_all_sockets (Component *component) nice_component_detach_all_sockets (NiceComponent *component)
{ {
GSList *i; GSList *i;
...@@ -613,7 +606,7 @@ component_detach_all_sockets (Component *component) ...@@ -613,7 +606,7 @@ component_detach_all_sockets (Component *component)
} }
void void
component_free_socket_sources (Component *component) nice_component_free_socket_sources (NiceComponent *component)
{ {
nice_debug ("Free socket sources for component %p.", component); nice_debug ("Free socket sources for component %p.", component);
...@@ -622,11 +615,11 @@ component_free_socket_sources (Component *component) ...@@ -622,11 +615,11 @@ component_free_socket_sources (Component *component)
component->socket_sources = NULL; component->socket_sources = NULL;
component->socket_sources_age++; component->socket_sources_age++;
component_clear_selected_pair (component); nice_component_clear_selected_pair (component);
} }
GMainContext * GMainContext *
component_dup_io_context (Component *component) nice_component_dup_io_context (NiceComponent *component)
{ {
return g_main_context_ref (component->own_ctx); return g_main_context_ref (component->own_ctx);
} }
...@@ -634,7 +627,7 @@ component_dup_io_context (Component *component) ...@@ -634,7 +627,7 @@ component_dup_io_context (Component *component)
/* If @context is %NULL, it's own context is used, so component->ctx is always /* If @context is %NULL, it's own context is used, so component->ctx is always
* guaranteed to be non-%NULL. */ * guaranteed to be non-%NULL. */
void void
component_set_io_context (Component *component, GMainContext *context) nice_component_set_io_context (NiceComponent *component, GMainContext *context)
{ {
g_mutex_lock (&component->io_mutex); g_mutex_lock (&component->io_mutex);
...@@ -644,11 +637,11 @@ component_set_io_context (Component *component, GMainContext *context) ...@@ -644,11 +637,11 @@ component_set_io_context (Component *component, GMainContext *context)
else else
g_main_context_ref (context); g_main_context_ref (context);
component_detach_all_sockets (component); nice_component_detach_all_sockets (component);
g_main_context_unref (component->ctx); g_main_context_unref (component->ctx);
component->ctx = context; component->ctx = context;
component_reattach_all_sockets (component); nice_component_reattach_all_sockets (component);
} }
g_mutex_unlock (&component->io_mutex); g_mutex_unlock (&component->io_mutex);
...@@ -665,7 +658,7 @@ component_set_io_context (Component *component, GMainContext *context) ...@@ -665,7 +658,7 @@ component_set_io_context (Component *component, GMainContext *context)
* emitted for it (which could cause data loss if the I/O callback function was * emitted for it (which could cause data loss if the I/O callback function was
* unset in that time). */ * unset in that time). */
void void
component_set_io_callback (Component *component, nice_component_set_io_callback (NiceComponent *component,
NiceAgentRecvFunc func, gpointer user_data, NiceAgentRecvFunc func, gpointer user_data,
NiceInputMessage *recv_messages, guint n_recv_messages, NiceInputMessage *recv_messages, guint n_recv_messages,
GError **error) GError **error)
...@@ -682,14 +675,14 @@ component_set_io_callback (Component *component, ...@@ -682,14 +675,14 @@ component_set_io_callback (Component *component,
component->recv_messages = NULL; component->recv_messages = NULL;
component->n_recv_messages = 0; component->n_recv_messages = 0;
component_schedule_io_callback (component); nice_component_schedule_io_callback (component);
} else { } else {
component->io_callback = NULL; component->io_callback = NULL;
component->io_user_data = NULL; component->io_user_data = NULL;
component->recv_messages = recv_messages; component->recv_messages = recv_messages;
component->n_recv_messages = n_recv_messages; component->n_recv_messages = n_recv_messages;
component_deschedule_io_callback (component); nice_component_deschedule_io_callback (component);
} }
nice_input_message_iter_reset (&component->recv_messages_iter); nice_input_message_iter_reset (&component->recv_messages_iter);
...@@ -699,7 +692,7 @@ component_set_io_callback (Component *component, ...@@ -699,7 +692,7 @@ component_set_io_callback (Component *component,
} }
gboolean gboolean
component_has_io_callback (Component *component) nice_component_has_io_callback (NiceComponent *component)
{ {
gboolean has_io_callback; gboolean has_io_callback;
...@@ -735,7 +728,7 @@ io_callback_data_free (IOCallbackData *data) ...@@ -735,7 +728,7 @@ io_callback_data_free (IOCallbackData *data)
static gboolean static gboolean
emit_io_callback_cb (gpointer user_data) emit_io_callback_cb (gpointer user_data)
{ {
Component *component = user_data; NiceComponent *component = user_data;
IOCallbackData *data; IOCallbackData *data;
NiceAgentRecvFunc io_callback; NiceAgentRecvFunc io_callback;
gpointer io_user_data; gpointer io_user_data;
...@@ -752,7 +745,7 @@ emit_io_callback_cb (gpointer user_data) ...@@ -752,7 +745,7 @@ emit_io_callback_cb (gpointer user_data)
g_mutex_lock (&component->io_mutex); g_mutex_lock (&component->io_mutex);
/* The members of Component are guaranteed not to have changed since this /* The members of Component are guaranteed not to have changed since this
* GSource was attached in component_emit_io_callback(). The Component’s agent * GSource was attached in nice_component_emit_io_callback(). The Component’s agent
* and stream are immutable after construction, as are the stream and * and stream are immutable after construction, as are the stream and
* component IDs. The callback and its user data may have changed, but are * component IDs. The callback and its user data may have changed, but are
* guaranteed to be non-%NULL at the start as the idle source is removed when * guaranteed to be non-%NULL at the start as the idle source is removed when
...@@ -762,7 +755,7 @@ emit_io_callback_cb (gpointer user_data) ...@@ -762,7 +755,7 @@ emit_io_callback_cb (gpointer user_data)
* *
* If the component is destroyed (which happens if the agent or stream are * If the component is destroyed (which happens if the agent or stream are
* destroyed) between attaching the GSource and firing it, the GSource is * destroyed) between attaching the GSource and firing it, the GSource is
* detached in component_free() and this callback is never invoked. If the * detached during dispose and this callback is never invoked. If the
* agent is destroyed during an io_callback, its weak pointer will be * agent is destroyed during an io_callback, its weak pointer will be
* nullified. Similarly, the Component needs to be re-queried for after every * nullified. Similarly, the Component needs to be re-queried for after every
* iteration, just in case the client has removed the stream in the * iteration, just in case the client has removed the stream in the
...@@ -805,7 +798,7 @@ emit_io_callback_cb (gpointer user_data) ...@@ -805,7 +798,7 @@ emit_io_callback_cb (gpointer user_data)
/* This must be called with the agent lock *held*. */ /* This must be called with the agent lock *held*. */
void void
component_emit_io_callback (Component *component, nice_component_emit_io_callback (NiceComponent *component,
const guint8 *buf, gsize buf_len) const guint8 *buf, gsize buf_len)
{ {
NiceAgent *agent; NiceAgent *agent;
...@@ -857,7 +850,7 @@ component_emit_io_callback (Component *component, ...@@ -857,7 +850,7 @@ component_emit_io_callback (Component *component,
nice_debug ("%s: **WARNING: SLOW PATH**", G_STRFUNC); nice_debug ("%s: **WARNING: SLOW PATH**", G_STRFUNC);
component_schedule_io_callback (component); nice_component_schedule_io_callback (component);
g_mutex_unlock (&component->io_mutex); g_mutex_unlock (&component->io_mutex);
} }
...@@ -865,7 +858,7 @@ component_emit_io_callback (Component *component, ...@@ -865,7 +858,7 @@ component_emit_io_callback (Component *component,
/* Note: Must be called with the io_mutex held. */ /* Note: Must be called with the io_mutex held. */
static void static void
component_schedule_io_callback (Component *component) nice_component_schedule_io_callback (NiceComponent *component)
{ {
GSource *source; GSource *source;
...@@ -888,7 +881,7 @@ component_schedule_io_callback (Component *component) ...@@ -888,7 +881,7 @@ component_schedule_io_callback (Component *component)
/* Note: Must be called with the io_mutex held. */ /* Note: Must be called with the io_mutex held. */
static void static void
component_deschedule_io_callback (Component *component) nice_component_deschedule_io_callback (NiceComponent *component)
{ {
/* Already descheduled? */ /* Already descheduled? */
if (component->io_callback_id == 0) if (component->io_callback_id == 0)
...@@ -983,8 +976,8 @@ nice_component_init (NiceComponent *component) ...@@ -983,8 +976,8 @@ nice_component_init (NiceComponent *component)
/* Start off with a fresh main context and all I/O paused. This /* Start off with a fresh main context and all I/O paused. This
* will be updated when nice_agent_attach_recv() or nice_agent_recv_messages() * will be updated when nice_agent_attach_recv() or nice_agent_recv_messages()
* are called. */ * are called. */
component_set_io_context (component, NULL); nice_component_set_io_context (component, NULL);
component_set_io_callback (component, NULL, NULL, NULL, 0, NULL); nice_component_set_io_callback (component, NULL, NULL, NULL, 0, NULL);
g_queue_init (&component->queued_tcp_packets); g_queue_init (&component->queued_tcp_packets);
} }
...@@ -1136,7 +1129,7 @@ component_source_prepare (GSource *source, gint *timeout_) ...@@ -1136,7 +1129,7 @@ component_source_prepare (GSource *source, gint *timeout_)
{ {
ComponentSource *component_source = (ComponentSource *) source; ComponentSource *component_source = (ComponentSource *) source;
NiceAgent *agent; NiceAgent *agent;
Component *component; NiceComponent *component;
GSList *parentl, *childl; GSList *parentl, *childl;
agent = g_weak_ref_get (&component_source->agent_ref); agent = g_weak_ref_get (&component_source->agent_ref);
...@@ -1306,7 +1299,7 @@ static GSourceFuncs component_source_funcs = { ...@@ -1306,7 +1299,7 @@ static GSourceFuncs component_source_funcs = {
* Returns: (transfer full): a new #ComponentSource; unref with g_source_unref() * Returns: (transfer full): a new #ComponentSource; unref with g_source_unref()
*/ */
GSource * GSource *
component_input_source_new (NiceAgent *agent, guint stream_id, nice_component_input_source_new (NiceAgent *agent, guint stream_id,
guint component_id, GPollableInputStream *pollable_istream, guint component_id, GPollableInputStream *pollable_istream,
GCancellable *cancellable) GCancellable *cancellable)
{ {
......
...@@ -42,8 +42,7 @@ ...@@ -42,8 +42,7 @@
#include <glib.h> #include <glib.h>
typedef struct _Component Component G_GNUC_DEPRECATED_FOR(NiceComponent); typedef struct _NiceComponent NiceComponent;
typedef Component NiceComponent;
#include "agent.h" #include "agent.h"
#include "agent-priv.h" #include "agent-priv.h"
...@@ -111,7 +110,7 @@ incoming_check_free (IncomingCheck *icheck); ...@@ -111,7 +110,7 @@ incoming_check_free (IncomingCheck *icheck);
typedef struct { typedef struct {
NiceSocket *socket; NiceSocket *socket;
GSource *source; GSource *source;
Component *component; NiceComponent *component;
} SocketSource; } SocketSource;
...@@ -150,8 +149,7 @@ io_callback_data_free (IOCallbackData *data); ...@@ -150,8 +149,7 @@ io_callback_data_free (IOCallbackData *data);
#define NICE_COMPONENT_GET_CLASS(obj) \ #define NICE_COMPONENT_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), NICE_TYPE_COMPONENT, NiceComponentClass)) (G_TYPE_INSTANCE_GET_CLASS ((obj), NICE_TYPE_COMPONENT, NiceComponentClass))
struct _Component struct _NiceComponent {
{
/*< private >*/ /*< private >*/
GObject parent; GObject parent;
...@@ -233,82 +231,64 @@ typedef struct { ...@@ -233,82 +231,64 @@ typedef struct {
GType nice_component_get_type (void); GType nice_component_get_type (void);
G_DEPRECATED NiceComponent *
Component * nice_component_new (guint component_id, NiceAgent *agent, NiceStream *stream);
component_new (guint component_id, NiceAgent *agent, NiceStream *stream);
G_DEPRECATED
void
component_close (Component *cmp);
G_DEPRECATED_FOR(g_object_unref)
void void
component_free (Component *cmp); nice_component_close (NiceComponent *component);
G_DEPRECATED
gboolean gboolean
component_find_pair (Component *cmp, NiceAgent *agent, const gchar *lfoundation, const gchar *rfoundation, CandidatePair *pair); nice_component_find_pair (NiceComponent *component, NiceAgent *agent,
const gchar *lfoundation, const gchar *rfoundation, CandidatePair *pair);
G_DEPRECATED
void void
component_restart (Component *cmp); nice_component_restart (NiceComponent *component);
G_DEPRECATED
void void
component_update_selected_pair (Component *component, const CandidatePair *pair); nice_component_update_selected_pair (NiceComponent *component,
const CandidatePair *pair);
G_DEPRECATED
NiceCandidate * NiceCandidate *
component_find_remote_candidate (const Component *component, const NiceAddress *addr, NiceCandidateTransport transport); nice_component_find_remote_candidate (NiceComponent *component,
const NiceAddress *addr, NiceCandidateTransport transport);
G_DEPRECATED
NiceCandidate * NiceCandidate *
component_set_selected_remote_candidate (NiceAgent *agent, Component *component, nice_component_set_selected_remote_candidate (NiceComponent *component,
NiceCandidate *candidate); NiceAgent *agent, NiceCandidate *candidate);
G_DEPRECATED
void void
component_attach_socket (Component *component, NiceSocket *nsocket); nice_component_attach_socket (NiceComponent *component, NiceSocket *nsocket);
G_DEPRECATED
void void
component_detach_socket (Component *component, NiceSocket *nsocket); nice_component_detach_socket (NiceComponent *component, NiceSocket *nsocket);
G_DEPRECATED
void void
component_detach_all_sockets (Component *component); nice_component_detach_all_sockets (NiceComponent *component);
G_DEPRECATED
void void
component_free_socket_sources (Component *component); nice_component_free_socket_sources (NiceComponent *component);
GSource * GSource *
component_input_source_new (NiceAgent *agent, guint stream_id, nice_component_input_source_new (NiceAgent *agent, guint stream_id,
guint component_id, GPollableInputStream *pollable_istream, guint component_id, GPollableInputStream *pollable_istream,
GCancellable *cancellable); GCancellable *cancellable);
G_DEPRECATED
GMainContext * GMainContext *
component_dup_io_context (Component *component); nice_component_dup_io_context (NiceComponent *component);
G_DEPRECATED
void void
component_set_io_context (Component *component, GMainContext *context); nice_component_set_io_context (NiceComponent *component, GMainContext *context);
G_DEPRECATED
void void
component_set_io_callback (Component *component, nice_component_set_io_callback (NiceComponent *component,
NiceAgentRecvFunc func, gpointer user_data, NiceAgentRecvFunc func, gpointer user_data,
NiceInputMessage *recv_messages, guint n_recv_messages, NiceInputMessage *recv_messages, guint n_recv_messages,
GError **error); GError **error);
G_DEPRECATED
void void
component_emit_io_callback (Component *component, nice_component_emit_io_callback (NiceComponent *component,
const guint8 *buf, gsize buf_len); const guint8 *buf, gsize buf_len);
G_DEPRECATED
gboolean gboolean
component_has_io_callback (Component *component); nice_component_has_io_callback (NiceComponent *component);
G_DEPRECATED
void void
component_clean_turn_servers (Component *component); nice_component_clean_turn_servers (NiceComponent *component);
TurnServer * TurnServer *
......
...@@ -62,17 +62,17 @@ ...@@ -62,17 +62,17 @@
#include "stun/usages/turn.h" #include "stun/usages/turn.h"
static void priv_update_check_list_failed_components (NiceAgent *agent, NiceStream *stream); static void priv_update_check_list_failed_components (NiceAgent *agent, NiceStream *stream);
static void priv_update_check_list_state_for_ready (NiceAgent *agent, NiceStream *stream, Component *component); static void priv_update_check_list_state_for_ready (NiceAgent *agent, NiceStream *stream, NiceComponent *component);
static guint priv_prune_pending_checks (NiceStream *stream, guint component_id); static guint priv_prune_pending_checks (NiceStream *stream, guint component_id);
static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *stream, Component *component, NiceSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate); static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate);
static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Component *component, NiceCandidate *remotecand); static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceCandidate *remotecand);
static size_t priv_create_username (NiceAgent *agent, NiceStream *stream, static size_t priv_create_username (NiceAgent *agent, NiceStream *stream,
guint component_id, NiceCandidate *remote, NiceCandidate *local, guint component_id, NiceCandidate *remote, NiceCandidate *local,
uint8_t *dest, guint dest_len, gboolean inbound); uint8_t *dest, guint dest_len, gboolean inbound);
static size_t priv_get_password (NiceAgent *agent, NiceStream *stream, static size_t priv_get_password (NiceAgent *agent, NiceStream *stream,
NiceCandidate *remote, uint8_t **password); NiceCandidate *remote, uint8_t **password);
static void conn_check_free_item (gpointer data); static void conn_check_free_item (gpointer data);
static void priv_conn_check_add_for_candidate_pair_matched (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *local, NiceCandidate *remote, NiceCheckState initial_state); static void priv_conn_check_add_for_candidate_pair_matched (NiceAgent *agent, guint stream_id, NiceComponent *component, NiceCandidate *local, NiceCandidate *remote, NiceCheckState initial_state);
static int priv_timer_expired (GTimeVal *timer, GTimeVal *now) static int priv_timer_expired (GTimeVal *timer, GTimeVal *now)
{ {
...@@ -245,7 +245,7 @@ static void ...@@ -245,7 +245,7 @@ static void
candidate_check_pair_fail (NiceStream *stream, NiceAgent *agent, CandidateCheckPair *p) candidate_check_pair_fail (NiceStream *stream, NiceAgent *agent, CandidateCheckPair *p)
{ {
StunTransactionId id; StunTransactionId id;
Component *component; NiceComponent *component;
component = nice_stream_find_component_by_id (stream, p->component_id); component = nice_stream_find_component_by_id (stream, p->component_id);
...@@ -365,7 +365,7 @@ static gboolean priv_conn_check_tick_stream (NiceStream *stream, NiceAgent *agen ...@@ -365,7 +365,7 @@ static gboolean priv_conn_check_tick_stream (NiceStream *stream, NiceAgent *agen
for (component_item = stream->components; component_item; for (component_item = stream->components; component_item;
component_item = component_item->next) { component_item = component_item->next) {
Component *component = component_item->data; NiceComponent *component = component_item->data;
for (k = stream->conncheck_list; k ; k = k->next) { for (k = stream->conncheck_list; k ; k = k->next) {
CandidateCheckPair *p = k->data; CandidateCheckPair *p = k->data;
...@@ -446,7 +446,7 @@ static gboolean priv_conn_check_tick_unlocked (NiceAgent *agent) ...@@ -446,7 +446,7 @@ static gboolean priv_conn_check_tick_unlocked (NiceAgent *agent)
NiceStream *stream = i->data; NiceStream *stream = i->data;
priv_update_check_list_failed_components (agent, stream); priv_update_check_list_failed_components (agent, stream);
for (j = stream->components; j; j = j->next) { for (j = stream->components; j; j = j->next) {
Component *component = j->data; NiceComponent *component = j->data;
priv_update_check_list_state_for_ready (agent, stream, component); priv_update_check_list_state_for_ready (agent, stream, component);
} }
} }
...@@ -512,7 +512,7 @@ static gboolean priv_conn_keepalive_retransmissions_tick (gpointer pointer) ...@@ -512,7 +512,7 @@ static gboolean priv_conn_keepalive_retransmissions_tick (gpointer pointer)
{ {
/* Time out */ /* Time out */
StunTransactionId id; StunTransactionId id;
Component *component; NiceComponent *component;
if (!agent_find_component (pair->keepalive.agent, if (!agent_find_component (pair->keepalive.agent,
pair->keepalive.stream_id, pair->keepalive.component_id, pair->keepalive.stream_id, pair->keepalive.component_id,
...@@ -620,7 +620,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) ...@@ -620,7 +620,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
NiceStream *stream = i->data; NiceStream *stream = i->data;
for (j = stream->components; j; j = j->next) { for (j = stream->components; j; j = j->next) {
Component *component = j->data; NiceComponent *component = j->data;
if (component->selected_pair.local != NULL) { if (component->selected_pair.local != NULL) {
CandidatePair *p = &component->selected_pair; CandidatePair *p = &component->selected_pair;
...@@ -712,7 +712,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) ...@@ -712,7 +712,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
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) {
Component *component = j->data; NiceComponent *component = j->data;
if (component->state < NICE_COMPONENT_STATE_READY && if (component->state < NICE_COMPONENT_STATE_READY &&
agent->stun_server_ip) { agent->stun_server_ip) {
NiceAddress stun_server; NiceAddress stun_server;
...@@ -996,7 +996,7 @@ gint conn_check_compare (const CandidateCheckPair *a, const CandidateCheckPair * ...@@ -996,7 +996,7 @@ gint conn_check_compare (const CandidateCheckPair *a, const CandidateCheckPair *
* @param component pointer to component object to which 'pair'has been added * @param component pointer to component object to which 'pair'has been added
* @param pair newly added connectivity check * @param pair newly added connectivity check
*/ */
static void priv_preprocess_conn_check_pending_data (NiceAgent *agent, NiceStream *stream, Component *component, CandidateCheckPair *pair) static void priv_preprocess_conn_check_pending_data (NiceAgent *agent, NiceStream *stream, NiceComponent *component, CandidateCheckPair *pair)
{ {
GSList *i; GSList *i;
for (i = component->incoming_checks; i; i = i->next) { for (i = component->incoming_checks; i; i = i->next) {
...@@ -1048,7 +1048,7 @@ void conn_check_remote_candidates_set(NiceAgent *agent) ...@@ -1048,7 +1048,7 @@ void conn_check_remote_candidates_set(NiceAgent *agent)
NiceStream *stream = i->data; NiceStream *stream = i->data;
for (j = stream->conncheck_list; j ; j = j->next) { for (j = stream->conncheck_list; j ; j = j->next) {
CandidateCheckPair *pair = j->data; CandidateCheckPair *pair = j->data;
Component *component = nice_stream_find_component_by_id (stream, pair->component_id); NiceComponent *component = nice_stream_find_component_by_id (stream, pair->component_id);
gboolean match = FALSE; gboolean match = FALSE;
/* performn delayed processing of spec steps section 7.2.1.4, /* performn delayed processing of spec steps section 7.2.1.4,
...@@ -1205,20 +1205,20 @@ static void priv_limit_conn_check_list_size (GSList *conncheck_list, guint upper ...@@ -1205,20 +1205,20 @@ static void priv_limit_conn_check_list_size (GSList *conncheck_list, guint upper
* and has higher priority than the currently selected pair. See * and has higher priority than the currently selected pair. See
* ICE sect 11.1.1. "Procedures for Full Implementations" (ID-19). * ICE sect 11.1.1. "Procedures for Full Implementations" (ID-19).
*/ */
static gboolean priv_update_selected_pair (NiceAgent *agent, Component *component, CandidateCheckPair *pair) static gboolean priv_update_selected_pair (NiceAgent *agent, NiceComponent *component, CandidateCheckPair *pair)
{ {
CandidatePair cpair; CandidatePair cpair;
g_assert (component); g_assert (component);
g_assert (pair); g_assert (pair);
if (pair->priority > component->selected_pair.priority && if (pair->priority > component->selected_pair.priority &&
component_find_pair (component, agent, pair->local->foundation, nice_component_find_pair (component, agent, pair->local->foundation,
pair->remote->foundation, &cpair)) { pair->remote->foundation, &cpair)) {
nice_debug ("Agent %p : changing SELECTED PAIR for component %u: %s:%s " nice_debug ("Agent %p : changing SELECTED PAIR for component %u: %s:%s "
"(prio:%" G_GUINT64_FORMAT ").", agent, component->id, "(prio:%" G_GUINT64_FORMAT ").", agent, component->id,
pair->local->foundation, pair->remote->foundation, pair->priority); pair->local->foundation, pair->remote->foundation, pair->priority);
component_update_selected_pair (component, &cpair); nice_component_update_selected_pair (component, &cpair);
priv_conn_keepalive_tick_unlocked (agent); priv_conn_keepalive_tick_unlocked (agent);
...@@ -1262,7 +1262,7 @@ static void priv_update_check_list_failed_components (NiceAgent *agent, NiceStre ...@@ -1262,7 +1262,7 @@ static void priv_update_check_list_failed_components (NiceAgent *agent, NiceStre
/* note: iterate the conncheck list for each component separately */ /* note: iterate the conncheck list for each component separately */
for (c = 0; c < components; c++) { for (c = 0; c < components; c++) {
Component *comp = NULL; NiceComponent *comp = NULL;
if (!agent_find_component (agent, stream->id, c+1, NULL, &comp)) if (!agent_find_component (agent, stream->id, c+1, NULL, &comp))
continue; continue;
...@@ -1300,7 +1300,7 @@ static void priv_update_check_list_failed_components (NiceAgent *agent, NiceStre ...@@ -1300,7 +1300,7 @@ static void priv_update_check_list_failed_components (NiceAgent *agent, NiceStre
* *
* Sends a component state changesignal via 'agent'. * Sends a component state changesignal via 'agent'.
*/ */
static void priv_update_check_list_state_for_ready (NiceAgent *agent, NiceStream *stream, Component *component) static void priv_update_check_list_state_for_ready (NiceAgent *agent, NiceStream *stream, NiceComponent *component)
{ {
GSList *i; GSList *i;
guint succeeded = 0, nominated = 0; guint succeeded = 0, nominated = 0;
...@@ -1347,7 +1347,7 @@ static void priv_update_check_list_state_for_ready (NiceAgent *agent, NiceStream ...@@ -1347,7 +1347,7 @@ static void priv_update_check_list_state_for_ready (NiceAgent *agent, NiceStream
* described by 'component' and 'remotecand' is nominated * described by 'component' and 'remotecand' is nominated
* for use. * for use.
*/ */
static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Component *component, NiceCandidate *remotecand) static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceCandidate *remotecand)
{ {
GSList *i; GSList *i;
...@@ -1374,7 +1374,7 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Comp ...@@ -1374,7 +1374,7 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Comp
* Creates a new connectivity check pair and adds it to * Creates a new connectivity check pair and adds it to
* the agent's list of checks. * the agent's list of checks.
*/ */
static void priv_add_new_check_pair (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *local, NiceCandidate *remote, NiceCheckState initial_state, gboolean use_candidate) static void priv_add_new_check_pair (NiceAgent *agent, guint stream_id, NiceComponent *component, NiceCandidate *local, NiceCandidate *remote, NiceCheckState initial_state, gboolean use_candidate)
{ {
NiceStream *stream; NiceStream *stream;
CandidateCheckPair *pair; CandidateCheckPair *pair;
...@@ -1433,7 +1433,7 @@ conn_check_match_transport (NiceCandidateTransport transport) ...@@ -1433,7 +1433,7 @@ conn_check_match_transport (NiceCandidateTransport transport)
} }
static void priv_conn_check_add_for_candidate_pair_matched (NiceAgent *agent, static void priv_conn_check_add_for_candidate_pair_matched (NiceAgent *agent,
guint stream_id, Component *component, NiceCandidate *local, guint stream_id, NiceComponent *component, NiceCandidate *local,
NiceCandidate *remote, NiceCheckState initial_state) NiceCandidate *remote, NiceCheckState initial_state)
{ {
nice_debug ("Agent %p, Adding check pair between %s and %s", agent, nice_debug ("Agent %p, Adding check pair between %s and %s", agent,
...@@ -1455,7 +1455,7 @@ static void priv_conn_check_add_for_candidate_pair_matched (NiceAgent *agent, ...@@ -1455,7 +1455,7 @@ static void priv_conn_check_add_for_candidate_pair_matched (NiceAgent *agent,
} }
gboolean conn_check_add_for_candidate_pair (NiceAgent *agent, gboolean conn_check_add_for_candidate_pair (NiceAgent *agent,
guint stream_id, Component *component, NiceCandidate *local, guint stream_id, NiceComponent *component, NiceCandidate *local,
NiceCandidate *remote) NiceCandidate *remote)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
...@@ -1501,7 +1501,7 @@ gboolean conn_check_add_for_candidate_pair (NiceAgent *agent, ...@@ -1501,7 +1501,7 @@ gboolean conn_check_add_for_candidate_pair (NiceAgent *agent,
* *
* @return number of checks added, negative on fatal errors * @return number of checks added, negative on fatal errors
*/ */
int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *remote) int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, NiceComponent *component, NiceCandidate *remote)
{ {
GSList *i; GSList *i;
int added = 0; int added = 0;
...@@ -1532,7 +1532,7 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component * ...@@ -1532,7 +1532,7 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *
* *
* @return number of checks added, negative on fatal errors * @return number of checks added, negative on fatal errors
*/ */
int conn_check_add_for_local_candidate (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *local) int conn_check_add_for_local_candidate (NiceAgent *agent, guint stream_id, NiceComponent *component, NiceCandidate *local)
{ {
GSList *i; GSList *i;
int added = 0; int added = 0;
...@@ -1836,7 +1836,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair) ...@@ -1836,7 +1836,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
uint8_t uname[NICE_STREAM_MAX_UNAME]; uint8_t uname[NICE_STREAM_MAX_UNAME];
NiceStream *stream; NiceStream *stream;
Component *component; NiceComponent *component;
gsize uname_len; gsize uname_len;
uint8_t *password = NULL; uint8_t *password = NULL;
gsize password_len; gsize password_len;
...@@ -1914,7 +1914,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair) ...@@ -1914,7 +1914,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
if (pair->sockptr->fileno == NULL && if (pair->sockptr->fileno == NULL &&
pair->local->transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE) { pair->local->transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE) {
NiceStream *stream2 = NULL; NiceStream *stream2 = NULL;
Component *component2 = NULL; NiceComponent *component2 = NULL;
NiceSocket *new_socket; NiceSocket *new_socket;
if (agent_find_component (agent, pair->stream_id, pair->component_id, if (agent_find_component (agent, pair->stream_id, pair->component_id,
...@@ -1930,7 +1930,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair) ...@@ -1930,7 +1930,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
_tcp_sock_is_writable, component2); _tcp_sock_is_writable, component2);
} }
component_attach_socket (component2, new_socket); nice_component_attach_socket (component2, new_socket);
} }
} }
} }
...@@ -2031,7 +2031,7 @@ static guint priv_prune_pending_checks (NiceStream *stream, guint component_id) ...@@ -2031,7 +2031,7 @@ static guint priv_prune_pending_checks (NiceStream *stream, guint component_id)
* @param remote_cand remote candidate from which the inbound check was sent * @param remote_cand remote candidate from which the inbound check was sent
* @param use_candidate whether the original check had USE-CANDIDATE attribute set * @param use_candidate whether the original check had USE-CANDIDATE attribute set
*/ */
static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *stream, Component *component, NiceSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate) static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate)
{ {
GSList *i; GSList *i;
NiceCandidate *local = NULL; NiceCandidate *local = NULL;
...@@ -2137,7 +2137,7 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *str ...@@ -2137,7 +2137,7 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *str
* *
* @pre (rcand == NULL || nice_address_equal(rcand->addr, toaddr) == TRUE) * @pre (rcand == NULL || nice_address_equal(rcand->addr, toaddr) == TRUE)
*/ */
static void priv_reply_to_conn_check (NiceAgent *agent, NiceStream *stream, Component *component, NiceCandidate *rcand, const NiceAddress *toaddr, NiceSocket *sockptr, size_t rbuf_len, uint8_t *rbuf, gboolean use_candidate) static void priv_reply_to_conn_check (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceCandidate *rcand, const NiceAddress *toaddr, NiceSocket *sockptr, size_t rbuf_len, uint8_t *rbuf, gboolean use_candidate)
{ {
g_assert (rcand == NULL || nice_address_equal(&rcand->addr, toaddr) == TRUE); g_assert (rcand == NULL || nice_address_equal(&rcand->addr, toaddr) == TRUE);
...@@ -2172,7 +2172,7 @@ static void priv_reply_to_conn_check (NiceAgent *agent, NiceStream *stream, Comp ...@@ -2172,7 +2172,7 @@ static void priv_reply_to_conn_check (NiceAgent *agent, NiceStream *stream, Comp
* *
* @return non-zero on error, zero on success * @return non-zero on error, zero on success
*/ */
static int priv_store_pending_check (NiceAgent *agent, Component *component, static int priv_store_pending_check (NiceAgent *agent, NiceComponent *component,
const NiceAddress *from, NiceSocket *sockptr, uint8_t *username, const NiceAddress *from, NiceSocket *sockptr, uint8_t *username,
uint16_t username_len, uint32_t priority, gboolean use_candidate) uint16_t username_len, uint32_t priority, gboolean use_candidate)
{ {
...@@ -2287,7 +2287,7 @@ static void priv_check_for_role_conflict (NiceAgent *agent, gboolean control) ...@@ -2287,7 +2287,7 @@ static void priv_check_for_role_conflict (NiceAgent *agent, gboolean control)
* *
* @return pointer to a candidate pair, found in conncheck list or newly created * @return pointer to a candidate pair, found in conncheck list or newly created
*/ */
static CandidateCheckPair *priv_process_response_check_for_reflexive(NiceAgent *agent, NiceStream *stream, Component *component, CandidateCheckPair *p, NiceSocket *sockptr, struct sockaddr *mapped_sockaddr, NiceCandidate *local_candidate, NiceCandidate *remote_candidate) static CandidateCheckPair *priv_process_response_check_for_reflexive(NiceAgent *agent, NiceStream *stream, NiceComponent *component, CandidateCheckPair *p, NiceSocket *sockptr, struct sockaddr *mapped_sockaddr, NiceCandidate *local_candidate, NiceCandidate *remote_candidate)
{ {
CandidateCheckPair *new_pair = NULL; CandidateCheckPair *new_pair = NULL;
NiceAddress mapped; NiceAddress mapped;
...@@ -2353,7 +2353,7 @@ static CandidateCheckPair *priv_process_response_check_for_reflexive(NiceAgent * ...@@ -2353,7 +2353,7 @@ static CandidateCheckPair *priv_process_response_check_for_reflexive(NiceAgent *
* *
* @return TRUE if a matching transaction is found * @return TRUE if a matching transaction is found
*/ */
static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, NiceStream *stream, Component *component, NiceSocket *sockptr, const NiceAddress *from, NiceCandidate *local_candidate, NiceCandidate *remote_candidate, StunMessage *resp) static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceSocket *sockptr, const NiceAddress *from, NiceCandidate *local_candidate, NiceCandidate *remote_candidate, StunMessage *resp)
{ {
union { union {
struct sockaddr_storage storage; struct sockaddr_storage storage;
...@@ -2907,7 +2907,7 @@ static gboolean priv_map_reply_to_relay_refresh (NiceAgent *agent, StunMessage * ...@@ -2907,7 +2907,7 @@ static gboolean priv_map_reply_to_relay_refresh (NiceAgent *agent, StunMessage *
static gboolean priv_map_reply_to_keepalive_conncheck (NiceAgent *agent, static gboolean priv_map_reply_to_keepalive_conncheck (NiceAgent *agent,
Component *component, StunMessage *resp) NiceComponent *component, StunMessage *resp)
{ {
StunTransactionId conncheck_id; StunTransactionId conncheck_id;
StunTransactionId response_id; StunTransactionId response_id;
...@@ -2936,7 +2936,7 @@ static gboolean priv_map_reply_to_keepalive_conncheck (NiceAgent *agent, ...@@ -2936,7 +2936,7 @@ static gboolean priv_map_reply_to_keepalive_conncheck (NiceAgent *agent,
typedef struct { typedef struct {
NiceAgent *agent; NiceAgent *agent;
NiceStream *stream; NiceStream *stream;
Component *component; NiceComponent *component;
uint8_t *password; uint8_t *password;
} conncheck_validater_data; } conncheck_validater_data;
...@@ -3033,7 +3033,7 @@ static bool conncheck_stun_validater (StunAgent *agent, ...@@ -3033,7 +3033,7 @@ static bool conncheck_stun_validater (StunAgent *agent,
* @return XXX (what FALSE means exactly?) * @return XXX (what FALSE means exactly?)
*/ */
gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream, gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream,
Component *component, NiceSocket *nicesock, const NiceAddress *from, NiceComponent *component, NiceSocket *nicesock, const NiceAddress *from,
gchar *buf, guint len) gchar *buf, guint len)
{ {
union { union {
...@@ -3378,7 +3378,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream, ...@@ -3378,7 +3378,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream,
/* Remove all pointers to the given @sock from the connection checking process. /* Remove all pointers to the given @sock from the connection checking process.
* These are entirely NiceCandidates pointed to from various places. */ * These are entirely NiceCandidates pointed to from various places. */
void void
conn_check_prune_socket (NiceAgent *agent, NiceStream *stream, Component *component, conn_check_prune_socket (NiceAgent *agent, NiceStream *stream, NiceComponent *component,
NiceSocket *sock) NiceSocket *sock)
{ {
GSList *l; GSList *l;
......
...@@ -94,19 +94,19 @@ struct _CandidateCheckPair ...@@ -94,19 +94,19 @@ struct _CandidateCheckPair
StunMessage stun_message; StunMessage stun_message;
}; };
int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *remote); int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, NiceComponent *component, NiceCandidate *remote);
int conn_check_add_for_local_candidate (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *local); int conn_check_add_for_local_candidate (NiceAgent *agent, guint stream_id, NiceComponent *component, NiceCandidate *local);
gboolean conn_check_add_for_candidate_pair (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *local, NiceCandidate *remote); gboolean conn_check_add_for_candidate_pair (NiceAgent *agent, guint stream_id, NiceComponent *component, NiceCandidate *local, NiceCandidate *remote);
void conn_check_free (NiceAgent *agent); void conn_check_free (NiceAgent *agent);
gboolean conn_check_schedule_next (NiceAgent *agent); gboolean conn_check_schedule_next (NiceAgent *agent);
int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair); int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair);
void conn_check_prune_stream (NiceAgent *agent, NiceStream *stream); void conn_check_prune_stream (NiceAgent *agent, NiceStream *stream);
gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream, Component *component, NiceSocket *udp_socket, const NiceAddress *from, gchar *buf, guint len); gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceSocket *udp_socket, const NiceAddress *from, gchar *buf, guint len);
gint conn_check_compare (const CandidateCheckPair *a, const CandidateCheckPair *b); gint conn_check_compare (const CandidateCheckPair *a, const CandidateCheckPair *b);
void conn_check_remote_candidates_set(NiceAgent *agent); void conn_check_remote_candidates_set(NiceAgent *agent);
NiceCandidateTransport conn_check_match_transport (NiceCandidateTransport transport); NiceCandidateTransport conn_check_match_transport (NiceCandidateTransport transport);
void void
conn_check_prune_socket (NiceAgent *agent, NiceStream *stream, Component *component, conn_check_prune_socket (NiceAgent *agent, NiceStream *stream, NiceComponent *component,
NiceSocket *sock); NiceSocket *sock);
#endif /*_NICE_CONNCHECK_H */ #endif /*_NICE_CONNCHECK_H */
...@@ -305,7 +305,7 @@ void refresh_cancel (CandidateRefresh *refresh) ...@@ -305,7 +305,7 @@ void refresh_cancel (CandidateRefresh *refresh)
* defined in ICE spec section 4.1.3 "Eliminating Redundant * defined in ICE spec section 4.1.3 "Eliminating Redundant
* Candidates" (ID-19). * Candidates" (ID-19).
*/ */
static gboolean priv_add_local_candidate_pruned (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *candidate) static gboolean priv_add_local_candidate_pruned (NiceAgent *agent, guint stream_id, NiceComponent *component, NiceCandidate *candidate)
{ {
GSList *i; GSList *i;
...@@ -329,7 +329,7 @@ static gboolean priv_add_local_candidate_pruned (NiceAgent *agent, guint stream_ ...@@ -329,7 +329,7 @@ static gboolean priv_add_local_candidate_pruned (NiceAgent *agent, guint stream_
return TRUE; return TRUE;
} }
static guint priv_highest_remote_foundation (Component *component) static guint priv_highest_remote_foundation (NiceComponent *component)
{ {
GSList *i; GSList *i;
guint highest = 1; guint highest = 1;
...@@ -384,7 +384,7 @@ static void priv_assign_foundation (NiceAgent *agent, NiceCandidate *candidate) ...@@ -384,7 +384,7 @@ static void priv_assign_foundation (NiceAgent *agent, NiceCandidate *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) {
Component *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; NiceCandidate *n = k->data;
...@@ -427,12 +427,12 @@ static void priv_assign_remote_foundation (NiceAgent *agent, NiceCandidate *cand ...@@ -427,12 +427,12 @@ static void priv_assign_remote_foundation (NiceAgent *agent, NiceCandidate *cand
{ {
GSList *i, *j, *k; GSList *i, *j, *k;
guint next_remote_id; guint next_remote_id;
Component *component = NULL; NiceComponent *component = NULL;
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) {
Component *c = j->data; NiceComponent *c = j->data;
if (c->id == candidate->component_id) if (c->id == candidate->component_id)
component = c; component = c;
...@@ -523,7 +523,7 @@ HostCandidateResult discovery_add_local_host_candidate ( ...@@ -523,7 +523,7 @@ HostCandidateResult discovery_add_local_host_candidate (
NiceCandidate **outcandidate) NiceCandidate **outcandidate)
{ {
NiceCandidate *candidate; NiceCandidate *candidate;
Component *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
NiceSocket *nicesock = NULL; NiceSocket *nicesock = NULL;
HostCandidateResult res = HOST_CANDIDATE_FAILED; HostCandidateResult res = HOST_CANDIDATE_FAILED;
...@@ -580,7 +580,7 @@ HostCandidateResult discovery_add_local_host_candidate ( ...@@ -580,7 +580,7 @@ HostCandidateResult discovery_add_local_host_candidate (
} }
_priv_set_socket_tos (agent, nicesock, stream->tos); _priv_set_socket_tos (agent, nicesock, stream->tos);
component_attach_socket (component, nicesock); nice_component_attach_socket (component, nicesock);
*outcandidate = candidate; *outcandidate = candidate;
...@@ -610,7 +610,7 @@ discovery_add_server_reflexive_candidate ( ...@@ -610,7 +610,7 @@ discovery_add_server_reflexive_candidate (
gboolean nat_assisted) gboolean nat_assisted)
{ {
NiceCandidate *candidate; NiceCandidate *candidate;
Component *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
gboolean result = FALSE; gboolean result = FALSE;
...@@ -670,7 +670,7 @@ discovery_discover_tcp_server_reflexive_candidates ( ...@@ -670,7 +670,7 @@ discovery_discover_tcp_server_reflexive_candidates (
NiceAddress *address, NiceAddress *address,
NiceSocket *base_socket) NiceSocket *base_socket)
{ {
Component *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
NiceAddress base_addr = base_socket->addr; NiceAddress base_addr = base_socket->addr;
GSList *i; GSList *i;
...@@ -718,7 +718,7 @@ discovery_add_relay_candidate ( ...@@ -718,7 +718,7 @@ discovery_add_relay_candidate (
TurnServer *turn) TurnServer *turn)
{ {
NiceCandidate *candidate; NiceCandidate *candidate;
Component *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
NiceSocket *relay_socket = NULL; NiceSocket *relay_socket = NULL;
...@@ -769,7 +769,7 @@ discovery_add_relay_candidate ( ...@@ -769,7 +769,7 @@ discovery_add_relay_candidate (
if (!priv_add_local_candidate_pruned (agent, stream_id, component, candidate)) if (!priv_add_local_candidate_pruned (agent, stream_id, component, candidate))
goto errors; goto errors;
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 candidate;
...@@ -798,7 +798,7 @@ discovery_add_peer_reflexive_candidate ( ...@@ -798,7 +798,7 @@ discovery_add_peer_reflexive_candidate (
NiceCandidate *remote) NiceCandidate *remote)
{ {
NiceCandidate *candidate; NiceCandidate *candidate;
Component *component; NiceComponent *component;
NiceStream *stream; NiceStream *stream;
gboolean result; gboolean result;
...@@ -892,7 +892,7 @@ discovery_add_peer_reflexive_candidate ( ...@@ -892,7 +892,7 @@ discovery_add_peer_reflexive_candidate (
NiceCandidate *discovery_learn_remote_peer_reflexive_candidate ( NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
NiceAgent *agent, NiceAgent *agent,
NiceStream *stream, NiceStream *stream,
Component *component, NiceComponent *component,
guint32 priority, guint32 priority,
const NiceAddress *remote_address, const NiceAddress *remote_address,
NiceSocket *nicesock, NiceSocket *nicesock,
......
...@@ -54,7 +54,7 @@ typedef struct ...@@ -54,7 +54,7 @@ typedef struct
gboolean pending; /* is discovery in progress? */ gboolean pending; /* is discovery in progress? */
gboolean done; /* is discovery complete? */ gboolean done; /* is discovery complete? */
NiceStream *stream; NiceStream *stream;
Component *component; NiceComponent *component;
TurnServer *turn; TurnServer *turn;
StunAgent stun_agent; StunAgent stun_agent;
StunTimer timer; StunTimer timer;
...@@ -71,7 +71,7 @@ typedef struct ...@@ -71,7 +71,7 @@ typedef struct
NiceAddress server; /* STUN/TURN server address */ NiceAddress server; /* STUN/TURN server address */
NiceCandidate *candidate; /* candidate to refresh */ NiceCandidate *candidate; /* candidate to refresh */
NiceStream *stream; NiceStream *stream;
Component *component; NiceComponent *component;
StunAgent stun_agent; StunAgent stun_agent;
GSource *timer_source; GSource *timer_source;
GSource *tick_source; GSource *tick_source;
...@@ -152,7 +152,7 @@ NiceCandidate * ...@@ -152,7 +152,7 @@ NiceCandidate *
discovery_learn_remote_peer_reflexive_candidate ( discovery_learn_remote_peer_reflexive_candidate (
NiceAgent *agent, NiceAgent *agent,
NiceStream *stream, NiceStream *stream,
Component *component, NiceComponent *component,
guint32 priority, guint32 priority,
const NiceAddress *remote_address, const NiceAddress *remote_address,
NiceSocket *udp_socket, NiceSocket *udp_socket,
......
...@@ -332,7 +332,7 @@ nice_input_stream_close (GInputStream *stream, GCancellable *cancellable, ...@@ -332,7 +332,7 @@ nice_input_stream_close (GInputStream *stream, GCancellable *cancellable,
GError **error) GError **error)
{ {
NiceInputStreamPrivate *priv = NICE_INPUT_STREAM (stream)->priv; NiceInputStreamPrivate *priv = NICE_INPUT_STREAM (stream)->priv;
Component *component = NULL; NiceComponent *component = NULL;
NiceStream *_stream = NULL; NiceStream *_stream = NULL;
NiceAgent *agent; /* owned */ NiceAgent *agent; /* owned */
...@@ -361,7 +361,7 @@ static gboolean ...@@ -361,7 +361,7 @@ static gboolean
nice_input_stream_is_readable (GPollableInputStream *stream) nice_input_stream_is_readable (GPollableInputStream *stream)
{ {
NiceInputStreamPrivate *priv = NICE_INPUT_STREAM (stream)->priv; NiceInputStreamPrivate *priv = NICE_INPUT_STREAM (stream)->priv;
Component *component = NULL; NiceComponent *component = NULL;
NiceStream *_stream = NULL; NiceStream *_stream = NULL;
gboolean retval = FALSE; gboolean retval = FALSE;
GSList *i; GSList *i;
...@@ -458,7 +458,7 @@ nice_input_stream_create_source (GPollableInputStream *stream, ...@@ -458,7 +458,7 @@ nice_input_stream_create_source (GPollableInputStream *stream,
if (agent == NULL) if (agent == NULL)
goto dummy_source; goto dummy_source;
component_source = component_input_source_new (agent, priv->stream_id, component_source = nice_component_input_source_new (agent, priv->stream_id,
priv->component_id, stream, cancellable); priv->component_id, stream, cancellable);
g_object_unref (agent); g_object_unref (agent);
......
...@@ -476,7 +476,7 @@ nice_output_stream_close (GOutputStream *stream, GCancellable *cancellable, ...@@ -476,7 +476,7 @@ nice_output_stream_close (GOutputStream *stream, GCancellable *cancellable,
GError **error) GError **error)
{ {
NiceOutputStreamPrivate *priv = NICE_OUTPUT_STREAM (stream)->priv; NiceOutputStreamPrivate *priv = NICE_OUTPUT_STREAM (stream)->priv;
Component *component = NULL; NiceComponent *component = NULL;
NiceStream *_stream = NULL; NiceStream *_stream = NULL;
NiceAgent *agent; /* owned */ NiceAgent *agent; /* owned */
...@@ -505,7 +505,7 @@ static gboolean ...@@ -505,7 +505,7 @@ static gboolean
nice_output_stream_is_writable (GPollableOutputStream *stream) nice_output_stream_is_writable (GPollableOutputStream *stream)
{ {
NiceOutputStreamPrivate *priv = NICE_OUTPUT_STREAM (stream)->priv; NiceOutputStreamPrivate *priv = NICE_OUTPUT_STREAM (stream)->priv;
Component *component = NULL; NiceComponent *component = NULL;
NiceStream *_stream = NULL; NiceStream *_stream = NULL;
gboolean retval = FALSE; gboolean retval = FALSE;
NiceAgent *agent; /* owned */ NiceAgent *agent; /* owned */
...@@ -595,7 +595,7 @@ nice_output_stream_create_source (GPollableOutputStream *stream, ...@@ -595,7 +595,7 @@ nice_output_stream_create_source (GPollableOutputStream *stream,
{ {
NiceOutputStreamPrivate *priv = NICE_OUTPUT_STREAM (stream)->priv; NiceOutputStreamPrivate *priv = NICE_OUTPUT_STREAM (stream)->priv;
GSource *component_source = NULL; GSource *component_source = NULL;
Component *component = NULL; NiceComponent *component = NULL;
NiceStream *_stream = NULL; NiceStream *_stream = NULL;
NiceAgent *agent; /* owned */ NiceAgent *agent; /* owned */
......
...@@ -67,9 +67,9 @@ nice_stream_new (guint n_components, NiceAgent *agent) ...@@ -67,9 +67,9 @@ nice_stream_new (guint n_components, NiceAgent *agent)
/* Create the components. */ /* Create the components. */
for (n = 0; n < n_components; n++) { for (n = 0; n < n_components; n++) {
Component *component = NULL; NiceComponent *component = NULL;
component = component_new (n + 1, agent, stream); component = nice_component_new (n + 1, agent, stream);
stream->components = g_slist_append (stream->components, component); stream->components = g_slist_append (stream->components, component);
} }
...@@ -84,18 +84,18 @@ nice_stream_close (NiceStream *stream) ...@@ -84,18 +84,18 @@ nice_stream_close (NiceStream *stream)
GSList *i; GSList *i;
for (i = stream->components; i; i = i->next) { for (i = stream->components; i; i = i->next) {
Component *component = i->data; NiceComponent *component = i->data;
component_close (component); nice_component_close (component);
} }
} }
Component * NiceComponent *
nice_stream_find_component_by_id (NiceStream *stream, guint id) nice_stream_find_component_by_id (NiceStream *stream, guint id)
{ {
GSList *i; GSList *i;
for (i = stream->components; i; i = i->next) { for (i = stream->components; i; i = i->next) {
Component *component = i->data; NiceComponent *component = i->data;
if (component && component->id == id) if (component && component->id == id)
return component; return component;
} }
...@@ -113,7 +113,7 @@ nice_stream_all_components_ready (NiceStream *stream) ...@@ -113,7 +113,7 @@ nice_stream_all_components_ready (NiceStream *stream)
GSList *i; GSList *i;
for (i = stream->components; i; i = i->next) { for (i = stream->components; i; i = i->next) {
Component *component = i->data; NiceComponent *component = i->data;
if (component && if (component &&
!(component->state == NICE_COMPONENT_STATE_CONNECTED || !(component->state == NICE_COMPONENT_STATE_CONNECTED ||
component->state == NICE_COMPONENT_STATE_READY)) component->state == NICE_COMPONENT_STATE_READY))
...@@ -153,9 +153,9 @@ nice_stream_restart (NiceStream *stream, NiceAgent *agent) ...@@ -153,9 +153,9 @@ nice_stream_restart (NiceStream *stream, NiceAgent *agent)
nice_stream_initialize_credentials (stream, agent->rng); nice_stream_initialize_credentials (stream, agent->rng);
for (i = stream->components; i; i = i->next) { for (i = stream->components; i; i = i->next) {
Component *component = i->data; NiceComponent *component = i->data;
component_restart (component); nice_component_restart (component);
} }
} }
...@@ -188,7 +188,7 @@ nice_stream_finalize (GObject *obj) ...@@ -188,7 +188,7 @@ nice_stream_finalize (GObject *obj)
stream = NICE_STREAM (obj); stream = NICE_STREAM (obj);
g_free (stream->name); g_free (stream->name);
g_slist_free_full (stream->components, (GDestroyNotify) component_free); g_slist_free_full (stream->components, (GDestroyNotify) g_object_unref);
g_atomic_int_inc (&n_streams_destroyed); g_atomic_int_inc (&n_streams_destroyed);
nice_debug ("Destroyed NiceStream (%u created, %u destroyed)", nice_debug ("Destroyed NiceStream (%u created, %u destroyed)",
......
...@@ -79,7 +79,7 @@ struct _NiceStream { ...@@ -79,7 +79,7 @@ struct _NiceStream {
guint id; guint id;
guint n_components; guint n_components;
gboolean initial_binding_request_received; gboolean initial_binding_request_received;
GSList *components; /* list of 'Component' structs */ GSList *components; /* list of 'NiceComponent' objects */
GSList *conncheck_list; /* list of CandidateCheckPair items */ GSList *conncheck_list; /* list of CandidateCheckPair items */
gchar local_ufrag[NICE_STREAM_MAX_UFRAG]; gchar local_ufrag[NICE_STREAM_MAX_UFRAG];
gchar local_password[NICE_STREAM_MAX_PWD]; gchar local_password[NICE_STREAM_MAX_PWD];
...@@ -105,7 +105,7 @@ nice_stream_close (NiceStream *stream); ...@@ -105,7 +105,7 @@ nice_stream_close (NiceStream *stream);
gboolean gboolean
nice_stream_all_components_ready (NiceStream *stream); nice_stream_all_components_ready (NiceStream *stream);
Component * NiceComponent *
nice_stream_find_component_by_id (NiceStream *stream, guint id); nice_stream_find_component_by_id (NiceStream *stream, guint id);
void void
......
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