diff options
author | Nils Durner <durner@gnunet.org> | 2009-08-23 22:11:49 +0000 |
---|---|---|
committer | Nils Durner <durner@gnunet.org> | 2009-08-23 22:11:49 +0000 |
commit | 2518cfc0a86865ebe4d0550e0013ed52a494231b (patch) | |
tree | e9a130b782597e18bcff24a9fdab6e5c6aae1f9c /src/util/test_network.c | |
parent | 2ae973618f3b51fa9bbf5532eaa1352cafc24ecc (diff) | |
download | gnunet-2518cfc0a86865ebe4d0550e0013ed52a494231b.tar.gz gnunet-2518cfc0a86865ebe4d0550e0013ed52a494231b.zip |
low level network API
Diffstat (limited to 'src/util/test_network.c')
-rw-r--r-- | src/util/test_network.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/util/test_network.c b/src/util/test_network.c index cb0656921..6f09c4fce 100644 --- a/src/util/test_network.c +++ b/src/util/test_network.c | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_common.h" | 25 | #include "gnunet_common.h" |
26 | #include "gnunet_network_lib.h" | 26 | #include "gnunet_connection_lib.h" |
27 | #include "gnunet_scheduler_lib.h" | 27 | #include "gnunet_scheduler_lib.h" |
28 | #include "gnunet_time_lib.h" | 28 | #include "gnunet_time_lib.h" |
29 | 29 | ||
@@ -49,24 +49,24 @@ static int ls; | |||
49 | * | 49 | * |
50 | * @return -1 on error, otherwise the listen socket | 50 | * @return -1 on error, otherwise the listen socket |
51 | */ | 51 | */ |
52 | static int | 52 | static struct GNUNET_NETWORK_Descriptor * |
53 | open_listen_socket () | 53 | open_listen_socket () |
54 | { | 54 | { |
55 | const static int on = 1; | 55 | const static int on = 1; |
56 | struct sockaddr_in sa; | 56 | struct sockaddr_in sa; |
57 | int fd; | 57 | struct GNUNET_NETWORK_Descriptor *desc; |
58 | 58 | ||
59 | memset (&sa, 0, sizeof (sa)); | 59 | memset (&sa, 0, sizeof (sa)); |
60 | sa.sin_port = htons (PORT); | 60 | sa.sin_port = htons (PORT); |
61 | sa.sin_family = AF_INET; | 61 | sa.sin_family = AF_INET; |
62 | fd = SOCKET (AF_INET, SOCK_STREAM, 0); | 62 | desc = GNUNET_NETWORK_socket_socket (AF_INET, SOCK_STREAM, 0); |
63 | GNUNET_assert (fd >= 0); | 63 | GNUNET_assert (desc != NULL); |
64 | if (SETSOCKOPT (fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0) | 64 | if (GNUNET_NETWORK_socket_setsockopt (desc, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) < 0) |
65 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 65 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
66 | "setsockopt"); | 66 | "setsockopt"); |
67 | GNUNET_assert (BIND (fd, &sa, sizeof (sa)) >= 0); | 67 | GNUNET_assert (GNUNET_NETWORK_socket_bind (desc, &sa, sizeof (sa)) >= 0); |
68 | LISTEN (fd, 5); | 68 | GNUNET_NETWORK_socket_listen (desc, 5); |
69 | return fd; | 69 | return desc; |
70 | } | 70 | } |
71 | 71 | ||
72 | static void | 72 | static void |
@@ -166,7 +166,7 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
166 | #if VERBOSE | 166 | #if VERBOSE |
167 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test prepares to accept\n"); | 167 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test prepares to accept\n"); |
168 | #endif | 168 | #endif |
169 | GNUNET_SCHEDULER_add_read (tc->sched, | 169 | GNUNET_SCHEDULER_add_read_net (tc->sched, |
170 | GNUNET_NO, | 170 | GNUNET_NO, |
171 | GNUNET_SCHEDULER_PRIORITY_HIGH, | 171 | GNUNET_SCHEDULER_PRIORITY_HIGH, |
172 | GNUNET_SCHEDULER_NO_TASK, | 172 | GNUNET_SCHEDULER_NO_TASK, |