32#define LOG(kind, ...) GNUNET_log_from (kind, "util-nc", __VA_ARGS__)
struct GNUNET_MQ_Handle * mq
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
static struct GNUNET_NotificationContext * nc
Notification context for broadcasting to monitors.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_notification_context_destroy(struct GNUNET_NotificationContext *nc)
Destroy the context, force disconnect for all subscribers.
struct GNUNET_MQ_Envelope * GNUNET_MQ_msg_copy(const struct GNUNET_MessageHeader *hdr)
Create a new envelope by copying an existing message.
unsigned int GNUNET_MQ_get_length(struct GNUNET_MQ_Handle *mq)
Obtain the current length of the message queue.
unsigned int GNUNET_notification_context_get_size(struct GNUNET_NotificationContext *nc)
Return active number of subscribers in this context.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
struct GNUNET_NotificationContext * GNUNET_notification_context_create(unsigned int queue_length)
Create a new notification context.
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.
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.
void GNUNET_MQ_destroy_notify_cancel(struct GNUNET_MQ_DestroyNotificationHandle *dnh)
Cancel registration from GNUNET_MQ_destroy_notify().
void GNUNET_notification_context_add(struct GNUNET_NotificationContext *nc, struct GNUNET_MQ_Handle *mq)
Add a subscriber to the notification context.
static void handle_mq_destroy(void *cls)
Subscriber has disconnected, clean up.
Handle we return for callbacks registered to be notified when GNUNET_MQ_destroy() is called on a queu...
Handle to a message queue.
The notification context is the key datastructure for a convenience API used for transmission of noti...
struct SubscriberList * subscribers_head
Head of list of subscribers receiving notifications.
struct SubscriberList * subscribers_tail
Tail of list of subscribers receiving notifications.
unsigned int queue_length
Maximum number of optional messages to queue per subscriber.
Lists of subscribers we manage for notifications.
struct GNUNET_MQ_Handle * mq
Message queue for the subscriber.
struct GNUNET_NotificationContext * nc
Overall context this subscriber belongs to.
struct GNUNET_MQ_DestroyNotificationHandle * mq_nh
Handle where we registered with mq to be told about the MQ's destruction.
struct SubscriberList * prev
This is a doubly linked list.
struct SubscriberList * next
This is a doubly linked list.