Data Structures | Macros | Typedefs | Enumerations | Functions
config.h File Reference
#include "app/config/or_options_st.h"
#include "lib/testsupport/testsupport.h"

Go to the source code of this file.

Data Structures

struct  bridge_line_t


#define MIN_HEARTBEAT_PERIOD   (30*60)
#define OPTIONS_DUMP_ALL   3
#define options_get_datadir_fname2_suffix(options, sub1, sub2, suffix)
#define options_get_cachedir_fname2_suffix(options, sub1, sub2, suffix)
#define options_get_keydir_fname2_suffix(options, sub1, sub2, suffix)
#define options_get_datadir_fname(opts, sub1)   options_get_datadir_fname2_suffix((opts),(sub1), NULL, NULL)
#define options_get_datadir_fname2(opts, sub1, sub2)   options_get_datadir_fname2_suffix((opts),(sub1), (sub2), NULL)
#define get_datadir_fname2_suffix(sub1, sub2, suffix)   options_get_datadir_fname2_suffix(get_options(), (sub1), (sub2), (suffix))
#define get_datadir_fname(sub1)   get_datadir_fname2_suffix((sub1), NULL, NULL)
#define get_datadir_fname2(sub1, sub2)   get_datadir_fname2_suffix((sub1), (sub2), NULL)
#define get_datadir_fname_suffix(sub1, suffix)   get_datadir_fname2_suffix((sub1), NULL, (suffix))
#define options_get_keydir_fname(options, sub1)   options_get_keydir_fname2_suffix((options), (sub1), NULL, NULL)
#define get_keydir_fname_suffix(sub1, suffix)   options_get_keydir_fname2_suffix(get_options(), (sub1), NULL, suffix)
#define get_keydir_fname(sub1)   options_get_keydir_fname2_suffix(get_options(), (sub1), NULL, NULL)
#define get_cachedir_fname(sub1)   options_get_cachedir_fname2_suffix(get_options(), (sub1), NULL, NULL)
#define get_cachedir_fname_suffix(sub1, suffix)   options_get_cachedir_fname2_suffix(get_options(), (sub1), NULL, (suffix))
#define get_primary_or_port()   (get_first_advertised_port_by_type_af(CONN_TYPE_OR_LISTENER, AF_INET))
#define get_primary_dir_port()   (get_first_advertised_port_by_type_af(CONN_TYPE_DIR_LISTENER, AF_INET))
#define bridge_line_free(line)   FREE_AND_NULL(bridge_line_t, bridge_line_free_, (line))


typedef enum setopt_err_t setopt_err_t
typedef struct bridge_line_t bridge_line_t


enum  setopt_err_t {


