tor  0.4.2.1-alpha-dev
Macros | Functions | Variables
dispatch_new.c File Reference
#include "orconfig.h"
#include "lib/dispatch/dispatch.h"
#include "lib/dispatch/dispatch_st.h"
#include "lib/dispatch/dispatch_cfg.h"
#include "lib/dispatch/dispatch_cfg_st.h"
#include "lib/cc/ctassert.h"
#include "lib/intmath/cmp.h"
#include "lib/malloc/malloc.h"
#include "lib/log/util_bug.h"
#include <string.h>

Go to the source code of this file.

Functions

static int max_in_sl (const smartlist_t *sl, int dflt)
 
 CTASSERT (sizeof(uint16_t)==sizeof(msg_type_id_t))
 
static char * type_fmt_nop (msg_aux_data_t arg)
 
static void type_free_nop (msg_aux_data_t arg)
 
static void alert_fn_nop (dispatch_t *d, channel_id_t ch, void *arg)
 
static dtbl_entry_t * dtbl_entry_from_lst (smartlist_t *receivers)
 
dispatch_tdispatch_new (const dispatch_cfg_t *cfg)
 

Variables

static dispatch_typefns_t nop_typefns
 

Detailed Description

Code to construct a dispatch_t from a dispatch_cfg_t.

Definition in file dispatch_new.c.

Function Documentation

◆ alert_fn_nop()

static void alert_fn_nop ( dispatch_t d,
channel_id_t  ch,
void *  arg 
)
static

Alert function to use when none is configured: do nothing.

Definition at line 76 of file dispatch_new.c.

◆ dispatch_new()

dispatch_t* dispatch_new ( const dispatch_cfg_t cfg)

Create and return a new dispatcher from a given dispatch_cfg_t.

Definition at line 112 of file dispatch_new.c.

◆ dtbl_entry_from_lst()

static dtbl_entry_t* dtbl_entry_from_lst ( smartlist_t receivers)
static

Given a list of recvfn_t, create and return a new dtbl_entry_t mapping to each of those functions.

Definition at line 88 of file dispatch_new.c.

◆ max_in_sl()

static int max_in_sl ( const smartlist_t sl,
int  dflt 
)
static

Given a smartlist full of (possibly NULL) pointers to uint16_t values, return the largest value, or dflt if the list is empty.

Definition at line 30 of file dispatch_new.c.

References SMARTLIST_FOREACH_BEGIN.

◆ type_fmt_nop()

static char* type_fmt_nop ( msg_aux_data_t  arg)
static

Helper: Format an unformattable message auxiliary data item: just return a copy of the string <>.

Definition at line 53 of file dispatch_new.c.

◆ type_free_nop()

static void type_free_nop ( msg_aux_data_t  arg)
static

Helper: Free an unfreeable message auxiliary data item: do nothing.

Definition at line 61 of file dispatch_new.c.

Variable Documentation

◆ nop_typefns

dispatch_typefns_t nop_typefns
static
Initial value:
= {
.free_fn = type_free_nop,
.fmt_fn = type_fmt_nop
}
static void type_free_nop(msg_aux_data_t arg)
Definition: dispatch_new.c:61
static char * type_fmt_nop(msg_aux_data_t arg)
Definition: dispatch_new.c:53

Type functions to use when no type functions are provided.

Definition at line 67 of file dispatch_new.c.