Tor 0.4.9.0-alpha-dev
Macros | Functions | Variables
ocirc_event.c File Reference

Publish state change messages for origin circuits. More...

#include "core/or/or.h"
#include "core/or/cpath_build_state_st.h"
#include "core/or/ocirc_event.h"
#include "core/or/or_sys.h"
#include "core/or/origin_circuit_st.h"
#include "lib/subsys/subsys.h"

Go to the source code of this file.

Functions

 DECLARE_PUBLISH (ocirc_state)
 
 DECLARE_PUBLISH (ocirc_chan)
 
 DECLARE_PUBLISH (ocirc_cevent)
 
static void ocirc_event_free (msg_aux_data_t u)
 
static char * ocirc_state_fmt (msg_aux_data_t u)
 
static char * ocirc_chan_fmt (msg_aux_data_t u)
 
static char * ocirc_cevent_fmt (msg_aux_data_t u)
 
int ocirc_add_pubsub (struct pubsub_connector_t *connector)
 
void ocirc_state_publish (ocirc_state_msg_t *msg)
 
void ocirc_chan_publish (ocirc_chan_msg_t *msg)
 
void ocirc_cevent_publish (ocirc_cevent_msg_t *msg)
 

Variables

static dispatch_typefns_t ocirc_state_fns
 
static dispatch_typefns_t ocirc_chan_fns
 
static dispatch_typefns_t ocirc_cevent_fns
 

Detailed Description

Publish state change messages for origin circuits.

Implements a basic publish-subscribe framework for messages about the state of origin circuits. The publisher calls the subscriber callback functions synchronously.

Although the synchronous calls might not simplify the call graph, this approach improves data isolation because the publisher doesn't need knowledge about the internals of subscribing subsystems. It also avoids race conditions that might occur in asynchronous frameworks.

Definition in file ocirc_event.c.

Macro Definition Documentation

◆ OCIRC_EVENT_PRIVATE

#define OCIRC_EVENT_PRIVATE

Definition at line 21 of file ocirc_event.c.

Function Documentation

◆ ocirc_add_pubsub()

int ocirc_add_pubsub ( struct pubsub_connector_t connector)

Definition at line 88 of file ocirc_event.c.

◆ ocirc_cevent_fmt()

static char * ocirc_cevent_fmt ( msg_aux_data_t  u)
static

Definition at line 62 of file ocirc_event.c.

◆ ocirc_cevent_publish()

void ocirc_cevent_publish ( ocirc_cevent_msg_t msg)

Definition at line 118 of file ocirc_event.c.

◆ ocirc_chan_fmt()

static char * ocirc_chan_fmt ( msg_aux_data_t  u)
static

Definition at line 51 of file ocirc_event.c.

◆ ocirc_chan_publish()

void ocirc_chan_publish ( ocirc_chan_msg_t msg)

Definition at line 112 of file ocirc_event.c.

◆ ocirc_event_free()

static void ocirc_event_free ( msg_aux_data_t  u)
static

Definition at line 34 of file ocirc_event.c.

◆ ocirc_state_fmt()

static char * ocirc_state_fmt ( msg_aux_data_t  u)
static

Definition at line 40 of file ocirc_event.c.

◆ ocirc_state_publish()

void ocirc_state_publish ( ocirc_state_msg_t msg)

Definition at line 106 of file ocirc_event.c.

Variable Documentation

◆ ocirc_cevent_fns

dispatch_typefns_t ocirc_cevent_fns
static
Initial value:
= {
.free_fn = ocirc_event_free,
.fmt_fn = ocirc_cevent_fmt,
}

Definition at line 82 of file ocirc_event.c.

◆ ocirc_chan_fns

dispatch_typefns_t ocirc_chan_fns
static
Initial value:
= {
.free_fn = ocirc_event_free,
.fmt_fn = ocirc_chan_fmt,
}

Definition at line 77 of file ocirc_event.c.

◆ ocirc_state_fns

dispatch_typefns_t ocirc_state_fns
static
Initial value:
= {
.free_fn = ocirc_event_free,
.fmt_fn = ocirc_state_fmt,
}

Definition at line 72 of file ocirc_event.c.