Tor  0.4.7.0-alpha-dev
Macros | Functions | Variables
dispatch_new.c File Reference

Code to construct a dispatch_t from a dispatch_cfg_t. More...

#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_u16_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 77 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 113 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 89 of file dispatch_new.c.

◆ max_in_u16_sl()

STATIC int max_in_u16_sl ( const smartlist_t sl,
int  dflt 
)

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 31 of file dispatch_new.c.

◆ 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 54 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 62 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 char * type_fmt_nop(msg_aux_data_t arg)
Definition: dispatch_new.c:54
static void type_free_nop(msg_aux_data_t arg)
Definition: dispatch_new.c:62

Type functions to use when no type functions are provided.

Definition at line 68 of file dispatch_new.c.