Commit 01e72828 authored by Youness Alaoui's avatar Youness Alaoui
Browse files

Port libnice to the new NiceSocket API

parent 4d04f6a4
......@@ -68,8 +68,8 @@ struct _NiceAgent
GObject parent; /**< gobject pointer */
gboolean full_mode; /**< property: full-mode */
NiceUDPSocketFactory udp_socket_factory; /**< property: socket factory */
NiceUDPSocketFactory relay_socket_factory; /**< property: socket factory */
NiceSocketFactory *udp_socket_factory; /**< property: socket factory */
NiceSocketFactory *relay_socket_factory; /**< property: socket factory */
GTimeVal next_check_tv; /**< property: next conncheck timestamp */
gchar *stun_server_ip; /**< property: STUN server IP */
guint stun_server_port; /**< property: STUN server port */
......@@ -138,6 +138,6 @@ GSource *agent_timeout_add_with_context (NiceAgent *agent, guint interval, GSour
void priv_attach_stream_component_socket (NiceAgent *agent,
Stream *stream,
Component *component,
NiceUDPSocket *udp_socket);
NiceSocket *socket);
#endif /*_NICE_AGENT_PRIV_H */
......@@ -57,8 +57,7 @@
#include "debug.h"
#include "udp.h"
#include "udp-bsd.h"
#include "socket.h"
#include "udp-turn.h"
#include "candidate.h"
#include "component.h"
......@@ -377,8 +376,10 @@ nice_agent_init (NiceAgent *agent)
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS |
STUN_AGENT_USAGE_USE_FINGERPRINT);
nice_udp_bsd_socket_factory_init (&agent->udp_socket_factory);
nice_udp_turn_socket_factory_init (&agent->relay_socket_factory);
agent->udp_socket_factory =
nice_socket_factory_new (NICE_SOCKET_FACTORY_UDP_BSD);
agent->relay_socket_factory =
nice_socket_factory_new (NICE_SOCKET_FACTORY_UDP_RELAY);
agent->rng = nice_rng_new ();
priv_generate_tie_breaker (agent);
......@@ -1305,22 +1306,21 @@ _nice_agent_recv (
NiceAgent *agent,
Stream *stream,
Component *component,
NiceUDPSocket *udp_socket,
NiceSocket *socket,
guint buf_len,
gchar *buf)
{
NiceAddress from;
gint len;
len = nice_udp_socket_recv (udp_socket, &from,
buf_len, buf);
len = nice_socket_recv (socket, &from, buf_len, buf);
#ifndef NDEBUG
if (len >= 0) {
gchar tmpbuf[INET6_ADDRSTRLEN];
nice_address_to_string (&from, tmpbuf);
nice_debug ("Agent %p : Packet received on local socket %u from [%s]:%u (%u octets).", agent,
udp_socket->fileno, tmpbuf, nice_address_get_port (&from), len);
socket->fileno, tmpbuf, nice_address_get_port (&from), len);
}
#endif
......@@ -1341,7 +1341,7 @@ _nice_agent_recv (
NiceCandidate *cand = i->data;
if (cand->type == NICE_CANDIDATE_TYPE_RELAYED) {
len = nice_udp_turn_socket_parse_recv (cand->sockptr, &from, len, buf, &from, buf, len);
udp_socket = cand->sockptr;
socket = cand->sockptr;
}
}
}
......@@ -1352,7 +1352,7 @@ _nice_agent_recv (
return len;
if (conn_check_handle_inbound_stun (agent, stream, component, udp_socket,
if (conn_check_handle_inbound_stun (agent, stream, component, socket,
&from, buf, len))
/* handled STUN message*/
return 0;
......@@ -1399,7 +1399,7 @@ nice_agent_recv (
for (i = component->sockets; i; i = i->next)
{
NiceUDPSocket *sockptr = i->data;
NiceSocket *sockptr = i->data;
FD_SET (sockptr->fileno, &fds);
max_fd = MAX (sockptr->fileno, max_fd);
......@@ -1421,7 +1421,7 @@ nice_agent_recv (
for (j = 0; j <= max_fd; j++)
if (FD_ISSET (j, &fds))
{
NiceUDPSocket *socket;
NiceSocket *socket;
socket = component_find_udp_socket_by_fd (component, j);
g_assert (socket);
......@@ -1454,7 +1454,7 @@ nice_agent_recv_sock (
guint buf_len,
gchar *buf)
{
NiceUDPSocket *socket;
NiceSocket *socket;
Stream *stream;
Component *component;
guint ret = 0;
......@@ -1517,7 +1517,7 @@ nice_agent_poll_read (
for (j = component->sockets; j; j = j->next)
{
NiceUDPSocket *sockptr = j->data;
NiceSocket *sockptr = j->data;
FD_SET (sockptr->fileno, &fds);
max_fd = MAX (sockptr->fileno, max_fd);
......@@ -1554,7 +1554,7 @@ nice_agent_poll_read (
}
else
{
NiceUDPSocket *socket = NULL;
NiceSocket *socket = NULL;
Stream *stream = NULL;
Component *component = NULL;
gchar buf[MAX_BUFFER_SIZE];
......@@ -1622,7 +1622,7 @@ nice_agent_send (
if (component->selected_pair.local != NULL)
{
NiceUDPSocket *sock;
NiceSocket *sock;
NiceAddress *addr;
#ifndef NDEBUG
......@@ -1636,7 +1636,7 @@ nice_agent_send (
sock = component->selected_pair.local->sockptr;
addr = &component->selected_pair.remote->addr;
nice_udp_socket_send (sock, addr, len, buf);
nice_socket_send (sock, addr, len, buf);
component->media_after_tick = TRUE;
ret = len;
......@@ -1802,10 +1802,10 @@ nice_agent_dispose (GObject *object)
if (G_OBJECT_CLASS (nice_agent_parent_class)->dispose)
G_OBJECT_CLASS (nice_agent_parent_class)->dispose (object);
nice_udp_socket_factory_close (&agent->udp_socket_factory);
nice_udp_socket_factory_close (&agent->relay_socket_factory);
nice_socket_factory_free (agent->udp_socket_factory);
agent->udp_socket_factory = NULL;
nice_socket_factory_free (agent->relay_socket_factory);
agent->relay_socket_factory = NULL;
g_static_rec_mutex_free (&agent->mutex);
}
......@@ -1818,7 +1818,7 @@ struct _IOCtx
NiceAgent *agent;
Stream *stream;
Component *component;
NiceUDPSocket *socket;
NiceSocket *socket;
};
......@@ -1827,7 +1827,7 @@ io_ctx_new (
NiceAgent *agent,
Stream *stream,
Component *component,
NiceUDPSocket *socket)
NiceSocket *socket)
{
IOCtx *ctx;
......@@ -1888,7 +1888,7 @@ void
priv_attach_stream_component_socket (NiceAgent *agent,
Stream *stream,
Component *component,
NiceUDPSocket *udp_socket)
NiceSocket *socket)
{
GIOChannel *io;
GSource *source;
......@@ -1897,11 +1897,11 @@ priv_attach_stream_component_socket (NiceAgent *agent,
if (!component->ctx)
return;
io = g_io_channel_unix_new (udp_socket->fileno);
io = g_io_channel_unix_new (socket->fileno);
/* note: without G_IO_ERR the glib mainloop goes into
* busyloop if errors are encountered */
source = g_io_create_watch (io, G_IO_IN | G_IO_ERR);
ctx = io_ctx_new (agent, stream, component, udp_socket);
ctx = io_ctx_new (agent, stream, component, socket);
g_source_set_callback (source, (GSourceFunc) nice_agent_g_source_cb,
ctx, (GDestroyNotify) io_ctx_free);
nice_debug ("Agent %p : Attach source %p (stream %u).", agent, source, stream->id);
......
......@@ -41,7 +41,7 @@
#include <glib-object.h>
#include "udp.h"
#include "socket.h"
#include "address.h"
#include "candidate.h"
#include "random.h"
......
......@@ -39,7 +39,7 @@
#ifndef _CANDIDATE_H
#define _CANDIDATE_H
#include "udp.h"
#include "socket.h"
G_BEGIN_DECLS
......@@ -76,7 +76,7 @@ struct _NiceCandidate
guint stream_id;
guint component_id;
gchar foundation[NICE_CANDIDATE_MAX_FOUNDATION];
NiceUDPSocket *sockptr;
NiceSocket *sockptr;
gchar *username; /* pointer to a NULL-terminated username string */
gchar *password; /* pointer to a NULL-terminated password string */
};
......
......@@ -87,9 +87,8 @@ component_free (Component *cmp)
cmp->restart_candidate = NULL;
for (i = cmp->sockets; i; i = i->next) {
NiceUDPSocket *udpsocket = i->data;
nice_udp_socket_close (udpsocket);
g_slice_free (NiceUDPSocket, udpsocket);
NiceSocket *udpsocket = i->data;
nice_socket_free (udpsocket);
}
for (i = cmp->gsources; i; i = i->next) {
......@@ -130,7 +129,7 @@ component_find_udp_socket_by_fd (Component *component, guint fd)
for (i = component->sockets; i; i = i->next)
{
NiceUDPSocket *sockptr = i->data;
NiceSocket *sockptr = i->data;
if (sockptr->fileno == fd)
return sockptr;
......
......@@ -67,7 +67,7 @@ struct _CandidatePair
struct _IncomingCheck
{
NiceAddress from;
NiceUDPSocket *local_socket;
NiceSocket *local_socket;
uint32_t priority;
gboolean use_candidate;
};
......@@ -79,7 +79,7 @@ struct _Component
NiceComponentState state;
GSList *local_candidates; /**< list of Candidate objs */
GSList *remote_candidates; /**< list of Candidate objs */
GSList *sockets; /**< list of NiceUDPSocket objs */
GSList *sockets; /**< list of NiceSocket objs */
GSList *gsources; /**< list of GSource objs */
GSList *incoming_checks; /**< list of IncomingCheck objs */
NiceAddress turn_server; /**< TURN server address */
......
......@@ -62,7 +62,7 @@
static void priv_update_check_list_failed_components (NiceAgent *agent, Stream *stream);
static void priv_prune_pending_checks (Stream *stream, guint component_id);
static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream, Component *component, NiceUDPSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate);
static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream, Component *component, NiceSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate);
static void priv_mark_pair_nominated (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *remotecand);
static int priv_timer_expired (GTimeVal *restrict timer, GTimeVal *restrict now)
......@@ -286,7 +286,7 @@ static gboolean priv_conn_check_tick_stream (Stream *stream, NiceAgent *agent, G
nice_debug ("Agent %p :STUN transaction retransmitted (timeout %dms).",
agent, timeout);
nice_udp_socket_send (p->local->sockptr, &p->remote->addr,
nice_socket_send (p->local->sockptr, &p->remote->addr,
stun_message_length (&p->stun_message),
(gchar *)p->stun_buffer);
......@@ -478,7 +478,7 @@ static gboolean priv_conn_keepalive_tick (gpointer pointer)
buf_len = stun_usage_bind_keepalive (&agent->stun_agent, &msg,
buf, sizeof(buf));
nice_udp_socket_send (p->local->sockptr, &p->remote->addr, buf_len, (gchar *)buf);
nice_socket_send (p->local->sockptr, &p->remote->addr, buf_len, (gchar *)buf);
nice_debug ("Agent %p : stun_bind_keepalive for pair %p res %d.",
agent, p, (int) buf_len);
......@@ -1223,7 +1223,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
stun_timer_start (&pair->timer);
/* send the conncheck */
nice_udp_socket_send (pair->local->sockptr, &pair->remote->addr,
nice_socket_send (pair->local->sockptr, &pair->remote->addr,
buffer_len, (gchar *)pair->stun_buffer);
timeout = stun_timer_remainder (&pair->timer);
......@@ -1274,7 +1274,7 @@ static void priv_prune_pending_checks (Stream *stream, guint component_id)
* @param remote_cand remote candidate from which the inbound check was sent
* @param use_candidate whether the original check had USE-CANDIDATE attribute set
*/
static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream, Component *component, NiceUDPSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate)
static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream, Component *component, NiceSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate)
{
GSList *i;
gboolean result = FALSE;
......@@ -1347,14 +1347,14 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream,
* @param rcand remote candidate from which the request came, if NULL,
* the response is sent immediately but no other processing is done
* @param toaddr address to which reply is sent
* @param udp_socket the socket over which the request came
* @param socket the socket over which the request came
* @param rbuf_len length of STUN message to send
* @param rbuf buffer containing the STUN message to send
* @param use_candidate whether the request had USE_CANDIDATE attribute
*
* @pre (rcand == NULL || nice_address_equal(rcand->addr, toaddr) == TRUE)
*/
static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *rcand, const NiceAddress *toaddr, NiceUDPSocket *udp_socket, size_t rbuf_len, uint8_t *rbuf, gboolean use_candidate)
static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *rcand, const NiceAddress *toaddr, NiceSocket *socket, size_t rbuf_len, uint8_t *rbuf, gboolean use_candidate)
{
g_assert (rcand == NULL || nice_address_equal(&rcand->addr, toaddr) == TRUE);
......@@ -1365,18 +1365,18 @@ static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Componen
nice_debug ("Agent %p : STUN-CC RESP to '%s:%u', socket=%u, len=%u, cand=%p (c-id:%u), use-cand=%d.", agent,
tmpbuf,
nice_address_get_port (toaddr),
udp_socket->fileno,
socket->fileno,
(unsigned)rbuf_len,
rcand, component->id,
(int)use_candidate);
}
#endif
nice_udp_socket_send (udp_socket, toaddr, rbuf_len, (const gchar*)rbuf);
nice_socket_send (socket, toaddr, rbuf_len, (const gchar*)rbuf);
if (rcand) {
/* note: upon succesful check, make the reserve check immediately */
priv_schedule_triggered_check (agent, stream, component, udp_socket, rcand, use_candidate);
priv_schedule_triggered_check (agent, stream, component, socket, rcand, use_candidate);
if (use_candidate)
priv_mark_pair_nominated (agent, stream, component, rcand);
......@@ -1391,7 +1391,7 @@ static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Componen
*
* @return non-zero on error, zero on success
*/
static int priv_store_pending_check (NiceAgent *agent, Component *component, const NiceAddress *from, NiceUDPSocket *udp_socket, uint32_t priority, gboolean use_candidate)
static int priv_store_pending_check (NiceAgent *agent, Component *component, const NiceAddress *from, NiceSocket *socket, uint32_t priority, gboolean use_candidate)
{
IncomingCheck *icheck;
nice_debug ("Agent %p : Storing pending check.", agent);
......@@ -1409,7 +1409,7 @@ static int priv_store_pending_check (NiceAgent *agent, Component *component, con
if (pending) {
component->incoming_checks = pending;
icheck->from = *from;
icheck->local_socket = udp_socket;
icheck->local_socket = socket;
icheck->priority = priority;
icheck->use_candidate = use_candidate;
return 0;
......@@ -1504,7 +1504,7 @@ static void priv_check_for_role_conflict (NiceAgent *agent, gboolean control)
*
* @return pointer to a new pair if one was created, otherwise NULL
*/
static CandidateCheckPair *priv_process_response_check_for_peer_reflexive(NiceAgent *agent, Stream *stream, Component *component, CandidateCheckPair *p, NiceUDPSocket *sockptr, struct sockaddr *mapped_sockaddr, NiceCandidate *local_candidate, NiceCandidate *remote_candidate)
static CandidateCheckPair *priv_process_response_check_for_peer_reflexive(NiceAgent *agent, Stream *stream, Component *component, CandidateCheckPair *p, NiceSocket *sockptr, struct sockaddr *mapped_sockaddr, NiceCandidate *local_candidate, NiceCandidate *remote_candidate)
{
CandidateCheckPair *new_pair = NULL;
NiceAddress mapped;
......@@ -1555,7 +1555,7 @@ static CandidateCheckPair *priv_process_response_check_for_peer_reflexive(NiceAg
*
* @return TRUE if a matching transaction is found
*/
static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream *stream, Component *component, NiceUDPSocket *sockptr, const NiceAddress *from, NiceCandidate *local_candidate, NiceCandidate *remote_candidate, StunMessage *resp)
static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream *stream, Component *component, NiceSocket *sockptr, const NiceAddress *from, NiceCandidate *local_candidate, NiceCandidate *remote_candidate, StunMessage *resp)
{
struct sockaddr sockaddr;
socklen_t socklen = sizeof (sockaddr);
......@@ -1934,7 +1934,7 @@ static bool conncheck_stun_validater (StunAgent *agent,
* @param agent self pointer
* @param stream stream the packet is related to
* @param component component the packet is related to
* @param udp_socket UDP socket from which the packet was received
* @param socket socket from which the packet was received
* @param from address of the sender
* @param buf message contents
* @param buf message length
......@@ -1944,7 +1944,7 @@ static bool conncheck_stun_validater (StunAgent *agent,
* @return XXX (what FALSE means exactly?)
*/
gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
Component *component, NiceUDPSocket *udp_socket, const NiceAddress *from,
Component *component, NiceSocket *socket, const NiceAddress *from,
gchar *buf, guint len)
{
struct sockaddr sockaddr;
......@@ -1992,7 +1992,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
CandidateDiscovery *d = i->data;
if (d->type == NICE_CANDIDATE_TYPE_RELAYED &&
d->stream == stream && d->component == component &&
d->nicesock == udp_socket) {
d->nicesock == socket) {
valid = stun_agent_validate (&d->turn_agent, &req,
(uint8_t *) buf, len, conncheck_stun_validater, &validater_data);
turn_msg = TRUE;
......@@ -2022,7 +2022,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
return FALSE;
if (agent->compatibility != NICE_COMPATIBILITY_MSN) {
nice_udp_socket_send (udp_socket, from, rbuf_len, (const gchar*)rbuf);
nice_socket_send (socket, from, rbuf_len, (const gchar*)rbuf);
}
return TRUE;
}
......@@ -2034,7 +2034,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
&req, STUN_ERROR_UNAUTHORIZED)) {
rbuf_len = stun_agent_finish_message (&agent->stun_agent, &msg, NULL, 0);
if (rbuf_len > 0 && agent->compatibility != NICE_COMPATIBILITY_MSN)
nice_udp_socket_send (udp_socket, from, rbuf_len, (const gchar*)rbuf);
nice_socket_send (socket, from, rbuf_len, (const gchar*)rbuf);
}
return TRUE;
}
......@@ -2044,7 +2044,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
&req, STUN_ERROR_BAD_REQUEST)) {
rbuf_len = stun_agent_finish_message (&agent->stun_agent, &msg, NULL, 0);
if (rbuf_len > 0 && agent->compatibility != NICE_COMPATIBILITY_MSN)
nice_udp_socket_send (udp_socket, from, rbuf_len, (const gchar*)rbuf);
nice_socket_send (socket, from, rbuf_len, (const gchar*)rbuf);
}
return TRUE;
}
......@@ -2099,7 +2099,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
&req, STUN_ERROR_UNAUTHORIZED)) {
rbuf_len = stun_agent_finish_message (&agent->stun_agent, &msg, NULL, 0);
if (rbuf_len > 0&& agent->compatibility != NICE_COMPATIBILITY_MSN)
nice_udp_socket_send (udp_socket, from, rbuf_len, (const gchar*)rbuf);
nice_socket_send (socket, from, rbuf_len, (const gchar*)rbuf);
}
return TRUE;
}
......@@ -2158,12 +2158,12 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
nice_debug ("Agent %p : No matching remote candidate for incoming check ->"
"peer-reflexive candidate.", agent);
remote_candidate = discovery_learn_remote_peer_reflexive_candidate (
agent, stream, component, priority, from, udp_socket,
agent, stream, component, priority, from, socket,
local_candidate, remote_candidate2);
}
priv_reply_to_conn_check (agent, stream, component, remote_candidate,
from, udp_socket, rbuf_len, rbuf, use_candidate);
from, socket, rbuf_len, rbuf, use_candidate);
if (component->remote_candidates == NULL) {
/* case: We've got a valid binding request to a local candidate
......@@ -2173,7 +2173,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
* we get information about the remote candidates */
/* step: send a reply immediately but postpone other processing */
priv_store_pending_check (agent, component, from, udp_socket,
priv_store_pending_check (agent, component, from, socket,
priority, use_candidate);
}
} else {
......@@ -2190,7 +2190,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
/* step: let's try to match the response to an existing check context */
if (trans_found != TRUE)
trans_found = priv_map_reply_to_conn_check_request (agent, stream,
component, udp_socket, from, local_candidate, remote_candidate, &req);
component, socket, from, local_candidate, remote_candidate, &req);
/* step: let's try to match the response to an existing discovery */
if (trans_found != TRUE)
......
......@@ -86,7 +86,7 @@ void conn_check_free (NiceAgent *agent);
gboolean conn_check_schedule_next (NiceAgent *agent);
int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair);
gboolean conn_check_prune_stream (NiceAgent *agent, Stream *stream);
gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Component *component, NiceUDPSocket *udp_socket, const NiceAddress *from, gchar *buf, guint len);
gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Component *component, NiceSocket *udp_socket, const NiceAddress *from, gchar *buf, guint len);
gint conn_check_compare (const CandidateCheckPair *a, const CandidateCheckPair *b);
void conn_check_remote_candidates_set(NiceAgent *agent);
......
......@@ -281,7 +281,7 @@ NiceCandidate *discovery_add_local_host_candidate (
NiceCandidate *candidate;
Component *component;
Stream *stream;
NiceUDPSocket *udp_socket = NULL;
NiceSocket *udp_socket = NULL;
gboolean errors = FALSE;
if (!agent_find_component (agent, stream_id, component_id, &stream, &component))
......@@ -347,7 +347,7 @@ NiceCandidate *discovery_add_local_host_candidate (
if (candidate)
nice_candidate_free (candidate), candidate = NULL;
if (udp_socket)
g_slice_free (NiceUDPSocket, udp_socket);
nice_socket_free (udp_socket);
}
return candidate;
......@@ -365,7 +365,7 @@ discovery_add_server_reflexive_candidate (
guint stream_id,
guint component_id,
NiceAddress *address,
NiceUDPSocket *base_socket)
NiceSocket *base_socket)
{
NiceCandidate *candidate;
Component *component;
......@@ -422,21 +422,21 @@ discovery_add_relay_candidate (
guint stream_id,
guint component_id,
NiceAddress *address,
NiceUDPSocket *base_socket)
NiceSocket *base_socket)
{
NiceCandidate *candidate;
Component *component;
Stream *stream;
gboolean result = FALSE;
gboolean errors = FALSE;
NiceUDPSocket *relay_socket = NULL;
NiceSocket *relay_socket = NULL;
if (!agent_find_component (agent, stream_id, component_id, &stream, &component))
return NULL;
candidate = nice_candidate_new (NICE_CANDIDATE_TYPE_RELAYED);
if (candidate) {
relay_socket = g_slice_new0 (NiceUDPSocket);
relay_socket = g_slice_new0 (NiceSocket);
if (relay_socket) {
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
candidate->priority = nice_candidate_jingle_priority (candidate) * 1000;
......@@ -451,7 +451,7 @@ discovery_add_relay_candidate (
candidate->addr = *address;
/* step: link to the base candidate+socket */
if (nice_udp_turn_create_socket_full (&agent->relay_socket_factory,
if (nice_udp_turn_create_socket_full (agent->relay_socket_factory,
relay_socket, address, base_socket, &component->turn_server,
component->turn_username, component->turn_password,
priv_agent_to_udp_turn_compatibility (agent))) {
......@@ -484,7 +484,7 @@ discovery_add_relay_candidate (
if (candidate)
nice_candidate_free (candidate), candidate = NULL;
if (relay_socket)
g_slice_free (NiceUDPSocket, relay_socket);
g_slice_free (NiceSocket, relay_socket);
}
return candidate;
}
......@@ -501,7 +501,7 @@ discovery_add_peer_reflexive_candidate (
guint stream_id,
guint component_id,
NiceAddress *address,
NiceUDPSocket *base_socket,
NiceSocket *base_socket,
NiceCandidate *local,
NiceCandidate *remote)
{
......@@ -602,7 +602,7 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
Component *component,
guint32 priority,
const NiceAddress *remote_address,
NiceUDPSocket *udp_socket,
NiceSocket *udp_socket,
NiceCandidate *local,
NiceCandidate *remote)
{
......@@ -751,7 +751,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
stun_timer_start (&cand->timer);
/* send the conncheck */
nice_udp_socket_send (cand->nicesock, &cand->server,
nice_socket_send (cand->nicesock, &cand->server,
buffer_len, (gchar *)cand->stun_buffer);
/* case: success, start waiting for the result */
......@@ -800,7 +800,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
timeout);
/* TODO retransmit */
nice_udp_socket_send (cand->nicesock, &cand->server,
nice_socket_send (cand->nicesock, &cand->server,
stun_message_length (&cand->stun_message),
(gchar *)cand->stun_buffer);
......
......@@ -48,7 +48,7 @@ struct _CandidateDiscovery
NiceAgent *agent; /**< back pointer to owner */
NiceCandidateType type; /**< candidate type STUN or TURN */
guint socket; /**< XXX: should be taken from local cand: existing socket to use */
NiceUDPSocket *nicesock; /**< XXX: should be taken from local cand: existing socket to use */
NiceSocket *nicesock; /**< XXX: should be taken from local cand: existing socket to use */
NiceAddress server; /**< STUN/TURN server address */
NiceAddress *interface; /**< Address of local interface */
GTimeVal next_tick; /**< next tick timestamp */
......@@ -84,7 +84,7 @@ discovery_add_relay_candidate (
guint stream_id,
guint component_id,
NiceAddress *address,
NiceUDPSocket *base_socket);
NiceSocket *base_socket);
NiceCandidate*
discovery_add_server_reflexive_candidate (
......@@ -92,7 +92,7 @@ discovery_add_server_reflexive_candidate (
guint stream_id,
guint component_id,
NiceAddress *address,
NiceUDPSocket *base_socket);
NiceSocket *base_socket);
NiceCandidate*
discovery_add_peer_reflexive_candidate (
......@@ -100,7 +100,7 @@ discovery_add_peer_reflexive_candidate (
guint stream_id,
guint component_id,
NiceAddress *address,
NiceUDPSocket *base_socket,
NiceSocket *base_socket,
NiceCandidate *local,
NiceCandidate *remote);
......@@ -111,7 +111,7 @@ discovery_learn_remote_peer_reflexive_candidate (
Component *component,
guint32 priority,
const NiceAddress *remote_address,
NiceUDPSocket *udp_socket,
NiceSocket *udp_socket,
NiceCandidate *local,
NiceCandidate *remote);
......