general purpose request queue More...
Go to the source code of this file.
Data Structures | |
struct | GNUNET_MQ_Envelope |
struct | GNUNET_MQ_Handle |
Handle to a message queue. More... | |
struct | GNUNET_MQ_DestroyNotificationHandle |
Handle we return for callbacks registered to be notified when GNUNET_MQ_destroy() is called on a queue. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "util-mq", __VA_ARGS__) |
Functions | |
void | GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, const struct GNUNET_MessageHeader *mh) |
Call the message message handler that was registered for the type of the given message in the given message queue. More... | |
enum GNUNET_GenericReturnValue | GNUNET_MQ_handle_message (const struct GNUNET_MQ_MessageHandler *handlers, const struct GNUNET_MessageHeader *mh) |
Call the message message handler that was registered for the type of the given message in the given handlers list. More... | |
void | GNUNET_MQ_inject_error (struct GNUNET_MQ_Handle *mq, enum GNUNET_MQ_Error error) |
Call the error handler of a message queue with the given error code. More... | |
void | GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *ev) |
Discard the message queue message, free all allocated resources. More... | |
unsigned int | GNUNET_MQ_get_length (struct GNUNET_MQ_Handle *mq) |
Obtain the current length of the message queue. More... | |
void | GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev) |
Send a message with the given message queue. More... | |
struct GNUNET_MQ_Envelope * | GNUNET_MQ_unsent_head (struct GNUNET_MQ_Handle *mq) |
Remove the first envelope that has not yet been sent from the message queue and return it. More... | |
struct GNUNET_MQ_Envelope * | GNUNET_MQ_env_copy (struct GNUNET_MQ_Envelope *env) |
Function to copy an envelope. More... | |
void | GNUNET_MQ_send_copy (struct GNUNET_MQ_Handle *mq, const struct GNUNET_MQ_Envelope *ev) |
Send a copy of a message with the given message queue. More... | |
static void | impl_send_continue (void *cls) |
Task run to call the send implementation for the next queued message, if any. More... | |
void | GNUNET_MQ_impl_send_continue (struct GNUNET_MQ_Handle *mq) |
Call the send implementation for the next queued message, if any. More... | |
void | GNUNET_MQ_impl_send_in_flight (struct GNUNET_MQ_Handle *mq) |
Call the send notification for the current message, but do not try to send the next message until #gnunet_mq_impl_send_continue is called. More... | |
struct GNUNET_MQ_Handle * | GNUNET_MQ_queue_for_callbacks (GNUNET_MQ_SendImpl send, GNUNET_MQ_DestroyImpl destroy, GNUNET_MQ_CancelImpl cancel, void *impl_state, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls) |
Create a message queue for the specified handlers. More... | |
void | GNUNET_MQ_set_handlers_closure (struct GNUNET_MQ_Handle *mq, void *handlers_cls) |
Change the closure argument in all of the handlers of the mq. More... | |
const struct GNUNET_MessageHeader * | GNUNET_MQ_impl_current (struct GNUNET_MQ_Handle *mq) |
Get the message that should currently be sent. More... | |
void * | GNUNET_MQ_impl_state (struct GNUNET_MQ_Handle *mq) |
Get the implementation state associated with the message queue. More... | |
struct GNUNET_MQ_Envelope * | GNUNET_MQ_msg_ (struct GNUNET_MessageHeader **mhp, uint16_t size, uint16_t type) |
Create a new envelope. More... | |
struct GNUNET_MQ_Envelope * | GNUNET_MQ_msg_copy (const struct GNUNET_MessageHeader *hdr) |
Create a new envelope by copying an existing message. More... | |
struct GNUNET_MQ_Envelope * | GNUNET_MQ_msg_nested_mh_ (struct GNUNET_MessageHeader **mhp, uint16_t base_size, uint16_t type, const struct GNUNET_MessageHeader *nested_mh) |
Implementation of the GNUNET_MQ_msg_nested_mh macro. More... | |
uint32_t | GNUNET_MQ_assoc_add (struct GNUNET_MQ_Handle *mq, void *assoc_data) |
Associate the assoc_data in mq with a unique request id. More... | |
void * | GNUNET_MQ_assoc_get (struct GNUNET_MQ_Handle *mq, uint32_t request_id) |
Get the data associated with a request_id in a queue. More... | |
void * | GNUNET_MQ_assoc_remove (struct GNUNET_MQ_Handle *mq, uint32_t request_id) |
Remove the association for a request_id. More... | |
void | GNUNET_MQ_notify_sent (struct GNUNET_MQ_Envelope *ev, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls) |
Call a callback once the envelope has been sent, that is, sending it can not be canceled anymore. More... | |
void | GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq) |
Destroy the message queue. More... | |
const struct GNUNET_MessageHeader * | GNUNET_MQ_extract_nested_mh_ (const struct GNUNET_MessageHeader *mh, uint16_t base_size) |
Implementation of the #GNUNET_MQ_extract_nexted_mh macro. More... | |
void | GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev) |
Cancel sending the message. More... | |
struct GNUNET_MQ_Envelope * | GNUNET_MQ_get_current_envelope (struct GNUNET_MQ_Handle *mq) |
Function to obtain the current envelope from within GNUNET_MQ_SendImpl implementations. More... | |
struct GNUNET_MQ_Envelope * | GNUNET_MQ_get_last_envelope (struct GNUNET_MQ_Handle *mq) |
Function to obtain the last envelope in the queue. More... | |
void | GNUNET_MQ_env_set_options (struct GNUNET_MQ_Envelope *env, enum GNUNET_MQ_PriorityPreferences pp) |
Set application-specific options for this envelope. More... | |
enum GNUNET_MQ_PriorityPreferences | GNUNET_MQ_env_get_options (struct GNUNET_MQ_Envelope *env) |
Get performance preferences set for this envelope. More... | |
enum GNUNET_MQ_PriorityPreferences | GNUNET_MQ_env_combine_options (enum GNUNET_MQ_PriorityPreferences p1, enum GNUNET_MQ_PriorityPreferences p2) |
Combine performance preferences set for different envelopes that are being combined into one larger envelope. More... | |
void | GNUNET_MQ_set_options (struct GNUNET_MQ_Handle *mq, enum GNUNET_MQ_PriorityPreferences pp) |
Set application-specific options for this queue. More... | |
const struct GNUNET_MessageHeader * | GNUNET_MQ_env_get_msg (const struct GNUNET_MQ_Envelope *env) |
Obtain message contained in envelope. More... | |
const struct GNUNET_MQ_Envelope * | GNUNET_MQ_env_next (const struct GNUNET_MQ_Envelope *env) |
Return next envelope in queue. More... | |
struct GNUNET_MQ_DestroyNotificationHandle * | GNUNET_MQ_destroy_notify (struct GNUNET_MQ_Handle *mq, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls) |
Register function to be called whenever mq is being destroyed. More... | |
void | GNUNET_MQ_destroy_notify_cancel (struct GNUNET_MQ_DestroyNotificationHandle *dnh) |
Cancel registration from GNUNET_MQ_destroy_notify(). More... | |
void | GNUNET_MQ_dll_insert_head (struct GNUNET_MQ_Envelope **env_head, struct GNUNET_MQ_Envelope **env_tail, struct GNUNET_MQ_Envelope *env) |
Insert env into the envelope DLL starting at env_head Note that env must not be in any MQ while this function is used with DLLs defined outside of the MQ module. More... | |
void | GNUNET_MQ_dll_insert_tail (struct GNUNET_MQ_Envelope **env_head, struct GNUNET_MQ_Envelope **env_tail, struct GNUNET_MQ_Envelope *env) |
Insert env into the envelope DLL starting at env_head Note that env must not be in any MQ while this function is used with DLLs defined outside of the MQ module. More... | |
void | GNUNET_MQ_dll_remove (struct GNUNET_MQ_Envelope **env_head, struct GNUNET_MQ_Envelope **env_tail, struct GNUNET_MQ_Envelope *env) |
Remove env from the envelope DLL starting at env_head. More... | |
struct GNUNET_MQ_MessageHandler * | GNUNET_MQ_copy_handlers (const struct GNUNET_MQ_MessageHandler *handlers) |
Copy an array of handlers. More... | |
struct GNUNET_MQ_MessageHandler * | GNUNET_MQ_copy_handlers2 (const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_MessageCallback agpl_handler, void *agpl_cls) |
Copy an array of handlers, appending AGPL handler. More... | |
unsigned int | GNUNET_MQ_count_handlers (const struct GNUNET_MQ_MessageHandler *handlers) |
Count the handlers in a handler array. More... | |
const char * | GNUNET_MQ_preference_to_string (enum GNUNET_MQ_PreferenceKind type) |
Convert an enum GNUNET_MQ_PreferenceType to a string. More... | |
general purpose request queue
Definition in file mq.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "util-mq", __VA_ARGS__) |
|
static |
Task run to call the send implementation for the next queued message, if any.
Only useful for implementing message queues, results in undefined behavior if not used carefully.
cls | message queue to send the next message with |
Definition at line 409 of file mq.c.
References GNUNET_MQ_Handle::current_envelope, GNUNET_MQ_Handle::envelope_head, GNUNET_MQ_Handle::envelope_tail, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MQ_Handle::impl_state, LOG, GNUNET_MQ_Envelope::mh, mq, GNUNET_MQ_Handle::send_impl, GNUNET_MQ_Handle::send_task, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.
Referenced by GNUNET_MQ_impl_send_continue().