aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/dos_sys.c
blob: 03a9ee914099ffbd93deef0da16abbf3b4ea613b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* Copyright (c) 2021-2021, The Tor Project, Inc. */
/* See LICENSE for licensing information */

/**
 * @file dos_sys.c
 * @brief Subsystem definitions for DOS module.
 **/

#include "core/or/or.h"

#include "lib/subsys/subsys.h"

#include "core/or/dos_config.h"
#include "core/or/dos_sys.h"

#include "core/or/dos_options_st.h"

static const dos_options_t *global_dos_options;

static int
subsys_dos_initialize(void)
{
  return 0;
}

static void
subsys_dos_shutdown(void)
{
  global_dos_options = NULL;
}

const dos_options_t *
dos_get_options(void)
{
  tor_assert(global_dos_options);
  return global_dos_options;
}

static int
dos_set_options(void *arg)
{
  dos_options_t *opts = arg;
  global_dos_options = opts;
  return 0;
}

const struct subsys_fns_t sys_dos = {
  SUBSYS_DECLARE_LOCATION(),

  .name = "dos",
  .supported = true,
  .level = DOS_SUBSYS_LEVEL,

  .initialize = subsys_dos_initialize,
  .shutdown = subsys_dos_shutdown,

  /* Configuration Options. */
  .options_format = &dos_options_fmt,
  .set_options = dos_set_options,
};