General-purpose message queue. More...
Data Structures | |
struct | GNUNET_MQ_MessageHandler |
Message handler for a specific message type. More... | |
Macros | |
#define | GNUNET_MQ_LIB_H |
#define | GNUNET_MQ_msg_extra(mvar, esize, type) |
Allocate an envelope, with extra space allocated after the space needed by the message struct. More... | |
#define | GNUNET_MQ_msg(mvar, type) GNUNET_MQ_msg_extra (mvar, 0, type) |
Allocate a GNUNET_MQ_Envelope. More... | |
#define | GNUNET_MQ_msg_header(type) GNUNET_MQ_msg_ (NULL, sizeof(struct GNUNET_MessageHeader), type) |
Allocate a GNUNET_MQ_Envelope, where the message only consists of a header. More... | |
#define | GNUNET_MQ_msg_header_extra(mh, esize, type) |
Allocate a GNUNET_MQ_Envelope, where the message only consists of a header and extra space. More... | |
#define | GNUNET_MQ_msg_nested_mh(mvar, type, mh) |
Allocate a GNUNET_MQ_Envelope, and append a payload message after the given message struct. More... | |
#define | GNUNET_MQ_extract_nested_mh(var) |
Return a pointer to the message at the end of the given message. More... | |
#define | GNUNET_MQ_handler_end() |
End-marker for the handlers array. More... | |
Typedefs | |
typedef void(* | GNUNET_MQ_MessageCallback) (void *cls, const struct GNUNET_MessageHeader *msg) |
Called when a message has been received. More... | |
typedef enum GNUNET_GenericReturnValue(* | GNUNET_MQ_MessageValidationCallback) (void *cls, const struct GNUNET_MessageHeader *msg) |
Called when a message needs to be validated. More... | |
typedef void(* | GNUNET_MQ_SendImpl) (struct GNUNET_MQ_Handle *mq, const struct GNUNET_MessageHeader *msg, void *impl_state) |
Signature of functions implementing the sending functionality of a message queue. More... | |
typedef void(* | GNUNET_MQ_DestroyImpl) (struct GNUNET_MQ_Handle *mq, void *impl_state) |
Signature of functions implementing the destruction of a message queue. More... | |
typedef void(* | GNUNET_MQ_CancelImpl) (struct GNUNET_MQ_Handle *mq, void *impl_state) |
Implementation function that cancels the currently sent message. More... | |
typedef void(* | GNUNET_MQ_ErrorHandler) (void *cls, enum GNUNET_MQ_Error error) |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue. More... | |
Enumerations | |
enum | GNUNET_MQ_Error { GNUNET_MQ_ERROR_READ = 1 , GNUNET_MQ_ERROR_WRITE = 2 , GNUNET_MQ_ERROR_TIMEOUT = 4 , GNUNET_MQ_ERROR_MALFORMED = 8 , GNUNET_MQ_ERROR_NO_MATCH = 16 } |
Error codes for the queue. More... | |
enum | GNUNET_MQ_PriorityPreferences { GNUNET_MQ_PRIO_BACKGROUND = 0 , GNUNET_MQ_PRIO_BEST_EFFORT = 1 , GNUNET_MQ_PRIO_URGENT = 2 , GNUNET_MQ_PRIO_CRITICAL_CONTROL = 3 , GNUNET_MQ_PRIORITY_MASK = 3 , GNUNET_MQ_PREF_UNRELIABLE = 16 , GNUNET_MQ_PREF_LOW_LATENCY = 32 , GNUNET_MQ_PREF_CORK_ALLOWED = 64 , GNUNET_MQ_PREF_GOODPUT = 128 , GNUNET_MQ_PREF_OUT_OF_ORDER = 256 } |
Per envelope preferences and priorities. More... | |
Functions | |
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... | |
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_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... | |
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... | |
struct GNUNET_NotificationContext * | GNUNET_notification_context_create (unsigned int queue_length) |
Create a new notification context. More... | |
void | GNUNET_notification_context_destroy (struct GNUNET_NotificationContext *nc) |
Destroy the context, force disconnect for all subscribers. More... | |
void | GNUNET_notification_context_add (struct GNUNET_NotificationContext *nc, struct GNUNET_MQ_Handle *mq) |
Add a subscriber to the notification context. More... | |
void | GNUNET_notification_context_broadcast (struct GNUNET_NotificationContext *nc, const struct GNUNET_MessageHeader *msg, int can_drop) |
Send a message to all subscribers of this context. More... | |
unsigned int | GNUNET_notification_context_get_size (struct GNUNET_NotificationContext *nc) |
Return active number of subscribers in this context. More... | |
will return a <tt>struct | |||||||||
Defines a static function name which takes two arguments and a context-pointer for validating and handling variable-sized messages of type code and with a message type argument of str. Given such arguments, the function GNUNET_MQ_MessageHandler for the given message type. The macro is to be used as follows:
| |||||||||
enum | GNUNET_MQ_PreferenceKind { GNUNET_MQ_PREFERENCE_NONE = 0 , GNUNET_MQ_PREFERENCE_BANDWIDTH = 1 , GNUNET_MQ_PREFERENCE_LATENCY = 2 , GNUNET_MQ_PREFERENCE_RELIABILITY } | ||||||||
Enum defining all known preference categories. 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... | |||||||||
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... | |||||||||
void | GNUNET_MQ_discard (struct GNUNET_MQ_Envelope *mqm) | ||||||||
Discard the message queue message, free all allocated resources. 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_env_copy (struct GNUNET_MQ_Envelope *env) | ||||||||
Function to copy an envelope. 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... | |||||||||
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... | |||||||||
void | GNUNET_MQ_set_options (struct GNUNET_MQ_Handle *mq, enum GNUNET_MQ_PriorityPreferences pp) | ||||||||
Set application-specific options for this queue. 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... | |||||||||
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... | |||||||||
void | GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev) | ||||||||
Cancel sending the message. 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... | |||||||||
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 *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... | |||||||||
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... | |||||||||
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_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... | |||||||||
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_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... | |||||||||
void * | GNUNET_MQ_impl_state (struct GNUNET_MQ_Handle *mq) | ||||||||
Get the implementation state associated with the message queue. More... | |||||||||
const struct GNUNET_MessageHeader * | GNUNET_MQ_impl_current (struct GNUNET_MQ_Handle *mq) | ||||||||
Get the message that should currently be sent. More... | |||||||||
const char * | GNUNET_MQ_preference_to_string (enum GNUNET_MQ_PreferenceKind type) | ||||||||
Convert an enum GNUNET_MQ_PreferenceType to a string. More... | |||||||||
#define | GNUNET_MQ_hd_var_size(name, code, str, ctx) | ||||||||
#define | GNUNET_MQ_check_zero_termination(m) | ||||||||
Insert code for a "check_" function that verifies that a given variable-length message received over the network is followed by a 0-terminated string. More... | |||||||||
#define | GNUNET_MQ_check_boxed_message(m) | ||||||||
Insert code for a "check_" function that verifies that a given variable-length message received over the network is followed by another variable-length message that fits exactly with the given size. More... | |||||||||
will return a <tt>struct GNUNET_MQ_MessageHandler</tt> | |||||||||
Defines a static function name which takes as a single argument a message handler for fixed-sized messages of type code and with a message type argument of str. Given such an argument, the function for the given message type. The macro is to be used as follows:
| |||||||||
#define | GNUNET_MQ_hd_fixed_size(name, code, str, ctx) | ||||||||
General-purpose message queue.
General-purpose broadcast mechanism for message queues.
#define GNUNET_MQ_LIB_H |
Definition at line 44 of file gnunet_mq_lib.h.
#define GNUNET_MQ_msg_extra | ( | mvar, | |
esize, | |||
type | |||
) |
Allocate an envelope, with extra space allocated after the space needed by the message struct.
The allocated message will already have the type and size field set.
mvar | variable to store the allocated message in; must have a header field; can be NULL |
esize | extra space to allocate after the message |
type | type of the message |
Definition at line 61 of file gnunet_mq_lib.h.
#define GNUNET_MQ_msg | ( | mvar, | |
type | |||
) | GNUNET_MQ_msg_extra (mvar, 0, type) |
Allocate a GNUNET_MQ_Envelope.
The contained message will already have the type and size field set.
mvar | variable to store the allocated message in; must have a header field; can be NULL |
type | type of the message |
Definition at line 76 of file gnunet_mq_lib.h.
#define GNUNET_MQ_msg_header | ( | type | ) | GNUNET_MQ_msg_ (NULL, sizeof(struct GNUNET_MessageHeader), type) |
Allocate a GNUNET_MQ_Envelope, where the message only consists of a header.
The allocated message will already have the type and size field set.
type | type of the message |
Definition at line 85 of file gnunet_mq_lib.h.
Allocate a GNUNET_MQ_Envelope, where the message only consists of a header and extra space.
The allocated message will already have the type and size field set.
mh | pointer that will changed to point at to the allocated message header |
esize | extra space to allocate after the message header |
type | type of the message |
Definition at line 97 of file gnunet_mq_lib.h.
Allocate a GNUNET_MQ_Envelope, and append a payload message after the given message struct.
mvar | pointer to a message struct, will be changed to point at the newly allocated message, whose size is 'sizeof(*mvar) + ntohs (mh->size)' |
type | message type of the allocated message, has no effect on the nested message |
mh | message to nest |
Definition at line 112 of file gnunet_mq_lib.h.
#define GNUNET_MQ_extract_nested_mh | ( | var | ) |
Return a pointer to the message at the end of the given message.
var | pointer to a message struct, the type of the expression determines the base size, the space after the base size is the nested message |
Definition at line 132 of file gnunet_mq_lib.h.
#define GNUNET_MQ_handler_end | ( | ) |
End-marker for the handlers array.
Definition at line 531 of file gnunet_mq_lib.h.
Definition at line 565 of file gnunet_mq_lib.h.
Definition at line 617 of file gnunet_mq_lib.h.
#define GNUNET_MQ_check_zero_termination | ( | m | ) |
Insert code for a "check_" function that verifies that a given variable-length message received over the network is followed by a 0-terminated string.
If the message m is not followed by a 0-terminated string, an error is logged and the function is returned with GNUNET_NO.
an | IPC message with proper type to determine the size, starting with a struct GNUNET_MessageHeader |
Definition at line 640 of file gnunet_mq_lib.h.
#define GNUNET_MQ_check_boxed_message | ( | m | ) |
Insert code for a "check_" function that verifies that a given variable-length message received over the network is followed by another variable-length message that fits exactly with the given size.
If the message m is not followed by another struct GNUNET_MessageHeader
with a size that adds up to the total size, an error is logged and the function is returned with GNUNET_NO.
an | IPC message with proper type to determine the size, starting with a struct GNUNET_MessageHeader |
Definition at line 666 of file gnunet_mq_lib.h.
typedef void(* GNUNET_MQ_MessageCallback) (void *cls, const struct GNUNET_MessageHeader *msg) |
Called when a message has been received.
cls | closure |
msg | the received message |
Definition at line 318 of file gnunet_mq_lib.h.
typedef enum GNUNET_GenericReturnValue(* GNUNET_MQ_MessageValidationCallback) (void *cls, const struct GNUNET_MessageHeader *msg) |
Called when a message needs to be validated.
cls | closure |
msg | the received message |
Definition at line 318 of file gnunet_mq_lib.h.
typedef void(* GNUNET_MQ_SendImpl) (struct GNUNET_MQ_Handle *mq, const struct GNUNET_MessageHeader *msg, void *impl_state) |
Signature of functions implementing the sending functionality of a message queue.
mq | the message queue |
msg | the message to send |
impl_state | state of the implementation |
Definition at line 346 of file gnunet_mq_lib.h.
typedef void(* GNUNET_MQ_DestroyImpl) (struct GNUNET_MQ_Handle *mq, void *impl_state) |
Signature of functions implementing the destruction of a message queue.
Implementations must not free mq, but should take care of impl_state.
mq | the message queue to destroy |
impl_state | state of the implementation |
Definition at line 361 of file gnunet_mq_lib.h.
typedef void(* GNUNET_MQ_CancelImpl) (struct GNUNET_MQ_Handle *mq, void *impl_state) |
Implementation function that cancels the currently sent message.
mq | message queue |
impl_state | state specific to the implementation |
Definition at line 372 of file gnunet_mq_lib.h.
typedef void(* GNUNET_MQ_ErrorHandler) (void *cls, enum GNUNET_MQ_Error error) |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.
Not every message queue implementation supports an error handler.
cls | closure |
error | error code |
Definition at line 386 of file gnunet_mq_lib.h.
enum GNUNET_MQ_Error |
Error codes for the queue.
Definition at line 201 of file gnunet_mq_lib.h.
Per envelope preferences and priorities.
Enumerator | |
---|---|
GNUNET_MQ_PRIO_BACKGROUND | Lowest priority, i.e. background traffic (e.g. NSE, FS). This is the default! |
GNUNET_MQ_PRIO_BEST_EFFORT | Best-effort traffic (e.g. CADET relay, DHT) |
GNUNET_MQ_PRIO_URGENT | Urgent traffic (local peer, e.g. Conversation). |
GNUNET_MQ_PRIO_CRITICAL_CONTROL | Highest priority, control traffic (e.g. CORE/CADET KX). |
GNUNET_MQ_PRIORITY_MASK | Bit mask to apply to extract the priority bits. |
GNUNET_MQ_PREF_UNRELIABLE | Flag to indicate that unreliable delivery is acceptable. This means TRANSPORT will not attempt to receive an acknowledgment. CORE will just pass this flag through. CADET will use unreliable delivery if this flag is set. Note that even without this flag, messages may be lost by TRANSPORT and CORE. Thus, how "strong" the semantics of reliable delivery are depends on the layer! |
GNUNET_MQ_PREF_LOW_LATENCY | Flag to indicate that low latency is important. This flag must generally not be used in combination with #GNUNET_MQ_PREF_CORKING_ALLOWED as it would be a contradiction. When this flags is set, the envelope may skip forward in the queue (depending on priority) and also TRANSPORT should attempt to pick a communicator with particularly low latency. |
GNUNET_MQ_PREF_CORK_ALLOWED | Flag to indicate that CORKing is acceptable. This allows the receiver to delay transmission in hope of combining this message with other messages into a larger transmission with less per-message overhead. |
GNUNET_MQ_PREF_GOODPUT | Flag to indicate that high bandwidth is desired. This flag indicates that the method chosen for transmission should focus on overall goodput. It rarely makes sense to combine this flag with GNUNET_MQ_PREF_LOW_LATENCY. |
GNUNET_MQ_PREF_OUT_OF_ORDER | Flag to indicate that out-of-order delivery is OK. |
Definition at line 237 of file gnunet_mq_lib.h.
Enum defining all known preference categories.
enum GNUNET_MQ_PriorityPreference
Definition at line 1087 of file gnunet_mq_lib.h.
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.
mh | message header to extract nested message header from |
base_size | size of the message before the nested message's header appears |
Definition at line 757 of file mq.c.
References GNUNET_assert, GNUNET_break_op, mh, and GNUNET_MessageHeader::size.
const struct GNUNET_MessageHeader * GNUNET_MQ_env_get_msg | ( | const struct GNUNET_MQ_Envelope * | env | ) |
Obtain message contained in envelope.
env | the envelope |
Definition at line 896 of file mq.c.
References env, and GNUNET_MQ_Envelope::mh.
Referenced by do_send(), hello_iter(), mqm_execute(), route_message(), run(), and store_pi().
const struct GNUNET_MQ_Envelope * GNUNET_MQ_env_next | ( | const struct GNUNET_MQ_Envelope * | env | ) |
Return next envelope in queue.
env | a queued envelope |
Definition at line 903 of file mq.c.
References env, and GNUNET_MQ_Envelope::next.
Referenced by route_message().
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.
mhp | pointer to the message header pointer that will be changed to allocate at the newly allocated space for the message. |
base_size | size of the data before the nested message |
type | type of the message in the envelope |
nested_mh | the message to append to the message after base_size |
Definition at line 565 of file mq.c.
References GNUNET_memcpy, GNUNET_MQ_msg_(), GNUNET_MQ_Envelope::mh, GNUNET_MessageHeader::size, size, and type.
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.
This is just in case some application needs to also manage a FIFO of envelopes independent of MQ itself and wants to reuse the pointers internal to env. Use with caution.
[in,out] | env_head | of envelope DLL |
[in,out] | env_tail | tail of envelope DLL |
[in,out] | env | element to insert at the tail |
Definition at line 941 of file mq.c.
References env, and GNUNET_CONTAINER_DLL_insert.
Referenced by route_message().
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.
This is just in case some application needs to also manage a FIFO of envelopes independent of MQ itself and wants to reuse the pointers internal to env. Use with caution.
[in,out] | env_head | of envelope DLL |
[in,out] | env_tail | tail of envelope DLL |
[in,out] | env | element to insert at the tail |
Definition at line 952 of file mq.c.
References env, and GNUNET_CONTAINER_DLL_insert_tail.
Referenced by route_message().
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.
Note that env must not be in any MQ while this function is used with DLLs defined outside of the MQ module. This is just in case some application needs to also manage a FIFO of envelopes independent of MQ itself and wants to reuse the pointers internal to env. Use with caution.
[in,out] | env_head | of envelope DLL |
[in,out] | env_tail | tail of envelope DLL |
[in,out] | env | element to remove from the DLL |
Definition at line 963 of file mq.c.
References env, and GNUNET_CONTAINER_DLL_remove.
Referenced by dir_ready_cb(), and discard_buffer().
struct GNUNET_MQ_MessageHandler * GNUNET_MQ_copy_handlers | ( | const struct GNUNET_MQ_MessageHandler * | handlers | ) |
Copy an array of handlers.
Useful if the array has been declared in local memory and needs to be persisted for future use.
handlers | Array of handlers to be copied. |
Definition at line 974 of file mq.c.
References GNUNET_memcpy, GNUNET_MQ_count_handlers(), GNUNET_new_array, and handlers.
Referenced by GNUNET_CADET_open_port(), GNUNET_CORE_connect(), GNUNET_MQ_queue_for_callbacks(), GNUNET_SERVICE_register_(), and GNUNET_SERVICE_run_().
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.
Useful if the array has been declared in local memory and needs to be persisted for future use.
handlers | Array of handlers to be copied. Can be NULL (nothing done). |
agpl_handler | function to call for AGPL handling |
agpl_cls | closure for agpl_handler |
Definition at line 992 of file mq.c.
References GNUNET_MQ_MessageHandler::cb, GNUNET_MQ_MessageHandler::cls, GNUNET_MQ_MessageHandler::expected_size, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_REQUEST_AGPL, GNUNET_MQ_count_handlers(), GNUNET_new_array, handlers, GNUNET_MQ_MessageHandler::mv, and GNUNET_MQ_MessageHandler::type.
Referenced by GNUNET_CADET_open_port(), GNUNET_SERVICE_register_(), GNUNET_SERVICE_run_(), and GNUNET_SERVICE_start().
unsigned int GNUNET_MQ_count_handlers | ( | const struct GNUNET_MQ_MessageHandler * | handlers | ) |
Count the handlers in a handler array.
handlers | Array of handlers to be counted. |
Definition at line 1017 of file mq.c.
References handlers.
Referenced by GNUNET_CORE_connect(), GNUNET_MQ_copy_handlers(), and GNUNET_MQ_copy_handlers2().
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.
This function is indented to be used for the implementation of message queues.
handlers | a set of handlers |
mh | message to dispatch |
Definition at line 205 of file mq.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, handlers, LOG, and mh.
Referenced by demultiplex_with_cmc(), GDS_u_receive(), GNUNET_MQ_inject_message(), helper_mst(), and tokenizer_cb().
struct GNUNET_MQ_Envelope * GNUNET_MQ_msg_ | ( | struct GNUNET_MessageHeader ** | mhp, |
uint16_t | size, | ||
uint16_t | type | ||
) |
Create a new envelope.
mhp | message header to store the allocated message header in, can be NULL |
size | size of the message to allocate |
type | type of the message, will be set in the allocated message |
Definition at line 533 of file mq.c.
References GNUNET_malloc, GNUNET_MQ_Envelope::mh, GNUNET_MessageHeader::size, size, type, and GNUNET_MessageHeader::type.
Referenced by GNUNET_MQ_msg_nested_mh_().
struct GNUNET_MQ_Envelope * GNUNET_MQ_msg_copy | ( | const struct GNUNET_MessageHeader * | hdr | ) |
Create a new envelope by copying an existing message.
hdr | header of the message to copy |
Definition at line 550 of file mq.c.
References GNUNET_malloc, GNUNET_memcpy, GNUNET_MQ_Envelope::mh, GNUNET_MessageHeader::size, and size.
Referenced by do_connect(), GNUNET_MQ_env_copy(), GNUNET_notification_context_broadcast(), handle_send_msg(), handle_start(), route_message(), schedule_next_hello(), send_key(), send_ping(), and transmit_task_cb().
void GNUNET_MQ_discard | ( | struct GNUNET_MQ_Envelope * | mqm | ) |
Discard the message queue message, free all allocated resources.
Must be called in the event that a message is created but should not actually be sent.
mqm | the message to discard |
Definition at line 285 of file mq.c.
References GNUNET_assert, GNUNET_free, and GNUNET_MQ_Envelope::parent_queue.
Referenced by abort_all_requests(), broadcast_status(), cadet_mq_cancel_impl(), core_mq_cancel_impl(), destroy_channel(), discard_buffer(), disconnect_and_free_peer_entry(), free_ait(), free_channel_client(), free_it(), free_op(), free_qe(), free_queue_entry(), free_ze(), GCCH_handle_channel_plaintext_data(), GCP_request_mq_cancel(), GCP_send_ooo(), GCP_set_mq(), GCT_send_cancel(), GNUNET_ABD_request_cancel(), GNUNET_GNS_lookup_cancel(), GNUNET_MQ_destroy(), GSF_peer_disconnect_handler(), handle_dns_response(), handle_result(), make_queue_entry(), mqm_execute(), send_client_element(), send_to_channel(), and set_operation_destroy().
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.
mq | message queue to interrogate |
Definition at line 830 of file mq.c.
References GNUNET_MQ_Handle::current_envelope, and mq.
Referenced by cadet_mq_send_impl(), core_mq_send_impl(), and mq_send_impl().
struct GNUNET_MQ_Envelope * GNUNET_MQ_env_copy | ( | struct GNUNET_MQ_Envelope * | env | ) |
Function to copy an envelope.
The envelope must not yet be in any queue or have any options or callbacks set.
env | envelope to copy |
Definition at line 373 of file mq.c.
References env, GNUNET_assert, GNUNET_MQ_msg_copy(), GNUNET_NO, GNUNET_MQ_Envelope::have_custom_options, GNUNET_MQ_Envelope::mh, GNUNET_MQ_Envelope::next, GNUNET_MQ_Envelope::parent_queue, and GNUNET_MQ_Envelope::sent_cb.
Referenced by cadet_channel_end_cb(), and dns_pre_request_handler().
struct GNUNET_MQ_Envelope * GNUNET_MQ_get_last_envelope | ( | struct GNUNET_MQ_Handle * | mq | ) |
Function to obtain the last envelope in the queue.
mq | message queue to interrogate |
Definition at line 837 of file mq.c.
References GNUNET_MQ_Handle::current_envelope, GNUNET_MQ_Handle::envelope_tail, and mq.
void GNUNET_MQ_env_set_options | ( | struct GNUNET_MQ_Envelope * | env, |
enum GNUNET_MQ_PriorityPreferences | pp | ||
) |
Set application-specific options for this envelope.
Overrides the options set for the queue with GNUNET_MQ_set_options() for this message only.
env | message to set options for |
pp | priority and preferences to set for env |
Definition at line 847 of file mq.c.
References env, GNUNET_YES, GNUNET_MQ_Envelope::have_custom_options, and GNUNET_MQ_Envelope::priority.
Referenced by adv_transmit(), client_request_complete_alice(), route_message(), send_to_channel(), and transmit_pending().
enum GNUNET_MQ_PriorityPreferences GNUNET_MQ_env_get_options | ( | struct GNUNET_MQ_Envelope * | env | ) |
Get performance preferences set for this envelope.
env | message to set options for |
Definition at line 856 of file mq.c.
References env, GNUNET_YES, GNUNET_MQ_Envelope::have_custom_options, mq, GNUNET_MQ_Envelope::parent_queue, GNUNET_MQ_Envelope::priority, and GNUNET_MQ_Handle::priority.
Referenced by cadet_mq_send_impl(), core_mq_send_impl(), mq_send_impl(), and route_message().
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.
p1 | one set of preferences |
p2 | second set of preferences |
Definition at line 869 of file mq.c.
References GNUNET_MAX, GNUNET_MQ_PREF_CORK_ALLOWED, GNUNET_MQ_PREF_GOODPUT, GNUNET_MQ_PREF_LOW_LATENCY, GNUNET_MQ_PREF_OUT_OF_ORDER, GNUNET_MQ_PREF_UNRELIABLE, GNUNET_MQ_PRIORITY_MASK, and ret.
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.
mq | queue to remove envelope from |
Definition at line 355 of file mq.c.
References env, GNUNET_MQ_Handle::envelope_head, GNUNET_MQ_Handle::envelope_tail, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, mq, GNUNET_MQ_Envelope::parent_queue, and GNUNET_MQ_Handle::queue_length.
Referenced by send_to_channel().
void GNUNET_MQ_set_options | ( | struct GNUNET_MQ_Handle * | mq, |
enum GNUNET_MQ_PriorityPreferences | pp | ||
) |
Set application-specific options for this queue.
mq | message queue to set options for |
pp | priority and preferences to use by default |
Definition at line 888 of file mq.c.
References mq, and GNUNET_MQ_Handle::priority.
Referenced by connect_notify(), and handle_core_connect().
unsigned int GNUNET_MQ_get_length | ( | struct GNUNET_MQ_Handle * | mq | ) |
Obtain the current length of the message queue.
mq | queue to inspect |
Definition at line 293 of file mq.c.
References GNUNET_assert, GNUNET_MQ_Handle::in_flight, mq, and GNUNET_MQ_Handle::queue_length.
Referenced by continue_writing(), GCP_send(), GCP_send_ooo(), GNUNET_notification_context_broadcast(), GNUNET_STATISTICS_destroy(), GNUNET_TRANSPORT_communicator_receive(), GSC_CLIENTS_deliver_message(), GSC_NEIGHBOURS_get_queue_length(), handle_p2p_get(), schedule_action(), send_to_channel(), and transmit_pending().
void GNUNET_MQ_send | ( | struct GNUNET_MQ_Handle * | mq, |
struct GNUNET_MQ_Envelope * | ev | ||
) |
Send a message with the given message queue.
May only be called once per message.
mq | message queue |
ev | the envelope with the message to send. |
Definition at line 305 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_insert_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MQ_Handle::impl_state, LOG, GNUNET_MQ_Envelope::mh, mq, GNUNET_MQ_Envelope::parent_queue, GNUNET_MQ_Handle::queue_length, GNUNET_MQ_Handle::send_impl, GNUNET_MQ_Handle::send_task, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.
Referenced by addr_cb(), adv_transmit(), announce_reconnect(), attr_iter_cb(), attr_iter_finished(), attr_store_cont(), broadcast_status(), cadet_channel_end_cb(), cadet_mq_send_now(), callback_found_message(), cancel_stream(), change_service(), check_peer_online(), clean_up_channel(), client_request_complete_alice(), client_response_handler(), client_send_response(), conclude_autoconfig_request(), connect_cb(), consume_result_cb(), core_mq_send_impl(), core_send_connect_info(), cores_send_disconnect_info(), create_internal(), create_loc_uri(), cred_iter_cb(), cred_iter_finished(), cred_store_cont(), decode_and_send(), decrypt_conclude(), dns_pre_request_handler(), do_connect(), do_flood(), do_send(), fail_intersection_operation(), fail_union_operation(), finish_cmc_handling_with_continue(), finish_handling_raw_message(), forward_reply(), GCP_request_mq_cancel(), GCP_send_ooo(), get_action(), get_all_peers_iterator(), get_all_tunnels_iterator(), GNUNET_ARM_request_service_list(), GNUNET_CADET_channel_create(), GNUNET_CADET_channel_destroy(), GNUNET_CADET_close_port(), GNUNET_CADET_drop_message(), GNUNET_CADET_receive_done(), GNUNET_CONSENSUS_conclude(), GNUNET_CONSENSUS_create(), GNUNET_CONSENSUS_insert(), GNUNET_CONVERSATION_call_resume(), GNUNET_CONVERSATION_call_suspend(), GNUNET_CONVERSATION_caller_hang_up(), GNUNET_CONVERSATION_caller_pick_up(), GNUNET_CONVERSATION_caller_resume(), GNUNET_CONVERSATION_caller_suspend(), GNUNET_DATASTORE_disconnect(), GNUNET_DHT_get_stop(), GNUNET_DHT_hello_get(), GNUNET_DHT_hello_offer(), GNUNET_DHT_monitor_stop(), GNUNET_DHT_put(), GNUNET_DNS_request_answer(), GNUNET_DNS_request_drop(), GNUNET_DNS_request_forward(), GNUNET_FS_get_indexed_files(), GNUNET_FS_indexing_send_list(), GNUNET_IDENTITY_create(), GNUNET_IDENTITY_delete(), GNUNET_IDENTITY_ego_lookup(), GNUNET_IDENTITY_ego_lookup_by_suffix(), GNUNET_IDENTITY_rename(), GNUNET_MESSENGER_connect(), GNUNET_MESSENGER_disconnect(), GNUNET_MESSENGER_get_message(), GNUNET_MQ_send_copy(), GNUNET_NAMECACHE_block_cache(), GNUNET_NAMECACHE_lookup_block(), GNUNET_NAMESTORE_record_set_edit_begin(), GNUNET_NAMESTORE_record_set_edit_cancel(), GNUNET_NAMESTORE_records_store(), GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_NAMESTORE_zone_iteration_start2(), GNUNET_NAMESTORE_zone_iteration_stop(), GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_NAMESTORE_zone_monitor_next(), GNUNET_NAMESTORE_zone_to_name(), GNUNET_NAT_add_global_address(), GNUNET_NAT_AUTO_autoconfig_start(), GNUNET_NAT_request_reversal(), GNUNET_NAT_stun_handle_packet(), GNUNET_notification_context_broadcast(), GNUNET_PEERSTORE_iteration_next(), GNUNET_PEERSTORE_iteration_start(), GNUNET_PEERSTORE_iteration_stop(), GNUNET_PEERSTORE_monitor_next(), GNUNET_PEERSTORE_store(), GNUNET_RECLAIM_get_attributes_next(), GNUNET_RECLAIM_get_attributes_start(), GNUNET_RECLAIM_get_attributes_stop(), GNUNET_RECLAIM_get_credentials_next(), GNUNET_RECLAIM_get_credentials_start(), GNUNET_RECLAIM_get_credentials_stop(), GNUNET_RECLAIM_ticket_iteration_next(), GNUNET_RECLAIM_ticket_iteration_start(), GNUNET_RECLAIM_ticket_iteration_stop(), GNUNET_RECLAIM_ticket_revoke(), GNUNET_REVOCATION_query(), GNUNET_REVOCATION_revoke(), GNUNET_RPS_seed_ids(), GNUNET_RPS_stream_request(), GNUNET_RPS_sub_start(), GNUNET_RPS_sub_stop(), GNUNET_RPS_view_request(), GNUNET_RPS_view_request_cancel(), GNUNET_SCALARPRODUCT_accept_computation(), GNUNET_SCALARPRODUCT_start_computation(), GNUNET_SECRETSHARING_create_session(), GNUNET_SECRETSHARING_decrypt(), gnunet_send(), GNUNET_SET_add_element(), GNUNET_SET_commit(), GNUNET_SET_copy_lazy(), GNUNET_SET_iterate(), GNUNET_SET_operation_cancel(), GNUNET_SET_remove_element(), GNUNET_SETI_add_element(), GNUNET_SETI_commit(), GNUNET_SETI_create(), GNUNET_SETI_operation_cancel(), GNUNET_SETU_add_element(), GNUNET_SETU_commit(), GNUNET_SETU_create(), GNUNET_SETU_operation_cancel(), GNUNET_TRANSPORT_application_suggest_cancel(), GNUNET_TRANSPORT_application_validate(), GNUNET_TRANSPORT_communicator_burst_finished(), GNUNET_TRANSPORT_communicator_notify(), GNUNET_TRANSPORT_communicator_receive(), GNUNET_TRANSPORT_TESTING_send(), GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue(), GNUNET_TRANSPORT_TESTING_transport_communicator_send(), GSC_CLIENTS_deliver_message(), GSC_CLIENTS_notify_client_about_neighbour(), GSC_CLIENTS_solicit_request(), GSC_KX_encrypt_and_transmit(), GSC_KX_handle_client_monitor_peers(), GSC_send_to_client(), handle_backchannel_encapsulation(), handle_block_cache(), handle_cadet_audio_message(), handle_cadet_hangup_message(), handle_cadet_pickup_message(), handle_cadet_resume_message(), handle_cadet_ring_message(), handle_cadet_suspend_message(), handle_channel_created(), handle_client_accept(), handle_client_audio_message(), handle_client_call_message(), handle_client_copy_lazy_prepare(), handle_client_evaluate(), handle_client_hangup_message(), handle_client_init(), handle_client_loc_sign(), handle_client_pickup_message(), handle_client_resume_message(), handle_client_suspend_message(), handle_client_unindex(), handle_communicator_backchannel(), handle_create_queue(), handle_data(), handle_datastore_reply(), handle_dht_local_hello_get(), handle_disconnect(), handle_edit_record_set(), handle_edit_record_set_cancel(), handle_get(), handle_get_peers(), handle_gns_response(), handle_incoming_msg(), handle_info_tunnels(), handle_iter_element(), handle_list(), handle_lookup_block(), handle_lookup_block_it(), handle_lookup_by_suffix_message(), handle_lookup_message(), handle_ping(), handle_query_message(), handle_record_lookup(), handle_request(), handle_revoke_message(), handle_room_close(), handle_room_entry(), handle_room_open(), handle_room_sync(), handle_search_result(), handle_send_msg(), handle_send_ready(), handle_show_path(), handle_start(), handle_start_message(), handle_test(), handle_union_p2p_demand(), handle_union_p2p_full_done(), handle_union_p2p_offer(), handle_union_p2p_strata_estimator(), handle_zone_to_name(), handle_zone_to_name_it(), hash_for_index_cb(), hash_for_index_val(), intersection_evaluate(), iterate_next_member_ids(), iterate_proc(), iteration_done_client_continue(), keygen_round2_conclude(), listen_connect(), maybe_finish(), monitor_iterate_cb(), monitor_sync(), mqm_execute(), notify_change(), notify_client(), notify_clients_stun_change(), notify_monitor(), notify_srv_handle_message(), open_port_cb(), path_info_iterator(), peer_transmit(), prepare_client_end_notification(), process_dns_result(), process_queue(), process_requests(), put_action(), queue_send_msg(), read_stdio(), reconnect(), reconnect_arm(), reconnect_arm_monitor(), reconnect_phone(), records_lookup(), response_action(), retry_entry(), return_agpl(), reversal_callback(), revoke_result_cb(), schedule_action(), schedule_next_hello(), schedule_transmit_search_request(), search_reconnect(), send_ack(), send_add_address(), send_add_queue(), send_alices_cryptodata_message(), send_bloomfilter(), send_client_done(), send_client_done_and_destroy(), send_client_element(), send_client_removed_element(), send_client_reply(), send_close_room(), send_del_address(), send_del_queue(), send_delete_response(), send_echo(), send_element_count(), send_end_msg(), send_enter_room(), send_full_element_iterator(), send_full_set(), send_get(), send_get_known_results(), send_ibf(), send_intermediate_response(), send_key(), send_lookup_response(), send_lookup_response_with_filter(), send_message(), send_message_to_room(), send_missing_full_elements_iter(), send_monitor_start(), send_offers_iterator(), send_open_room(), send_p2p_done(), send_packet_to_cadet_channel(), send_ping(), send_remaining_elements(), send_reply(), send_request(), send_request_to_client(), send_result_code(), send_simple_cb(), send_simple_single(), send_start_monitor(), send_store_response(), send_stream_peers(), send_sync_room(), send_ticket_result(), send_to_channel(), send_to_client_iter(), send_tunnel_envelope(), send_update_queue(), send_view(), signal_index_ok(), signal_result(), start_burst(), store_record_continuation(), suggest_to_connect(), test_nat_punched(), ticket_iter_cb(), transmit(), transmit_bobs_cryptodata_message(), transmit_bobs_cryptodata_message_multipart(), transmit_call_audio(), transmit_client_response(), transmit_get(), transmit_item(), transmit_pending(), transmit_phone_audio(), transmit_set(), transmit_status(), transmit_suggestion(), transmit_task_cb(), transmit_watch(), unindex_finish(), union_accept(), union_evaluate(), watch_notifier(), and zone_iteration_done_client_continue().
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.
Can be called repeatedly on the same envelope.
mq | message queue |
ev | the envelope with the message to send. |
Definition at line 384 of file mq.c.
References env, GNUNET_assert, GNUNET_malloc, GNUNET_memcpy, GNUNET_MQ_send(), GNUNET_MQ_Envelope::mh, mq, GNUNET_MQ_Envelope::sent_cb, GNUNET_MQ_Envelope::sent_cls, and GNUNET_MessageHeader::size.
Referenced by GNUNET_ABD_collect(), GNUNET_ABD_verify(), GNUNET_GNS_lookup_limited(), GNUNET_RECLAIM_attribute_delete(), GNUNET_RECLAIM_attribute_store(), GNUNET_RECLAIM_credential_delete(), GNUNET_RECLAIM_credential_store(), GNUNET_RECLAIM_ticket_consume(), GNUNET_RECLAIM_ticket_issue(), and reconnect().
void GNUNET_MQ_send_cancel | ( | struct GNUNET_MQ_Envelope * | ev | ) |
Cancel sending the message.
Message must have been sent with GNUNET_MQ_send before. May not be called after the notify sent callback has been called
ev | queued envelope to cancel |
Definition at line 785 of file mq.c.
References GNUNET_MQ_Handle::cancel_impl, 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_free, GNUNET_MQ_Handle::impl_state, GNUNET_MQ_Handle::in_flight, LOG, GNUNET_MQ_Envelope::mh, mq, GNUNET_MQ_Envelope::parent_queue, GNUNET_MQ_Handle::queue_length, GNUNET_MQ_Handle::send_impl, and GNUNET_MessageHeader::type.
Referenced by GSF_push_stop_(), handle_client_audio_message(), mq_cancel_impl(), and neighbour_delete().
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.
mq | message queue, id will be unique for the queue |
assoc_data | to associate |
Definition at line 592 of file mq.c.
References GNUNET_MQ_Handle::assoc_id, GNUNET_MQ_Handle::assoc_map, GNUNET_assert, GNUNET_CONTAINER_multihashmap32_create(), GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_OK, id, and mq.
Referenced by GNUNET_SET_commit(), GNUNET_SETI_commit(), and GNUNET_SETU_commit().
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.
mq | the message queue with the association |
request_id | the request id we are interested in |
Definition at line 621 of file mq.c.
References GNUNET_MQ_Handle::assoc_map, GNUNET_CONTAINER_multihashmap32_get(), and mq.
Referenced by handle_result().
void * GNUNET_MQ_assoc_remove | ( | struct GNUNET_MQ_Handle * | mq, |
uint32_t | request_id | ||
) |
Remove the association for a request_id.
mq | the message queue with the association |
request_id | the request id we want to remove |
Definition at line 639 of file mq.c.
References GNUNET_MQ_Handle::assoc_map, GNUNET_CONTAINER_multihashmap32_get(), GNUNET_CONTAINER_multihashmap32_remove_all(), and mq.
Referenced by handle_result(), and set_operation_destroy().
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 * | cls | ||
) |
Create a message queue for the specified handlers.
send | function the implements sending messages |
destroy | function that implements destroying the queue |
cancel | function that implements canceling a message |
impl_state | for the queue, passed to send, destroy and cancel |
handlers | array of message handlers |
error_handler | handler for read and write errors |
cls | closure for message handlers and error handler |
Definition at line 482 of file mq.c.
References GNUNET_MQ_Handle::cancel_impl, destroy(), GNUNET_MQ_Handle::destroy_impl, GNUNET_MQ_Handle::error_handler, error_handler(), GNUNET_MQ_Handle::error_handler_cls, GNUNET_MQ_copy_handlers(), GNUNET_new, handlers, GNUNET_MQ_Handle::handlers, GNUNET_MQ_Handle::impl_state, mq, and GNUNET_MQ_Handle::send_impl.
Referenced by boot_queue(), connect_peer(), GCT_create_tunnel(), GNUNET_CADET_channel_create(), GNUNET_CLIENT_connect(), handle_channel_created(), handle_connect(), setup_connection_mq(), setup_peer_mq(), setup_queue(), setup_receiver_mq(), and start_client().
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.
mq | to modify |
handlers_cls | new closure to use |
Definition at line 506 of file mq.c.
References GNUNET_MQ_MessageHandler::cb, GNUNET_MQ_MessageHandler::cls, GNUNET_MQ_Handle::handlers, and mq.
Referenced by connect_peer(), GNUNET_CADET_channel_create(), handle_channel_created(), handle_connect(), and start_client().
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.
There can be only one notify sent callback per envelope.
ev | message to call the notify callback for |
cb | the notify callback |
cb_cls | closure for the callback |
Definition at line 655 of file mq.c.
References GNUNET_assert, GNUNET_MQ_Envelope::sent_cb, and GNUNET_MQ_Envelope::sent_cls.
Referenced by check_peer_online(), do_send(), finish_handling_raw_message(), GCP_request_mq_cancel(), GCP_send(), GCP_send_ooo(), GNUNET_CONSENSUS_insert(), GNUNET_DATASTORE_disconnect(), GNUNET_DHT_hello_offer(), GNUNET_DHT_put(), GNUNET_DHT_put_cancel(), gnunet_send(), GNUNET_SET_add_element(), GNUNET_SET_remove_element(), GNUNET_SETI_add_element(), GNUNET_SETU_add_element(), GNUNET_TRANSPORT_TESTING_send(), GNUNET_TRANSPORT_TESTING_transport_communicator_send(), handle_client_audio_message(), handle_client_hangup_message(), handle_datastore_reply(), handle_send_msg(), read_stdio(), schedule_action(), schedule_peer_transmission(), send_message(), send_message_to_room(), send_p2p_done(), send_remaining_elements(), send_tunnel_envelope(), transmit_bobs_cryptodata_message(), transmit_bobs_cryptodata_message_multipart(), transmit_content(), transmit_get(), transmit_pending(), transmit_set(), and transmit_watch().
void GNUNET_MQ_destroy | ( | struct GNUNET_MQ_Handle * | mq | ) |
Destroy the message queue.
mq | message queue to destroy |
Definition at line 700 of file mq.c.
References GNUNET_MQ_Handle::assoc_map, GNUNET_MQ_DestroyNotificationHandle::cb, GNUNET_MQ_DestroyNotificationHandle::cb_cls, GNUNET_MQ_Handle::current_envelope, GNUNET_MQ_Handle::destroy_impl, GNUNET_MQ_Handle::dnh_head, GNUNET_MQ_Handle::envelope_head, GNUNET_MQ_Handle::envelope_tail, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap32_destroy(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_MQ_destroy_notify_cancel(), GNUNET_MQ_discard(), GNUNET_SCHEDULER_cancel(), GNUNET_MQ_Handle::handlers, GNUNET_MQ_Handle::impl_state, LOG, GNUNET_MQ_Envelope::mh, mq, GNUNET_MQ_Envelope::parent_queue, GNUNET_MQ_Handle::queue_length, GNUNET_MQ_Handle::send_task, and GNUNET_MessageHeader::type.
Referenced by announce_mq_error_handler(), callback_mq_error(), create_loc_uri(), deactivate_fs_download(), destroy_channel(), destroy_handle(), destroy_tunnel(), disconnect(), disconnect_and_free_peer_entry(), do_disconnect(), download_mq_error_handler(), error_handler(), fail_call(), finish_client_drop(), force_reconnect(), GNUNET_ABD_disconnect(), GNUNET_ARM_disconnect(), GNUNET_ARM_monitor_stop(), GNUNET_CADET_disconnect(), GNUNET_CADET_get_channel_cancel(), GNUNET_CADET_get_path_cancel(), GNUNET_CADET_list_peers_cancel(), GNUNET_CADET_list_tunnels_cancel(), GNUNET_CONSENSUS_destroy(), GNUNET_CONVERSATION_call_stop(), GNUNET_CONVERSATION_phone_destroy(), GNUNET_CORE_disconnect(), GNUNET_CORE_monitor_stop(), GNUNET_DATASTORE_disconnect(), GNUNET_DHT_disconnect(), GNUNET_DNS_disconnect(), GNUNET_FS_get_indexed_files_cancel(), GNUNET_FS_search_pause(), GNUNET_FS_search_signal_suspend_(), GNUNET_FS_search_stop(), GNUNET_FS_unindex_signal_suspend_(), GNUNET_FS_unindex_stop(), GNUNET_GNS_disconnect(), GNUNET_IDENTITY_disconnect(), GNUNET_IDENTITY_ego_lookup_by_suffix_cancel(), GNUNET_IDENTITY_ego_lookup_cancel(), GNUNET_NAMECACHE_disconnect(), GNUNET_NAMESTORE_disconnect(), GNUNET_NAMESTORE_zone_monitor_stop(), GNUNET_NAT_AUTO_autoconfig_cancel(), GNUNET_NAT_AUTO_test_stop(), GNUNET_NAT_autoconfig_cancel(), GNUNET_NAT_test_stop(), GNUNET_NAT_unregister(), GNUNET_NSE_disconnect(), GNUNET_PEERSTORE_monitor_stop(), GNUNET_RECLAIM_disconnect(), GNUNET_REGEX_announce_cancel(), GNUNET_REGEX_search_cancel(), GNUNET_RESOLVER_disconnect(), GNUNET_REVOCATION_query_cancel(), GNUNET_REVOCATION_revoke_cancel(), GNUNET_RPS_disconnect(), GNUNET_SCALARPRODUCT_cancel(), GNUNET_SECRETSHARING_decrypt_cancel(), GNUNET_SECRETSHARING_session_destroy(), GNUNET_SET_destroy(), GNUNET_SET_listen_cancel(), GNUNET_SETI_destroy(), GNUNET_SETI_listen_cancel(), GNUNET_SETU_destroy(), GNUNET_SETU_listen_cancel(), GNUNET_TRANSPORT_application_done(), GNUNET_TRANSPORT_communicator_mq_del(), GNUNET_VPN_disconnect(), handle_client_listener_error(), handle_conclude_done(), handle_index_start_failed(), handle_index_start_ok(), handle_mq_error(), handle_response(), handle_unindex_response(), index_mq_error_handler(), loc_mq_error_handler(), mq_error_handler(), neighbour_delete(), process_result_with_request(), publish_cleanup(), queue_destroy(), receiver_destroy(), reconnect(), reconnect_arm_later(), reconnect_arm_monitor_later(), reconnect_later(), reconnect_phone(), reschedule_connect(), search_mq_error_handler(), try_reconnect(), and unindex_mq_error_handler().
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.
mq | message queue to watch |
cb | function to call on mq destruction |
cb_cls | closure for cb |
Definition at line 910 of file mq.c.
References GNUNET_MQ_DestroyNotificationHandle::cb, GNUNET_MQ_DestroyNotificationHandle::cb_cls, GNUNET_MQ_Handle::dnh_head, GNUNET_MQ_Handle::dnh_tail, GNUNET_CONTAINER_DLL_insert, GNUNET_new, mq, and GNUNET_MQ_DestroyNotificationHandle::mq.
Referenced by GNUNET_notification_context_add().
void GNUNET_MQ_destroy_notify_cancel | ( | struct GNUNET_MQ_DestroyNotificationHandle * | dnh | ) |
Cancel registration from GNUNET_MQ_destroy_notify().
dnh | handle for registration to cancel |
Definition at line 928 of file mq.c.
References GNUNET_MQ_Handle::dnh_head, GNUNET_MQ_Handle::dnh_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_free, mq, and GNUNET_MQ_DestroyNotificationHandle::mq.
Referenced by GNUNET_MQ_destroy(), and GNUNET_notification_context_destroy().
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.
This function is intended to be used for the implementation of message queues.
mq | message queue with the handlers |
mh | message to dispatch |
Definition at line 187 of file mq.c.
References GNUNET_break_op, GNUNET_MQ_ERROR_MALFORMED, GNUNET_MQ_handle_message(), GNUNET_MQ_inject_error(), GNUNET_SYSERR, GNUNET_MQ_Handle::handlers, mh, mq, and ret.
Referenced by handle_decrypted(), handle_local_data(), handle_notify_inbound(), handle_recv(), recv_message(), and service_client_mst_cb().
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.
If there is no error handler, log a warning.
This function is intended to be used for the implementation of message queues.
mq | message queue |
error | the error type |
Definition at line 269 of file mq.c.
References GNUNET_MQ_Handle::error_handler, GNUNET_MQ_Handle::error_handler_cls, GNUNET_ERROR_TYPE_WARNING, LOG, and mq.
Referenced by do_send(), GNUNET_MQ_inject_message(), receive_ready(), and transmit_ready().
void GNUNET_MQ_impl_send_continue | ( | struct GNUNET_MQ_Handle * | mq | ) |
Call the send implementation for the next queued message, if any.
Calls the send notification for the current message unless GNUNET_MQ_impl_send_in_flight was called for this envelope.
Only useful for implementing message queues, results in undefined behavior if not used carefully.
mq | message queue to send the next message with |
Definition at line 437 of file mq.c.
References GNUNET_MQ_Handle::current_envelope, GNUNET_assert, GNUNET_free, GNUNET_SCHEDULER_add_now(), impl_send_continue(), GNUNET_MQ_Handle::in_flight, mq, GNUNET_MQ_Envelope::parent_queue, GNUNET_MQ_Handle::queue_length, GNUNET_MQ_Handle::send_task, GNUNET_MQ_Envelope::sent_cb, and GNUNET_MQ_Envelope::sent_cls.
Referenced by cadet_mq_send_impl(), cadet_mq_send_now(), core_mq_send_impl(), do_send(), handle_send_ok(), handle_send_ready(), mq_send_d(), mq_send_impl(), notify_send_done(), queue_write(), select_write_cb(), send_msg_with_kx(), and transmit_ready().
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.
Only useful for implementing message queues, results in undefined behavior if not used carefully.
mq | message queue to send the next message with |
Definition at line 461 of file mq.c.
References GNUNET_MQ_Handle::current_envelope, GNUNET_assert, GNUNET_MQ_Handle::in_flight, mq, GNUNET_MQ_Envelope::parent_queue, GNUNET_MQ_Envelope::sent_cb, and GNUNET_MQ_Envelope::sent_cls.
Referenced by do_send(), and transmit_ready().
void * GNUNET_MQ_impl_state | ( | struct GNUNET_MQ_Handle * | mq | ) |
Get the implementation state associated with the message queue.
While the GNUNET_MQ_Impl* callbacks receive the implementation state, continuations that are scheduled by the implementation function often only have one closure argument, with this function it is possible to get at the implementation state when only passing the struct GNUNET_MQ_Handle
as closure.
mq | message queue with the current message |
Definition at line 526 of file mq.c.
References GNUNET_MQ_Handle::impl_state, and mq.
const struct GNUNET_MessageHeader * GNUNET_MQ_impl_current | ( | struct GNUNET_MQ_Handle * | mq | ) |
Get the message that should currently be sent.
Fails if there is no current message. Only useful for implementing message queues, results in undefined behavior if not used carefully.
mq | message queue with the current message |
Definition at line 517 of file mq.c.
References GNUNET_MQ_Handle::current_envelope, GNUNET_assert, GNUNET_MQ_Envelope::mh, and mq.
const char * GNUNET_MQ_preference_to_string | ( | enum GNUNET_MQ_PreferenceKind | type | ) |
Convert an enum GNUNET_MQ_PreferenceType
to a string.
type | the preference type |
enum GNUNET_MQ_PriorityPreference
Definition at line 1030 of file mq.c.
References GNUNET_MQ_PREFERENCE_BANDWIDTH, GNUNET_MQ_PREFERENCE_LATENCY, GNUNET_MQ_PREFERENCE_NONE, GNUNET_MQ_PREFERENCE_RELIABILITY, and type.
struct GNUNET_NotificationContext * GNUNET_notification_context_create | ( | unsigned int | queue_length | ) |
Create a new notification context.
queue_length | maximum number of messages to keep in the notification queue; optional messages are dropped if the queue gets longer than this number of messages |
Definition at line 122 of file nc.c.
References GNUNET_new, nc, and GNUNET_NotificationContext::queue_length.
Referenced by GSC_KX_init(), and run().
void GNUNET_notification_context_destroy | ( | struct GNUNET_NotificationContext * | nc | ) |
Destroy the context, force disconnect for all subscribers.
nc | context to destroy. |
Definition at line 138 of file nc.c.
References GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_destroy_notify_cancel(), SubscriberList::mq_nh, nc, GNUNET_NotificationContext::subscribers_head, and GNUNET_NotificationContext::subscribers_tail.
Referenced by cleanup_task(), do_shutdown(), GSC_KX_done(), and shutdown_task().
void GNUNET_notification_context_add | ( | struct GNUNET_NotificationContext * | nc, |
struct GNUNET_MQ_Handle * | mq | ||
) |
Add a subscriber to the notification context.
nc | context to modify |
mq | message queue add |
Definition at line 161 of file nc.c.
References GNUNET_CONTAINER_DLL_insert, GNUNET_MQ_destroy_notify(), GNUNET_new, handle_mq_destroy(), mq, SubscriberList::mq, SubscriberList::mq_nh, SubscriberList::nc, nc, SubscriberList::next, GNUNET_NotificationContext::subscribers_head, and GNUNET_NotificationContext::subscribers_tail.
Referenced by client_connect_cb(), GSC_KX_handle_client_monitor_peers(), handle_monitor(), handle_monitor_start(), handle_start(), and handle_start_message().
void GNUNET_notification_context_broadcast | ( | struct GNUNET_NotificationContext * | nc, |
const struct GNUNET_MessageHeader * | msg, | ||
int | can_drop | ||
) |
Send a message to all subscribers of this context.
nc | context to modify |
msg | message to send |
can_drop | can this message be dropped due to queue length limitations |
Definition at line 190 of file nc.c.
References env, GNUNET_MQ_get_length(), GNUNET_MQ_msg_copy(), GNUNET_MQ_send(), GNUNET_YES, SubscriberList::mq, msg, nc, SubscriberList::next, GNUNET_NotificationContext::queue_length, and GNUNET_NotificationContext::subscribers_head.
Referenced by broadcast_status(), monitor_notify_all(), notify_listeners(), and update_network_size_estimate().
unsigned int GNUNET_notification_context_get_size | ( | struct GNUNET_NotificationContext * | nc | ) |
Return active number of subscribers in this context.
nc | context to query |
Definition at line 216 of file nc.c.
References nc, SubscriberList::next, and GNUNET_NotificationContext::subscribers_head.