12#ifndef TOR_FEATURE_RELAY_RELAY_CONFIG_H
13#define TOR_FEATURE_RELAY_RELAY_CONFIG_H
17#ifdef HAVE_MODULE_RELAY
28MOCK_DECL(
const char*, relay_get_dirportfrontpage, (
void));
29void relay_config_free_all(
void);
31uint32_t relay_get_effective_bwrate(
const struct or_options_t *options);
32uint32_t relay_get_effective_bwburst(
const struct or_options_t *options);
34void port_warn_nonlocal_ext_orports(
const struct smartlist_t *ports,
35 const char *portname);
40 int *have_low_ports_out);
41void port_update_port_set_relay(
struct or_options_t *options,
44int options_validate_relay_os(
const struct or_options_t *old_options,
48int options_validate_relay_info(
const struct or_options_t *old_options,
52int options_validate_publish_server(
const struct or_options_t *old_options,
56int options_validate_relay_padding(
const struct or_options_t *old_options,
60int options_validate_relay_bandwidth(
const struct or_options_t *old_options,
64int options_validate_relay_accounting(
const struct or_options_t *old_options,
68int options_validate_relay_testing(
const struct or_options_t *old_options,
72int options_act_relay(
const struct or_options_t *old_options);
73int options_act_relay_accounting(
const struct or_options_t *old_options);
74int options_act_relay_bandwidth(
const struct or_options_t *old_options);
75int options_act_bridge_stats(
const struct or_options_t *old_options);
77int options_act_relay_stats(
const struct or_options_t *old_options,
78 bool *print_notice_out);
79void options_act_relay_stats_msg(
void);
81int options_act_relay_desc(
const struct or_options_t *old_options);
82int options_act_relay_dos(
const struct or_options_t *old_options);
83int options_act_relay_dir(
const struct or_options_t *old_options);
85#ifdef RELAY_CONFIG_PRIVATE
90 size_t total_mem,
char **msg);
126 *msg = tor_strdup(
"This tor was built with relay mode disabled. "
127 "It can not be configured with an ORPort, a DirPort, "
128 "DirCache 1, or BridgeRelay 1.");
139 int *have_low_ports_out)
144 if (*have_low_ports_out < 0)
145 *have_low_ports_out = 0;
149#define relay_get_dirportfrontpage() \
151#define relay_config_free_all() \
154#define relay_get_effective_bwrate(options) \
155 (((void)(options)),0)
156#define relay_get_effective_bwburst(options) \
157 (((void)(options)),0)
159#define port_warn_nonlocal_ext_orports(ports, portname) \
160 (((void)(ports)),((void)(portname)))
162#define port_update_port_set_relay(options, ports) \
163 (((void)(options)),((void)(ports)))
165#define options_validate_relay_os(old_options, options, msg) \
166 (((void)(old_options)),((void)(options)),((void)(msg)),0)
167#define options_validate_relay_info(old_options, options, msg) \
168 (((void)(old_options)),((void)(options)),((void)(msg)),0)
169#define options_validate_publish_server(old_options, options, msg) \
170 (((void)(old_options)),((void)(options)),((void)(msg)),0)
171#define options_validate_relay_padding(old_options, options, msg) \
172 (((void)(old_options)),((void)(options)),((void)(msg)),0)
173#define options_validate_relay_bandwidth(old_options, options, msg) \
174 (((void)(old_options)),((void)(options)),((void)(msg)),0)
175#define options_validate_relay_accounting(old_options, options, msg) \
176 (((void)(old_options)),((void)(options)),((void)(msg)),0)
177#define options_validate_relay_testing(old_options, options, msg) \
178 (((void)(old_options)),((void)(options)),((void)(msg)),0)
180#define options_act_relay(old_options) \
181 (((void)(old_options)),0)
182#define options_act_relay_accounting(old_options) \
183 (((void)(old_options)),0)
184#define options_act_relay_bandwidth(old_options) \
185 (((void)(old_options)),0)
186#define options_act_bridge_stats(old_options) \
187 (((void)(old_options)),0)
189#define options_act_relay_stats(old_options, print_notice_out) \
190 (((void)(old_options)),((void)(print_notice_out)),0)
191#define options_act_relay_stats_msg() \
194#define options_act_relay_desc(old_options) \
195 (((void)(old_options)),0)
196#define options_act_relay_dos(old_options) \
197 (((void)(old_options)),0)
198#define options_act_relay_dir(old_options) \
199 (((void)(old_options)),0)
Utility macros to handle different features and behavior in different compilers.
STATIC void remove_duplicate_orports(smartlist_t *ports)
STATIC int check_bridge_distribution_setting(const char *bd)
int port_parse_ports_relay(or_options_t *options, char **msg, smartlist_t *ports_out, int *have_low_ports_out)
STATIC const char * describe_relay_port(const port_cfg_t *port)
STATIC int have_enough_mem_for_dircache(const or_options_t *options, size_t total_mem, char **msg)
static int options_validate_relay_mode(const struct or_options_t *old_options, struct or_options_t *options, char **msg)
struct config_line_t * ORPort_lines
struct config_line_t * DirPort_lines
Macros to implement mocking and selective exposure for the test code.
#define MOCK_DECL(rv, funcname, arglist)
Integer definitions used throughout Tor.