Tor 0.4.9.0-alpha-dev
dos_sys.c
Go to the documentation of this file.
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
17
18static const dos_options_t *global_dos_options;
19
20static int
21subsys_dos_initialize(void)
22{
23 return 0;
24}
25
26static void
27subsys_dos_shutdown(void)
28{
29 global_dos_options = NULL;
30}
31
32const dos_options_t *
33dos_get_options(void)
34{
35 tor_assert(global_dos_options);
36 return global_dos_options;
37}
38
39static int
40dos_set_options(void *arg)
41{
42 dos_options_t *opts = arg;
43 global_dos_options = opts;
44 return 0;
45}
46
47const struct subsys_fns_t sys_dos = {
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};
const config_format_t dos_options_fmt
Definition: dos_config.c:23
Header for core/or/dos_config.c.
Structure dos_options_t to hold options for the DoS subsystem.
Header for core/or/dos_sys.c.
#define DOS_SUBSYS_LEVEL
Definition: dos_sys.h:23
Master header file for Tor-specific functionality.
Types used to declare a subsystem.
#define SUBSYS_DECLARE_LOCATION()
Definition: subsys.h:211
#define tor_assert(expr)
Definition: util_bug.h:103