Commit 7e665bf9 authored by Dafydd Harries's avatar Dafydd Harries

add "nice" prefix to UDP code

darcs-hash:20070201183830-c9803-6e562ea7405a931c59d56fbf67075fcaf90b1ee9.gz
parent aa301c19
......@@ -174,17 +174,17 @@ nice_event_free (Event *ev)
/**
* nice_agent_new:
*
* @mgr: a UDPSocketManager used for allocating sockets
* @factory: a NiceUDPSocketFactory used for allocating sockets
*
* Create a new NiceAgent.
**/
NiceAgent *
nice_agent_new (UDPSocketManager *mgr)
nice_agent_new (NiceUDPSocketFactory *factory)
{
NiceAgent *agent;
agent = g_slice_new0 (NiceAgent);
agent->sockmgr = mgr;
agent->socket_factory = factory;
agent->next_candidate_id = 1;
agent->next_stream_id = 1;
return agent;
......@@ -247,7 +247,7 @@ nice_agent_add_local_host_candidate (
sin.sin_addr.s_addr = htonl (address->addr_ipv4);
sin.sin_port = 0;
/* XXX: handle error */
udp_socket_manager_alloc_socket (agent->sockmgr, &(candidate->sock), &sin);
nice_udp_socket_factory_make (agent->socket_factory, &(candidate->sock), &sin);
candidate->port = ntohs (candidate->sock.addr.sin_port);
}
......@@ -496,7 +496,7 @@ RESPOND:
response->attributes[0] = stun_attribute_mapped_address_new (
ntohl (from.sin_addr.s_addr), ntohs (from.sin_port));
len = stun_message_pack (response, &packed);
udp_socket_send (&local->sock, &from, len, packed);
nice_udp_socket_send (&local->sock, &from, len, packed);
g_free (packed);
stun_message_free (response);
......@@ -513,7 +513,7 @@ ERROR:
response = stun_message_new (STUN_MESSAGE_BINDING_ERROR_RESPONSE,
msg->transaction_id, 0);
len = stun_message_pack (response, &packed);
udp_socket_send (&local->sock, &from, len, packed);
nice_udp_socket_send (&local->sock, &from, len, packed);
g_free (packed);
stun_message_free (response);
......@@ -542,7 +542,7 @@ _nice_agent_recv (
gchar buf[1024];
struct sockaddr_in from;
len = udp_socket_recv (&(candidate->sock), &from,
len = nice_udp_socket_recv (&(candidate->sock), &from,
sizeof (buf) / sizeof (gchar), buf);
g_assert (len > 0);
......
......@@ -57,7 +57,7 @@ struct _NiceAgent
{
guint next_candidate_id;
guint next_stream_id;
UDPSocketManager *sockmgr;
NiceUDPSocketFactory *socket_factory;
GSList *local_addresses;
GSList *local_candidates;
GSList *remote_candidates;
......@@ -72,7 +72,7 @@ typedef void (*NiceAgentRecvHandler) (
NiceAgent *
nice_agent_new (UDPSocketManager *mgr);
nice_agent_new (NiceUDPSocketFactory *factory);
Event *
nice_agent_pop_event (NiceAgent *agent);
......
......@@ -29,7 +29,7 @@ struct _NiceCandidate
guint component_id;
// guint generation;
// gchar *foundation;
UDPSocket sock;
NiceUDPSocket sock;
gchar username[128];
gchar password[128];
};
......
......@@ -29,14 +29,14 @@ main (void)
NiceAgent *agent;
NiceAddress addr;
NiceCandidate *candidate;
UDPSocketManager mgr;
UDPSocket *sock;
NiceUDPSocketFactory factory;
NiceUDPSocket *sock;
struct sockaddr_in from = {0,};
udp_fake_socket_manager_init (&mgr);
nice_udp_fake_socket_factory_init (&factory);
/* set up agent */
agent = nice_agent_new (&mgr);
agent = nice_agent_new (&factory);
nice_address_set_ipv4_from_string (&addr, "192.168.0.1");
nice_agent_add_local_address (agent, &addr);
nice_agent_add_stream (agent, handle_recv, NULL);
......@@ -45,13 +45,13 @@ main (void)
/* recieve an RTP packet */
candidate = agent->local_candidates->data;
sock = &(candidate->sock);
udp_fake_socket_push_recv (sock, &from, 7, "\x80lalala");
nice_udp_fake_socket_push_recv (sock, &from, 7, "\x80lalala");
nice_agent_recv (agent, candidate->id);
g_assert (cb_called == TRUE);
/* clean up */
nice_agent_free (agent);
udp_socket_manager_close (&mgr);
nice_udp_socket_factory_close (&factory);
return 0;
}
......
......@@ -23,7 +23,7 @@ test_stun_no_password (
struct sockaddr_in from)
{
NiceCandidate *candidate;
UDPSocket *sock;
NiceUDPSocket *sock;
guint len;
struct sockaddr_in to = {0,};
gchar buf[1024];
......@@ -42,7 +42,7 @@ test_stun_no_password (
breq = stun_message_new (STUN_MESSAGE_BINDING_REQUEST,
"0123456789abcdef", 0);
packed_len = stun_message_pack (breq, &packed);
udp_fake_socket_push_recv (sock, &from, packed_len, packed);
nice_udp_fake_socket_push_recv (sock, &from, packed_len, packed);
g_free (packed);
stun_message_free (breq);
}
......@@ -51,7 +51,7 @@ test_stun_no_password (
nice_agent_recv (agent, candidate->id);
/* error response should have been sent */
len = udp_fake_socket_pop_send (sock, &to, sizeof (buf) / sizeof (gchar),
len = nice_udp_fake_socket_pop_send (sock, &to, sizeof (buf) / sizeof (gchar),
buf);
g_assert (len != 0);
......@@ -74,7 +74,7 @@ test_stun_invalid_password (
struct sockaddr_in from)
{
NiceCandidate *candidate;
UDPSocket *sock;
NiceUDPSocket *sock;
guint len;
struct sockaddr_in to = {0,};
gchar buf[1024];
......@@ -95,7 +95,7 @@ test_stun_invalid_password (
breq->attributes[0] = stun_attribute_username_new ("lala");
packed_len = stun_message_pack (breq, &packed);
g_assert (packed_len != 0);
udp_fake_socket_push_recv (sock, &from, packed_len, packed);
nice_udp_fake_socket_push_recv (sock, &from, packed_len, packed);
g_free (packed);
stun_message_free (breq);
}
......@@ -104,7 +104,7 @@ test_stun_invalid_password (
nice_agent_recv (agent, candidate->id);
/* error should have been sent */
len = udp_fake_socket_pop_send (sock, &to, sizeof (buf) / sizeof (gchar),
len = nice_udp_fake_socket_pop_send (sock, &to, sizeof (buf) / sizeof (gchar),
buf);
g_assert (len != 0);
......@@ -127,7 +127,7 @@ test_stun_valid_password (
struct sockaddr_in from)
{
NiceCandidate *candidate;
UDPSocket *sock;
NiceUDPSocket *sock;
guint len;
guint packed_len;
struct sockaddr_in to = {0,};
......@@ -156,7 +156,7 @@ test_stun_valid_password (
g_free (username);
packed_len = stun_message_pack (breq, &packed);
g_assert (packed_len != 0);
udp_fake_socket_push_recv (sock, &from, packed_len, packed);
nice_udp_fake_socket_push_recv (sock, &from, packed_len, packed);
g_free (packed);
stun_message_free (breq);
}
......@@ -178,7 +178,7 @@ test_stun_valid_password (
nice_agent_recv (agent, candidate->id);
/* compare sent packet to expected */
len = udp_fake_socket_pop_send (sock, &to, sizeof (buf) / sizeof (gchar),
len = nice_udp_fake_socket_pop_send (sock, &to, sizeof (buf) / sizeof (gchar),
buf);
g_assert (len == packed_len);
g_assert (0 == memcmp (buf, packed, len));
......@@ -194,11 +194,11 @@ main (void)
NiceAgent *agent;
NiceAddress local_addr, remote_addr;
NiceCandidate *candidate;
UDPSocketManager mgr;
UDPSocket *sock;
NiceUDPSocketFactory factory;
NiceUDPSocket *sock;
struct sockaddr_in from = {0,};
udp_fake_socket_manager_init (&mgr);
nice_udp_fake_socket_factory_init (&factory);
nice_address_set_ipv4_from_string (&local_addr, "192.168.0.1");
nice_address_set_ipv4_from_string (&remote_addr, "192.168.0.5");
......@@ -208,7 +208,7 @@ main (void)
from.sin_port = htons (5678);
/* set up agent */
agent = nice_agent_new (&mgr);
agent = nice_agent_new (&factory);
nice_agent_add_local_address (agent, &local_addr);
nice_agent_add_stream (agent, handle_recv, NULL);
nice_agent_add_remote_candidate (agent, 1, 1, NICE_CANDIDATE_TYPE_HOST,
......@@ -224,7 +224,7 @@ main (void)
/* clean up */
nice_agent_free (agent);
udp_socket_manager_close (&mgr);
nice_udp_socket_factory_close (&factory);
return 0;
}
......
......@@ -22,14 +22,14 @@ main (void)
NiceAgent *agent;
NiceAddress addr_local, addr_remote;
NiceCandidate *candidate;
UDPSocketManager mgr;
NiceUDPSocketFactory factory;
udp_fake_socket_manager_init (&mgr);
nice_udp_fake_socket_factory_init (&factory);
nice_address_set_ipv4_from_string (&addr_local, "192.168.0.1");
nice_address_set_ipv4_from_string (&addr_remote, "192.168.0.2");
agent = nice_agent_new (&mgr);
agent = nice_agent_new (&factory);
g_assert (agent->local_addresses == NULL);
g_assert (agent->local_candidates == NULL);
......
......@@ -9,7 +9,7 @@
#include "stun.h"
static void
send_stun (UDPSocket *udpsock, struct sockaddr_in sin)
send_stun (NiceUDPSocket *udpsock, struct sockaddr_in sin)
{
gchar *packed;
guint packed_len;
......@@ -27,11 +27,11 @@ send_stun (UDPSocket *udpsock, struct sockaddr_in sin)
}
packed_len = stun_message_pack (msg, &packed);
udp_socket_send (udpsock, &sin, packed_len, packed);
nice_udp_socket_send (udpsock, &sin, packed_len, packed);
g_free (packed);
stun_message_free (msg);
packed_len = udp_socket_recv (udpsock, &sin, 1024, buf);
packed_len = nice_udp_socket_recv (udpsock, &sin, 1024, buf);
g_assert (packed_len > 0);
msg = stun_message_unpack (packed_len, buf);
g_assert (msg);
......@@ -51,8 +51,8 @@ handle_connection (guint sock)
{
gchar *line;
struct sockaddr_in sin;
UDPSocketManager man;
UDPSocket udpsock;
NiceUDPSocketFactory man;
NiceUDPSocket udpsock;
NiceCandidate *candidate;
line = readline (sock);
......@@ -67,13 +67,13 @@ handle_connection (guint sock)
g_debug ("got candidate");
udp_bsd_socket_manager_init (&man);
nice_udp_bsd_socket_factory_init (&man);
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = 0;
if (!udp_socket_manager_alloc_socket (&man, &udpsock, &sin))
if (!nice_udp_socket_factory_make (&man, &udpsock, &sin))
goto OUT;
// copy remote candidate address into sin
......@@ -83,11 +83,11 @@ handle_connection (guint sock)
// agent doesn't proactively do STUN, so we have to do it ourselves for now
send_stun (&udpsock, sin);
udp_socket_send (&udpsock, &sin, 6, "\x80hello");
udp_socket_close (&udpsock);
nice_udp_socket_send (&udpsock, &sin, 6, "\x80hello");
nice_udp_socket_close (&udpsock);
OUT:
udp_socket_manager_close (&man);
nice_udp_socket_factory_close (&man);
nice_candidate_free (candidate);
}
......
......@@ -25,15 +25,15 @@ handle_recv (
static gboolean
make_agent (
gchar *ip,
UDPSocketManager *mgr,
NiceUDPSocketFactory *factory,
NiceAgent **ret_agent,
UDPSocket **ret_sock)
NiceUDPSocket **ret_sock)
{
NiceAgent *agent;
NiceAddress addr_local;
NiceCandidate *candidate;
agent = nice_agent_new (mgr);
agent = nice_agent_new (factory);
nice_address_set_ipv4_from_string (&addr_local, ip);
nice_agent_add_local_address (agent, &addr_local);
......@@ -70,8 +70,8 @@ static void
handle_connection (guint fileno, const struct sockaddr_in *sin, gpointer data)
{
NiceAgent *agent;
UDPSocketManager mgr;
UDPSocket *sock;
NiceUDPSocketFactory factory;
NiceUDPSocket *sock;
GSList *sockets = NULL;
gchar ip_str[INET_ADDRSTRLEN];
fd_set fds;
......@@ -81,9 +81,9 @@ handle_connection (guint fileno, const struct sockaddr_in *sin, gpointer data)
inet_ntop (AF_INET, &(sin->sin_addr), ip_str, INET_ADDRSTRLEN);
g_debug ("got connection from %s:%d", ip_str, ntohs (sin->sin_port));
udp_bsd_socket_manager_init (&mgr);
nice_udp_bsd_socket_factory_init (&factory);
if (!make_agent ((gchar *) data, &mgr, &agent, &sock))
if (!make_agent ((gchar *) data, &factory, &agent, &sock))
return;
sockets = g_slist_append (sockets, sock);
......@@ -141,17 +141,17 @@ END:
while (sockets != NULL)
{
GSList *tmp;
UDPSocket *sock = sockets->data;
NiceUDPSocket *sock = sockets->data;
tmp = sockets;
sockets = sockets->next;
g_slist_free_1 (tmp);
udp_socket_close (sock);
g_slice_free (UDPSocket, sock);
nice_udp_socket_close (sock);
g_slice_free (NiceUDPSocket, sock);
}
g_slist_free (sockets);
udp_socket_manager_close (&mgr);
nice_udp_socket_factory_close (&factory);
}
static gboolean
......
......@@ -25,12 +25,12 @@ T nice_rng_generate_bytes
T nice_rng_generate_bytes_print
T nice_rng_generate_int
T nice_rng_new
T udp_bsd_socket_manager_init
T udp_fake_socket_manager_init
T udp_fake_socket_pop_send
T udp_fake_socket_push_recv
T udp_socket_close
T udp_socket_manager_alloc_socket
T udp_socket_manager_close
T udp_socket_recv
T udp_socket_send
T nice_udp_bsd_socket_factory_init
T nice_udp_fake_socket_factory_init
T nice_udp_fake_socket_pop_send
T nice_udp_fake_socket_push_recv
T nice_udp_socket_close
T nice_udp_socket_factory_close
T nice_udp_socket_factory_make
T nice_udp_socket_recv
T nice_udp_socket_send
......@@ -7,13 +7,13 @@
int
main (void)
{
UDPSocketManager man;
UDPSocket sock;
NiceUDPSocketFactory man;
NiceUDPSocket sock;
struct sockaddr_in sin = {0,};
guint len;
gchar buf[1024];
udp_fake_socket_manager_init (&man);
nice_udp_fake_socket_factory_init (&man);
memset (buf, '\0', 1024);
......@@ -21,7 +21,7 @@ main (void)
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = 0;
udp_socket_manager_alloc_socket (&man, &sock, &sin);
nice_udp_socket_factory_make (&man, &sock, &sin);
/* test recv */
......@@ -29,12 +29,12 @@ main (void)
len = 5;
sin.sin_addr.s_addr = htonl (0x01020304);
sin.sin_port = htons (2345);
udp_fake_socket_push_recv (&sock, &sin, len, buf);
nice_udp_fake_socket_push_recv (&sock, &sin, len, buf);
memset (buf, '\0', 5);
memset (&sin, '\0', sizeof (sin));
len = udp_socket_recv (&sock, &sin, sizeof (buf), buf);
len = nice_udp_socket_recv (&sock, &sin, sizeof (buf), buf);
g_assert (len == 5);
g_assert (memcmp (buf, "he\0lo", 5) == 0);
g_assert (ntohl (sin.sin_addr.s_addr) == 0x01020304);
......@@ -44,19 +44,19 @@ main (void)
memcpy (buf, "la\0la", 5);
len = 5;
udp_socket_send (&sock, &sin, len, buf);
nice_udp_socket_send (&sock, &sin, len, buf);
memset (buf, '\0', len);
memset (&sin, '\0', sizeof (sin));
len = udp_fake_socket_pop_send (&sock, &sin, sizeof (buf), buf);
len = nice_udp_fake_socket_pop_send (&sock, &sin, sizeof (buf), buf);
g_assert (len == 5);
g_assert (0 == memcmp (buf, "la\0la", 5));
g_assert (ntohl (sin.sin_addr.s_addr) == 0x01020304);
g_assert (ntohs (sin.sin_port) == 2345);
udp_socket_close (&sock);
udp_socket_manager_close (&man);
nice_udp_socket_close (&sock);
nice_udp_socket_factory_close (&man);
return 0;
}
......@@ -8,11 +8,11 @@
#include "udp-bsd.h"
/*** UDPSocket ***/
/*** NiceUDPSocket ***/
static gint
socket_recv (
UDPSocket *sock,
NiceUDPSocket *sock,
struct sockaddr_in *from,
guint len,
gchar *buf)
......@@ -28,7 +28,7 @@ socket_recv (
static gboolean
socket_send (
UDPSocket *sock,
NiceUDPSocket *sock,
struct sockaddr_in *to,
guint len,
gchar *buf)
......@@ -39,17 +39,17 @@ socket_send (
}
static void
socket_close (UDPSocket *sock)
socket_close (NiceUDPSocket *sock)
{
close (sock->fileno);
}
/*** UDPSocketManager ***/
/*** NiceUDPSocketFactory ***/
static gboolean
socket_manager_init_socket (
UDPSocketManager *man,
UDPSocket *sock,
socket_factory_init_socket (
NiceUDPSocketFactory *man,
NiceUDPSocket *sock,
struct sockaddr_in *sin)
{
gint sockfd;
......@@ -81,21 +81,21 @@ socket_manager_init_socket (
}
static void
socket_manager_select (UDPPacketRecvFunc cb)
socket_factory_select (NiceUDPRecvFunc cb)
{
g_assert_not_reached ();
}
static void
socket_manager_close (UDPSocketManager *man)
socket_factory_close (NiceUDPSocketFactory *man)
{
}
void
udp_bsd_socket_manager_init (UDPSocketManager *man)
nice_udp_bsd_socket_factory_init (NiceUDPSocketFactory *man)
{
man->init = socket_manager_init_socket;
man->select = socket_manager_select;
man->close = socket_manager_close;
man->init = socket_factory_init_socket;
man->select = socket_factory_select;
man->close = socket_factory_close;
}
......@@ -7,7 +7,7 @@
G_BEGIN_DECLS
void
udp_bsd_socket_manager_init (UDPSocketManager *man);
nice_udp_bsd_socket_factory_init (NiceUDPSocketFactory *man);
G_END_DECLS
......
......@@ -7,13 +7,13 @@
gint
main (void)
{
UDPSocketManager man;
UDPSocket sock;
NiceUDPSocketFactory man;
NiceUDPSocket sock;
struct sockaddr_in sin;
udp_bsd_socket_manager_init (&man);
nice_udp_bsd_socket_factory_init (&man);
if (!udp_socket_manager_alloc_socket (&man, &sock, NULL))
if (!nice_udp_socket_factory_make (&man, &sock, NULL))
g_assert_not_reached ();
if (inet_pton (AF_INET, "127.0.0.1", &(sin.sin_addr)) < 0)
......@@ -30,13 +30,13 @@ main (void)
if (fgets (buf, sizeof (buf), stdin) == NULL)
break;
udp_socket_send (&sock, &sin, strlen (buf), buf);
length = udp_socket_recv (&sock, NULL, sizeof (buf), buf);
nice_udp_socket_send (&sock, &sin, strlen (buf), buf);
length = nice_udp_socket_recv (&sock, NULL, sizeof (buf), buf);
g_print (buf);
}
udp_socket_close (&sock);
udp_socket_manager_close (&man);
nice_udp_socket_close (&sock);
nice_udp_socket_factory_close (&man);
return 0;
}
......@@ -4,11 +4,11 @@
gint
main (void)
{
UDPSocketManager man;
UDPSocket sock;
NiceUDPSocketFactory man;
NiceUDPSocket sock;
struct sockaddr_in sin;
udp_bsd_socket_manager_init (&man);
nice_udp_bsd_socket_factory_init (&man);
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons (9999);
......
......@@ -44,7 +44,7 @@ _g_slist_pop (GSList **list)
static gboolean
fake_send (
UDPSocket *sock,
NiceUDPSocket *sock,
struct sockaddr_in *to,
guint len,
gchar *buf)
......@@ -65,7 +65,7 @@ fake_send (
static gint
fake_recv (
UDPSocket *sock,
NiceUDPSocket *sock,
struct sockaddr_in *from,
guint len,
gchar *buf)
......@@ -82,7 +82,7 @@ fake_recv (
}
static void
fake_close (UDPSocket *sock)
fake_close (NiceUDPSocket *sock)
{
UDPFakeSocketPriv *priv;
......@@ -95,8 +95,8 @@ fake_close (UDPSocket *sock)
/* XXX: copied INADDR_ANY to sock->addr rather than using a valid address */
static gboolean
fake_socket_init (
UDPSocketManager *man,
UDPSocket *sock,
NiceUDPSocketFactory *man,
NiceUDPSocket *sock,
struct sockaddr_in *sin)
{
int fds[2];
......@@ -127,8 +127,8 @@ fake_socket_init (
}
void
udp_fake_socket_push_recv (
UDPSocket *sock,
nice_udp_fake_socket_push_recv (
NiceUDPSocket *sock,
struct sockaddr_in *from,
guint len,
gchar *buf)
......@@ -142,8 +142,8 @@ udp_fake_socket_push_recv (
}
guint
udp_fake_socket_pop_send (
UDPSocket *sock,
nice_udp_fake_socket_pop_send (
NiceUDPSocket *sock,
struct sockaddr_in *to,
guint len,
gchar *buf)
......@@ -165,16 +165,16 @@ udp_fake_socket_pop_send (
}
static void
fake_socket_manager_close (UDPSocketManager *man)
fake_socket_factory_close (NiceUDPSocketFactory *man)
{
}
void
udp_fake_socket_manager_init (UDPSocketManager *man)
nice_udp_fake_socket_factory_init (NiceUDPSocketFactory *man)
{
man->init = fake_socket_init;
man->select = NULL;
man->close = fake_socket_manager_close;
man->close = fake_socket_factory_close;
man->priv = NULL;
}
......@@ -7,18 +7,18 @@
G_BEGIN_DECLS
void
udp_fake_socket_manager_init (UDPSocketManager *man);
nice_udp_fake_socket_factory_init (NiceUDPSocketFactory *man);
void
udp_fake_socket_push_recv (
UDPSocket *man,
nice_udp_fake_socket_push_recv (
NiceUDPSocket *man,
struct sockaddr_in *from,
guint len,
gchar *buf);
guint
udp_fake_socket_pop_send (
UDPSocket *man,
nice_udp_fake_socket_pop_send (
NiceUDPSocket *man,
struct sockaddr_in *to,
guint len,
gchar *buf);
......
......@@ -6,23 +6,23 @@
#include <udp.h>
gboolean
udp_socket_manager_alloc_socket (
UDPSocketManager *man,
UDPSocket *sock,
nice_udp_socket_factory_make (
NiceUDPSocketFactory *man,
NiceUDPSocket *sock,
struct sockaddr_in *sin)
{
return man->init (man, sock, sin);
}
void
udp_socket_manager_close (UDPSocketManager *man)
nice_udp_socket_factory_close (NiceUDPSocketFactory *man)
{
man->close (man);
}
guint
udp_socket_recv (
UDPSocket *sock,
nice_udp_socket_recv (
NiceUDPSocket *sock,
struct sockaddr_in *sin,
guint len,
gchar *buf)
......@@ -31,8 +31,8 @@ udp_socket_recv (
}
void
udp_socket_send (
UDPSocket *sock,
nice_udp_socket_send (
NiceUDPSocket *sock,
struct sockaddr_in *sin,
guint len,
gchar *buf)
......@@ -41,7 +41,7 @@ udp_socket_send (
}
void
udp_socket_close (UDPSocket *sock)
nice_udp_socket_close (NiceUDPSocket *sock)
{
sock->close (sock);
}
......
......@@ -8,31 +8,31 @@
G_BEGIN_DECLS
typedef struct _UDPSocket UDPSocket;
typedef struct _UDPSocket NiceUDPSocket;
struct _UDPSocket
{
struct sockaddr_in addr;
guint fileno;
gint (*recv