From c94be01c832866f9c0169963c658e36dd3329cc2 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 13 Jul 2011 11:07:19 +0000 Subject: revised fragmentation API for blocking writes --- src/include/gnunet_fragmentation_lib.h | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'src/include/gnunet_fragmentation_lib.h') diff --git a/src/include/gnunet_fragmentation_lib.h b/src/include/gnunet_fragmentation_lib.h index bb29a5fba..e91e74c6f 100644 --- a/src/include/gnunet_fragmentation_lib.h +++ b/src/include/gnunet_fragmentation_lib.h @@ -49,8 +49,10 @@ struct GNUNET_FRAGMENT_Context; /** - * Function that is called with messages - * created by the fragmentation module. + * Function that is called with messages created by the fragmentation + * module. In the case of the 'proc' callback of the + * GNUNET_FRAGMENT_context_create function, this function must + * eventually call 'GNUNET_FRAGMENT_context_transmission_done'. * * @param cls closure * @param msg the message that was created @@ -87,6 +89,17 @@ GNUNET_FRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats, void *proc_cls); +/** + * Continuation to call from the 'proc' function after the fragment + * has been transmitted (and hence the next fragment can now be + * given to proc). + * + * @param fc fragmentation context + */ +void +GNUNET_FRAGMENT_context_transmission_done (struct GNUNET_FRAGMENT_Context *fc); + + /** * Process an acknowledgement message we got from the other * side (to control re-transmits). @@ -120,6 +133,21 @@ GNUNET_FRAGMENT_context_destroy (struct GNUNET_FRAGMENT_Context *fc); struct GNUNET_DEFRAGMENT_Context; +/** + * Function that is called with acknowledgement messages created by + * the fragmentation module. Acknowledgements are cummulative, + * so it is OK to only transmit the 'latest' ack message for the same + * message ID. + * + * @param cls closure + * @param id unique message ID (modulo collisions) + * @param msg the message that was created + */ +typedef void (*GNUNET_DEFRAGMENT_AckProcessor) (void *cls, + uint32_t id, + const struct GNUNET_MessageHeader *msg); + + /** * Create a defragmentation context. * @@ -139,7 +167,7 @@ GNUNET_DEFRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats, unsigned int num_msgs, void *cls, GNUNET_FRAGMENT_MessageProcessor proc, - GNUNET_FRAGMENT_MessageProcessor ackp); + GNUNET_DEFRAGMENT_AckProcessor ackp); /** -- cgit v1.2.3