summaryrefslogtreecommitdiff
path: root/udp
diff options
context:
space:
mode:
authorDafydd Harries <dafydd.harries@collabora.co.uk>2007-01-20 03:34:00 +0000
committerDafydd Harries <dafydd.harries@collabora.co.uk>2007-01-20 03:34:00 +0000
commitf92750a92b52878f1f6555e0222b7604441f551e (patch)
tree2db7aa41c897a8558cda084a614ccff9ffaa9160 /udp
parent9b2d430126d765497520bb3f6b3ba47534857523 (diff)
downloadlibnice-f92750a92b52878f1f6555e0222b7604441f551e.tar.gz
fake UDP: simplify Packet struct
darcs-hash:20070120033445-c9803-09408144ece3f71be9f9631501de29bc4fd5aa39.gz
Diffstat (limited to 'udp')
-rw-r--r--udp/udp-fake.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/udp/udp-fake.c b/udp/udp-fake.c
index 31a5419..36b51dd 100644
--- a/udp/udp-fake.c
+++ b/udp/udp-fake.c
@@ -11,8 +11,7 @@ typedef struct _Packet Packet;
struct _Packet
{
- struct sockaddr_in from;
- struct sockaddr_in to;
+ struct sockaddr_in sin;
guint len;
gchar buf[1024];
};
@@ -54,7 +53,7 @@ fake_send (
packet = g_slice_new0 (Packet);
packet->len = len;
- packet->to = *to;
+ packet->sin = *to;
strncpy (packet->buf, buf, len);
man = (UDPSocketManager *) sock->priv;
@@ -87,7 +86,7 @@ fake_recv (
len = packet->len;
memcpy (buf, packet->buf, len);
- memcpy (from, &(packet->from), sizeof (*from));
+ memcpy (from, &(packet->sin), sizeof (*from));
g_slice_free (Packet, packet);
return len;
@@ -117,7 +116,7 @@ udp_fake_socket_manager_push_recv (
packet = g_slice_new0 (Packet);
packet->len = len;
- packet->from = *from;
+ packet->sin = *from;
strncpy (packet->buf, buf, len);
priv = (UDPFakeSocketManagerPriv *) man->priv;
@@ -140,7 +139,7 @@ udp_fake_socket_manager_pop_send (
if (!packet)
return 0;
- *to = packet->to;
+ *to = packet->sin;
return packet->len;
}