 MOCK_DECL (const char *, get_dirportfrontpage,(void))
 MOCK_DECL (const or_options_t *, get_options,(void))
 MOCK_DECL (or_options_t *, get_options_mutable,(void))
int set_options (or_options_t *new_val, char **msg)
void config_free_all (void)
const char * safe_str_client (const char *address)
const char * safe_str (const char *address)
const char * escaped_safe_str_client (const char *address)
const char * escaped_safe_str (const char *address)
void init_protocol_warning_severity_level (void)
int get_protocol_warning_severity_level (void)
setopt_err_t options_trial_assign (struct config_line_t *list, unsigned flags, char **msg)
uint32_t get_last_resolved_addr (void)
void reset_last_resolved_addr (void)
int resolve_my_address (int warn_severity, const or_options_t *options, uint32_t *addr_out, const char **method_out, char **hostname_out)
 MOCK_DECL (int, is_local_addr,(const tor_addr_t *addr))
void options_init (or_options_t *options)
char * options_dump (const or_options_t *options, int how_to_dump)
int options_init_from_torrc (int argc, char **argv)
setopt_err_t options_init_from_string (const char *cf_defaults, const char *cf, int command, const char *command_arg, char **msg)
int option_is_recognized (const char *key)
const char * option_get_canonical_name (const char *key)
struct config_line_toption_get_assignment (const or_options_t *options, const char *key)
int options_save_current (void)
const char * get_torrc_fname (int defaults_fname)
 MOCK_DECL (char *, options_get_dir_fname2_suffix,(const or_options_t *options, directory_root_t roottype, const char *sub1, const char *sub2, const char *suffix))
int using_default_dir_authorities (const or_options_t *options)
int create_keys_directory (const or_options_t *options)
int check_or_create_data_subdir (const char *subdir)
int write_to_data_subdir (const char *subdir, const char *fname, const char *str, const char *descr)
int get_num_cpus (const or_options_t *options)
 MOCK_DECL (const smartlist_t *, get_configured_ports,(void))
int get_first_advertised_port_by_type_af (int listener_type, int address_family)
const tor_addr_tget_first_advertised_addr_by_type_af (int listener_type, int address_family)
int port_exists_by_type_addr_port (int listener_type, const tor_addr_t *addr, int port, int check_wildcard)
int port_exists_by_type_addr32h_port (int listener_type, uint32_t addr_ipv4h, int port, int check_wildcard)
char * get_first_listener_addrport_string (int listener_type)
int options_need_geoip_info (const or_options_t *options, const char **reason_out)
smartlist_tget_list_of_ports_to_forward (void)
int getinfo_helper_config (control_connection_t *conn, const char *question, char **answer, const char **errmsg)
uint32_t get_effective_bwrate (const or_options_t *options)
uint32_t get_effective_bwburst (const or_options_t *options)
char * get_transport_bindaddr_from_config (const char *transport)
int init_cookie_authentication (const char *fname, const char *header, int cookie_len, int group_readable, uint8_t **cookie_out, int *cookie_is_set_out)
or_options_toptions_new (void)
int config_parse_commandline (int argc, char **argv, int ignore_errors, struct config_line_t **result, struct config_line_t **cmdline_result)
void config_register_addressmaps (const or_options_t *options)
int addressmap_register_auto (const char *from, const char *to, time_t expires, addressmap_entry_source_t addrmap_source, const char **msg)
int port_cfg_line_extract_addrport (const char *line, char **addrport_out, int *is_unix_out, const char **rest_out)
void bridge_line_free_ (bridge_line_t *bridge_line)
bridge_line_tparse_bridge_line (const char *line)
smartlist_tget_options_from_transport_options_line (const char *line, const char *transport)
smartlist_tget_options_for_server_transport (const char *transport)
int options_any_client_port_set (const or_options_t *options)

Detailed Description

Header file for config.c.

Definition in file config.h.

Macro Definition Documentation



Maximum default value for MaxMemInQueues, in bytes.

Definition at line 30 of file config.h.


#define MIN_HEARTBEAT_PERIOD   (30*60)

Lowest allowable value for HeartbeatPeriod; if this is too low, we might expose more information than we're comfortable with.

Definition at line 24 of file config.h.

◆ options_get_cachedir_fname2_suffix

#define options_get_cachedir_fname2_suffix (   options,
options_get_dir_fname2_suffix((options), DIRROOT_CACHEDIR, \
(sub1), (sub2), (suffix))

Definition at line 110 of file config.h.

◆ options_get_datadir_fname2_suffix

#define options_get_datadir_fname2_suffix (   options,
options_get_dir_fname2_suffix((options), DIRROOT_DATADIR, \
(sub1), (sub2), (suffix))

Definition at line 107 of file config.h.

◆ options_get_keydir_fname

#define options_get_keydir_fname (   options,
)    options_get_keydir_fname2_suffix((options), (sub1), NULL, NULL)


Definition at line 132 of file config.h.

Referenced by log_master_signing_key_cert_expiration().

◆ options_get_keydir_fname2_suffix

#define options_get_keydir_fname2_suffix (   options,
options_get_dir_fname2_suffix((options), DIRROOT_KEYDIR, \
(sub1), (sub2), (suffix))

Definition at line 113 of file config.h.

Typedef Documentation

◆ bridge_line_t

typedef struct bridge_line_t bridge_line_t

Represents the information stored in a torrc Bridge line.

◆ setopt_err_t

typedef enum setopt_err_t setopt_err_t

Enumeration Type Documentation

◆ setopt_err_t

An error from options_trial_assign() or options_init_from_string().

Definition at line 46 of file config.h.

Function Documentation

◆ addressmap_register_auto()

