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.


 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)


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.

Variable Documentation

◆ orconn_state_fns

dispatch_typefns_t orconn_state_fns
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
Initial value:
= {
.free_fn = orconn_event_free,
.fmt_fn = orconn_status_fmt,

Definition at line 63 of file orconn_event.c.