diff options
author | Nils Durner <durner@gnunet.org> | 2009-08-09 08:25:58 +0000 |
---|---|---|
committer | Nils Durner <durner@gnunet.org> | 2009-08-09 08:25:58 +0000 |
commit | b309c5f5ae339faf3632f7ee3a86520981f6523a (patch) | |
tree | 76a946e557092b5a7dd88119e2193a1849890bc0 /src/util | |
parent | 3ec9635b91ede9037261608d3d173e348c7d9bd8 (diff) | |
download | gnunet-b309c5f5ae339faf3632f7ee3a86520981f6523a.tar.gz gnunet-b309c5f5ae339faf3632f7ee3a86520981f6523a.zip |
rename NETWORK_socket API to NETWORK_connection (to make room for the new actual NET API)
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/client.c | 16 | ||||
-rw-r--r-- | src/util/network.c | 76 | ||||
-rw-r--r-- | src/util/server.c | 26 | ||||
-rw-r--r-- | src/util/test_network.c | 26 | ||||
-rw-r--r-- | src/util/test_network_addressing.c | 28 | ||||
-rw-r--r-- | src/util/test_network_receive_cancel.c | 24 | ||||
-rw-r--r-- | src/util/test_network_timeout.c | 16 | ||||
-rw-r--r-- | src/util/test_network_timeout_no_connect.c | 6 | ||||
-rw-r--r-- | src/util/test_network_transmit_cancel.c | 10 |
9 files changed, 114 insertions, 114 deletions
diff --git a/src/util/client.c b/src/util/client.c index ab50d9d4d..4e6e09066 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -48,7 +48,7 @@ struct GNUNET_CLIENT_Connection | |||
48 | /** | 48 | /** |
49 | * the socket handle, NULL if not live | 49 | * the socket handle, NULL if not live |
50 | */ | 50 | */ |
51 | struct GNUNET_NETWORK_SocketHandle *sock; | 51 | struct GNUNET_NETWORK_ConnectionHandle *sock; |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Our scheduler. | 54 | * Our scheduler. |
@@ -127,7 +127,7 @@ GNUNET_CLIENT_connect (struct GNUNET_SCHEDULER_Handle *sched, | |||
127 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 127 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
128 | { | 128 | { |
129 | struct GNUNET_CLIENT_Connection *ret; | 129 | struct GNUNET_CLIENT_Connection *ret; |
130 | struct GNUNET_NETWORK_SocketHandle *sock; | 130 | struct GNUNET_NETWORK_ConnectionHandle *sock; |
131 | char *hostname; | 131 | char *hostname; |
132 | unsigned long long port; | 132 | unsigned long long port; |
133 | 133 | ||
@@ -147,7 +147,7 @@ GNUNET_CLIENT_connect (struct GNUNET_SCHEDULER_Handle *sched, | |||
147 | service_name); | 147 | service_name); |
148 | return NULL; | 148 | return NULL; |
149 | } | 149 | } |
150 | sock = GNUNET_NETWORK_socket_create_from_connect (sched, | 150 | sock = GNUNET_NETWORK_connection_create_from_connect (sched, |
151 | hostname, | 151 | hostname, |
152 | port, | 152 | port, |
153 | GNUNET_SERVER_MAX_MESSAGE_SIZE); | 153 | GNUNET_SERVER_MAX_MESSAGE_SIZE); |
@@ -184,7 +184,7 @@ void | |||
184 | GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *sock) | 184 | GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *sock) |
185 | { | 185 | { |
186 | GNUNET_assert (sock->sock != NULL); | 186 | GNUNET_assert (sock->sock != NULL); |
187 | GNUNET_NETWORK_socket_destroy (sock->sock); | 187 | GNUNET_NETWORK_connection_destroy (sock->sock); |
188 | sock->sock = NULL; | 188 | sock->sock = NULL; |
189 | sock->receiver_handler = NULL; | 189 | sock->receiver_handler = NULL; |
190 | GNUNET_SCHEDULER_add_after (sock->sched, | 190 | GNUNET_SCHEDULER_add_after (sock->sched, |
@@ -331,7 +331,7 @@ GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *sock, | |||
331 | GNUNET_SCHEDULER_NO_TASK, | 331 | GNUNET_SCHEDULER_NO_TASK, |
332 | &receive_task, sock); | 332 | &receive_task, sock); |
333 | else | 333 | else |
334 | sock->receiver_task = GNUNET_NETWORK_receive (sock->sock, | 334 | sock->receiver_task = GNUNET_NETWORK_connection_receive (sock->sock, |
335 | GNUNET_SERVER_MAX_MESSAGE_SIZE, | 335 | GNUNET_SERVER_MAX_MESSAGE_SIZE, |
336 | timeout, | 336 | timeout, |
337 | &receive_helper, sock); | 337 | &receive_helper, sock); |
@@ -362,7 +362,7 @@ write_shutdown (void *cls, size_t size, void *buf) | |||
362 | void | 362 | void |
363 | GNUNET_CLIENT_service_shutdown (struct GNUNET_CLIENT_Connection *sock) | 363 | GNUNET_CLIENT_service_shutdown (struct GNUNET_CLIENT_Connection *sock) |
364 | { | 364 | { |
365 | GNUNET_NETWORK_notify_transmit_ready (sock->sock, | 365 | GNUNET_NETWORK_connection_notify_transmit_ready (sock->sock, |
366 | sizeof (struct GNUNET_MessageHeader), | 366 | sizeof (struct GNUNET_MessageHeader), |
367 | GNUNET_TIME_UNIT_FOREVER_REL, | 367 | GNUNET_TIME_UNIT_FOREVER_REL, |
368 | &write_shutdown, NULL); | 368 | &write_shutdown, NULL); |
@@ -478,7 +478,7 @@ GNUNET_CLIENT_service_test (struct GNUNET_SCHEDULER_Handle *sched, | |||
478 | conn->test_cb = task; | 478 | conn->test_cb = task; |
479 | conn->test_cb_cls = task_cls; | 479 | conn->test_cb_cls = task_cls; |
480 | if (NULL == | 480 | if (NULL == |
481 | GNUNET_NETWORK_notify_transmit_ready (conn->sock, | 481 | GNUNET_NETWORK_connection_notify_transmit_ready (conn->sock, |
482 | sizeof (struct | 482 | sizeof (struct |
483 | GNUNET_MessageHeader), | 483 | GNUNET_MessageHeader), |
484 | timeout, &write_test, NULL)) | 484 | timeout, &write_test, NULL)) |
@@ -515,7 +515,7 @@ GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *sock, | |||
515 | GNUNET_NETWORK_TransmitReadyNotify | 515 | GNUNET_NETWORK_TransmitReadyNotify |
516 | notify, void *notify_cls) | 516 | notify, void *notify_cls) |
517 | { | 517 | { |
518 | return GNUNET_NETWORK_notify_transmit_ready (sock->sock, | 518 | return GNUNET_NETWORK_connection_notify_transmit_ready (sock->sock, |
519 | size, | 519 | size, |
520 | timeout, notify, notify_cls); | 520 | timeout, notify, notify_cls); |
521 | } | 521 | } |
diff --git a/src/util/network.c b/src/util/network.c index 9b61bd8c2..3ee19cfb2 100644 --- a/src/util/network.c +++ b/src/util/network.c | |||
@@ -66,7 +66,7 @@ struct GNUNET_NETWORK_TransmitHandle | |||
66 | /** | 66 | /** |
67 | * Our socket handle. | 67 | * Our socket handle. |
68 | */ | 68 | */ |
69 | struct GNUNET_NETWORK_SocketHandle *sh; | 69 | struct GNUNET_NETWORK_ConnectionHandle *sh; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Timeout for receiving (in absolute time). | 72 | * Timeout for receiving (in absolute time). |
@@ -89,7 +89,7 @@ struct GNUNET_NETWORK_TransmitHandle | |||
89 | /** | 89 | /** |
90 | * @brief handle for a network socket | 90 | * @brief handle for a network socket |
91 | */ | 91 | */ |
92 | struct GNUNET_NETWORK_SocketHandle | 92 | struct GNUNET_NETWORK_ConnectionHandle |
93 | { | 93 | { |
94 | 94 | ||
95 | /** | 95 | /** |
@@ -167,7 +167,7 @@ struct GNUNET_NETWORK_SocketHandle | |||
167 | GNUNET_SCHEDULER_TaskIdentifier write_task; | 167 | GNUNET_SCHEDULER_TaskIdentifier write_task; |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * The handle we return for GNUNET_NETWORK_notify_transmit_ready. | 170 | * The handle we return for GNUNET_NETWORK_connection_notify_transmit_ready. |
171 | */ | 171 | */ |
172 | struct GNUNET_NETWORK_TransmitHandle nth; | 172 | struct GNUNET_NETWORK_TransmitHandle nth; |
173 | 173 | ||
@@ -217,13 +217,13 @@ struct GNUNET_NETWORK_SocketHandle | |||
217 | * 0 for sockets that need no write buffers, such as listen sockets) | 217 | * 0 for sockets that need no write buffers, such as listen sockets) |
218 | * @return the boxed socket handle | 218 | * @return the boxed socket handle |
219 | */ | 219 | */ |
220 | struct GNUNET_NETWORK_SocketHandle * | 220 | struct GNUNET_NETWORK_ConnectionHandle * |
221 | GNUNET_NETWORK_socket_create_from_existing (struct GNUNET_SCHEDULER_Handle | 221 | GNUNET_NETWORK_connection_create_from_existing (struct GNUNET_SCHEDULER_Handle |
222 | *sched, int osSocket, | 222 | *sched, int osSocket, |
223 | size_t maxbuf) | 223 | size_t maxbuf) |
224 | { | 224 | { |
225 | struct GNUNET_NETWORK_SocketHandle *ret; | 225 | struct GNUNET_NETWORK_ConnectionHandle *ret; |
226 | ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_SocketHandle) + maxbuf); | 226 | ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_ConnectionHandle) + maxbuf); |
227 | ret->write_buffer = (char *) &ret[1]; | 227 | ret->write_buffer = (char *) &ret[1]; |
228 | ret->write_buffer_size = maxbuf; | 228 | ret->write_buffer_size = maxbuf; |
229 | ret->sock = osSocket; | 229 | ret->sock = osSocket; |
@@ -244,14 +244,14 @@ GNUNET_NETWORK_socket_create_from_existing (struct GNUNET_SCHEDULER_Handle | |||
244 | * 0 for sockets that need no write buffers, such as listen sockets) | 244 | * 0 for sockets that need no write buffers, such as listen sockets) |
245 | * @return the socket handle, NULL on error | 245 | * @return the socket handle, NULL on error |
246 | */ | 246 | */ |
247 | struct GNUNET_NETWORK_SocketHandle * | 247 | struct GNUNET_NETWORK_ConnectionHandle * |
248 | GNUNET_NETWORK_socket_create_from_accept (struct GNUNET_SCHEDULER_Handle | 248 | GNUNET_NETWORK_connection_create_from_accept (struct GNUNET_SCHEDULER_Handle |
249 | *sched, | 249 | *sched, |
250 | GNUNET_NETWORK_AccessCheck access, | 250 | GNUNET_NETWORK_AccessCheck access, |
251 | void *access_cls, int lsock, | 251 | void *access_cls, int lsock, |
252 | size_t maxbuf) | 252 | size_t maxbuf) |
253 | { | 253 | { |
254 | struct GNUNET_NETWORK_SocketHandle *ret; | 254 | struct GNUNET_NETWORK_ConnectionHandle *ret; |
255 | char addr[32]; | 255 | char addr[32]; |
256 | socklen_t addrlen; | 256 | socklen_t addrlen; |
257 | int fd; | 257 | int fd; |
@@ -320,7 +320,7 @@ GNUNET_NETWORK_socket_create_from_accept (struct GNUNET_SCHEDULER_Handle | |||
320 | _("Accepting connection from `%s'\n"), | 320 | _("Accepting connection from `%s'\n"), |
321 | GNUNET_a2s(uaddr, addrlen)); | 321 | GNUNET_a2s(uaddr, addrlen)); |
322 | #endif | 322 | #endif |
323 | ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_SocketHandle) + maxbuf); | 323 | ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_ConnectionHandle) + maxbuf); |
324 | ret->write_buffer = (char *) &ret[1]; | 324 | ret->write_buffer = (char *) &ret[1]; |
325 | ret->write_buffer_size = maxbuf; | 325 | ret->write_buffer_size = maxbuf; |
326 | ret->addr = uaddr; | 326 | ret->addr = uaddr; |
@@ -339,7 +339,7 @@ GNUNET_NETWORK_socket_create_from_accept (struct GNUNET_SCHEDULER_Handle | |||
339 | * @return GNUNET_OK on success | 339 | * @return GNUNET_OK on success |
340 | */ | 340 | */ |
341 | int | 341 | int |
342 | GNUNET_NETWORK_socket_get_address (struct GNUNET_NETWORK_SocketHandle *sock, | 342 | GNUNET_NETWORK_connection_get_address (struct GNUNET_NETWORK_ConnectionHandle *sock, |
343 | void **addr, size_t * addrlen) | 343 | void **addr, size_t * addrlen) |
344 | { | 344 | { |
345 | if ((sock->addr == NULL) || (sock->addrlen == 0)) | 345 | if ((sock->addr == NULL) || (sock->addrlen == 0)) |
@@ -414,7 +414,7 @@ socket_set_blocking (int handle, int doBlock) | |||
414 | * families as specified in the "address_families" array. | 414 | * families as specified in the "address_families" array. |
415 | */ | 415 | */ |
416 | static void | 416 | static void |
417 | try_lookup (struct GNUNET_NETWORK_SocketHandle *sock) | 417 | try_lookup (struct GNUNET_NETWORK_ConnectionHandle *sock) |
418 | { | 418 | { |
419 | struct addrinfo hints; | 419 | struct addrinfo hints; |
420 | int ec; | 420 | int ec; |
@@ -446,7 +446,7 @@ try_lookup (struct GNUNET_NETWORK_SocketHandle *sock) | |||
446 | * @return GNUNET_SYSERR error (no more addresses to try) | 446 | * @return GNUNET_SYSERR error (no more addresses to try) |
447 | */ | 447 | */ |
448 | static int | 448 | static int |
449 | try_connect (struct GNUNET_NETWORK_SocketHandle *sock) | 449 | try_connect (struct GNUNET_NETWORK_ConnectionHandle *sock) |
450 | { | 450 | { |
451 | int s; | 451 | int s; |
452 | 452 | ||
@@ -536,7 +536,7 @@ static void | |||
536 | connect_continuation (void *cls, | 536 | connect_continuation (void *cls, |
537 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 537 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
538 | { | 538 | { |
539 | struct GNUNET_NETWORK_SocketHandle *sock = cls; | 539 | struct GNUNET_NETWORK_ConnectionHandle *sock = cls; |
540 | unsigned int len; | 540 | unsigned int len; |
541 | int error; | 541 | int error; |
542 | 542 | ||
@@ -605,14 +605,14 @@ connect_continuation (void *cls, | |||
605 | * 0 for sockets that need no write buffers, such as listen sockets) | 605 | * 0 for sockets that need no write buffers, such as listen sockets) |
606 | * @return the socket handle | 606 | * @return the socket handle |
607 | */ | 607 | */ |
608 | struct GNUNET_NETWORK_SocketHandle * | 608 | struct GNUNET_NETWORK_ConnectionHandle * |
609 | GNUNET_NETWORK_socket_create_from_connect (struct GNUNET_SCHEDULER_Handle | 609 | GNUNET_NETWORK_connection_create_from_connect (struct GNUNET_SCHEDULER_Handle |
610 | *sched, const char *hostname, | 610 | *sched, const char *hostname, |
611 | uint16_t port, size_t maxbuf) | 611 | uint16_t port, size_t maxbuf) |
612 | { | 612 | { |
613 | struct GNUNET_NETWORK_SocketHandle *ret; | 613 | struct GNUNET_NETWORK_ConnectionHandle *ret; |
614 | 614 | ||
615 | ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_SocketHandle) + maxbuf); | 615 | ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_ConnectionHandle) + maxbuf); |
616 | ret->sock = -1; | 616 | ret->sock = -1; |
617 | ret->sched = sched; | 617 | ret->sched = sched; |
618 | ret->write_buffer = (char *) &ret[1]; | 618 | ret->write_buffer = (char *) &ret[1]; |
@@ -652,14 +652,14 @@ GNUNET_NETWORK_socket_create_from_connect (struct GNUNET_SCHEDULER_Handle | |||
652 | * 0 for sockets that need no write buffers, such as listen sockets) | 652 | * 0 for sockets that need no write buffers, such as listen sockets) |
653 | * @return the socket handle | 653 | * @return the socket handle |
654 | */ | 654 | */ |
655 | struct GNUNET_NETWORK_SocketHandle * | 655 | struct GNUNET_NETWORK_ConnectionHandle * |
656 | GNUNET_NETWORK_socket_create_from_sockaddr (struct GNUNET_SCHEDULER_Handle | 656 | GNUNET_NETWORK_connection_create_from_sockaddr (struct GNUNET_SCHEDULER_Handle |
657 | *sched, int af_family, | 657 | *sched, int af_family, |
658 | const struct sockaddr *serv_addr, | 658 | const struct sockaddr *serv_addr, |
659 | socklen_t addrlen, size_t maxbuf) | 659 | socklen_t addrlen, size_t maxbuf) |
660 | { | 660 | { |
661 | int s; | 661 | int s; |
662 | struct GNUNET_NETWORK_SocketHandle *ret; | 662 | struct GNUNET_NETWORK_ConnectionHandle *ret; |
663 | 663 | ||
664 | s = SOCKET (af_family, SOCK_STREAM, 0); | 664 | s = SOCKET (af_family, SOCK_STREAM, 0); |
665 | if (s == -1) | 665 | if (s == -1) |
@@ -691,7 +691,7 @@ GNUNET_NETWORK_socket_create_from_sockaddr (struct GNUNET_SCHEDULER_Handle | |||
691 | GNUNET_break (0 == CLOSE (s)); | 691 | GNUNET_break (0 == CLOSE (s)); |
692 | return NULL; | 692 | return NULL; |
693 | } | 693 | } |
694 | ret = GNUNET_NETWORK_socket_create_from_existing (sched, s, maxbuf); | 694 | ret = GNUNET_NETWORK_connection_create_from_existing (sched, s, maxbuf); |
695 | ret->addr = GNUNET_malloc (addrlen); | 695 | ret->addr = GNUNET_malloc (addrlen); |
696 | memcpy (ret->addr, serv_addr, addrlen); | 696 | memcpy (ret->addr, serv_addr, addrlen); |
697 | ret->addrlen = addrlen; | 697 | ret->addrlen = addrlen; |
@@ -708,7 +708,7 @@ GNUNET_NETWORK_socket_create_from_sockaddr (struct GNUNET_SCHEDULER_Handle | |||
708 | * @return GNUNET_YES if valid, GNUNET_NO otherwise | 708 | * @return GNUNET_YES if valid, GNUNET_NO otherwise |
709 | */ | 709 | */ |
710 | int | 710 | int |
711 | GNUNET_NETWORK_socket_check (struct GNUNET_NETWORK_SocketHandle *sock) | 711 | GNUNET_NETWORK_connection_check (struct GNUNET_NETWORK_ConnectionHandle *sock) |
712 | { | 712 | { |
713 | if (sock->ai != NULL) | 713 | if (sock->ai != NULL) |
714 | return GNUNET_YES; /* still trying to connect */ | 714 | return GNUNET_YES; /* still trying to connect */ |
@@ -724,7 +724,7 @@ static void | |||
724 | destroy_continuation (void *cls, | 724 | destroy_continuation (void *cls, |
725 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 725 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
726 | { | 726 | { |
727 | struct GNUNET_NETWORK_SocketHandle *sock = cls; | 727 | struct GNUNET_NETWORK_ConnectionHandle *sock = cls; |
728 | GNUNET_NETWORK_TransmitReadyNotify notify; | 728 | GNUNET_NETWORK_TransmitReadyNotify notify; |
729 | 729 | ||
730 | if (sock->write_task != GNUNET_SCHEDULER_NO_TASK) | 730 | if (sock->write_task != GNUNET_SCHEDULER_NO_TASK) |
@@ -780,7 +780,7 @@ destroy_continuation (void *cls, | |||
780 | * @param sock socket to destroy | 780 | * @param sock socket to destroy |
781 | */ | 781 | */ |
782 | void | 782 | void |
783 | GNUNET_NETWORK_socket_destroy (struct GNUNET_NETWORK_SocketHandle *sock) | 783 | GNUNET_NETWORK_connection_destroy (struct GNUNET_NETWORK_ConnectionHandle *sock) |
784 | { | 784 | { |
785 | if (sock->write_buffer_off == 0) | 785 | if (sock->write_buffer_off == 0) |
786 | sock->ai_pos = NULL; /* if we're still trying to connect and have | 786 | sock->ai_pos = NULL; /* if we're still trying to connect and have |
@@ -797,7 +797,7 @@ GNUNET_NETWORK_socket_destroy (struct GNUNET_NETWORK_SocketHandle *sock) | |||
797 | * Tell the receiver callback that a timeout was reached. | 797 | * Tell the receiver callback that a timeout was reached. |
798 | */ | 798 | */ |
799 | static void | 799 | static void |
800 | signal_timeout (struct GNUNET_NETWORK_SocketHandle *sh) | 800 | signal_timeout (struct GNUNET_NETWORK_ConnectionHandle *sh) |
801 | { | 801 | { |
802 | GNUNET_NETWORK_Receiver receiver; | 802 | GNUNET_NETWORK_Receiver receiver; |
803 | 803 | ||
@@ -815,7 +815,7 @@ signal_timeout (struct GNUNET_NETWORK_SocketHandle *sh) | |||
815 | * Tell the receiver callback that we had an IO error. | 815 | * Tell the receiver callback that we had an IO error. |
816 | */ | 816 | */ |
817 | static void | 817 | static void |
818 | signal_error (struct GNUNET_NETWORK_SocketHandle *sh, int errcode) | 818 | signal_error (struct GNUNET_NETWORK_ConnectionHandle *sh, int errcode) |
819 | { | 819 | { |
820 | GNUNET_NETWORK_Receiver receiver; | 820 | GNUNET_NETWORK_Receiver receiver; |
821 | GNUNET_assert (NULL != (receiver = sh->receiver)); | 821 | GNUNET_assert (NULL != (receiver = sh->receiver)); |
@@ -831,7 +831,7 @@ signal_error (struct GNUNET_NETWORK_SocketHandle *sh, int errcode) | |||
831 | static void | 831 | static void |
832 | receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 832 | receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
833 | { | 833 | { |
834 | struct GNUNET_NETWORK_SocketHandle *sh = cls; | 834 | struct GNUNET_NETWORK_ConnectionHandle *sh = cls; |
835 | struct GNUNET_TIME_Absolute now; | 835 | struct GNUNET_TIME_Absolute now; |
836 | char buffer[sh->max]; | 836 | char buffer[sh->max]; |
837 | ssize_t ret; | 837 | ssize_t ret; |
@@ -904,7 +904,7 @@ RETRY: | |||
904 | static void | 904 | static void |
905 | receive_again (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 905 | receive_again (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
906 | { | 906 | { |
907 | struct GNUNET_NETWORK_SocketHandle *sh = cls; | 907 | struct GNUNET_NETWORK_ConnectionHandle *sh = cls; |
908 | struct GNUNET_TIME_Absolute now; | 908 | struct GNUNET_TIME_Absolute now; |
909 | 909 | ||
910 | sh->read_task = GNUNET_SCHEDULER_NO_TASK; | 910 | sh->read_task = GNUNET_SCHEDULER_NO_TASK; |
@@ -968,7 +968,7 @@ receive_again (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
968 | * @return scheduler task ID used for receiving, GNUNET_SCHEDULER_NO_TASK on error | 968 | * @return scheduler task ID used for receiving, GNUNET_SCHEDULER_NO_TASK on error |
969 | */ | 969 | */ |
970 | GNUNET_SCHEDULER_TaskIdentifier | 970 | GNUNET_SCHEDULER_TaskIdentifier |
971 | GNUNET_NETWORK_receive (struct GNUNET_NETWORK_SocketHandle *sock, | 971 | GNUNET_NETWORK_connection_receive (struct GNUNET_NETWORK_ConnectionHandle *sock, |
972 | size_t max, | 972 | size_t max, |
973 | struct GNUNET_TIME_Relative timeout, | 973 | struct GNUNET_TIME_Relative timeout, |
974 | GNUNET_NETWORK_Receiver receiver, void *receiver_cls) | 974 | GNUNET_NETWORK_Receiver receiver, void *receiver_cls) |
@@ -999,7 +999,7 @@ GNUNET_NETWORK_receive (struct GNUNET_NETWORK_SocketHandle *sock, | |||
999 | * @return closure of the original receiver callback | 999 | * @return closure of the original receiver callback |
1000 | */ | 1000 | */ |
1001 | void * | 1001 | void * |
1002 | GNUNET_NETWORK_receive_cancel (struct GNUNET_NETWORK_SocketHandle *sock, | 1002 | GNUNET_NETWORK_connection_receive_cancel (struct GNUNET_NETWORK_ConnectionHandle *sock, |
1003 | GNUNET_SCHEDULER_TaskIdentifier task) | 1003 | GNUNET_SCHEDULER_TaskIdentifier task) |
1004 | { | 1004 | { |
1005 | GNUNET_assert (sock->read_task == task); | 1005 | GNUNET_assert (sock->read_task == task); |
@@ -1018,7 +1018,7 @@ GNUNET_NETWORK_receive_cancel (struct GNUNET_NETWORK_SocketHandle *sock, | |||
1018 | * @return GNUNET_YES if we were able to call notify | 1018 | * @return GNUNET_YES if we were able to call notify |
1019 | */ | 1019 | */ |
1020 | static int | 1020 | static int |
1021 | process_notify (struct GNUNET_NETWORK_SocketHandle *sock) | 1021 | process_notify (struct GNUNET_NETWORK_ConnectionHandle *sock) |
1022 | { | 1022 | { |
1023 | size_t used; | 1023 | size_t used; |
1024 | size_t avail; | 1024 | size_t avail; |
@@ -1067,7 +1067,7 @@ process_notify (struct GNUNET_NETWORK_SocketHandle *sock) | |||
1067 | static void | 1067 | static void |
1068 | transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1068 | transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
1069 | { | 1069 | { |
1070 | struct GNUNET_NETWORK_SocketHandle *sock = cls; | 1070 | struct GNUNET_NETWORK_ConnectionHandle *sock = cls; |
1071 | GNUNET_NETWORK_TransmitReadyNotify notify; | 1071 | GNUNET_NETWORK_TransmitReadyNotify notify; |
1072 | 1072 | ||
1073 | #if DEBUG_NETWORK | 1073 | #if DEBUG_NETWORK |
@@ -1080,7 +1080,7 @@ transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1080 | 1080 | ||
1081 | 1081 | ||
1082 | static void | 1082 | static void |
1083 | transmit_error (struct GNUNET_NETWORK_SocketHandle *sock) | 1083 | transmit_error (struct GNUNET_NETWORK_ConnectionHandle *sock) |
1084 | { | 1084 | { |
1085 | if (sock->nth.notify_ready == NULL) | 1085 | if (sock->nth.notify_ready == NULL) |
1086 | return; /* nobody to tell about it */ | 1086 | return; /* nobody to tell about it */ |
@@ -1101,7 +1101,7 @@ transmit_error (struct GNUNET_NETWORK_SocketHandle *sock) | |||
1101 | static void | 1101 | static void |
1102 | transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1102 | transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
1103 | { | 1103 | { |
1104 | struct GNUNET_NETWORK_SocketHandle *sock = cls; | 1104 | struct GNUNET_NETWORK_ConnectionHandle *sock = cls; |
1105 | ssize_t ret; | 1105 | ssize_t ret; |
1106 | size_t have; | 1106 | size_t have; |
1107 | 1107 | ||
@@ -1221,7 +1221,7 @@ SCHEDULE_WRITE: | |||
1221 | * NULL if we are already going to notify someone else (busy) | 1221 | * NULL if we are already going to notify someone else (busy) |
1222 | */ | 1222 | */ |
1223 | struct GNUNET_NETWORK_TransmitHandle * | 1223 | struct GNUNET_NETWORK_TransmitHandle * |
1224 | GNUNET_NETWORK_notify_transmit_ready (struct GNUNET_NETWORK_SocketHandle | 1224 | GNUNET_NETWORK_connection_notify_transmit_ready (struct GNUNET_NETWORK_ConnectionHandle |
1225 | *sock, size_t size, | 1225 | *sock, size_t size, |
1226 | struct GNUNET_TIME_Relative timeout, | 1226 | struct GNUNET_TIME_Relative timeout, |
1227 | GNUNET_NETWORK_TransmitReadyNotify | 1227 | GNUNET_NETWORK_TransmitReadyNotify |
@@ -1285,7 +1285,7 @@ GNUNET_NETWORK_notify_transmit_ready (struct GNUNET_NETWORK_SocketHandle | |||
1285 | * notification. | 1285 | * notification. |
1286 | */ | 1286 | */ |
1287 | void | 1287 | void |
1288 | GNUNET_NETWORK_notify_transmit_ready_cancel (struct | 1288 | GNUNET_NETWORK_connection_notify_transmit_ready_cancel (struct |
1289 | GNUNET_NETWORK_TransmitHandle *h) | 1289 | GNUNET_NETWORK_TransmitHandle *h) |
1290 | { | 1290 | { |
1291 | GNUNET_assert (h->notify_ready != NULL); | 1291 | GNUNET_assert (h->notify_ready != NULL); |
diff --git a/src/util/server.c b/src/util/server.c index 8ffc9c027..d518cbeec 100644 --- a/src/util/server.c +++ b/src/util/server.c | |||
@@ -312,7 +312,7 @@ process_listen_socket (void *cls, | |||
312 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 312 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
313 | { | 313 | { |
314 | struct GNUNET_SERVER_Handle *server = cls; | 314 | struct GNUNET_SERVER_Handle *server = cls; |
315 | struct GNUNET_NETWORK_SocketHandle *sock; | 315 | struct GNUNET_NETWORK_ConnectionHandle *sock; |
316 | struct GNUNET_SERVER_Client *client; | 316 | struct GNUNET_SERVER_Client *client; |
317 | fd_set r; | 317 | fd_set r; |
318 | 318 | ||
@@ -329,7 +329,7 @@ process_listen_socket (void *cls, | |||
329 | } | 329 | } |
330 | GNUNET_assert (FD_ISSET (server->listen_socket, tc->read_ready)); | 330 | GNUNET_assert (FD_ISSET (server->listen_socket, tc->read_ready)); |
331 | GNUNET_assert (!FD_ISSET (server->shutpipe[0], tc->read_ready)); | 331 | GNUNET_assert (!FD_ISSET (server->shutpipe[0], tc->read_ready)); |
332 | sock = GNUNET_NETWORK_socket_create_from_accept (tc->sched, | 332 | sock = GNUNET_NETWORK_connection_create_from_accept (tc->sched, |
333 | server->access, | 333 | server->access, |
334 | server->access_cls, | 334 | server->access_cls, |
335 | server->listen_socket, | 335 | server->listen_socket, |
@@ -867,20 +867,20 @@ sock_receive (void *cls, | |||
867 | struct GNUNET_TIME_Relative timeout, | 867 | struct GNUNET_TIME_Relative timeout, |
868 | GNUNET_NETWORK_Receiver receiver, void *receiver_cls) | 868 | GNUNET_NETWORK_Receiver receiver, void *receiver_cls) |
869 | { | 869 | { |
870 | return GNUNET_NETWORK_receive (cls, max, timeout, receiver, receiver_cls); | 870 | return GNUNET_NETWORK_connection_receive (cls, max, timeout, receiver, receiver_cls); |
871 | } | 871 | } |
872 | 872 | ||
873 | 873 | ||
874 | /** | 874 | /** |
875 | * Wrapper to cancel receiving from a socket. | 875 | * Wrapper to cancel receiving from a socket. |
876 | * | 876 | * |
877 | * @param cls handle to the GNUNET_NETWORK_SocketHandle to cancel | 877 | * @param cls handle to the GNUNET_NETWORK_ConnectionHandle to cancel |
878 | * @param tc task ID that was returned by GNUNET_NETWORK_receive | 878 | * @param tc task ID that was returned by GNUNET_NETWORK_connection_receive |
879 | */ | 879 | */ |
880 | static void | 880 | static void |
881 | sock_receive_cancel (void *cls, GNUNET_SCHEDULER_TaskIdentifier ti) | 881 | sock_receive_cancel (void *cls, GNUNET_SCHEDULER_TaskIdentifier ti) |
882 | { | 882 | { |
883 | GNUNET_NETWORK_receive_cancel (cls, ti); | 883 | GNUNET_NETWORK_connection_receive_cancel (cls, ti); |
884 | } | 884 | } |
885 | 885 | ||
886 | 886 | ||
@@ -894,7 +894,7 @@ sock_notify_transmit_ready (void *cls, | |||
894 | GNUNET_NETWORK_TransmitReadyNotify notify, | 894 | GNUNET_NETWORK_TransmitReadyNotify notify, |
895 | void *notify_cls) | 895 | void *notify_cls) |
896 | { | 896 | { |
897 | return GNUNET_NETWORK_notify_transmit_ready (cls, size, timeout, notify, | 897 | return GNUNET_NETWORK_connection_notify_transmit_ready (cls, size, timeout, notify, |
898 | notify_cls); | 898 | notify_cls); |
899 | } | 899 | } |
900 | 900 | ||
@@ -905,7 +905,7 @@ sock_notify_transmit_ready (void *cls, | |||
905 | static void | 905 | static void |
906 | sock_notify_transmit_ready_cancel (void *cls, void *h) | 906 | sock_notify_transmit_ready_cancel (void *cls, void *h) |
907 | { | 907 | { |
908 | GNUNET_NETWORK_notify_transmit_ready_cancel (h); | 908 | GNUNET_NETWORK_connection_notify_transmit_ready_cancel (h); |
909 | } | 909 | } |
910 | 910 | ||
911 | 911 | ||
@@ -918,7 +918,7 @@ sock_notify_transmit_ready_cancel (void *cls, void *h) | |||
918 | static int | 918 | static int |
919 | sock_check (void *cls) | 919 | sock_check (void *cls) |
920 | { | 920 | { |
921 | return GNUNET_NETWORK_socket_check (cls); | 921 | return GNUNET_NETWORK_connection_check (cls); |
922 | } | 922 | } |
923 | 923 | ||
924 | 924 | ||
@@ -930,7 +930,7 @@ sock_check (void *cls) | |||
930 | static void | 930 | static void |
931 | sock_destroy (void *cls) | 931 | sock_destroy (void *cls) |
932 | { | 932 | { |
933 | GNUNET_NETWORK_socket_destroy (cls); | 933 | GNUNET_NETWORK_connection_destroy (cls); |
934 | } | 934 | } |
935 | 935 | ||
936 | 936 | ||
@@ -950,7 +950,7 @@ struct GNUNET_SERVER_Client * | |||
950 | GNUNET_SERVER_connect_socket (struct | 950 | GNUNET_SERVER_connect_socket (struct |
951 | GNUNET_SERVER_Handle | 951 | GNUNET_SERVER_Handle |
952 | *server, | 952 | *server, |
953 | struct GNUNET_NETWORK_SocketHandle *connection) | 953 | struct GNUNET_NETWORK_ConnectionHandle *connection) |
954 | { | 954 | { |
955 | struct GNUNET_SERVER_Client *client; | 955 | struct GNUNET_SERVER_Client *client; |
956 | 956 | ||
@@ -1064,7 +1064,7 @@ GNUNET_SERVER_client_get_address (struct GNUNET_SERVER_Client *client, | |||
1064 | { | 1064 | { |
1065 | if (client->receive != &sock_receive) | 1065 | if (client->receive != &sock_receive) |
1066 | return GNUNET_SYSERR; /* not a network client */ | 1066 | return GNUNET_SYSERR; /* not a network client */ |
1067 | return GNUNET_NETWORK_socket_get_address (client->client_closure, | 1067 | return GNUNET_NETWORK_connection_get_address (client->client_closure, |
1068 | addr, addrlen); | 1068 | addr, addrlen); |
1069 | } | 1069 | } |
1070 | 1070 | ||
@@ -1127,7 +1127,7 @@ GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client) | |||
1127 | * @param callback_cls closure for callback | 1127 | * @param callback_cls closure for callback |
1128 | * @return non-NULL if the notify callback was queued; can be used | 1128 | * @return non-NULL if the notify callback was queued; can be used |
1129 | * to cancel the request using | 1129 | * to cancel the request using |
1130 | * GNUNET_NETWORK_notify_transmit_ready_cancel. | 1130 | * GNUNET_NETWORK_connection_notify_transmit_ready_cancel. |
1131 | * NULL if we are already going to notify someone else (busy) | 1131 | * NULL if we are already going to notify someone else (busy) |
1132 | */ | 1132 | */ |
1133 | struct GNUNET_NETWORK_TransmitHandle * | 1133 | struct GNUNET_NETWORK_TransmitHandle * |
diff --git a/src/util/test_network.c b/src/util/test_network.c index 02555c299..cb0656921 100644 --- a/src/util/test_network.c +++ b/src/util/test_network.c | |||
@@ -32,11 +32,11 @@ | |||
32 | #define PORT 12435 | 32 | #define PORT 12435 |
33 | 33 | ||
34 | 34 | ||
35 | static struct GNUNET_NETWORK_SocketHandle *csock; | 35 | static struct GNUNET_NETWORK_ConnectionHandle *csock; |
36 | 36 | ||
37 | static struct GNUNET_NETWORK_SocketHandle *asock; | 37 | static struct GNUNET_NETWORK_ConnectionHandle *asock; |
38 | 38 | ||
39 | static struct GNUNET_NETWORK_SocketHandle *lsock; | 39 | static struct GNUNET_NETWORK_ConnectionHandle *lsock; |
40 | 40 | ||
41 | static size_t sofar; | 41 | static size_t sofar; |
42 | 42 | ||
@@ -88,7 +88,7 @@ receive_check (void *cls, | |||
88 | #if VERBOSE | 88 | #if VERBOSE |
89 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receive needs more data\n"); | 89 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receive needs more data\n"); |
90 | #endif | 90 | #endif |
91 | GNUNET_NETWORK_receive (asock, | 91 | GNUNET_NETWORK_connection_receive (asock, |
92 | 1024, | 92 | 1024, |
93 | GNUNET_TIME_relative_multiply | 93 | GNUNET_TIME_relative_multiply |
94 | (GNUNET_TIME_UNIT_SECONDS, 5), &receive_check, | 94 | (GNUNET_TIME_UNIT_SECONDS, 5), &receive_check, |
@@ -101,7 +101,7 @@ receive_check (void *cls, | |||
101 | "Receive closes accepted socket\n"); | 101 | "Receive closes accepted socket\n"); |
102 | #endif | 102 | #endif |
103 | *ok = 0; | 103 | *ok = 0; |
104 | GNUNET_NETWORK_socket_destroy (asock); | 104 | GNUNET_NETWORK_connection_destroy (asock); |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
@@ -112,19 +112,19 @@ run_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
112 | #if VERBOSE | 112 | #if VERBOSE |
113 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test accepts connection\n"); | 113 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test accepts connection\n"); |
114 | #endif | 114 | #endif |
115 | asock = GNUNET_NETWORK_socket_create_from_accept (tc->sched, | 115 | asock = GNUNET_NETWORK_connection_create_from_accept (tc->sched, |
116 | NULL, NULL, ls, 1024); | 116 | NULL, NULL, ls, 1024); |
117 | GNUNET_assert (asock != NULL); | 117 | GNUNET_assert (asock != NULL); |
118 | GNUNET_assert (GNUNET_YES == GNUNET_NETWORK_socket_check (asock)); | 118 | GNUNET_assert (GNUNET_YES == GNUNET_NETWORK_connection_check (asock)); |
119 | #if VERBOSE | 119 | #if VERBOSE |
120 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test destroys listen socket\n"); | 120 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test destroys listen socket\n"); |
121 | #endif | 121 | #endif |
122 | GNUNET_NETWORK_socket_destroy (lsock); | 122 | GNUNET_NETWORK_connection_destroy (lsock); |
123 | #if VERBOSE | 123 | #if VERBOSE |
124 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 124 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
125 | "Test asks to receive on accepted socket\n"); | 125 | "Test asks to receive on accepted socket\n"); |
126 | #endif | 126 | #endif |
127 | GNUNET_NETWORK_receive (asock, | 127 | GNUNET_NETWORK_connection_receive (asock, |
128 | 1024, | 128 | 1024, |
129 | GNUNET_TIME_relative_multiply | 129 | GNUNET_TIME_relative_multiply |
130 | (GNUNET_TIME_UNIT_SECONDS, 5), &receive_check, cls); | 130 | (GNUNET_TIME_UNIT_SECONDS, 5), &receive_check, cls); |
@@ -146,23 +146,23 @@ static void | |||
146 | task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 146 | task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
147 | { | 147 | { |
148 | ls = open_listen_socket (); | 148 | ls = open_listen_socket (); |
149 | lsock = GNUNET_NETWORK_socket_create_from_existing (tc->sched, ls, 0); | 149 | lsock = GNUNET_NETWORK_connection_create_from_existing (tc->sched, ls, 0); |
150 | GNUNET_assert (lsock != NULL); | 150 | GNUNET_assert (lsock != NULL); |
151 | csock = GNUNET_NETWORK_socket_create_from_connect (tc->sched, | 151 | csock = GNUNET_NETWORK_connection_create_from_connect (tc->sched, |
152 | "localhost", PORT, 1024); | 152 | "localhost", PORT, 1024); |
153 | GNUNET_assert (csock != NULL); | 153 | GNUNET_assert (csock != NULL); |
154 | #if VERBOSE | 154 | #if VERBOSE |
155 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test asks for write notification\n"); | 155 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test asks for write notification\n"); |
156 | #endif | 156 | #endif |
157 | GNUNET_assert (NULL != | 157 | GNUNET_assert (NULL != |
158 | GNUNET_NETWORK_notify_transmit_ready (csock, | 158 | GNUNET_NETWORK_connection_notify_transmit_ready (csock, |
159 | 12, | 159 | 12, |
160 | GNUNET_TIME_UNIT_SECONDS, | 160 | GNUNET_TIME_UNIT_SECONDS, |
161 | &make_hello, NULL)); | 161 | &make_hello, NULL)); |
162 | #if VERBOSE | 162 | #if VERBOSE |
163 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test destroys client socket\n"); | 163 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test destroys client socket\n"); |
164 | #endif | 164 | #endif |
165 | GNUNET_NETWORK_socket_destroy (csock); | 165 | GNUNET_NETWORK_connection_destroy (csock); |
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 |
diff --git a/src/util/test_network_addressing.c b/src/util/test_network_addressing.c index 3c2a690d9..aeb187634 100644 --- a/src/util/test_network_addressing.c +++ b/src/util/test_network_addressing.c | |||
@@ -32,11 +32,11 @@ | |||
32 | #define PORT 12435 | 32 | #define PORT 12435 |
33 | 33 | ||
34 | 34 | ||
35 | static struct GNUNET_NETWORK_SocketHandle *csock; | 35 | static struct GNUNET_NETWORK_ConnectionHandle *csock; |
36 | 36 | ||
37 | static struct GNUNET_NETWORK_SocketHandle *asock; | 37 | static struct GNUNET_NETWORK_ConnectionHandle *asock; |
38 | 38 | ||
39 | static struct GNUNET_NETWORK_SocketHandle *lsock; | 39 | static struct GNUNET_NETWORK_ConnectionHandle *lsock; |
40 | 40 | ||
41 | static size_t sofar; | 41 | static size_t sofar; |
42 | 42 | ||
@@ -82,7 +82,7 @@ receive_check (void *cls, | |||
82 | sofar += available; | 82 | sofar += available; |
83 | if (sofar < 12) | 83 | if (sofar < 12) |
84 | { | 84 | { |
85 | GNUNET_NETWORK_receive (asock, | 85 | GNUNET_NETWORK_connection_receive (asock, |
86 | 1024, | 86 | 1024, |
87 | GNUNET_TIME_relative_multiply | 87 | GNUNET_TIME_relative_multiply |
88 | (GNUNET_TIME_UNIT_SECONDS, 5), &receive_check, | 88 | (GNUNET_TIME_UNIT_SECONDS, 5), &receive_check, |
@@ -91,7 +91,7 @@ receive_check (void *cls, | |||
91 | else | 91 | else |
92 | { | 92 | { |
93 | *ok = 0; | 93 | *ok = 0; |
94 | GNUNET_NETWORK_socket_destroy (asock); | 94 | GNUNET_NETWORK_connection_destroy (asock); |
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
@@ -104,12 +104,12 @@ run_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
104 | struct sockaddr_in *v4; | 104 | struct sockaddr_in *v4; |
105 | struct sockaddr_in expect; | 105 | struct sockaddr_in expect; |
106 | 106 | ||
107 | asock = GNUNET_NETWORK_socket_create_from_accept (tc->sched, | 107 | asock = GNUNET_NETWORK_connection_create_from_accept (tc->sched, |
108 | NULL, NULL, ls, 1024); | 108 | NULL, NULL, ls, 1024); |
109 | GNUNET_assert (asock != NULL); | 109 | GNUNET_assert (asock != NULL); |
110 | GNUNET_assert (GNUNET_YES == GNUNET_NETWORK_socket_check (asock)); | 110 | GNUNET_assert (GNUNET_YES == GNUNET_NETWORK_connection_check (asock)); |
111 | GNUNET_assert (GNUNET_OK == | 111 | GNUNET_assert (GNUNET_OK == |
112 | GNUNET_NETWORK_socket_get_address (asock, &addr, &alen)); | 112 | GNUNET_NETWORK_connection_get_address (asock, &addr, &alen)); |
113 | GNUNET_assert (alen == sizeof (struct sockaddr_in)); | 113 | GNUNET_assert (alen == sizeof (struct sockaddr_in)); |
114 | v4 = addr; | 114 | v4 = addr; |
115 | memset (&expect, 0, sizeof (expect)); | 115 | memset (&expect, 0, sizeof (expect)); |
@@ -118,8 +118,8 @@ run_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
118 | expect.sin_addr.s_addr = htonl (INADDR_LOOPBACK); | 118 | expect.sin_addr.s_addr = htonl (INADDR_LOOPBACK); |
119 | GNUNET_assert (0 == memcmp (&expect, v4, alen)); | 119 | GNUNET_assert (0 == memcmp (&expect, v4, alen)); |
120 | GNUNET_free (addr); | 120 | GNUNET_free (addr); |
121 | GNUNET_NETWORK_socket_destroy (lsock); | 121 | GNUNET_NETWORK_connection_destroy (lsock); |
122 | GNUNET_NETWORK_receive (asock, | 122 | GNUNET_NETWORK_connection_receive (asock, |
123 | 1024, | 123 | 1024, |
124 | GNUNET_TIME_relative_multiply | 124 | GNUNET_TIME_relative_multiply |
125 | (GNUNET_TIME_UNIT_SECONDS, 5), &receive_check, cls); | 125 | (GNUNET_TIME_UNIT_SECONDS, 5), &receive_check, cls); |
@@ -138,24 +138,24 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
138 | { | 138 | { |
139 | struct sockaddr_in v4; | 139 | struct sockaddr_in v4; |
140 | ls = open_listen_socket (); | 140 | ls = open_listen_socket (); |
141 | lsock = GNUNET_NETWORK_socket_create_from_existing (tc->sched, ls, 0); | 141 | lsock = GNUNET_NETWORK_connection_create_from_existing (tc->sched, ls, 0); |
142 | GNUNET_assert (lsock != NULL); | 142 | GNUNET_assert (lsock != NULL); |
143 | 143 | ||
144 | v4.sin_family = AF_INET; | 144 | v4.sin_family = AF_INET; |
145 | v4.sin_port = htons (PORT); | 145 | v4.sin_port = htons (PORT); |
146 | v4.sin_addr.s_addr = htonl (INADDR_LOOPBACK); | 146 | v4.sin_addr.s_addr = htonl (INADDR_LOOPBACK); |
147 | csock = GNUNET_NETWORK_socket_create_from_sockaddr (tc->sched, | 147 | csock = GNUNET_NETWORK_connection_create_from_sockaddr (tc->sched, |
148 | AF_INET, | 148 | AF_INET, |
149 | (const struct sockaddr | 149 | (const struct sockaddr |
150 | *) &v4, sizeof (v4), | 150 | *) &v4, sizeof (v4), |
151 | 1024); | 151 | 1024); |
152 | GNUNET_assert (csock != NULL); | 152 | GNUNET_assert (csock != NULL); |
153 | GNUNET_assert (NULL != | 153 | GNUNET_assert (NULL != |
154 | GNUNET_NETWORK_notify_transmit_ready (csock, | 154 | GNUNET_NETWORK_connection_notify_transmit_ready (csock, |
155 | 12, | 155 | 12, |
156 | GNUNET_TIME_UNIT_SECONDS, | 156 | GNUNET_TIME_UNIT_SECONDS, |
157 | &make_hello, NULL)); | 157 | &make_hello, NULL)); |
158 | GNUNET_NETWORK_socket_destroy (csock); | 158 | GNUNET_NETWORK_connection_destroy (csock); |
159 | GNUNET_SCHEDULER_add_read (tc->sched, | 159 | GNUNET_SCHEDULER_add_read (tc->sched, |
160 | GNUNET_NO, | 160 | GNUNET_NO, |
161 | GNUNET_SCHEDULER_PRIORITY_HIGH, | 161 | GNUNET_SCHEDULER_PRIORITY_HIGH, |
diff --git a/src/util/test_network_receive_cancel.c b/src/util/test_network_receive_cancel.c index 7eb31153c..51d8350af 100644 --- a/src/util/test_network_receive_cancel.c +++ b/src/util/test_network_receive_cancel.c | |||
@@ -32,11 +32,11 @@ | |||
32 | #define PORT 12435 | 32 | #define PORT 12435 |
33 | 33 | ||
34 | 34 | ||
35 | static struct GNUNET_NETWORK_SocketHandle *csock; | 35 | static struct GNUNET_NETWORK_ConnectionHandle *csock; |
36 | 36 | ||
37 | static struct GNUNET_NETWORK_SocketHandle *asock; | 37 | static struct GNUNET_NETWORK_ConnectionHandle *asock; |
38 | 38 | ||
39 | static struct GNUNET_NETWORK_SocketHandle *lsock; | 39 | static struct GNUNET_NETWORK_ConnectionHandle *lsock; |
40 | 40 | ||
41 | static int ls; | 41 | static int ls; |
42 | 42 | ||
@@ -85,13 +85,13 @@ static void | |||
85 | run_accept_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 85 | run_accept_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
86 | { | 86 | { |
87 | 87 | ||
88 | asock = GNUNET_NETWORK_socket_create_from_accept (tc->sched, | 88 | asock = GNUNET_NETWORK_connection_create_from_accept (tc->sched, |
89 | NULL, NULL, ls, 1024); | 89 | NULL, NULL, ls, 1024); |
90 | GNUNET_assert (asock != NULL); | 90 | GNUNET_assert (asock != NULL); |
91 | GNUNET_assert (GNUNET_YES == GNUNET_NETWORK_socket_check (asock)); | 91 | GNUNET_assert (GNUNET_YES == GNUNET_NETWORK_connection_check (asock)); |
92 | GNUNET_NETWORK_socket_destroy (lsock); | 92 | GNUNET_NETWORK_connection_destroy (lsock); |
93 | receive_task | 93 | receive_task |
94 | = GNUNET_NETWORK_receive (asock, | 94 | = GNUNET_NETWORK_connection_receive (asock, |
95 | 1024, | 95 | 1024, |
96 | GNUNET_TIME_relative_multiply | 96 | GNUNET_TIME_relative_multiply |
97 | (GNUNET_TIME_UNIT_SECONDS, 5), &dead_receive, | 97 | (GNUNET_TIME_UNIT_SECONDS, 5), &dead_receive, |
@@ -103,9 +103,9 @@ static void | |||
103 | receive_cancel_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 103 | receive_cancel_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
104 | { | 104 | { |
105 | int *ok = cls; | 105 | int *ok = cls; |
106 | GNUNET_NETWORK_receive_cancel (asock, receive_task); | 106 | GNUNET_NETWORK_connection_receive_cancel (asock, receive_task); |
107 | GNUNET_NETWORK_socket_destroy (csock); | 107 | GNUNET_NETWORK_connection_destroy (csock); |
108 | GNUNET_NETWORK_socket_destroy (asock); | 108 | GNUNET_NETWORK_connection_destroy (asock); |
109 | *ok = 0; | 109 | *ok = 0; |
110 | } | 110 | } |
111 | 111 | ||
@@ -115,9 +115,9 @@ static void | |||
115 | task_receive_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 115 | task_receive_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
116 | { | 116 | { |
117 | ls = open_listen_socket (); | 117 | ls = open_listen_socket (); |
118 | lsock = GNUNET_NETWORK_socket_create_from_existing (tc->sched, ls, 0); | 118 | lsock = GNUNET_NETWORK_connection_create_from_existing (tc->sched, ls, 0); |
119 | GNUNET_assert (lsock != NULL); | 119 | GNUNET_assert (lsock != NULL); |
120 | csock = GNUNET_NETWORK_socket_create_from_connect (tc->sched, | 120 | csock = GNUNET_NETWORK_connection_create_from_connect (tc->sched, |
121 | "localhost", PORT, 1024); | 121 | "localhost", PORT, 1024); |
122 | GNUNET_assert (csock != NULL); | 122 | GNUNET_assert (csock != NULL); |
123 | GNUNET_SCHEDULER_add_read (tc->sched, | 123 | GNUNET_SCHEDULER_add_read (tc->sched, |
diff --git a/src/util/test_network_timeout.c b/src/util/test_network_timeout.c index 2c2f6f9f2..1d8910842 100644 --- a/src/util/test_network_timeout.c +++ b/src/util/test_network_timeout.c | |||
@@ -31,9 +31,9 @@ | |||
31 | 31 | ||
32 | #define PORT 12435 | 32 | #define PORT 12435 |
33 | 33 | ||
34 | static struct GNUNET_NETWORK_SocketHandle *csock; | 34 | static struct GNUNET_NETWORK_ConnectionHandle *csock; |
35 | 35 | ||
36 | static struct GNUNET_NETWORK_SocketHandle *lsock; | 36 | static struct GNUNET_NETWORK_ConnectionHandle *lsock; |
37 | 37 | ||
38 | static int ls; | 38 | static int ls; |
39 | 39 | ||
@@ -74,8 +74,8 @@ send_kilo (void *cls, size_t size, void *buf) | |||
74 | #endif | 74 | #endif |
75 | GNUNET_assert (buf == NULL); | 75 | GNUNET_assert (buf == NULL); |
76 | *ok = 0; | 76 | *ok = 0; |
77 | GNUNET_NETWORK_socket_destroy (lsock); | 77 | GNUNET_NETWORK_connection_destroy (lsock); |
78 | GNUNET_NETWORK_socket_destroy (csock); | 78 | GNUNET_NETWORK_connection_destroy (csock); |
79 | return 0; | 79 | return 0; |
80 | } | 80 | } |
81 | #if VERBOSE | 81 | #if VERBOSE |
@@ -85,7 +85,7 @@ send_kilo (void *cls, size_t size, void *buf) | |||
85 | memset (buf, 42, 1024); | 85 | memset (buf, 42, 1024); |
86 | 86 | ||
87 | GNUNET_assert (NULL != | 87 | GNUNET_assert (NULL != |
88 | GNUNET_NETWORK_notify_transmit_ready (csock, | 88 | GNUNET_NETWORK_connection_notify_transmit_ready (csock, |
89 | 1024, | 89 | 1024, |
90 | GNUNET_TIME_UNIT_SECONDS, | 90 | GNUNET_TIME_UNIT_SECONDS, |
91 | &send_kilo, cls)); | 91 | &send_kilo, cls)); |
@@ -98,13 +98,13 @@ task_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
98 | { | 98 | { |
99 | 99 | ||
100 | ls = open_listen_socket (); | 100 | ls = open_listen_socket (); |
101 | lsock = GNUNET_NETWORK_socket_create_from_existing (tc->sched, ls, 0); | 101 | lsock = GNUNET_NETWORK_connection_create_from_existing (tc->sched, ls, 0); |
102 | GNUNET_assert (lsock != NULL); | 102 | GNUNET_assert (lsock != NULL); |
103 | csock = GNUNET_NETWORK_socket_create_from_connect (tc->sched, | 103 | csock = GNUNET_NETWORK_connection_create_from_connect (tc->sched, |
104 | "localhost", PORT, 1024); | 104 | "localhost", PORT, 1024); |
105 | GNUNET_assert (csock != NULL); | 105 | GNUNET_assert (csock != NULL); |
106 | GNUNET_assert (NULL != | 106 | GNUNET_assert (NULL != |
107 | GNUNET_NETWORK_notify_transmit_ready (csock, | 107 | GNUNET_NETWORK_connection_notify_transmit_ready (csock, |
108 | 1024, | 108 | 1024, |
109 | GNUNET_TIME_UNIT_SECONDS, | 109 | GNUNET_TIME_UNIT_SECONDS, |
110 | &send_kilo, cls)); | 110 | &send_kilo, cls)); |
diff --git a/src/util/test_network_timeout_no_connect.c b/src/util/test_network_timeout_no_connect.c index fd5e82dcd..172a6991d 100644 --- a/src/util/test_network_timeout_no_connect.c +++ b/src/util/test_network_timeout_no_connect.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | #define PORT 13425 | 32 | #define PORT 13425 |
33 | 33 | ||
34 | static struct GNUNET_NETWORK_SocketHandle *csock; | 34 | static struct GNUNET_NETWORK_ConnectionHandle *csock; |
35 | 35 | ||
36 | static size_t | 36 | static size_t |
37 | handle_timeout (void *cls, size_t size, void *buf) | 37 | handle_timeout (void *cls, size_t size, void *buf) |
@@ -51,11 +51,11 @@ handle_timeout (void *cls, size_t size, void *buf) | |||
51 | static void | 51 | static void |
52 | task_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 52 | task_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
53 | { | 53 | { |
54 | csock = GNUNET_NETWORK_socket_create_from_connect (tc->sched, | 54 | csock = GNUNET_NETWORK_connection_create_from_connect (tc->sched, |
55 | "localhost", PORT, 1024); | 55 | "localhost", PORT, 1024); |
56 | GNUNET_assert (csock != NULL); | 56 | GNUNET_assert (csock != NULL); |
57 | GNUNET_assert (NULL != | 57 | GNUNET_assert (NULL != |
58 | GNUNET_NETWORK_notify_transmit_ready (csock, | 58 | GNUNET_NETWORK_connection_notify_transmit_ready (csock, |
59 | 1024, | 59 | 1024, |
60 | GNUNET_TIME_UNIT_SECONDS, | 60 | GNUNET_TIME_UNIT_SECONDS, |
61 | &handle_timeout, cls)); | 61 | &handle_timeout, cls)); |
diff --git a/src/util/test_network_transmit_cancel.c b/src/util/test_network_transmit_cancel.c index 802f9a477..7a67000a8 100644 --- a/src/util/test_network_transmit_cancel.c +++ b/src/util/test_network_transmit_cancel.c | |||
@@ -46,17 +46,17 @@ task_transmit_cancel (void *cls, | |||
46 | { | 46 | { |
47 | int *ok = cls; | 47 | int *ok = cls; |
48 | struct GNUNET_NETWORK_TransmitHandle *th; | 48 | struct GNUNET_NETWORK_TransmitHandle *th; |
49 | struct GNUNET_NETWORK_SocketHandle *csock; | 49 | struct GNUNET_NETWORK_ConnectionHandle *csock; |
50 | 50 | ||
51 | csock = GNUNET_NETWORK_socket_create_from_connect (tc->sched, | 51 | csock = GNUNET_NETWORK_connection_create_from_connect (tc->sched, |
52 | "localhost", PORT, 1024); | 52 | "localhost", PORT, 1024); |
53 | GNUNET_assert (csock != NULL); | 53 | GNUNET_assert (csock != NULL); |
54 | th = GNUNET_NETWORK_notify_transmit_ready (csock, | 54 | th = GNUNET_NETWORK_connection_notify_transmit_ready (csock, |
55 | 12, | 55 | 12, |
56 | GNUNET_TIME_UNIT_MINUTES, | 56 | GNUNET_TIME_UNIT_MINUTES, |
57 | ¬_run, cls); | 57 | ¬_run, cls); |
58 | GNUNET_NETWORK_notify_transmit_ready_cancel (th); | 58 | GNUNET_NETWORK_connection_notify_transmit_ready_cancel (th); |
59 | GNUNET_NETWORK_socket_destroy (csock); | 59 | GNUNET_NETWORK_connection_destroy (csock); |
60 | *ok = 0; | 60 | *ok = 0; |
61 | } | 61 | } |
62 | 62 | ||