Tor  0.4.7.0-alpha-dev
dirauth_sys.c
Go to the documentation of this file.
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 /**
8  * @file dirauth_sys.c
9  * @brief Directory authority subsystem declarations
10  **/
11 
12 #include "core/or/or.h"
13 
14 #define DIRAUTH_SYS_PRIVATE
15 #include "feature/dirauth/bwauth.h"
19 #include "feature/dirauth/keypin.h"
22 
24 
25 #include "lib/subsys/subsys.h"
26 
27 static const dirauth_options_t *global_dirauth_options;
28 
29 static int
30 subsys_dirauth_initialize(void)
31 {
32  dirauth_register_periodic_events();
33  return 0;
34 }
35 
36 static void
37 subsys_dirauth_shutdown(void)
38 {
43  global_dirauth_options = NULL;
44 }
45 
46 const dirauth_options_t *
47 dirauth_get_options(void)
48 {
49  tor_assert(global_dirauth_options);
50  return global_dirauth_options;
51 }
52 
53 STATIC int
54 dirauth_set_options(void *arg)
55 {
56  dirauth_options_t *opts = arg;
57  global_dirauth_options = opts;
58  return 0;
59 }
60 
61 const struct subsys_fns_t sys_dirauth = {
62  .name = "dirauth",
64  .supported = true,
65  .level = DIRAUTH_SUBSYS_LEVEL,
66  .initialize = subsys_dirauth_initialize,
67  .shutdown = subsys_dirauth_shutdown,
68 
69  .options_format = &dirauth_options_fmt,
70  .set_options = dirauth_set_options,
71 };
void dirserv_clear_measured_bw_cache(void)
Definition: bwauth.c:103
Header file for bwauth.c.
const config_format_t dirauth_options_fmt
Header for feature/dirauth/dirauth_config.c.
Structure dirauth_options_t to hold directory authority options.
Header for dirauth_periodic.c.
Header for dirauth_sys.c.
#define DIRAUTH_SUBSYS_LEVEL
Definition: dirauth_sys.h:26
void dirvote_free_all(void)
Definition: dirvote.c:3773
Header file for dirvote.c.
int keypin_close_journal(void)
Definition: keypin.c:335
Header for keypin.c.
Master header file for Tor-specific functionality.
void dirserv_free_fingerprint_list(void)
Header file for process_descs.c.
const char * name
Definition: subsys.h:43
Types used to declare a subsystem.
#define SUBSYS_DECLARE_LOCATION()
Definition: subsys.h:211
#define STATIC
Definition: testsupport.h:32
#define tor_assert(expr)
Definition: util_bug.h:102