tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

dos_sys.c (1050B)


      1 /* Copyright (c) 2021-2021, The Tor Project, Inc. */
      2 /* See LICENSE for licensing information */
      3 
      4 /**
      5 * @file dos_sys.c
      6 * @brief Subsystem definitions for DOS module.
      7 **/
      8 
      9 #include "core/or/or.h"
     10 
     11 #include "lib/subsys/subsys.h"
     12 
     13 #include "core/or/dos_config.h"
     14 #include "core/or/dos_sys.h"
     15 
     16 #include "core/or/dos_options_st.h"
     17 
     18 static const dos_options_t *global_dos_options;
     19 
     20 static int
     21 subsys_dos_initialize(void)
     22 {
     23  return 0;
     24 }
     25 
     26 static void
     27 subsys_dos_shutdown(void)
     28 {
     29  global_dos_options = NULL;
     30 }
     31 
     32 const dos_options_t *
     33 dos_get_options(void)
     34 {
     35  tor_assert(global_dos_options);
     36  return global_dos_options;
     37 }
     38 
     39 static int
     40 dos_set_options(void *arg)
     41 {
     42  dos_options_t *opts = arg;
     43  global_dos_options = opts;
     44  return 0;
     45 }
     46 
     47 const struct subsys_fns_t sys_dos = {
     48  SUBSYS_DECLARE_LOCATION(),
     49 
     50  .name = "dos",
     51  .supported = true,
     52  .level = DOS_SUBSYS_LEVEL,
     53 
     54  .initialize = subsys_dos_initialize,
     55  .shutdown = subsys_dos_shutdown,
     56 
     57  /* Configuration Options. */
     58  .options_format = &dos_options_fmt,
     59  .set_options = dos_set_options,
     60 };