tor  0.4.2.1-alpha-dev
Macros | Functions | Variables
orconn_event.c File Reference
#include "core/or/or.h"
#include "lib/pubsub/pubsub.h"
#include "lib/subsys/subsys.h"
#include "core/or/orconn_event.h"
#include "core/or/orconn_event_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)
 
static 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
 
const subsys_fns_t sys_orconn_event
 

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.

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.

◆ sys_orconn_event

const subsys_fns_t sys_orconn_event
Initial value:
= {
.name = "orconn_event",
.supported = true,
.level = -33,
.add_pubsub = orconn_add_pubsub,
}

Definition at line 94 of file orconn_event.c.