diff options
author | Dafydd Harries <dafydd.harries@collabora.co.uk> | 2007-02-01 18:38:00 +0000 |
---|---|---|
committer | Dafydd Harries <dafydd.harries@collabora.co.uk> | 2007-02-01 18:38:00 +0000 |
commit | 7e665bf9417639fd365278a165705e0a64c28118 (patch) | |
tree | af387fa3e13f06f3c845582408bf5d2f6486e872 /udp | |
parent | aa301c199bdfec00e5307622f47d4b39110ac23b (diff) | |
download | libnice-7e665bf9417639fd365278a165705e0a64c28118.tar.gz |
add "nice" prefix to UDP code
darcs-hash:20070201183830-c9803-6e562ea7405a931c59d56fbf67075fcaf90b1ee9.gz
Diffstat (limited to 'udp')
-rw-r--r-- | udp/test.c | 20 | ||||
-rw-r--r-- | udp/udp-bsd.c | 28 | ||||
-rw-r--r-- | udp/udp-bsd.h | 2 | ||||
-rw-r--r-- | udp/udp-client.c | 16 | ||||
-rw-r--r-- | udp/udp-echo-server.c | 6 | ||||
-rw-r--r-- | udp/udp-fake.c | 24 | ||||
-rw-r--r-- | udp/udp-fake.h | 10 | ||||
-rw-r--r-- | udp/udp-generic.c | 18 | ||||
-rw-r--r-- | udp/udp.h | 36 |
9 files changed, 80 insertions, 80 deletions
@@ -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; } diff --git a/udp/udp-bsd.c b/udp/udp-bsd.c index 9b1d491..1787678 100644 --- a/udp/udp-bsd.c +++ b/udp/udp-bsd.c @@ -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; } diff --git a/udp/udp-bsd.h b/udp/udp-bsd.h index 31b8606..8454a34 100644 --- a/udp/udp-bsd.h +++ b/udp/udp-bsd.h @@ -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 diff --git a/udp/udp-client.c b/udp/udp-client.c index 23cee7b..7b1eec6 100644 --- a/udp/udp-client.c +++ b/udp/udp-client.c @@ -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; } diff --git a/udp/udp-echo-server.c b/udp/udp-echo-server.c index e6dda2a..76dc046 100644 --- a/udp/udp-echo-server.c +++ b/udp/udp-echo-server.c @@ -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); diff --git a/udp/udp-fake.c b/udp/udp-fake.c index 1eadeb6..e5f2476 100644 --- a/udp/udp-fake.c +++ b/udp/udp-fake.c @@ -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; } diff --git a/udp/udp-fake.h b/udp/udp-fake.h index 49c5e17..9fce834 100644 --- a/udp/udp-fake.h +++ b/udp/udp-fake.h @@ -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); diff --git a/udp/udp-generic.c b/udp/udp-generic.c index 7df012c..c932640 100644 --- a/udp/udp-generic.c +++ b/udp/udp-generic.c @@ -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) (UDPSocket *sock, struct sockaddr_in *from, guint len, + gint (*recv) (NiceUDPSocket *sock, struct sockaddr_in *from, guint len, gchar *buf); - gboolean (*send) (UDPSocket *sock, struct sockaddr_in *to, guint len, + gboolean (*send) (NiceUDPSocket *sock, struct sockaddr_in *to, guint len, gchar *buf); - void (*close) (UDPSocket *sock); + void (*close) (NiceUDPSocket *sock); void *priv; }; -typedef gboolean (*UDPPacketRecvFunc) (struct sockaddr_in *from, guint len, +typedef gboolean (*NiceUDPRecvFunc) (struct sockaddr_in *from, guint len, gchar *buf); -typedef struct _UDPSocketManager UDPSocketManager; +typedef struct _UDPSocketManager NiceUDPSocketFactory; struct _UDPSocketManager { - gboolean (*init) (UDPSocketManager *man, UDPSocket *sock, + gboolean (*init) (NiceUDPSocketFactory *man, NiceUDPSocket *sock, struct sockaddr_in *sin); - void (*select) (UDPPacketRecvFunc cb); - void (*close) (UDPSocketManager *man); + void (*select) (NiceUDPRecvFunc cb); + void (*close) (NiceUDPSocketFactory *man); void *priv; }; @@ -42,30 +42,30 @@ struct _UDPSocketManager * address bound to will be set in sock->addr. */ gboolean -udp_socket_manager_alloc_socket ( - UDPSocketManager *man, - UDPSocket *sock, +nice_udp_socket_factory_make ( + NiceUDPSocketFactory *man, + NiceUDPSocket *sock, struct sockaddr_in *sin); void -udp_socket_manager_close (UDPSocketManager *man); +nice_udp_socket_factory_close (NiceUDPSocketFactory *man); guint -udp_socket_recv ( - UDPSocket *sock, +nice_udp_socket_recv ( + NiceUDPSocket *sock, struct sockaddr_in *sin, guint len, gchar *buf); void -udp_socket_send ( - UDPSocket *sock, +nice_udp_socket_send ( + NiceUDPSocket *sock, struct sockaddr_in *sin, guint len, gchar *buf); void -udp_socket_close (UDPSocket *sock); +nice_udp_socket_close (NiceUDPSocket *sock); G_END_DECLS |