tor  0.4.2.0-alpha-dev
Macros | Functions | Variables
ocirc_event.c File Reference
#include "core/or/or.h"
#include "core/or/cpath_build_state_st.h"
#include "core/or/ocirc_event.h"
#include "core/or/ocirc_event_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)
 
static 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
 
const subsys_fns_t sys_ocirc_event
 

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.

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.

◆ sys_ocirc_event

const subsys_fns_t sys_ocirc_event
Initial value:
= {
.name = "ocirc_event",
.supported = true,
.level = -32,
.add_pubsub = ocirc_add_pubsub,
}

Definition at line 123 of file ocirc_event.c.