dispatch_cfg.h (1474B)
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-2021, 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 /** 11 * @file dispatch_cfg.h 12 * @brief Header for distpach_cfg.c 13 **/ 14 15 #include "lib/dispatch/msgtypes.h" 16 #include "lib/testsupport/testsupport.h" 17 18 /** 19 * A "dispatch_cfg" is the configuration used to set up a dispatcher. 20 * It is created and accessed with a set of dcfg_* functions, and then 21 * used with dispatcher_new() to make the dispatcher. 22 */ 23 typedef struct dispatch_cfg_t dispatch_cfg_t; 24 25 dispatch_cfg_t *dcfg_new(void); 26 27 int dcfg_msg_set_type(dispatch_cfg_t *cfg, message_id_t msg, 28 msg_type_id_t type); 29 30 int dcfg_msg_set_chan(dispatch_cfg_t *cfg, message_id_t msg, 31 channel_id_t chan); 32 33 int dcfg_type_set_fns(dispatch_cfg_t *cfg, msg_type_id_t type, 34 const dispatch_typefns_t *fns); 35 36 int dcfg_add_recv(dispatch_cfg_t *cfg, message_id_t msg, 37 subsys_id_t sys, recv_fn_t fn); 38 39 /** Free a dispatch_cfg_t. */ 40 #define dcfg_free(cfg) \ 41 FREE_AND_NULL(dispatch_cfg_t, dcfg_free_, (cfg)) 42 43 void dcfg_free_(dispatch_cfg_t *cfg); 44 45 #ifdef DISPATCH_NEW_PRIVATE 46 struct smartlist_t; 47 STATIC int max_in_u16_sl(const struct smartlist_t *sl, int dflt); 48 #endif 49 50 #endif /* !defined(TOR_DISPATCH_CFG_H) */