diff options
author | Youness Alaoui <kakaroto@kakaroto.(none)> | 2008-10-06 17:46:58 -0400 |
---|---|---|
committer | Youness Alaoui <kakaroto@kakaroto.(none)> | 2008-10-06 17:46:58 -0400 |
commit | e048732f37732f7a4dd64f77601b475607bb4752 (patch) | |
tree | e2780ae07f7343213833888d43b17f3e83ba29b7 | |
parent | a972e82678602a0d1fee62090b79c3b1eac786c8 (diff) | |
download | libnice-e048732f37732f7a4dd64f77601b475607bb4752.tar.gz |
Update udp socket layers to new NiceSocket API
-rw-r--r-- | socket/udp-bsd.c | 18 | ||||
-rw-r--r-- | socket/udp-bsd.h | 4 | ||||
-rw-r--r-- | socket/udp-turn.c | 42 | ||||
-rw-r--r-- | socket/udp-turn.h | 20 |
4 files changed, 42 insertions, 42 deletions
diff --git a/socket/udp-bsd.c b/socket/udp-bsd.c index 3bb7326..e79b571 100644 --- a/socket/udp-bsd.c +++ b/socket/udp-bsd.c @@ -54,7 +54,7 @@ #include "udp-bsd.h" -/*** NiceUDPSocket ***/ +/*** NiceSocket ***/ static int sock_recv_err (int fd) { #ifdef MSG_ERRQUEUE @@ -74,7 +74,7 @@ static int sock_recv_err (int fd) static gint socket_recv ( - NiceUDPSocket *sock, + NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) @@ -97,7 +97,7 @@ socket_recv ( static gboolean socket_send ( - NiceUDPSocket *sock, + NiceSocket *sock, const NiceAddress *to, guint len, const gchar *buf) @@ -116,18 +116,18 @@ socket_send ( } static void -socket_close (NiceUDPSocket *sock) +socket_close (NiceSocket *sock) { close (sock->fileno); } -/*** NiceUDPSocketFactory ***/ +/*** NiceSocketFactory ***/ static gboolean socket_factory_init_socket ( G_GNUC_UNUSED - NiceUDPSocketFactory *man, - NiceUDPSocket *sock, + NiceSocketFactory *man, + NiceSocket *sock, NiceAddress *addr) { int sockfd = -1; @@ -228,7 +228,7 @@ socket_factory_init_socket ( static void socket_factory_close ( G_GNUC_UNUSED - NiceUDPSocketFactory *man) + NiceSocketFactory *man) { (void)man; } @@ -236,7 +236,7 @@ socket_factory_close ( NICEAPI_EXPORT void nice_udp_bsd_socket_factory_init ( G_GNUC_UNUSED - NiceUDPSocketFactory *man) + NiceSocketFactory *man) { man->init = socket_factory_init_socket; man->close = socket_factory_close; diff --git a/socket/udp-bsd.h b/socket/udp-bsd.h index 0459f3f..f04d8d5 100644 --- a/socket/udp-bsd.h +++ b/socket/udp-bsd.h @@ -38,12 +38,12 @@ #ifndef _UDP_BSD_H #define _UDP_BSD_H -#include "udp.h" +#include "socket.h" G_BEGIN_DECLS void -nice_udp_bsd_socket_factory_init (NiceUDPSocketFactory *man); +nice_udp_bsd_socket_factory_init (NiceSocketFactory *man); G_END_DECLS diff --git a/socket/udp-turn.c b/socket/udp-turn.c index c5728a7..c678ee7 100644 --- a/socket/udp-turn.c +++ b/socket/udp-turn.c @@ -75,7 +75,7 @@ typedef struct { GList *channels; GList *retransmissions; ChannelBinding *current_binding; - NiceUDPSocket *udp_socket; + NiceSocket *base_socket; NiceAddress server_addr; uint8_t *username; size_t username_len; @@ -148,7 +148,7 @@ priv_send_channel_bind (turn_priv *priv, StunMessage *resp, priv->password, priv->password_len); if (stun_len > 0) { - nice_udp_socket_send (priv->udp_socket, &priv->server_addr, + nice_socket_send (priv->base_socket, &priv->server_addr, stun_len, (gchar *)buffer); return TRUE; } @@ -156,7 +156,7 @@ priv_send_channel_bind (turn_priv *priv, StunMessage *resp, return FALSE; } NICEAPI_EXPORT gboolean -nice_udp_turn_socket_set_peer (NiceUDPSocket *sock, NiceAddress *peer) +nice_udp_turn_socket_set_peer (NiceSocket *sock, NiceAddress *peer) { turn_priv *priv = (turn_priv *) sock->priv; StunMessage msg; @@ -217,7 +217,7 @@ nice_udp_turn_socket_set_peer (NiceUDPSocket *sock, NiceAddress *peer) priv->current_binding = g_new0 (ChannelBinding, 1); priv->current_binding->channel = 0; priv->current_binding->peer = *peer; - nice_udp_socket_send (priv->udp_socket, &priv->server_addr, + nice_socket_send (priv->base_socket, &priv->server_addr, stun_len, (gchar *)buffer); } return TRUE; @@ -236,7 +236,7 @@ nice_udp_turn_socket_set_peer (NiceUDPSocket *sock, NiceAddress *peer) gint nice_udp_turn_socket_parse_recv ( - NiceUDPSocket *sock, + NiceSocket *sock, NiceAddress *from, guint len, gchar *buf, @@ -366,7 +366,7 @@ nice_udp_turn_socket_parse_recv ( static gint socket_recv ( - NiceUDPSocket *sock, + NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) @@ -376,7 +376,7 @@ socket_recv ( gint recv_len; NiceAddress recv_from; - recv_len = nice_udp_socket_recv (priv->udp_socket, &recv_from, + recv_len = nice_socket_recv (priv->base_socket, &recv_from, sizeof(recv_buf), (gchar *) recv_buf); return nice_udp_turn_socket_parse_recv (sock, from, len, buf, &recv_from, @@ -385,7 +385,7 @@ socket_recv ( static gboolean socket_send ( - NiceUDPSocket *sock, + NiceSocket *sock, const NiceAddress *to, guint len, const gchar *buf) @@ -460,18 +460,18 @@ socket_send ( } if (msg_len > 0) { - nice_udp_socket_send (priv->udp_socket, &priv->server_addr, + nice_socket_send (priv->base_socket, &priv->server_addr, msg_len, (gchar *)buffer); return TRUE; } send: - nice_udp_socket_send (priv->udp_socket, to, len, buf); + nice_socket_send (priv->base_socket, to, len, buf); return TRUE; } static void -socket_close (NiceUDPSocket *sock) +socket_close (NiceSocket *sock) { turn_priv *priv = (turn_priv *) sock->priv; GList *i = priv->channels; @@ -485,12 +485,12 @@ socket_close (NiceUDPSocket *sock) g_free (priv); } -/*** NiceUDPSocketFactory ***/ +/*** NiceSocketFactory ***/ static gboolean socket_factory_init_socket ( - NiceUDPSocketFactory *man, - NiceUDPSocket *sock, + NiceSocketFactory *man, + NiceSocket *sock, NiceAddress *addr) { return FALSE; @@ -498,10 +498,10 @@ socket_factory_init_socket ( NICEAPI_EXPORT gboolean nice_udp_turn_create_socket_full ( - NiceUDPSocketFactory *man, - NiceUDPSocket *sock, + NiceSocketFactory *man, + NiceSocket *sock, NiceAddress *addr, - NiceUDPSocket *udp_socket, + NiceSocket *base_socket, NiceAddress *server_addr, gchar *username, gchar *password, @@ -527,7 +527,7 @@ nice_udp_turn_create_socket_full ( priv->channels = NULL; priv->current_binding = NULL; - priv->udp_socket = udp_socket; + priv->base_socket = base_socket; if (compatibility == NICE_UDP_TURN_SOCKET_COMPATIBILITY_MSN) { priv->username = g_base64_decode (username, &priv->username_len); @@ -546,7 +546,7 @@ nice_udp_turn_create_socket_full ( priv->server_addr = *server_addr; priv->compatibility = compatibility; sock->addr = *addr; - sock->fileno = udp_socket->fileno; + sock->fileno = base_socket->fileno; sock->send = socket_send; sock->recv = socket_recv; sock->close = socket_close; @@ -557,14 +557,14 @@ nice_udp_turn_create_socket_full ( static void socket_factory_close ( G_GNUC_UNUSED - NiceUDPSocketFactory *man) + NiceSocketFactory *man) { } NICEAPI_EXPORT void nice_udp_turn_socket_factory_init ( G_GNUC_UNUSED - NiceUDPSocketFactory *man) + NiceSocketFactory *man) { man->init = socket_factory_init_socket; diff --git a/socket/udp-turn.h b/socket/udp-turn.h index 2413382..f20419c 100644 --- a/socket/udp-turn.h +++ b/socket/udp-turn.h @@ -35,10 +35,10 @@ * file under either the MPL or the LGPL. */ -#ifndef _GOOGLE_RELAY_H -#define _GOOGLE_RELAY_H +#ifndef _UDP_TURN_H +#define _UDP_TURN_H -#include "udp.h" +#include "socket.h" G_BEGIN_DECLS @@ -50,7 +50,7 @@ typedef enum { gint nice_udp_turn_socket_parse_recv ( - NiceUDPSocket *sock, + NiceSocket *sock, NiceAddress *from, guint len, gchar *buf, @@ -59,14 +59,14 @@ nice_udp_turn_socket_parse_recv ( guint recv_len); gboolean -nice_udp_turn_socket_set_peer (NiceUDPSocket *sock, NiceAddress *peer); +nice_udp_turn_socket_set_peer (NiceSocket *sock, NiceAddress *peer); gboolean nice_udp_turn_create_socket_full ( - NiceUDPSocketFactory *man, - NiceUDPSocket *sock, + NiceSocketFactory *man, + NiceSocket *sock, NiceAddress *addr, - NiceUDPSocket *udp_socket, + NiceSocket *udp_socket, NiceAddress *server_addr, gchar *username, gchar *password, @@ -74,9 +74,9 @@ nice_udp_turn_create_socket_full ( void -nice_udp_turn_socket_factory_init (NiceUDPSocketFactory *man); +nice_udp_turn_socket_factory_init (NiceSocketFactory *man); G_END_DECLS -#endif /* _UDP_BSD_H */ +#endif /* _UDP_TURN_H */ |