tor  0.4.2.0-alpha-dev
Macros | Functions
dispatch_cfg.c File Reference
#include "orconfig.h"
#include "lib/dispatch/dispatch_cfg.h"
#include "lib/dispatch/dispatch_cfg_st.h"
#include "lib/dispatch/dispatch.h"
#include "lib/dispatch/dispatch_st.h"
#include "lib/container/smartlist.h"
#include "lib/malloc/malloc.h"

Go to the source code of this file.

Functions

dispatch_cfg_tdcfg_new (void)
 
int dcfg_msg_set_type (dispatch_cfg_t *cfg, message_id_t msg, msg_type_id_t type)
 
int dcfg_msg_set_chan (dispatch_cfg_t *cfg, message_id_t msg, channel_id_t chan)
 
int dcfg_type_set_fns (dispatch_cfg_t *cfg, msg_type_id_t type, const dispatch_typefns_t *fns)
 
int dcfg_add_recv (dispatch_cfg_t *cfg, message_id_t msg, subsys_id_t sys, recv_fn_t fn)
 
void dcfg_free_ (dispatch_cfg_t *cfg)
 

Detailed Description

Create and configure a dispatch_cfg_t.

A dispatch_cfg_t object is used to configure a set of messages and associated information before creating a dispatch_t.

Definition in file dispatch_cfg.c.

Function Documentation

◆ dcfg_add_recv()

int dcfg_add_recv ( dispatch_cfg_t cfg,
message_id_t  msg,
subsys_id_t  sys,
recv_fn_t  fn 
)

Associate a receiver with a message ID. Multiple receivers may be associated with a single messasge ID.

Return 0 on success, on failure.

Definition at line 101 of file dispatch_cfg.c.

References dispatch_cfg_t::recv_by_msg, and smartlist_grow().

◆ dcfg_free_()

void dcfg_free_ ( dispatch_cfg_t cfg)

Helper: release all storage held by cfg.

Definition at line 121 of file dispatch_cfg.c.

References dispatch_cfg_t::chan_by_msg, dispatch_cfg_t::fns_by_type, SMARTLIST_FOREACH, tor_free, and dispatch_cfg_t::type_by_msg.

◆ dcfg_msg_set_chan()

int dcfg_msg_set_chan ( dispatch_cfg_t cfg,
message_id_t  msg,
channel_id_t  chan 
)

Associate a message with a channel. Return 0 on success, -1 if a different channel was previously associated with the message ID.

Definition at line 63 of file dispatch_cfg.c.

References dispatch_cfg_t::chan_by_msg, and smartlist_grow().

◆ dcfg_msg_set_type()

int dcfg_msg_set_type ( dispatch_cfg_t cfg,
message_id_t  msg,
msg_type_id_t  type 
)

Associate a message with a datatype. Return 0 on success, -1 if a different type was previously associated with the message ID.

Definition at line 45 of file dispatch_cfg.c.

◆ dcfg_new()

dispatch_cfg_t* dcfg_new ( void  )

Create and return a new dispatch_cfg_t.

Definition at line 30 of file dispatch_cfg.c.

◆ dcfg_type_set_fns()

int dcfg_type_set_fns ( dispatch_cfg_t cfg,
msg_type_id_t  type,
const dispatch_typefns_t fns 
)

Associate a set of functions with a datatype. Return 0 on success, -1 if different functions were previously associated with the type.

Definition at line 81 of file dispatch_cfg.c.