aboutsummaryrefslogtreecommitdiff
path: root/src/util/mq.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/mq.c')
-rw-r--r--src/util/mq.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/util/mq.c b/src/util/mq.c
index 54d3d4a2e..f318dd04a 100644
--- a/src/util/mq.c
+++ b/src/util/mq.c
@@ -167,10 +167,12 @@ struct ClientConnectionState
167}; 167};
168 168
169 169
170
171
172/** 170/**
173 * Call the right callback for a message. 171 * Call the message message handler that was registered
172 * for the type of the given message in the given message queue.
173 *
174 * This function is indended to be used for the implementation
175 * of message queues.
174 * 176 *
175 * @param mq message queue with the handlers 177 * @param mq message queue with the handlers
176 * @param mh message to dispatch 178 * @param mh message to dispatch
@@ -199,9 +201,14 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, const struct GNUNET_Messa
199 201
200 202
201/** 203/**
202 * Call the right callback for an error condition. 204 * Call the error handler of a message queue with the given
205 * error code. If there is no error handler, log a warning.
206 *
207 * This function is intended to be used by the implementation
208 * of message queues.
203 * 209 *
204 * @param mq message queue 210 * @param mq message queue
211 * @param error the error type
205 */ 212 */
206void 213void
207GNUNET_MQ_inject_error (struct GNUNET_MQ_Handle *mq, 214GNUNET_MQ_inject_error (struct GNUNET_MQ_Handle *mq,
@@ -230,7 +237,7 @@ GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *mqm)
230 * May only be called once per message. 237 * May only be called once per message.
231 * 238 *
232 * @param mq message queue 239 * @param mq message queue
233 * @param ev the message to send. 240 * @param ev the envelope with the message to send.
234 */ 241 */
235void 242void
236GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev) 243GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
@@ -288,10 +295,11 @@ GNUNET_MQ_impl_send_continue (struct GNUNET_MQ_Handle *mq)
288 * 295 *
289 * @param send function the implements sending messages 296 * @param send function the implements sending messages
290 * @param destroy function that implements destroying the queue 297 * @param destroy function that implements destroying the queue
291 * @param destroy function that implements canceling a message 298 * @param cancel function that implements canceling a message
292 * @param state for the queue, passed to 'send' and 'destroy' 299 * @param impl_state for the queue, passed to 'send' and 'destroy'
293 * @param handlers array of message handlers 300 * @param handlers array of message handlers
294 * @param error_handler handler for read and write errors 301 * @param error_handler handler for read and write errors
302 * @param cls closure for message handlers and error handler
295 * @return a new message queue 303 * @return a new message queue
296 */ 304 */
297struct GNUNET_MQ_Handle * 305struct GNUNET_MQ_Handle *
@@ -391,6 +399,15 @@ GNUNET_MQ_msg_ (struct GNUNET_MessageHeader **mhp, uint16_t size, uint16_t type)
391} 399}
392 400
393 401
402/**
403 * Implementation of the GNUNET_MQ_msg_nested_mh macro.
404 *
405 * @param mhp pointer to the message header pointer that will be changed to allocate at
406 * the newly allocated space for the message.
407 * @param base_size size of the data before the nested message
408 * @param type type of the message in the envelope
409 * @param nested_mh the message to append to the message after base_size
410 */
394struct GNUNET_MQ_Envelope * 411struct GNUNET_MQ_Envelope *
395GNUNET_MQ_msg_nested_mh_ (struct GNUNET_MessageHeader **mhp, uint16_t base_size, uint16_t type, 412GNUNET_MQ_msg_nested_mh_ (struct GNUNET_MessageHeader **mhp, uint16_t base_size, uint16_t type,
396 const struct GNUNET_MessageHeader *nested_mh) 413 const struct GNUNET_MessageHeader *nested_mh)
@@ -633,7 +650,6 @@ GNUNET_MQ_replace_handlers (struct GNUNET_MQ_Handle *mq,
633 * Associate the assoc_data in mq with a unique request id. 650 * Associate the assoc_data in mq with a unique request id.
634 * 651 *
635 * @param mq message queue, id will be unique for the queue 652 * @param mq message queue, id will be unique for the queue
636 * @param mqm message to associate
637 * @param assoc_data to associate 653 * @param assoc_data to associate
638 */ 654 */
639uint32_t 655uint32_t