GNUnet  0.10.x
Data Structures | Macros | Functions
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 31 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 104 of file nc.c.

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

Referenced by GNUNET_notification_context_add().

105 {
106  struct SubscriberList *pos = cls;
107  struct GNUNET_NotificationContext *nc = pos->nc;
108 
110  nc->subscribers_tail,
111  pos);
112  GNUNET_free (pos);
113 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
The notification context is the key datastructure for a convenience API used for transmission of noti...
Definition: nc.c:77
struct GNUNET_NotificationContext * nc
Overall context this subscriber belongs to.
Definition: nc.c:53
struct SubscriberList * subscribers_tail
Tail of list of subscribers receiving notifications.
Definition: nc.c:88
Lists of subscribers we manage for notifications.
Definition: nc.c:37
struct SubscriberList * subscribers_head
Head of list of subscribers receiving notifications.
Definition: nc.c:83
static struct GNUNET_PEERINFO_NotifyContext * nc
Iterator context.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function: