Tor 0.4.9.0-alpha-dev
dirauth_config.h
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-2021, The Tor Project, Inc. */
5/* See LICENSE for licensing information */
6
7/**
8 * @file dirauth_config.h
9 * @brief Header for feature/dirauth/dirauth_config.c
10 **/
11
12#ifndef TOR_FEATURE_DIRAUTH_DIRAUTH_CONFIG_H
13#define TOR_FEATURE_DIRAUTH_DIRAUTH_CONFIG_H
14
15struct or_options_t;
16
17#ifdef HAVE_MODULE_DIRAUTH
18
19#include "lib/cc/torint.h"
20
21int options_validate_dirauth_mode(const struct or_options_t *old_options,
22 struct or_options_t *options,
23 char **msg);
24
25int options_validate_dirauth_schedule(const struct or_options_t *old_options,
26 struct or_options_t *options,
27 char **msg);
28
29int options_validate_dirauth_testing(const struct or_options_t *old_options,
30 struct or_options_t *options,
31 char **msg);
32
33int options_act_dirauth(const struct or_options_t *old_options);
34int options_act_dirauth_mtbf(const struct or_options_t *old_options);
35int options_act_dirauth_stats(const struct or_options_t *old_options,
36 bool *print_notice_out);
37
39
40extern const struct config_format_t dirauth_options_fmt;
41
42#else /* !defined(HAVE_MODULE_DIRAUTH) */
43
44/** When tor is compiled with the dirauth module disabled, it can't be
45 * configured as a directory authority.
46 *
47 * Returns -1 and sets msg to a newly allocated string, if AuthoritativeDir
48 * is set in options. Otherwise returns 0. */
49static inline int
51 struct or_options_t *options,
52 char **msg)
53{
54 (void)old_options;
55
56 /* Only check the primary option for now, #29211 will disable more
57 * options. */
58 if (options->AuthoritativeDir) {
59 /* REJECT() this configuration */
60 *msg = tor_strdup("This tor was built with dirauth mode disabled. "
61 "It can not be configured with AuthoritativeDir 1.");
62 return -1;
63 }
64
65 return 0;
66}
67
68#define options_validate_dirauth_schedule(old_options, options, msg) \
69 (((void)(old_options)),((void)(options)),((void)(msg)),0)
70#define options_validate_dirauth_testing(old_options, options, msg) \
71 (((void)(old_options)),((void)(options)),((void)(msg)),0)
72
73#define options_act_dirauth(old_options) \
74 (((void)(old_options)),0)
75#define options_act_dirauth_mtbf(old_options) \
76 (((void)(old_options)),0)
77
78static inline int
79options_act_dirauth_stats(const struct or_options_t *old_options,
80 bool *print_notice_out)
81{
82 (void)old_options;
83 *print_notice_out = 0;
84 return 0;
85}
86
87#define dirauth_should_reject_requests_under_load() (false)
88
89#endif /* defined(HAVE_MODULE_DIRAUTH) */
90
91#endif /* !defined(TOR_FEATURE_DIRAUTH_DIRAUTH_CONFIG_H) */
int options_act_dirauth_mtbf(const or_options_t *old_options)
const config_format_t dirauth_options_fmt
bool dirauth_should_reject_requests_under_load(void)
int options_act_dirauth_stats(const or_options_t *old_options, bool *print_notice_out)
int options_act_dirauth(const or_options_t *old_options)
int options_validate_dirauth_testing(const or_options_t *old_options, or_options_t *options, char **msg)
int options_validate_dirauth_schedule(const or_options_t *old_options, or_options_t *options, char **msg)
static int options_validate_dirauth_mode(const struct or_options_t *old_options, struct or_options_t *options, char **msg)
Integer definitions used throughout Tor.