tor  0.4.2.0-alpha-dev
dispatch_cfg.h
1 /* Copyright (c) 2001, Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2018, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 #ifndef TOR_DISPATCH_CFG_H
8 #define TOR_DISPATCH_CFG_H
9 
10 #include "lib/dispatch/msgtypes.h"
11 
17 typedef struct dispatch_cfg_t dispatch_cfg_t;
18 
20 
21 int dcfg_msg_set_type(dispatch_cfg_t *cfg, message_id_t msg,
22  msg_type_id_t type);
23 
24 int dcfg_msg_set_chan(dispatch_cfg_t *cfg, message_id_t msg,
25  channel_id_t chan);
26 
28  const dispatch_typefns_t *fns);
29 
30 int dcfg_add_recv(dispatch_cfg_t *cfg, message_id_t msg,
31  subsys_id_t sys, recv_fn_t fn);
32 
34 #define dcfg_free(cfg) \
35  FREE_AND_NULL(dispatch_cfg_t, dcfg_free_, (cfg))
36 
37 void dcfg_free_(dispatch_cfg_t *cfg);
38 
39 #endif /* !defined(TOR_DISPATCH_CFG_H) */
void dcfg_free_(dispatch_cfg_t *cfg)
Definition: dispatch_cfg.c:121
int dcfg_add_recv(dispatch_cfg_t *cfg, message_id_t msg, subsys_id_t sys, recv_fn_t fn)
Definition: dispatch_cfg.c:101
int dcfg_msg_set_type(dispatch_cfg_t *cfg, message_id_t msg, msg_type_id_t type)
Definition: dispatch_cfg.c:45
int dcfg_msg_set_chan(dispatch_cfg_t *cfg, message_id_t msg, channel_id_t chan)
Definition: dispatch_cfg.c:63
Types used for messages in the dispatcher code.
uint16_t msg_type_id_t
Definition: msgtypes.h:29
uint16_t subsys_id_t
Definition: msgtypes.h:22
void(* recv_fn_t)(const msg_t *m)
Definition: msgtypes.h:66
int dcfg_type_set_fns(dispatch_cfg_t *cfg, msg_type_id_t type, const dispatch_typefns_t *fns)
Definition: dispatch_cfg.c:81
dispatch_cfg_t * dcfg_new(void)
Definition: dispatch_cfg.c:30