LCOV - code coverage report
Current view: top level - feature/dirauth - dirauth_sys.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 17 17 100.0 %
Date: 2021-11-24 03:28:48 Functions: 4 4 100.0 %

          Line data    Source code
       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"
      16             : #include "feature/dirauth/dirauth_sys.h"
      17             : #include "feature/dirauth/dirvote.h"
      18             : #include "feature/dirauth/dirauth_periodic.h"
      19             : #include "feature/dirauth/keypin.h"
      20             : #include "feature/dirauth/process_descs.h"
      21             : #include "feature/dirauth/dirauth_config.h"
      22             : 
      23             : #include "feature/dirauth/dirauth_options_st.h"
      24             : 
      25             : #include "lib/subsys/subsys.h"
      26             : 
      27             : static const dirauth_options_t *global_dirauth_options;
      28             : 
      29             : static int
      30         244 : subsys_dirauth_initialize(void)
      31             : {
      32         244 :   dirauth_register_periodic_events();
      33         244 :   return 0;
      34             : }
      35             : 
      36             : static void
      37         235 : subsys_dirauth_shutdown(void)
      38             : {
      39         235 :   dirserv_free_fingerprint_list();
      40         235 :   dirvote_free_all();
      41         235 :   dirserv_clear_measured_bw_cache();
      42         235 :   keypin_close_journal();
      43         235 :   global_dirauth_options = NULL;
      44         235 : }
      45             : 
      46             : const dirauth_options_t *
      47         174 : dirauth_get_options(void)
      48             : {
      49         174 :   tor_assert(global_dirauth_options);
      50         174 :   return global_dirauth_options;
      51             : }
      52             : 
      53             : STATIC int
      54         217 : dirauth_set_options(void *arg)
      55             : {
      56         217 :   dirauth_options_t *opts = arg;
      57         217 :   global_dirauth_options = opts;
      58         217 :   return 0;
      59             : }
      60             : 
      61             : const struct subsys_fns_t sys_dirauth = {
      62             :   .name = "dirauth",
      63             :   SUBSYS_DECLARE_LOCATION(),
      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             : };

Generated by: LCOV version 1.14