diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-12-11 11:14:24 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-12-11 11:14:24 +0000 |
commit | 77e9e4a935bc9109365afebf00a4d88a694973ed (patch) | |
tree | 13285f304f3a128320255df548d69f80c6ba7d70 /src/stream/stream_api.c | |
parent | 8861ab9dc880d4ab8e24be3d66d1f2d60d3d950a (diff) | |
download | gnunet-77e9e4a935bc9109365afebf00a4d88a694973ed.tar.gz gnunet-77e9e4a935bc9109365afebf00a4d88a694973ed.zip |
- rename
Diffstat (limited to 'src/stream/stream_api.c')
-rw-r--r-- | src/stream/stream_api.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/stream/stream_api.c b/src/stream/stream_api.c index 1ca4031f2..0083e63fb 100644 --- a/src/stream/stream_api.c +++ b/src/stream/stream_api.c | |||
@@ -217,12 +217,12 @@ struct GNUNET_STREAM_Socket | |||
217 | /** | 217 | /** |
218 | * The write IO_handle associated with this socket | 218 | * The write IO_handle associated with this socket |
219 | */ | 219 | */ |
220 | struct GNUNET_STREAM_IOWriteHandle *write_handle; | 220 | struct GNUNET_STREAM_WriteHandle *write_handle; |
221 | 221 | ||
222 | /** | 222 | /** |
223 | * The read IO_handle associated with this socket | 223 | * The read IO_handle associated with this socket |
224 | */ | 224 | */ |
225 | struct GNUNET_STREAM_IOReadHandle *read_handle; | 225 | struct GNUNET_STREAM_ReadHandle *read_handle; |
226 | 226 | ||
227 | /** | 227 | /** |
228 | * The shutdown handle associated with this socket | 228 | * The shutdown handle associated with this socket |
@@ -459,7 +459,7 @@ struct GNUNET_STREAM_ListenSocket | |||
459 | /** | 459 | /** |
460 | * The IO Write Handle | 460 | * The IO Write Handle |
461 | */ | 461 | */ |
462 | struct GNUNET_STREAM_IOWriteHandle | 462 | struct GNUNET_STREAM_WriteHandle |
463 | { | 463 | { |
464 | /** | 464 | /** |
465 | * The socket to which this write handle is associated | 465 | * The socket to which this write handle is associated |
@@ -511,7 +511,7 @@ struct GNUNET_STREAM_IOWriteHandle | |||
511 | /** | 511 | /** |
512 | * The IO Read Handle | 512 | * The IO Read Handle |
513 | */ | 513 | */ |
514 | struct GNUNET_STREAM_IOReadHandle | 514 | struct GNUNET_STREAM_ReadHandle |
515 | { | 515 | { |
516 | /** | 516 | /** |
517 | * The socket to which this read handle is associated | 517 | * The socket to which this read handle is associated |
@@ -901,7 +901,7 @@ ackbitmap_is_bit_set (const GNUNET_STREAM_AckBitmap *bitmap, | |||
901 | static void | 901 | static void |
902 | write_data (struct GNUNET_STREAM_Socket *socket) | 902 | write_data (struct GNUNET_STREAM_Socket *socket) |
903 | { | 903 | { |
904 | struct GNUNET_STREAM_IOWriteHandle *io_handle = socket->write_handle; | 904 | struct GNUNET_STREAM_WriteHandle *io_handle = socket->write_handle; |
905 | unsigned int packet; | 905 | unsigned int packet; |
906 | 906 | ||
907 | for (packet=0; packet < io_handle->packets_sent; packet++) | 907 | for (packet=0; packet < io_handle->packets_sent; packet++) |
@@ -958,7 +958,7 @@ write_data (struct GNUNET_STREAM_Socket *socket) | |||
958 | static void | 958 | static void |
959 | cleanup_read_handle (struct GNUNET_STREAM_Socket *socket) | 959 | cleanup_read_handle (struct GNUNET_STREAM_Socket *socket) |
960 | { | 960 | { |
961 | struct GNUNET_STREAM_IOReadHandle *read_handle; | 961 | struct GNUNET_STREAM_ReadHandle *read_handle; |
962 | 962 | ||
963 | read_handle = socket->read_handle; | 963 | read_handle = socket->read_handle; |
964 | /* Read io time task should be there; if it is already executed then this | 964 | /* Read io time task should be there; if it is already executed then this |
@@ -987,7 +987,7 @@ call_read_processor (void *cls, | |||
987 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 987 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
988 | { | 988 | { |
989 | struct GNUNET_STREAM_Socket *socket = cls; | 989 | struct GNUNET_STREAM_Socket *socket = cls; |
990 | struct GNUNET_STREAM_IOReadHandle *read_handle; | 990 | struct GNUNET_STREAM_ReadHandle *read_handle; |
991 | GNUNET_STREAM_DataProcessor proc; | 991 | GNUNET_STREAM_DataProcessor proc; |
992 | void *proc_cls; | 992 | void *proc_cls; |
993 | size_t read_size; | 993 | size_t read_size; |
@@ -1101,7 +1101,7 @@ read_io_timeout (void *cls, | |||
1101 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 1101 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
1102 | { | 1102 | { |
1103 | struct GNUNET_STREAM_Socket *socket = cls; | 1103 | struct GNUNET_STREAM_Socket *socket = cls; |
1104 | struct GNUNET_STREAM_IOReadHandle *read_handle; | 1104 | struct GNUNET_STREAM_ReadHandle *read_handle; |
1105 | GNUNET_STREAM_DataProcessor proc; | 1105 | GNUNET_STREAM_DataProcessor proc; |
1106 | void *proc_cls; | 1106 | void *proc_cls; |
1107 | 1107 | ||
@@ -1964,7 +1964,7 @@ handle_receive_close (struct GNUNET_STREAM_Socket *socket, | |||
1964 | 1964 | ||
1965 | wc = socket->write_handle->write_cont; | 1965 | wc = socket->write_handle->write_cont; |
1966 | wc_cls = socket->write_handle->write_cont_cls; | 1966 | wc_cls = socket->write_handle->write_cont_cls; |
1967 | GNUNET_STREAM_io_write_cancel (socket->write_handle); | 1967 | GNUNET_STREAM_write_cancel (socket->write_handle); |
1968 | socket->write_handle = NULL; | 1968 | socket->write_handle = NULL; |
1969 | if (NULL != wc) | 1969 | if (NULL != wc) |
1970 | wc (wc_cls, | 1970 | wc (wc_cls, |
@@ -2091,7 +2091,7 @@ handle_close (struct GNUNET_STREAM_Socket *socket, | |||
2091 | 2091 | ||
2092 | wc = socket->write_handle->write_cont; | 2092 | wc = socket->write_handle->write_cont; |
2093 | wc_cls = socket->write_handle->write_cont_cls; | 2093 | wc_cls = socket->write_handle->write_cont_cls; |
2094 | GNUNET_STREAM_io_write_cancel (socket->write_handle); | 2094 | GNUNET_STREAM_write_cancel (socket->write_handle); |
2095 | socket->write_handle = NULL; | 2095 | socket->write_handle = NULL; |
2096 | if (NULL != wc) | 2096 | if (NULL != wc) |
2097 | wc (wc_cls, | 2097 | wc (wc_cls, |
@@ -2543,7 +2543,7 @@ handle_ack (struct GNUNET_STREAM_Socket *socket, | |||
2543 | const struct GNUNET_STREAM_AckMessage *ack, | 2543 | const struct GNUNET_STREAM_AckMessage *ack, |
2544 | const struct GNUNET_ATS_Information*atsi) | 2544 | const struct GNUNET_ATS_Information*atsi) |
2545 | { | 2545 | { |
2546 | struct GNUNET_STREAM_IOWriteHandle *write_handle; | 2546 | struct GNUNET_STREAM_WriteHandle *write_handle; |
2547 | uint64_t ack_bitmap; | 2547 | uint64_t ack_bitmap; |
2548 | unsigned int packet; | 2548 | unsigned int packet; |
2549 | int need_retransmission; | 2549 | int need_retransmission; |
@@ -3274,13 +3274,13 @@ GNUNET_STREAM_close (struct GNUNET_STREAM_Socket *socket) | |||
3274 | { | 3274 | { |
3275 | LOG (GNUNET_ERROR_TYPE_WARNING, | 3275 | LOG (GNUNET_ERROR_TYPE_WARNING, |
3276 | "Closing STREAM socket when a read handle is pending\n"); | 3276 | "Closing STREAM socket when a read handle is pending\n"); |
3277 | GNUNET_STREAM_io_read_cancel (socket->read_handle); | 3277 | GNUNET_STREAM_read_cancel (socket->read_handle); |
3278 | } | 3278 | } |
3279 | if (NULL != socket->write_handle) | 3279 | if (NULL != socket->write_handle) |
3280 | { | 3280 | { |
3281 | LOG (GNUNET_ERROR_TYPE_WARNING, | 3281 | LOG (GNUNET_ERROR_TYPE_WARNING, |
3282 | "Closing STREAM socket when a write handle is pending\n"); | 3282 | "Closing STREAM socket when a write handle is pending\n"); |
3283 | GNUNET_STREAM_io_write_cancel (socket->write_handle); | 3283 | GNUNET_STREAM_write_cancel (socket->write_handle); |
3284 | //socket->write_handle = NULL; | 3284 | //socket->write_handle = NULL; |
3285 | } | 3285 | } |
3286 | /* Terminate the ack'ing task if they are still present */ | 3286 | /* Terminate the ack'ing task if they are still present */ |
@@ -3465,7 +3465,7 @@ GNUNET_STREAM_listen_close (struct GNUNET_STREAM_ListenSocket *lsocket) | |||
3465 | * is broken then write_cont is immediately called and NULL is | 3465 | * is broken then write_cont is immediately called and NULL is |
3466 | * returned. | 3466 | * returned. |
3467 | */ | 3467 | */ |
3468 | struct GNUNET_STREAM_IOWriteHandle * | 3468 | struct GNUNET_STREAM_WriteHandle * |
3469 | GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket, | 3469 | GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket, |
3470 | const void *data, | 3470 | const void *data, |
3471 | size_t size, | 3471 | size_t size, |
@@ -3473,7 +3473,7 @@ GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket, | |||
3473 | GNUNET_STREAM_CompletionContinuation write_cont, | 3473 | GNUNET_STREAM_CompletionContinuation write_cont, |
3474 | void *write_cont_cls) | 3474 | void *write_cont_cls) |
3475 | { | 3475 | { |
3476 | struct GNUNET_STREAM_IOWriteHandle *io_handle; | 3476 | struct GNUNET_STREAM_WriteHandle *io_handle; |
3477 | struct GNUNET_STREAM_DataMessage *data_msg; | 3477 | struct GNUNET_STREAM_DataMessage *data_msg; |
3478 | const void *sweep; | 3478 | const void *sweep; |
3479 | struct GNUNET_TIME_Relative ack_deadline; | 3479 | struct GNUNET_TIME_Relative ack_deadline; |
@@ -3524,7 +3524,7 @@ GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket, | |||
3524 | size = GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH * socket->max_payload_size; | 3524 | size = GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH * socket->max_payload_size; |
3525 | num_needed_packets = | 3525 | num_needed_packets = |
3526 | (size + (socket->max_payload_size - 1)) / socket->max_payload_size; | 3526 | (size + (socket->max_payload_size - 1)) / socket->max_payload_size; |
3527 | io_handle = GNUNET_malloc (sizeof (struct GNUNET_STREAM_IOWriteHandle)); | 3527 | io_handle = GNUNET_malloc (sizeof (struct GNUNET_STREAM_WriteHandle)); |
3528 | io_handle->socket = socket; | 3528 | io_handle->socket = socket; |
3529 | io_handle->write_cont = write_cont; | 3529 | io_handle->write_cont = write_cont; |
3530 | io_handle->write_cont_cls = write_cont_cls; | 3530 | io_handle->write_cont_cls = write_cont_cls; |
@@ -3609,7 +3609,8 @@ probe_data_availability (void *cls, | |||
3609 | /** | 3609 | /** |
3610 | * Tries to read data from the stream. Should not be called when another read | 3610 | * Tries to read data from the stream. Should not be called when another read |
3611 | * handle is present; the existing read handle should be canceled with | 3611 | * handle is present; the existing read handle should be canceled with |
3612 | * GNUNET_STREAM_io_read_cancel(). Only one read handle per socket is present at any time | 3612 | * GNUNET_STREAM_read_cancel(). Only one read handle per socket is present at |
3613 | * any time | ||
3613 | * | 3614 | * |
3614 | * @param socket the socket representing a stream | 3615 | * @param socket the socket representing a stream |
3615 | * @param timeout the timeout period | 3616 | * @param timeout the timeout period |
@@ -3622,13 +3623,13 @@ probe_data_availability (void *cls, | |||
3622 | * read handle is present (only one read handle per socket is present | 3623 | * read handle is present (only one read handle per socket is present |
3623 | * at any time) | 3624 | * at any time) |
3624 | */ | 3625 | */ |
3625 | struct GNUNET_STREAM_IOReadHandle * | 3626 | struct GNUNET_STREAM_ReadHandle * |
3626 | GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket, | 3627 | GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket, |
3627 | struct GNUNET_TIME_Relative timeout, | 3628 | struct GNUNET_TIME_Relative timeout, |
3628 | GNUNET_STREAM_DataProcessor proc, | 3629 | GNUNET_STREAM_DataProcessor proc, |
3629 | void *proc_cls) | 3630 | void *proc_cls) |
3630 | { | 3631 | { |
3631 | struct GNUNET_STREAM_IOReadHandle *read_handle; | 3632 | struct GNUNET_STREAM_ReadHandle *read_handle; |
3632 | 3633 | ||
3633 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 3634 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
3634 | "%s: %s()\n", | 3635 | "%s: %s()\n", |
@@ -3657,7 +3658,7 @@ GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket, | |||
3657 | default: | 3658 | default: |
3658 | break; | 3659 | break; |
3659 | } | 3660 | } |
3660 | read_handle = GNUNET_malloc (sizeof (struct GNUNET_STREAM_IOReadHandle)); | 3661 | read_handle = GNUNET_malloc (sizeof (struct GNUNET_STREAM_ReadHandle)); |
3661 | read_handle->proc = proc; | 3662 | read_handle->proc = proc; |
3662 | read_handle->proc_cls = proc_cls; | 3663 | read_handle->proc_cls = proc_cls; |
3663 | read_handle->socket = socket; | 3664 | read_handle->socket = socket; |
@@ -3678,7 +3679,7 @@ GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket, | |||
3678 | * @param ioh handle to operation to cancel | 3679 | * @param ioh handle to operation to cancel |
3679 | */ | 3680 | */ |
3680 | void | 3681 | void |
3681 | GNUNET_STREAM_io_write_cancel (struct GNUNET_STREAM_IOWriteHandle *ioh) | 3682 | GNUNET_STREAM_write_cancel (struct GNUNET_STREAM_WriteHandle *ioh) |
3682 | { | 3683 | { |
3683 | struct GNUNET_STREAM_Socket *socket = ioh->socket; | 3684 | struct GNUNET_STREAM_Socket *socket = ioh->socket; |
3684 | unsigned int packet; | 3685 | unsigned int packet; |
@@ -3706,7 +3707,7 @@ GNUNET_STREAM_io_write_cancel (struct GNUNET_STREAM_IOWriteHandle *ioh) | |||
3706 | * @param ioh handle to operation to cancel | 3707 | * @param ioh handle to operation to cancel |
3707 | */ | 3708 | */ |
3708 | void | 3709 | void |
3709 | GNUNET_STREAM_io_read_cancel (struct GNUNET_STREAM_IOReadHandle *ioh) | 3710 | GNUNET_STREAM_read_cancel (struct GNUNET_STREAM_ReadHandle *ioh) |
3710 | { | 3711 | { |
3711 | struct GNUNET_STREAM_Socket *socket; | 3712 | struct GNUNET_STREAM_Socket *socket; |
3712 | 3713 | ||