Tor  0.4.6.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-2020, 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 };
SUBSYS_DECLARE_LOCATION
#define SUBSYS_DECLARE_LOCATION()
Definition: subsys.h:211
tor_assert
#define tor_assert(expr)
Definition: util_bug.h:102
DIRAUTH_SUBSYS_LEVEL
#define DIRAUTH_SUBSYS_LEVEL
Definition: dirauth_sys.h:26
process_descs.h
Header file for process_descs.c.
dirauth_periodic.h
Header for dirauth_periodic.c.
dirauth_options_fmt
const config_format_t dirauth_options_fmt
Definition: dirauth_config.c:462
subsys.h
Types used to declare a subsystem.
dirvote.h
Header file for dirvote.c.
dirauth_options_st.h
Structure dirauth_options_t to hold directory authority options.
subsys_fns_t::name
const char * name
Definition: subsys.h:43
keypin.h
Header for keypin.c.
dirauth_options_t
Definition: dirauth_options.inc:13
dirauth_config.h
Header for feature/dirauth/dirauth_config.c.
bwauth.h
Header file for bwauth.c.
dirserv_clear_measured_bw_cache
void dirserv_clear_measured_bw_cache(void)
Definition: bwauth.c:103
keypin_close_journal
int keypin_close_journal(void)
Definition: keypin.c:337
dirvote_free_all
void dirvote_free_all(void)
Definition: dirvote.c:3773
dirauth_sys.h
Header for dirauth_sys.c.
STATIC
#define STATIC
Definition: testsupport.h:32
dirserv_free_fingerprint_list
void dirserv_free_fingerprint_list(void)
Definition: process_descs.c:521
subsys_fns_t
Definition: subsys.h:38
or.h
Master header file for Tor-specific functionality.