int addressmap_register_auto ( const char *  from,
const char *  to,
time_t  expires,
addressmap_entry_source_t  addrmap_source,
const char **  msg 

As addressmap_register(), but detect the wildcarded status of "from" and "to", and do not steal a reference to to.

Definition at line 5578 of file config.c.

References address_is_invalid_destination(), and addressmap_register().

◆ bridge_line_free_()

void bridge_line_free_ ( bridge_line_t bridge_line)

Deallocate a bridge_line_t structure.

Definition at line 5825 of file config.c.

References SMARTLIST_FOREACH, and tor_free.

◆ check_or_create_data_subdir()

int check_or_create_data_subdir ( const char *  subdir)

Check wether the data directory has a private subdirectory subdir. If not, try to create it. Return 0 on success, -1 otherwise.

Definition at line 8051 of file config.c.

◆ config_free_all()

void config_free_all ( void  )

Release all memory and resources held by global configuration structures.

Definition at line 1022 of file config.c.

References global_default_options, and global_options.

◆ config_parse_commandline()

int config_parse_commandline ( int  argc,
char **  argv,
int  ignore_errors,
config_line_t **  result,
config_line_t **  cmdline_result 

Helper: Read a list of configuration options from the command line. If successful, or if ignore_errors is set, put them in *result, put the commandline-only options in *cmdline_result, and return 0; otherwise, return -1 and leave *result and cmdline_result alone.

Definition at line 2454 of file config.c.


Referenced by options_init_from_torrc().

◆ config_register_addressmaps()

void config_register_addressmaps ( const or_options_t options)

Adjust the address map based on the MapAddress elements in the configuration options

Definition at line 5532 of file config.c.

References or_options_t::AddressMap, addressmap_clear_configured(), and smartlist_split_string().

◆ create_keys_directory()

int create_keys_directory ( const or_options_t options)

Ensure that our keys directory exists, with appropriate permissions. Return 0 on success, -1 on failure.

Definition at line 1364 of file config.c.

◆ escaped_safe_str()

const char* escaped_safe_str ( const char *  address)

Equivalent to escaped(safe_str(address)). See reentrancy note on escaped(): don't use this outside the main thread, or twice in the same log statement.

Definition at line 1101 of file config.c.

References escaped().

◆ escaped_safe_str_client()

const char* escaped_safe_str_client ( const char *  address)

Equivalent to escaped(safe_str_client(address)). See reentrancy note on escaped(): don't use this outside the main thread, or twice in the same log statement.

Definition at line 1089 of file config.c.

References escaped().

◆ get_effective_bwburst()

uint32_t get_effective_bwburst ( const or_options_t options)

Return the bandwidthburst that we are going to report to the authorities based on the config options.

Definition at line 1735 of file config.c.

References or_options_t::BandwidthBurst, and or_options_t::RelayBandwidthBurst.

◆ get_effective_bwrate()

uint32_t get_effective_bwrate ( const or_options_t options)

Return the bandwidthrate that we are going to report to the authorities based on the config options.

Definition at line 1721 of file config.c.

References or_options_t::BandwidthRate, or_options_t::MaxAdvertisedBandwidth, and or_options_t::RelayBandwidthRate.

Referenced by router_should_be_dirserver().

◆ get_first_advertised_addr_by_type_af()

const tor_addr_t* get_first_advertised_addr_by_type_af ( int  listener_type,
int  address_family 

Return the first advertised address of type listener_type in address_family. Returns NULL if there is no advertised address, and when passed AF_UNSPEC.

Definition at line 7702 of file config.c.

References configured_ports, and SMARTLIST_FOREACH_BEGIN.

◆ get_first_advertised_port_by_type_af()

int get_first_advertised_port_by_type_af ( int  listener_type,
int  address_family 

Return the first advertised port of type listener_type in address_family. Returns 0 when no port is found, and when passed AF_UNSPEC.

Definition at line 7680 of file config.c.


Referenced by router_get_advertised_or_port_by_af().

◆ get_first_listener_addrport_string()

char* get_first_listener_addrport_string ( int  listener_type)

Return an address:port string representation of the address where the first listener_type listener waits for connections. Return NULL if we couldn't find a listener. The string is allocated on the heap and it's the responsibility of the caller to free it after use.

This function is meant to be used by the pluggable transport proxy spawning code, please make sure that it fits your purposes before using it.

Definition at line 7626 of file config.c.

References CFG_AUTO_PORT, configured_ports, fmt_and_decorate_addr, router_get_active_listener_port_by_type_af(), SMARTLIST_FOREACH_BEGIN, tor_addr_family(), tor_addr_is_null(), tor_addr_is_v4(), and tor_asprintf().

◆ get_last_resolved_addr()

uint32_t get_last_resolved_addr ( void  )

Accessor for last_resolved_addr from outside this file.

Definition at line 2664 of file config.c.

References last_resolved_addr.

Referenced by MOCK_IMPL().

◆ get_list_of_ports_to_forward()

smartlist_t* get_list_of_ports_to_forward ( void  )

Return a smartlist of ports that must be forwarded by tor-fw-helper. The smartlist contains the ports in a string format that is understandable by tor-fw-helper.

XXX TODO tor-fw-helper does not support forwarding ports to other hosts than the local one. If the user is binding to a different IP address, tor-fw-helper won't work.

Definition at line 8088 of file config.c.

References get_transport_proxy_ports(), router_get_advertised_dir_port(), router_get_advertised_or_port(), smartlist_add_all(), and smartlist_add_asprintf().

◆ get_num_cpus()

int get_num_cpus ( const or_options_t options)

Return the number of cpus configured in options. If we are told to auto-detect the number of cpus, return the auto-detected number.

Definition at line 7959 of file config.c.

References compute_num_cpus(), and or_options_t::NumCPUs.

Referenced by init_libevent().

◆ get_options_for_server_transport()

smartlist_t* get_options_for_server_transport ( const char *  transport)

Given the name of a pluggable transport in transport, check the configuration file to see if the user has asked us to pass any parameters to the pluggable transport. Return a smartlist containing the parameters, otherwise NULL.

Definition at line 6298 of file config.c.

References get_options_from_transport_options_line(), and or_options_t::ServerTransportOptions.

Referenced by get_transport_options_for_server_proxy().

◆ get_options_from_transport_options_line()

smartlist_t* get_options_from_transport_options_line ( const char *  line,
const char *  transport 

Given a ServerTransportOptions line, return a smartlist with the options. Return NULL if the line was not well-formed.

If transport is set, return NULL if the line is not referring to transport.

The returned smartlist and its strings are allocated on the heap and it's the responsibility of the caller to free it.

Definition at line 6225 of file config.c.

References smartlist_split_string().

Referenced by get_options_for_server_transport().

◆ get_protocol_warning_severity_level()

int get_protocol_warning_severity_level ( void  )

Return the severity level that should be used for warnings of severity LOG_PROTOCOL_WARN.

Definition at line 1122 of file config.c.

References atomic_counter_get(), and protocol_warning_severity_level.

◆ get_torrc_fname()

const char* get_torrc_fname ( int  defaults_fname)

Return the location for our configuration file. May return NULL.

Definition at line 5518 of file config.c.

References get_default_conf_file(), torrc_defaults_fname, and torrc_fname.

Referenced by options_save_current().

◆ get_transport_bindaddr_from_config()

char* get_transport_bindaddr_from_config ( const char *  transport)

Given the name of a pluggable transport in transport, check the configuration file to see if the user has explicitly asked for it to listen on a specific port. Return a <address:port> string if so, otherwise NULL.

Definition at line 6278 of file config.c.

References get_bindaddr_from_transport_listen_line(), and or_options_t::ServerTransportListenAddr.

Referenced by get_stored_bindaddr_for_server_transport().

◆ getinfo_helper_config()

int getinfo_helper_config ( control_connection_t conn,
const char *  question,
char **  answer,
const char **  errmsg 

Helper to implement GETINFO functions about configuration variables (not their values). Given a "config/names" question, set *answer to a new string describing the supported configuration variables and their types.

Definition at line 8126 of file config.c.

References config_var_t::name, and option_vars_.

◆ init_cookie_authentication()

int init_cookie_authentication ( const char *  fname,
const char *  header,
int  cookie_len,
int  group_readable,
uint8_t **  cookie_out,
int *  cookie_is_set_out 

Initialize cookie authentication (used so far by the ControlPort and Extended ORPort).

Allocate memory and create a cookie (of length cookie_len) in cookie_out. Then write it down to fname and prepend it with header.

If group_readable is set, set fname to be readable by the default GID.

If the whole procedure was successful, set cookie_is_set_out to True.

Definition at line 8409 of file config.c.

◆ init_protocol_warning_severity_level()

void init_protocol_warning_severity_level ( void  )

Initialize the log warning severity level for protocol warnings. Call only once at startup.

Definition at line 1140 of file config.c.

References atomic_counter_init(), LOG_WARN, protocol_warning_severity_level, and set_protocol_warning_severity_level().

Referenced by tor_run_main().

◆ option_get_assignment()

struct config_line_t* option_get_assignment ( const or_options_t options,
const char *  key 

Return a canonical list of the options assigned for key.

Definition at line 2564 of file config.c.

References config_get_assigned_option(), and options_format.

◆ option_get_canonical_name()

const char* option_get_canonical_name ( const char *  key)

Return the canonical name of a configuration option, or NULL if no such option exists.

Definition at line 2555 of file config.c.

References config_find_option(), config_var_t::name, and options_format.

◆ option_is_recognized()

int option_is_recognized ( const char *  key)

Return true iff key is a valid configuration option.

Definition at line 2546 of file config.c.

References config_find_option(), and options_format.

◆ options_any_client_port_set()

int options_any_client_port_set ( const or_options_t options)

Return true if any option is set in options to make us behave as a client.

Definition at line 8468 of file config.c.

Referenced by handle_missing_protocol_warning().

◆ options_dump()

char* options_dump ( const or_options_t options,
int  how_to_dump 

Return a string containing a possible configuration file that would give the configuration in options. If minimal is true, do not include options that are the same as Tor's defaults.

Definition at line 2975 of file config.c.

◆ options_init()

void options_init ( or_options_t options)

Set options to hold reasonable defaults for most options. Each option defaults to zero.

Definition at line 2965 of file config.c.

References config_init(), and options_format.

◆ options_init_from_string()

setopt_err_t options_init_from_string ( const char *  cf_defaults,
const char *  cf,
int  command,
const char *  command_arg,
char **  msg 

Load the options from the configuration in cf, validate them for consistency and take actions based on them.

Return 0 if success, negative on error:

  • -1 for general errors.
  • -2 for failure to parse/validate,
  • -3 for transition not allowed
  • -4 for error while setting the new options

Definition at line 5340 of file config.c.

Referenced by handle_control_loadconf().

◆ options_init_from_torrc()

int options_init_from_torrc ( int  argc,
char **  argv 

Read a configuration file into options, finding the configuration file location based on the command line. After loading the file call options_init_from_string() to load the config. Return 0 if success, -1 if failure, and 1 if we succeeded but should exit anyway.

Definition at line 5126 of file config.c.

References config_line_find(), config_parse_commandline(), global_cmdline_only_options, global_cmdline_options, have_parsed_cmdline, list_deprecated_options(), list_torrc_options(), print_usage(), tor_libevent_get_header_version_str(), and tor_libevent_get_version_str().

◆ options_need_geoip_info()

int options_need_geoip_info ( const or_options_t options,
const char **  reason_out 

If we need to have a GEOIP ip-to-country map to run with our configured options, return 1 and set *reason_out to a description of why.

Definition at line 1694 of file config.c.

References or_options_t::EntryNodes, or_options_t::ExcludeExitNodes, or_options_t::ExcludeNodes, or_options_t::ExitNodes, or_options_t::HSLayer2Nodes, or_options_t::HSLayer3Nodes, or_options_t::MiddleNodes, routerset_needs_geoip(), and should_record_bridge_info().

◆ options_new()

or_options_t* options_new ( void  )

Return a new empty or_options_t. Used for testing.

Definition at line 2957 of file config.c.

References config_new(), and options_format.

◆ options_save_current()

int options_save_current ( void  )

Save the current configuration file value to disk. Return 0 on success, -1 on failure.

Definition at line 7946 of file config.c.

References get_torrc_fname(), and write_configuration_file().

Referenced by handle_control_saveconf().

◆ options_trial_assign()

setopt_err_t options_trial_assign ( config_line_t list,
unsigned  flags,
char **  msg 

Try assigning list to the global options. You do this by duping options, assigning list to the new one, then validating it. If it's ok, then throw out the old one and stick with the new one. Else, revert to old and return failure. Return SETOPT_OK on success, or a setopt_err_t on failure.

If not success, point *msg to a newly allocated string describing what went wrong.

Definition at line 2579 of file config.c.

References config_assign(), config_dup(), global_default_options, in_option_validation, options_format, and options_validate().

◆ parse_bridge_line()

bridge_line_t* parse_bridge_line ( const char *  line)

Parse the contents of a string, line, containing a Bridge line, into a bridge_line_t.

Validates that the IP:PORT, fingerprint, and SOCKS arguments (given to the Pluggable Transport, if a one was specified) are well-formed.

Returns NULL If the Bridge line could not be validated, and returns a bridge_line_t containing the parsed information otherwise.

Bridge line format: Bridge [transport] IP:PORT [id-fingerprint] [k=v] [k=v] ...

Definition at line 5851 of file config.c.

◆ port_cfg_line_extract_addrport()

int port_cfg_line_extract_addrport ( const char *  line,
char **  addrport_out,
int *  is_unix_out,
const char **  rest_out 

Take a string (line) that begins with either an address:port, a port, or an AF_UNIX address, optionally quoted, prefixed with "unix:". Parse that line, and on success, set addrport_out to a new string containing the beginning portion (without prefix). Iff there was a unix: prefix, set is_unix_out to true. On success, also set rest_out to point to the part of the line after the address portion.

Return 0 on success, -1 on failure.

Definition at line 6706 of file config.c.

References eat_whitespace(), strcmpstart(), and tor_assert().

Referenced by parse_port_config().

◆ port_exists_by_type_addr_port()

int port_exists_by_type_addr_port ( int  listener_type,
const tor_addr_t addr,
int  port,
int  check_wildcard 

Return 1 if a port exists of type listener_type on addr and port. If check_wildcard is true, INADDR[6]_ANY and AF_UNSPEC addresses match any address of the appropriate family; and port -1 matches any port. To match auto ports, pass CFG_PORT_AUTO. (Does not match on the actual automatically chosen listener ports.)

Definition at line 7727 of file config.c.

References configured_ports, SMARTLIST_FOREACH_BEGIN, and tor_addr_eq.

◆ reset_last_resolved_addr()

void reset_last_resolved_addr ( void  )

Reset last_resolved_addr from outside this file.

Definition at line 2671 of file config.c.

References last_resolved_addr.

◆ resolve_my_address()

int resolve_my_address ( int  warn_severity,
const or_options_t options,
uint32_t *  addr_out,
const char **  method_out,
char **  hostname_out 

Attempt getting our non-local (as judged by tor_addr_is_internal() function) IP address using following techniques, listed in order from best (most desirable, try first) to worst (least desirable, try if everything else fails).

First, attempt using options->Address to get our non-local IP address.

If options->Address represents a non-local IP address, consider it ours.

If options->Address is a DNS name that resolves to a non-local IP address, consider this IP address ours.

If options->Address is NULL, fall back to getting local hostname and using it in above-described ways to try and get our IP address.

In case local hostname cannot be resolved to a non-local IP address, try getting an IP address of network interface in hopes it will be non-local one.

Fail if one or more of the following is true:

  • DNS name in options->Address cannot be resolved.
  • options->Address is a local host address.
  • Attempt at getting local hostname fails.
  • Attempt at getting network interface address fails.

Return 0 if all is well, or -1 if we can't find a suitable public IP address.

If we are returning 0:

  • Put our public IP address (in host order) into *addr_out.
  • If method_out is non-NULL, set *method_out to a static string describing how we arrived at our answer.
    • "CONFIGURED" - parsed from IP address string in options->Address
    • "RESOLVED" - resolved from DNS name in options->Address
    • "GETHOSTNAME" - resolved from a local hostname.
    • "INTERFACE" - retrieved from a network interface.
  • If hostname_out is non-NULL, and we resolved a hostname to get our address, set *hostname_out to a newly allocated string holding that hostname. (If we didn't get our address by resolving a hostname, set *hostname_out to NULL.)

XXXX ipv6

Definition at line 2733 of file config.c.

References or_options_t::Address, LOG_NOTICE, and tor_assert().

Referenced by MOCK_IMPL().

◆ safe_str()

const char* safe_str ( const char *  address)

Make address – a piece of information of unspecified sensitivity – safe to log according to the settings in options->SafeLogging, and return it.

(We return "[scrubbed]" if SafeLogging is anything besides "0", and address otherwise.)

Definition at line 1076 of file config.c.

References tor_assert().

◆ safe_str_client()

const char* safe_str_client ( const char *  address)

Make address – a piece of information related to our operation as a client – safe to log according to the settings in options->SafeLogging, and return it.

(We return "[scrubbed]" if SafeLogging is "1", and address otherwise.)

Definition at line 1059 of file config.c.

References tor_assert().

Referenced by connection_ap_handshake_attach_circuit(), and dumpstats().

◆ set_options()

int set_options ( or_options_t new_val,
char **  msg 

Change the current global options to contain new_val instead of their current value; take action based on the new value; free the old value as necessary. Returns 0 on success, -1 on failure.

Definition at line 919 of file config.c.

References global_options, options_act(), options_act_reversible(), tor_assert(), and tor_event_loop_shutdown_is_pending().

◆ write_to_data_subdir()

int write_to_data_subdir ( const char *  subdir,
const char *  fname,
const char *  str,
const char *  descr 

Create a file named fname with contents str in the subdirectory subdir of the data directory. descr should be a short description of the file's content and will be used for the warning message, if it's present and the write process fails. Return 0 on success, -1 otherwise.

Definition at line 8070 of file config.c.