aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_mq_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_mq_lib.h')
-rw-r--r--src/include/gnunet_mq_lib.h29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h
index 3a4dd3d5f..048ad39a0 100644
--- a/src/include/gnunet_mq_lib.h
+++ b/src/include/gnunet_mq_lib.h
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @author Florian Dold 22 * @author Florian Dold
23 * @file set/mq.h 23 * @file include/gnunet_mq_lib.h
24 * @brief general purpose message queue 24 * @brief general purpose message queue
25 */ 25 */
26#ifndef GNUNET_MQ_H 26#ifndef GNUNET_MQ_H
@@ -114,6 +114,9 @@ GNUNET_MQ_extract_nested_mh_ (const struct GNUNET_MessageHeader *mh, uint16_t ba
114 * 114 *
115 * @param mhp pointer to the message header pointer that will be changed to allocate at 115 * @param mhp pointer to the message header pointer that will be changed to allocate at
116 * the newly allocated space for the message. 116 * the newly allocated space for the message.
117 * @param base_size size of the data before the nested message
118 * @param type type of the message in the envelope
119 * @param nested_mh the message to append to the message after base_size
117 */ 120 */
118struct GNUNET_MQ_Envelope * 121struct GNUNET_MQ_Envelope *
119GNUNET_MQ_msg_nested_mh_ (struct GNUNET_MessageHeader **mhp, uint16_t base_size, uint16_t type, 122GNUNET_MQ_msg_nested_mh_ (struct GNUNET_MessageHeader **mhp, uint16_t base_size, uint16_t type,
@@ -271,7 +274,7 @@ GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *mqm);
271 * May only be called once per message. 274 * May only be called once per message.
272 * 275 *
273 * @param mq message queue 276 * @param mq message queue
274 * @param mqm the message to send. 277 * @param ev the envelope with the message to send.
275 */ 278 */
276void 279void
277GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev); 280GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev);
@@ -281,7 +284,7 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev);
281 * Cancel sending the message. Message must have been sent with GNUNET_MQ_send before. 284 * Cancel sending the message. Message must have been sent with GNUNET_MQ_send before.
282 * May not be called after the notify sent callback has been called 285 * May not be called after the notify sent callback has been called
283 * 286 *
284 * @param mqm queued message to cancel 287 * @param ev queued envelope to cancel
285 */ 288 */
286void 289void
287GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev); 290GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev);
@@ -291,7 +294,6 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev);
291 * Associate the assoc_data in mq with a unique request id. 294 * Associate the assoc_data in mq with a unique request id.
292 * 295 *
293 * @param mq message queue, id will be unique for the queue 296 * @param mq message queue, id will be unique for the queue
294 * @param mqm message to associate
295 * @param assoc_data to associate 297 * @param assoc_data to associate
296 */ 298 */
297uint32_t 299uint32_t
@@ -350,11 +352,11 @@ GNUNET_MQ_queue_for_server_client (struct GNUNET_SERVER_Client *client);
350 * 352 *
351 * @param send function the implements sending messages 353 * @param send function the implements sending messages
352 * @param destroy function that implements destroying the queue 354 * @param destroy function that implements destroying the queue
353 * @param destroy function that implements canceling a message 355 * @param cancel function that implements canceling a message
354 * @param state for the queue, passed to 'send' and 'destroy' 356 * @param impl_state for the queue, passed to 'send' and 'destroy'
355 * @param handlers array of message handlers 357 * @param handlers array of message handlers
356 * @param error_handler handler for read and write errors 358 * @param error_handler handler for read and write errors
357 * @param cls closure for handlers 359 * @param cls closure for message handlers and error handler
358 * @return a new message queue 360 * @return a new message queue
359 */ 361 */
360struct GNUNET_MQ_Handle * 362struct GNUNET_MQ_Handle *
@@ -411,7 +413,11 @@ GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq);
411 413
412 414
413/** 415/**
414 * Call the right callback for a message. 416 * Call the message message handler that was registered
417 * for the type of the given message in the given message queue.
418 *
419 * This function is indended to be used for the implementation
420 * of message queues.
415 * 421 *
416 * @param mq message queue with the handlers 422 * @param mq message queue with the handlers
417 * @param mh message to dispatch 423 * @param mh message to dispatch
@@ -422,9 +428,14 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq,
422 428
423 429
424/** 430/**
425 * Call the right callback for an error condition. 431 * Call the error handler of a message queue with the given
432 * error code. If there is no error handler, log a warning.
433 *
434 * This function is intended to be used for the implementation
435 * of message queues.
426 * 436 *
427 * @param mq message queue 437 * @param mq message queue
438 * @param error the error type
428 */ 439 */
429void 440void
430GNUNET_MQ_inject_error (struct GNUNET_MQ_Handle *mq, 441GNUNET_MQ_inject_error (struct GNUNET_MQ_Handle *mq,