GNUnet 0.22.2
nc.c File Reference

convenience functions for transmission of messages to multiple clients More...

#include "platform.h"
#include "gnunet_util_lib.h"
Include dependency graph for nc.c:

Go to the source code of this file.

Data Structures

struct  SubscriberList
 Lists of subscribers we manage for notifications. More...
 
struct  GNUNET_NotificationContext
 The notification context is the key datastructure for a convenience API used for transmission of notifications to the subscriber until the subscriber disconnects (or the notification context is destroyed, in which case we disconnect these subscribers). More...
 

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "util-nc", __VA_ARGS__)
 

Functions

static void handle_mq_destroy (void *cls)
 Subscriber has disconnected, clean up. More...
 
struct GNUNET_NotificationContextGNUNET_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...
 

Detailed Description

convenience functions for transmission of messages to multiple clients

Author
Christian Grothoff

Definition in file nc.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "util-nc", __VA_ARGS__)

Definition at line 32 of file nc.c.

Function Documentation

◆ handle_mq_destroy()

static void handle_mq_destroy ( void *  cls)
static

Subscriber has disconnected, clean up.

Parameters
clsour struct SubscriberList *

Definition at line 101 of file nc.c.

102{
103 struct SubscriberList *pos = cls;
104 struct GNUNET_NotificationContext *nc = pos->nc;
105
108 pos);
109 GNUNET_free (pos);
110}
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_free(ptr)
Wrapper around free.
The notification context is the key datastructure for a convenience API used for transmission of noti...
Definition: nc.c:77
struct SubscriberList * subscribers_head
Head of list of subscribers receiving notifications.
Definition: nc.c:81
struct SubscriberList * subscribers_tail
Tail of list of subscribers receiving notifications.
Definition: nc.c:86
Lists of subscribers we manage for notifications.
Definition: nc.c:39
struct GNUNET_NotificationContext * nc
Overall context this subscriber belongs to.
Definition: nc.c:53

References GNUNET_CONTAINER_DLL_remove, GNUNET_free, SubscriberList::nc, nc, GNUNET_NotificationContext::subscribers_head, and GNUNET_NotificationContext::subscribers_tail.

Referenced by GNUNET_notification_context_add().

Here is the caller graph for this function: