tor  master
Functions
pubsub.c File Reference

DOCDOC. More...

#include "orconfig.h"
#include "pubsub.h"
#include "container.h"
Include dependency graph for pubsub.c:

Functions

const pubsub_subscriber_tpubsub_subscribe_ (pubsub_topic_t *topic, pubsub_subscriber_fn_t fn, void *subscriber_data, unsigned subscribe_flags, unsigned priority)
 
int pubsub_unsubscribe_ (pubsub_topic_t *topic, const pubsub_subscriber_t *s)
 
int pubsub_notify_ (pubsub_topic_t *topic, pubsub_notify_fn_t notify_fn, void *event_data, unsigned notify_flags)
 
void pubsub_clear_ (pubsub_topic_t *topic)
 

Detailed Description

DOCDOC.

Function Documentation

◆ pubsub_clear_()

void pubsub_clear_ ( pubsub_topic_t topic)

Release all storage held by topic.

◆ pubsub_notify_()

int pubsub_notify_ ( pubsub_topic_t topic,
pubsub_notify_fn_t  notify_fn,
void *  event_data,
unsigned  notify_flags 
)

For every subscriber s in topic, invoke notify_fn on s and event_data. Return 0 if there were no nonzero return values, and -1 if there were any.

◆ pubsub_subscribe_()

const pubsub_subscriber_t* pubsub_subscribe_ ( pubsub_topic_t topic,
pubsub_subscriber_fn_t  fn,
void *  subscriber_data,
unsigned  subscribe_flags,
unsigned  priority 
)

Add a new subscriber to topic, where (when an event is triggered), we'll notify the function fn by passing it subscriber_data. Return a handle to the subscribe which can later be passed to pubsub_unsubscribe_().

Functions are called in priority order, from lowest to highest.

See pubsub.h for subscribe_flags.

◆ pubsub_unsubscribe_()

int pubsub_unsubscribe_ ( pubsub_topic_t topic,
const pubsub_subscriber_t s 
)

Remove the subscriber s from topic. After calling this function, s may no longer be used.

Here is the call graph for this function: