tor  0.4.2.0-alpha-dev
subsys.h
1 /* Copyright (c) 2003-2004, Roger Dingledine
2  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3  * Copyright (c) 2007-2019, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
5 
6 #ifndef TOR_SUBSYS_T
7 #define TOR_SUBSYS_T
8 
9 #include <stdbool.h>
10 
11 struct pubsub_connector_t;
12 
23 typedef struct subsys_fns_t {
28  const char *name;
29 
34  bool supported;
35 
41  int level;
42 
56  int (*initialize)(void);
57 
61  int (*add_pubsub)(struct pubsub_connector_t *);
62 
66  void (*prefork)(void);
67 
71  void (*postfork)(void);
72 
77  void (*thread_cleanup)(void);
78 
84  void (*shutdown)(void);
85 
86 } subsys_fns_t;
87 
88 #define MIN_SUBSYS_LEVEL -100
89 #define MAX_SUBSYS_LEVEL 100
90 
91 /* All tor "libraries" (in src/libs) should have a subsystem level equal to or
92  * less than this value. */
93 #define SUBSYS_LEVEL_LIBS -10
94 
95 #endif /* !defined(TOR_SUBSYS_T) */
int level
Definition: subsys.h:41
struct pubsub_connector_t pubsub_connector_t
bool supported
Definition: subsys.h:34
int(* initialize)(void)
Definition: subsys.h:56
int(* add_pubsub)(struct pubsub_connector_t *)
Definition: subsys.h:61
void(* postfork)(void)
Definition: subsys.h:71
void(* shutdown)(void)
Definition: subsys.h:84
void(* thread_cleanup)(void)
Definition: subsys.h:77
const char * name
Definition: subsys.h:28
void(* prefork)(void)
Definition: subsys.h:66