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

Publish state change messages for OR connections. More...

#include "core/or/or.h"
#include "lib/pubsub/pubsub.h"
#include "lib/subsys/subsys.h"
#include "core/or/orconn_event.h"
#include "core/or/or_sys.h"

Go to the source code of this file.

Functions

 DECLARE_PUBLISH (orconn_state)
 
 DECLARE_PUBLISH (orconn_status)
 
static void orconn_event_free (msg_aux_data_t u)
 
static char * orconn_state_fmt (msg_aux_data_t u)
 
static char * orconn_status_fmt (msg_aux_data_t u)
 
int orconn_add_pubsub (struct pubsub_connector_t *connector)
 
void orconn_state_publish (orconn_state_msg_t *msg)
 
void orconn_status_publish (orconn_status_msg_t *msg)
 

Variables

static dispatch_typefns_t orconn_state_fns
 
static dispatch_typefns_t orconn_status_fns
 

Detailed Description

Publish state change messages for OR connections.

Implements a basic publish-subscribe framework for messages about the state of OR connections. 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 orconn_event.c.

Macro Definition Documentation

◆ ORCONN_EVENT_PRIVATE

#define ORCONN_EVENT_PRIVATE

Definition at line 23 of file orconn_event.c.

Function Documentation

◆ orconn_add_pubsub()

int orconn_add_pubsub ( struct pubsub_connector_t connector)

Definition at line 69 of file orconn_event.c.

◆ orconn_event_free()

static void orconn_event_free ( msg_aux_data_t  u)
static

Definition at line 31 of file orconn_event.c.

◆ orconn_state_fmt()

static char * orconn_state_fmt ( msg_aux_data_t  u)
static

Definition at line 37 of file orconn_event.c.

◆ orconn_state_publish()

void orconn_state_publish ( orconn_state_msg_t msg)

Definition at line 83 of file orconn_event.c.

◆ orconn_status_fmt()

static char * orconn_status_fmt ( msg_aux_data_t  u)
static

Definition at line 48 of file orconn_event.c.

◆ orconn_status_publish()

void orconn_status_publish ( orconn_status_msg_t msg)

Definition at line 89 of file orconn_event.c.

Variable Documentation

◆ orconn_state_fns

dispatch_typefns_t orconn_state_fns
static
Initial value:
= {
.free_fn = orconn_event_free,
.fmt_fn = orconn_state_fmt,
}

Definition at line 58 of file orconn_event.c.

◆ orconn_status_fns

dispatch_typefns_t orconn_status_fns
static
Initial value:
= {
.free_fn = orconn_event_free,
.fmt_fn = orconn_status_fmt,
}

Definition at line 63 of file orconn_event.c.