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 */
8 * @file transport_config.h
9 * @brief Header for feature/relay/transport_config.c
12 #ifndef TOR_FEATURE_RELAY_TRANSPORT_CONFIG_H
13 #define TOR_FEATURE_RELAY_TRANSPORT_CONFIG_H
15 #ifdef HAVE_MODULE_RELAY
17 #include "lib/testsupport/testsupport.h"
22 int options_validate_server_transport(const struct or_options_t
*old_options
,
23 struct or_options_t
*options
,
26 char *pt_get_bindaddr_from_config(const char *transport
);
27 struct smartlist_t
*pt_get_options_for_server_transport(const char *transport
);
29 int options_act_server_transport(const struct or_options_t
*old_options
);
31 #ifdef RELAY_TRANSPORT_CONFIG_PRIVATE
33 STATIC
struct smartlist_t
*get_options_from_transport_options_line(
35 const char *transport
);
37 #endif /* defined(RELAY_TRANSPORT_CONFIG_PRIVATE) */
39 #else /* !defined(HAVE_MODULE_RELAY) */
41 /** When tor is compiled with the relay module disabled, it can't be
42 * configured with server pluggable transports.
44 * Returns -1 and sets msg to a newly allocated string, if ExtORPort,
45 * ServerTransportPlugin, ServerTransportListenAddr, or
46 * ServerTransportOptions are set in options. Otherwise returns 0. */
48 options_validate_server_transport(const struct or_options_t
*old_options
,
49 struct or_options_t
*options
,
54 /* These ExtORPort checks are too strict, and will reject valid configs
55 * that disable ports, like "ExtORPort 0". */
56 if (options
->ServerTransportPlugin
||
57 options
->ServerTransportListenAddr
||
58 options
->ServerTransportOptions
||
59 options
->ExtORPort_lines
) {
60 /* REJECT() this configuration */
61 *msg
= tor_strdup("This tor was built with relay mode disabled. "
62 "It can not be configured with an ExtORPort, "
63 "a ServerTransportPlugin, a ServerTransportListenAddr, "
64 "or ServerTransportOptions.");
71 #define pt_get_bindaddr_from_config(transport) \
72 (((void)(transport)),NULL)
74 /* 31851: called from client/transports.c, but only from server code */
75 #define pt_get_options_for_server_transport(transport) \
76 (((void)(transport)),NULL)
78 #define options_validate_server_transport(old_options, options, msg) \
79 (((void)(old_options)),((void)(options)),((void)(msg)),0)
80 #define options_act_server_transport(old_options) \
81 (((void)(old_options)),0)
83 #endif /* defined(HAVE_MODULE_RELAY) */
85 #endif /* !defined(TOR_FEATURE_RELAY_TRANSPORT_CONFIG_H) */