relay/dirauth: Set some output arguments in stubs
[tor.git] / src / feature / dirauth / dirauth_config.h
blob9042ff87791e22cde6f992efcffdb28a09c9d738
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-2020, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
7 /**
8 * @file dirauth_config.h
9 * @brief Header for feature/dirauth/dirauth_config.c
10 **/
12 #ifndef TOR_FEATURE_DIRAUTH_DIRAUTH_CONFIG_H
13 #define TOR_FEATURE_DIRAUTH_DIRAUTH_CONFIG_H
15 struct or_options_t;
17 #ifdef HAVE_MODULE_DIRAUTH
19 #include "lib/cc/torint.h"
21 int options_validate_dirauth_mode(const struct or_options_t *old_options,
22 struct or_options_t *options,
23 char **msg);
25 int options_validate_dirauth_schedule(const struct or_options_t *old_options,
26 struct or_options_t *options,
27 char **msg);
29 int options_validate_dirauth_testing(const struct or_options_t *old_options,
30 struct or_options_t *options,
31 char **msg);
33 int options_act_dirauth(const struct or_options_t *old_options);
34 int options_act_dirauth_mtbf(const struct or_options_t *old_options);
35 int options_act_dirauth_stats(const struct or_options_t *old_options,
36 bool *print_notice_out);
38 bool dirauth_should_reject_requests_under_load(void);
40 extern const struct config_format_t dirauth_options_fmt;
42 #else /* !defined(HAVE_MODULE_DIRAUTH) */
44 /** When tor is compiled with the dirauth module disabled, it can't be
45 * configured as a directory authority.
47 * Returns -1 and sets msg to a newly allocated string, if AuthoritativeDir
48 * is set in options. Otherwise returns 0. */
49 static inline int
50 options_validate_dirauth_mode(const struct or_options_t *old_options,
51 struct or_options_t *options,
52 char **msg)
54 (void)old_options;
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;
65 return 0;
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)
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)
78 static inline int
79 options_act_dirauth_stats(const struct or_options_t *old_options,
80 bool *print_notice_out)
82 (void)old_options;
83 *print_notice_out = 0;
84 return 0;
87 #define dirauth_should_reject_requests_under_load() (false)
89 #endif /* defined(HAVE_MODULE_DIRAUTH) */
91 #endif /* !defined(TOR_FEATURE_DIRAUTH_DIRAUTH_CONFIG_H) */