Tor  0.4.7.0-alpha-dev
subsysmgr.h
Go to the documentation of this file.
1 /* Copyright (c) 2003-2004, Roger Dingledine
2  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3  * Copyright (c) 2007-2021, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
5 
6 /**
7  * @file subsysmgr.h
8  * @brief Header for subsysmgr.c
9  **/
10 
11 #ifndef TOR_SUBSYSMGR_T
12 #define TOR_SUBSYSMGR_T
13 
14 #include "lib/subsys/subsys.h"
15 
16 extern const struct subsys_fns_t *tor_subsystems[];
17 extern const unsigned n_tor_subsystems;
18 
19 int subsystems_init(void);
21 
22 struct pubsub_builder_t;
24  int target_level);
25 int subsystems_add_pubsub(struct pubsub_builder_t *builder);
26 
27 void subsystems_shutdown(void);
28 void subsystems_shutdown_downto(int level);
29 
30 void subsystems_prefork(void);
31 void subsystems_postfork(void);
32 void subsystems_thread_cleanup(void);
33 
34 void subsystems_dump_list(void);
35 
36 struct config_mgr_t;
39 struct or_options_t;
40 struct or_state_t;
41 int subsystems_set_options(const struct config_mgr_t *mgr,
42  struct or_options_t *options);
43 int subsystems_set_state(const struct config_mgr_t *mgr,
44  struct or_state_t *state);
45 int subsystems_flush_state(const struct config_mgr_t *mgr,
46  struct or_state_t *state);
47 
48 #ifdef TOR_UNIT_TESTS
49 int subsystems_get_options_idx(const subsys_fns_t *sys);
50 int subsystems_get_state_idx(const subsys_fns_t *sys);
51 #endif
52 
53 #endif /* !defined(TOR_SUBSYSMGR_T) */
struct pubsub_builder_t pubsub_builder_t
Definition: pubsub_build.h:28
int level
Definition: subsys.h:61
Types used to declare a subsystem.
int subsystems_set_options(const config_mgr_t *mgr, struct or_options_t *options)
Definition: subsysmgr.c:410
int subsystems_set_state(const config_mgr_t *mgr, struct or_state_t *state)
Definition: subsysmgr.c:437
int subsystems_flush_state(const config_mgr_t *mgr, struct or_state_t *state)
Definition: subsysmgr.c:461
void subsystems_prefork(void)
Definition: subsysmgr.c:237
void subsystems_shutdown_downto(int level)
Definition: subsysmgr.c:213
const struct subsys_fns_t * tor_subsystems[]
int subsystems_register_state_formats(struct config_mgr_t *mgr)
Definition: subsysmgr.c:339
int subsystems_register_options_formats(struct config_mgr_t *mgr)
Definition: subsysmgr.c:316
int subsystems_add_pubsub_upto(struct pubsub_builder_t *builder, int target_level)
Definition: subsysmgr.c:160
void subsystems_shutdown(void)
Definition: subsysmgr.c:204
void subsystems_postfork(void)
Definition: subsysmgr.c:258
int subsystems_add_pubsub(struct pubsub_builder_t *builder)
Definition: subsysmgr.c:195
void subsystems_dump_list(void)
Definition: subsysmgr.c:301
int subsystems_init_upto(int level)
Definition: subsysmgr.c:124
int subsystems_init(void)
Definition: subsysmgr.c:114
void subsystems_thread_cleanup(void)
Definition: subsysmgr.c:279