summaryrefslogtreecommitdiff
path: root/src/feature/relay
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2019-11-05 11:28:57 +1000
committerteor <teor@torproject.org>2019-11-05 11:28:57 +1000
commitcb8ebc0b4c9582f2588be84bc0af0ab3dfe4fc2f (patch)
tree64d478c825955f9db31b6b074dcd8ecfc5e2cd04 /src/feature/relay
parent96334d6f7f4751256dec2b254a075e5dd2eba48f (diff)
downloadtor-cb8ebc0b4c9582f2588be84bc0af0ab3dfe4fc2f.tar.gz
tor-cb8ebc0b4c9582f2588be84bc0af0ab3dfe4fc2f.zip
config: Rename new global functions with a prefix
This is an automated commit, generated by this command: ./scripts/maint/rename_c_identifier.py \ get_dirportfrontpage relay_get_dirportfrontpage \ parse_port_config port_parse_config \ count_real_listeners port_count_real_listeners \ parse_transport_line pt_parse_transport_line \ ensure_bandwidth_cap config_ensure_bandwidth_cap \ get_effective_bwrate relay_get_effective_bwrate \ get_effective_bwburst relay_get_effective_bwburst \ warn_nonlocal_ext_orports port_warn_nonlocal_ext_orports \ parse_ports_relay port_parse_ports_relay \ update_port_set_relay port_update_port_set_relay \ get_transport_bindaddr_from_config pt_get_bindaddr_from_config \ get_options_for_server_transport pt_get_options_for_server_transport It was generated with --no-verify, because it has some long lines. Part of 32213.
Diffstat (limited to 'src/feature/relay')
-rw-r--r--src/feature/relay/relay_config.c44
-rw-r--r--src/feature/relay/relay_config.h24
-rw-r--r--src/feature/relay/router.c6
-rw-r--r--src/feature/relay/transport_config.c8
-rw-r--r--src/feature/relay/transport_config.h8
5 files changed, 45 insertions, 45 deletions
diff --git a/src/feature/relay/relay_config.c b/src/feature/relay/relay_config.c
index 4ec4416d35..e09f34de0e 100644
--- a/src/feature/relay/relay_config.c
+++ b/src/feature/relay/relay_config.c
@@ -71,7 +71,7 @@ static char *global_dirfrontpagecontents = NULL;
/** Return the contents of our frontpage string, or NULL if not configured. */
MOCK_IMPL(const char*,
-get_dirportfrontpage, (void))
+relay_get_dirportfrontpage, (void))
{
return global_dirfrontpagecontents;
}
@@ -88,33 +88,33 @@ relay_config_free_all(void)
/** Return the bandwidthrate that we are going to report to the authorities
* based on the config options. */
uint32_t
-get_effective_bwrate(const or_options_t *options)
+relay_get_effective_bwrate(const or_options_t *options)
{
uint64_t bw = options->BandwidthRate;
if (bw > options->MaxAdvertisedBandwidth)
bw = options->MaxAdvertisedBandwidth;
if (options->RelayBandwidthRate > 0 && bw > options->RelayBandwidthRate)
bw = options->RelayBandwidthRate;
- /* ensure_bandwidth_cap() makes sure that this cast can't overflow. */
+ /* config_ensure_bandwidth_cap() makes sure that this cast can't overflow. */
return (uint32_t)bw;
}
/** Return the bandwidthburst that we are going to report to the authorities
* based on the config options. */
uint32_t
-get_effective_bwburst(const or_options_t *options)
+relay_get_effective_bwburst(const or_options_t *options)
{
uint64_t bw = options->BandwidthBurst;
if (options->RelayBandwidthBurst > 0 && bw > options->RelayBandwidthBurst)
bw = options->RelayBandwidthBurst;
- /* ensure_bandwidth_cap() makes sure that this cast can't overflow. */
+ /* config_ensure_bandwidth_cap() makes sure that this cast can't overflow. */
return (uint32_t)bw;
}
/** Warn for every Extended ORPort port in <b>ports</b> that is on a
* publicly routable address. */
void
-warn_nonlocal_ext_orports(const smartlist_t *ports, const char *portname)
+port_warn_nonlocal_ext_orports(const smartlist_t *ports, const char *portname)
{
SMARTLIST_FOREACH_BEGIN(ports, const port_cfg_t *, port) {
if (port->type != CONN_TYPE_EXT_OR_LISTENER)
@@ -235,7 +235,7 @@ check_server_ports(const smartlist_t *ports,
* of the problem and return -1.
**/
int
-parse_ports_relay(or_options_t *options,
+port_parse_ports_relay(or_options_t *options,
char **msg,
smartlist_t *ports_out,
int *have_low_ports_out)
@@ -261,7 +261,7 @@ parse_ports_relay(or_options_t *options,
goto err;
}
- if (parse_port_config(ports,
+ if (port_parse_config(ports,
options->ORPort_lines,
"OR", CONN_TYPE_OR_LISTENER,
"0.0.0.0", 0,
@@ -269,7 +269,7 @@ parse_ports_relay(or_options_t *options,
*msg = tor_strdup("Invalid ORPort configuration");
goto err;
}
- if (parse_port_config(ports,
+ if (port_parse_config(ports,
options->ExtORPort_lines,
"ExtOR", CONN_TYPE_EXT_OR_LISTENER,
"127.0.0.1", 0,
@@ -277,7 +277,7 @@ parse_ports_relay(or_options_t *options,
*msg = tor_strdup("Invalid ExtORPort configuration");
goto err;
}
- if (parse_port_config(ports,
+ if (port_parse_config(ports,
options->DirPort_lines,
"Dir", CONN_TYPE_DIR_LISTENER,
"0.0.0.0", 0,
@@ -308,7 +308,7 @@ parse_ports_relay(or_options_t *options,
/** Update the relay *Port_set values in <b>options</b> from <b>ports</b>. */
void
-update_port_set_relay(or_options_t *options,
+port_update_port_set_relay(or_options_t *options,
const smartlist_t *ports)
{
if (BUG(!options))
@@ -323,11 +323,11 @@ update_port_set_relay(or_options_t *options,
/* Update the relay *Port_set options. The !! here is to force a boolean
* out of an integer. */
options->ORPort_set =
- !! count_real_listeners(ports, CONN_TYPE_OR_LISTENER, 0);
+ !! port_count_real_listeners(ports, CONN_TYPE_OR_LISTENER, 0);
options->DirPort_set =
- !! count_real_listeners(ports, CONN_TYPE_DIR_LISTENER, 0);
+ !! port_count_real_listeners(ports, CONN_TYPE_DIR_LISTENER, 0);
options->ExtORPort_set =
- !! count_real_listeners(ports, CONN_TYPE_EXT_OR_LISTENER, 0);
+ !! port_count_real_listeners(ports, CONN_TYPE_EXT_OR_LISTENER, 0);
}
/**
@@ -624,19 +624,19 @@ options_validate_relay_bandwidth(const or_options_t *old_options,
/* 31851: the tests expect us to validate bandwidths, even when we are not
* in relay mode. */
- if (ensure_bandwidth_cap(&options->MaxAdvertisedBandwidth,
+ if (config_ensure_bandwidth_cap(&options->MaxAdvertisedBandwidth,
"MaxAdvertisedBandwidth", msg) < 0)
return -1;
- if (ensure_bandwidth_cap(&options->RelayBandwidthRate,
+ if (config_ensure_bandwidth_cap(&options->RelayBandwidthRate,
"RelayBandwidthRate", msg) < 0)
return -1;
- if (ensure_bandwidth_cap(&options->RelayBandwidthBurst,
+ if (config_ensure_bandwidth_cap(&options->RelayBandwidthBurst,
"RelayBandwidthBurst", msg) < 0)
return -1;
- if (ensure_bandwidth_cap(&options->PerConnBWRate,
+ if (config_ensure_bandwidth_cap(&options->PerConnBWRate,
"PerConnBWRate", msg) < 0)
return -1;
- if (ensure_bandwidth_cap(&options->PerConnBWBurst,
+ if (config_ensure_bandwidth_cap(&options->PerConnBWBurst,
"PerConnBWBurst", msg) < 0)
return -1;
@@ -1046,9 +1046,9 @@ options_transition_affects_descriptor(const or_options_t *old_options,
YES_IF_CHANGED_BOOL(DirCache);
YES_IF_CHANGED_BOOL(AssumeReachable);
- if (get_effective_bwrate(old_options) != get_effective_bwrate(new_options) ||
- get_effective_bwburst(old_options) !=
- get_effective_bwburst(new_options) ||
+ if (relay_get_effective_bwrate(old_options) != relay_get_effective_bwrate(new_options) ||
+ relay_get_effective_bwburst(old_options) !=
+ relay_get_effective_bwburst(new_options) ||
public_server_mode(old_options) != public_server_mode(new_options))
return 1;
diff --git a/src/feature/relay/relay_config.h b/src/feature/relay/relay_config.h
index 5f08fc3e0f..c0d7d41240 100644
--- a/src/feature/relay/relay_config.h
+++ b/src/feature/relay/relay_config.h
@@ -25,20 +25,20 @@ int options_validate_relay_mode(const or_options_t *old_options,
or_options_t *options,
char **msg);
-MOCK_DECL(const char*, get_dirportfrontpage, (void));
+MOCK_DECL(const char*, relay_get_dirportfrontpage, (void));
void relay_config_free_all(void);
-uint32_t get_effective_bwrate(const or_options_t *options);
-uint32_t get_effective_bwburst(const or_options_t *options);
+uint32_t relay_get_effective_bwrate(const or_options_t *options);
+uint32_t relay_get_effective_bwburst(const or_options_t *options);
-void warn_nonlocal_ext_orports(const smartlist_t *ports,
+void port_warn_nonlocal_ext_orports(const smartlist_t *ports,
const char *portname);
-int parse_ports_relay(or_options_t *options,
+int port_parse_ports_relay(or_options_t *options,
char **msg,
smartlist_t *ports_out,
int *have_low_ports_out);
-void update_port_set_relay(or_options_t *options,
+void port_update_port_set_relay(or_options_t *options,
const smartlist_t *ports);
int options_validate_relay_os(const or_options_t *old_options,
@@ -128,23 +128,23 @@ options_validate_relay_mode(const or_options_t *old_options,
return 0;
}
-#define get_dirportfrontpage() \
+#define relay_get_dirportfrontpage() \
(NULL)
#define relay_config_free_all() \
STMT_BEGIN STMT_END
-#define get_effective_bwrate(options) \
+#define relay_get_effective_bwrate(options) \
(((void)(options)),0)
-#define get_effective_bwburst(options) \
+#define relay_get_effective_bwburst(options) \
(((void)(options)),0)
-#define warn_nonlocal_ext_orports(ports, portname) \
+#define port_warn_nonlocal_ext_orports(ports, portname) \
(((void)(ports)),((void)(portname)))
-#define parse_ports_relay(options, msg, ports_out, have_low_ports_out) \
+#define port_parse_ports_relay(options, msg, ports_out, have_low_ports_out) \
(((void)(options)),((void)(msg)),((void)(ports_out)), \
((void)(have_low_ports_out)),0)
-#define update_port_set_relay(options, ports) \
+#define port_update_port_set_relay(options, ports) \
(((void)(options)),((void)(ports)))
#define options_validate_relay_os(old_options, options, msg) \
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index c80a8b8c0c..7f80b288de 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -1223,7 +1223,7 @@ router_should_be_dirserver(const or_options_t *options, int dir_port)
* much larger effect on output than input so there is no reason to turn it
* off if using AccountingRule in. */
int interval_length = accounting_get_interval_length();
- uint32_t effective_bw = get_effective_bwrate(options);
+ uint32_t effective_bw = relay_get_effective_bwrate(options);
uint64_t acc_bytes;
if (!interval_length) {
log_warn(LD_BUG, "An accounting interval is not allowed to be zero "
@@ -2042,10 +2042,10 @@ router_build_fresh_unsigned_routerinfo,(routerinfo_t **ri_out))
ri->protocol_list = tor_strdup(protover_get_supported_protocols());
/* compute ri->bandwidthrate as the min of various options */
- ri->bandwidthrate = get_effective_bwrate(options);
+ ri->bandwidthrate = relay_get_effective_bwrate(options);
/* and compute ri->bandwidthburst similarly */
- ri->bandwidthburst = get_effective_bwburst(options);
+ ri->bandwidthburst = relay_get_effective_bwburst(options);
/* Report bandwidth, unless we're hibernating or shutting down */
ri->bandwidthcapacity = hibernating ? 0 : rep_hist_bandwidth_assess();
diff --git a/src/feature/relay/transport_config.c b/src/feature/relay/transport_config.c
index e94995a29f..9d6be4bafd 100644
--- a/src/feature/relay/transport_config.c
+++ b/src/feature/relay/transport_config.c
@@ -90,7 +90,7 @@ get_bindaddr_from_transport_listen_line(const char *line,
* it to listen on a specific port. Return a <address:port> string if
* so, otherwise NULL. */
char *
-get_transport_bindaddr_from_config(const char *transport)
+pt_get_bindaddr_from_config(const char *transport)
{
config_line_t *cl;
const or_options_t *options = get_options();
@@ -168,7 +168,7 @@ get_options_from_transport_options_line(const char *line,
* parameters to the pluggable transport. Return a smartlist
* containing the parameters, otherwise NULL. */
smartlist_t *
-get_options_for_server_transport(const char *transport)
+pt_get_options_for_server_transport(const char *transport)
{
config_line_t *cl;
const or_options_t *options = get_options();
@@ -219,7 +219,7 @@ options_validate_server_transport(const or_options_t *old_options,
}
for (cl = options->ServerTransportPlugin; cl; cl = cl->next) {
- if (parse_transport_line(options, cl->value, 1, 1) < 0)
+ if (pt_parse_transport_line(options, cl->value, 1, 1) < 0)
REJECT("Invalid server transport line. See logs for details.");
}
@@ -291,7 +291,7 @@ options_act_server_transport(const or_options_t *old_options)
if (!options->DisableNetwork) {
if (options->ServerTransportPlugin) {
for (cl = options->ServerTransportPlugin; cl; cl = cl->next) {
- if (parse_transport_line(options, cl->value, 0, 1) < 0) {
+ if (pt_parse_transport_line(options, cl->value, 0, 1) < 0) {
// LCOV_EXCL_START
log_warn(LD_BUG,
"Previously validated ServerTransportPlugin line "
diff --git a/src/feature/relay/transport_config.h b/src/feature/relay/transport_config.h
index 799c51c984..de6e7668e2 100644
--- a/src/feature/relay/transport_config.h
+++ b/src/feature/relay/transport_config.h
@@ -23,8 +23,8 @@ int options_validate_server_transport(const or_options_t *old_options,
or_options_t *options,
char **msg);
-char *get_transport_bindaddr_from_config(const char *transport);
-smartlist_t *get_options_for_server_transport(const char *transport);
+char *pt_get_bindaddr_from_config(const char *transport);
+smartlist_t *pt_get_options_for_server_transport(const char *transport);
int options_act_server_transport(const or_options_t *old_options);
@@ -68,11 +68,11 @@ options_validate_server_transport(const or_options_t *old_options,
return 0;
}
-#define get_transport_bindaddr_from_config(transport) \
+#define pt_get_bindaddr_from_config(transport) \
(((void)(transport)),NULL)
/* 31851: called from client/transports.c, but only from server code */
-#define get_options_for_server_transport(transport) \
+#define pt_get_options_for_server_transport(transport) \
(((void)(transport)),NULL)
#define options_validate_server_transport(old_options, options, msg) \