Tor
0.4.7.0-alpha-dev
|
Header file for config.c. More...
#include "app/config/or_options_st.h"
#include "lib/testsupport/testsupport.h"
#include "app/config/quiet_level.h"
Go to the source code of this file.
Data Structures | |
struct | parsed_cmdline_t |
struct | bridge_line_t |
Macros | |
#define | MIN_HEARTBEAT_PERIOD (30*60) |
#define | MAX_DEFAULT_MEMORY_QUEUE_SIZE (UINT64_C(2) << 30) |
#define | LOG_PROTOCOL_WARN (get_protocol_warning_severity_level()) |
#define | CONFIG_BACKUP_PATTERN "%s.orig.1" |
#define | OPTIONS_DUMP_MINIMAL 1 |
#define | OPTIONS_DUMP_ALL 2 |
#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 | safe_str_client(address) safe_str_client_opts(NULL, address) |
#define | safe_str(address) safe_str_opts(NULL, address) |
#define | portconf_get_primary_dir_port() (portconf_get_first_advertised_port(CONN_TYPE_DIR_LISTENER, AF_INET)) |
#define | parsed_cmdline_free(c) FREE_AND_NULL(parsed_cmdline_t, parsed_cmdline_free_, (c)) |
#define | bridge_line_free(line) FREE_AND_NULL(bridge_line_t, bridge_line_free_, (line)) |
#define | CL_PORT_NO_STREAM_OPTIONS (1u<<0) |
#define | CL_PORT_WARN_NONLOCAL (1u<<1) |
#define | CL_PORT_SERVER_OPTIONS (1u<<3) |
#define | CL_PORT_FORBID_NONLOCAL (1u<<4) |
#define | CL_PORT_TAKES_HOSTNAMES (1u<<5) |
#define | CL_PORT_IS_UNIXSOCKET (1u<<6) |
#define | CL_PORT_DFLT_GROUP_WRITABLE (1u<<7) |
#define | port_cfg_free(port) FREE_AND_NULL(port_cfg_t, port_cfg_free_, (port)) |
Enumerations | |
enum | setopt_err_t { SETOPT_OK = 0 , SETOPT_ERR_MISC = -1 , SETOPT_ERR_PARSE = -2 , SETOPT_ERR_TRANSITION = -3 , SETOPT_ERR_SETTING = -4 } |
enum | directory_root_t { DIRROOT_DATADIR , DIRROOT_CACHEDIR , DIRROOT_KEYDIR } |
Functions | |
const or_options_t * | get_options (void) |
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) |
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_t * | option_get_assignment (const or_options_t *options, const char *key) |
int | options_save_current (void) |
const char * | get_torrc_fname (int defaults_fname) |
char * | options_get_dir_fname2_suffix (const or_options_t *options, directory_root_t roottype, const char *sub1, const char *sub2, const char *suffix) |
const char * | safe_str_client_opts (const or_options_t *options, const char *address) |
const char * | safe_str_opts (const or_options_t *options, const char *address) |
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) |
const smartlist_t * | get_configured_ports (void) |
int | port_binds_ipv4 (const port_cfg_t *port) |
int | port_binds_ipv6 (const port_cfg_t *port) |
int | portconf_get_first_advertised_port (int listener_type, int address_family) |
const tor_addr_t * | portconf_get_first_advertised_addr (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) |
int | getinfo_helper_config (control_connection_t *conn, const char *question, char **answer, const char **errmsg) |
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_t * | options_new (void) |
parsed_cmdline_t * | config_parse_commandline (int argc, char **argv, int ignore_errors) |
void | parsed_cmdline_free_ (parsed_cmdline_t *cmdline) |
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_t * | parse_bridge_line (const char *line) |
int | options_any_client_port_set (const or_options_t *options) |
int | port_parse_config (smartlist_t *out, const struct config_line_t *ports, const char *portname, int listener_type, const char *defaultaddr, int defaultport, const unsigned flags) |
port_cfg_t * | port_cfg_new (size_t namelen) |
void | port_cfg_free_ (port_cfg_t *port) |
int | port_count_real_listeners (const smartlist_t *ports, int listenertype, int count_sockets) |
int | pt_parse_transport_line (const or_options_t *options, const char *line, int validate_only, int server) |
int | config_ensure_bandwidth_cap (uint64_t *value, const char *desc, char **msg) |
#define CONFIG_BACKUP_PATTERN "%s.orig.1" |
#define MAX_DEFAULT_MEMORY_QUEUE_SIZE (UINT64_C(2) << 30) |
#define MIN_HEARTBEAT_PERIOD (30*60) |
#define options_get_cachedir_fname2_suffix | ( | options, | |
sub1, | |||
sub2, | |||
suffix | |||
) |
#define options_get_datadir_fname2_suffix | ( | options, | |
sub1, | |||
sub2, | |||
suffix | |||
) |
#define options_get_keydir_fname | ( | options, | |
sub1 | |||
) | options_get_keydir_fname2_suffix((options), (sub1), NULL, NULL) |
#define options_get_keydir_fname2_suffix | ( | options, | |
sub1, | |||
sub2, | |||
suffix | |||
) |
enum setopt_err_t |
An error from options_trial_assign() or options_init_from_string().
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.
void bridge_line_free_ | ( | bridge_line_t * | bridge_line | ) |
Deallocate a bridge_line_t structure.
int check_or_create_data_subdir | ( | const char * | subdir | ) |
int config_ensure_bandwidth_cap | ( | uint64_t * | value, |
const char * | desc, | ||
char ** | msg | ||
) |
If value exceeds ROUTER_MAX_DECLARED_BANDWIDTH, write a complaint into *msg using string desc, and return -1. Else return 0.
Definition at line 2951 of file config.c.
Referenced by dirauth_options_pre_normalize().
void config_free_all | ( | void | ) |
parsed_cmdline_t* config_parse_commandline | ( | int | argc, |
char ** | argv, | ||
int | ignore_errors | ||
) |
Helper: Read a list of configuration options from the command line. If successful, return a newly allocated parsed_cmdline_t; otherwise return NULL.
If ignore_errors is set, try to recover from all recoverable errors and return the best command line we can.
Definition at line 2513 of file config.c.
Referenced by options_init_from_torrc(), and tor_init().
void config_register_addressmaps | ( | const or_options_t * | options | ) |
int create_keys_directory | ( | const or_options_t * | options | ) |
const char* escaped_safe_str | ( | const char * | address | ) |
const char* escaped_safe_str_client | ( | const char * | address | ) |
const smartlist_t* get_configured_ports | ( | void | ) |
Return a list of port_cfg_t for client ports parsed from the options.
Definition at line 6687 of file config.c.
Referenced by policies_parse_exit_policy_reject_private(), portconf_get_first_advertised(), and proxy_mode().
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.
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 7047 of file config.c.
Referenced by init_libevent().
const or_options_t* get_options | ( | void | ) |
Returns the currently configured options
Definition at line 919 of file config.c.
Referenced by add_authmethods(), add_wildcarded_test_address(), address_is_invalid_destination(), assert_identity_keys_ok(), authdir_policy_badexit_address(), authdir_policy_permits_address(), authdir_policy_valid_address(), bwhist_fill_bandwidth_history(), channelpadding_decide_to_pad_channel(), channelpadding_get_channel_idle_timeout(), channelpadding_get_circuits_available_timeout(), choose_good_entry_server(), choose_good_exit_server(), choose_good_exit_server_general(), choose_good_middle_server(), circpad_is_padding_allowed(), circpad_machine_conditions_apply(), circuit_all_predicted_ports_handled(), circuit_build_needed_circs(), circuit_build_no_more_hops(), circuit_build_times_count_close(), circuit_build_times_count_timeout(), circuit_build_times_get_initial_timeout(), circuit_build_times_handle_completed_hop(), circuit_build_times_init(), circuit_build_times_new_consensus_params(), circuit_build_times_parse_state(), circuit_build_times_set_timeout(), circuit_expire_building(), circuit_expire_old_circs_as_needed(), circuit_expire_old_circuits_clientside(), circuit_find_to_cannibalize(), circuit_get_open_circ_or_launch(), circuit_handle_first_hop(), circuit_is_acceptable(), circuit_log_ancient_one_hop_circuits(), circuit_note_clock_jumped(), circuit_send_intermediate_onion_skin(), circuit_should_use_vanguards(), circuit_stream_is_being_handled(), circuit_testing_failed(), circuit_testing_opened(), client_get_random_intro(), command_process_create_cell(), command_process_relay_cell(), compare_tor_addr_to_short_policy(), compute_retry_timeout(), config_load_geoip_file_(), configure_nameservers(), conn_get_proxy_type(), connection_ap_can_use_exit(), connection_ap_expire_beginning(), connection_ap_get_original_destination(), connection_ap_handshake_attach_circuit(), connection_ap_handshake_process_socks(), connection_ap_handshake_rewrite_and_attach(), connection_ap_handshake_send_begin(), connection_ap_rewrite_and_attach_if_allowed(), connection_bucket_init(), connection_check_oos(), connection_connect_sockaddr(), connection_dir_client_request_failed(), connection_exit_begin_conn(), connection_finished_connecting(), connection_https_proxy_connect(), connection_is_rate_limited(), connection_listener_new_for_port(), connection_or_check_valid_tls_handshake(), connection_or_client_learned_peer_id(), connection_or_connect(), connection_socks5_proxy_connect(), consider_hibernation(), consider_plaintext_ports(), consider_publishable_server(), consider_recording_trackhost(), control_event_circuit_cell_stats(), control_event_conn_bandwidth(), control_event_conn_bandwidth_used(), control_ports_write_to_file(), count_loading_descriptors_progress(), create_managed_proxy_environment(), decide_if_publishable_server(), dir_routerdesc_download_failed(), dirauth_sched_get_configured_interval(), dirauth_sched_get_cur_valid_after_time(), dirauth_set_routerstatus_from_routerinfo(), dirclient_dump_total_dls(), directory_get_from_dirserver(), directory_handle_command_post(), directory_info_has_arrived(), dirserv_compute_performance_thresholds(), dirserv_generate_networkstatus_vote_obj(), dirserv_router_has_valid_address(), dirserv_should_launch_reachability_test(), dirvote_get_preferred_voting_intervals(), dns_init(), dns_launch_correctness_checks(), dns_reset(), dns_servers_relaunch_checks(), do_dump_config(), do_hash_password(), do_hup(), do_list_fingerprint(), entry_guard_could_succeed(), entry_guards_changed_for_guard_selection(), entry_guards_expand_sample(), entry_guards_update_filtered_sets(), entry_guards_update_state(), escaped_safe_str(), escaped_safe_str_client(), evdns_log_cb(), extend_info_pick_orport(), extrainfo_dump_to_string_stats_helper(), fetch_networkstatus_callback(), find_and_remove_client_auth_creds_file(), format_client_stats_heartbeat(), geoip_note_client_seen(), geoip_note_ns_response(), get_accounting_bytes(), get_bridge_dl_status_by_id(), get_controller_cookie_file_name(), get_ext_or_auth_cookie_file_name(), get_guard_confirmed_min_lifetime(), get_guard_lifetime(), get_intro_point_max_lifetime(), get_intro_point_min_lifetime(), get_max_age_to_cache(), get_n_primary_guards(), get_proxy_addrport(), get_pt_proxy_uri(), get_time_period_length(), get_voting_interval(), getinfo_helper_events(), guard_in_node_family(), guards_update_all(), handle_cmdline_passphrase_fd(), handle_control_authenticate(), handle_control_getconf(), handle_control_saveconf(), handle_get_descriptor(), handle_get_networkstatus_bridges(), handle_signals(), hibernate_begin(), hibernate_hard_limit_reached(), hibernate_soft_limit_reached(), hs_clean_last_hid_serv_requests(), hs_dos_consensus_has_changed(), hs_pick_hsdir(), hs_service_add_ephemeral(), hs_service_map_has_changed(), hs_service_requires_uptime_circ(), init_keys(), init_v3_authority_keys(), ip_address_changed(), is_test_address(), launch_descriptor_downloads(), launch_direct_bridge_descriptor_fetch(), launch_one_resolve(), launch_test_addresses(), learned_bridge_descriptor(), list_bridge_identities(), load_service_keys(), log_cert_expiration(), log_heartbeat(), mark_circuit_unusable_for_new_conns(), mark_my_descriptor_dirty(), my_exit_policy_rejects(), net_is_completely_disabled(), net_is_disabled(), netstatus_load_from_state(), networkstatus_get_latest_consensus(), networkstatus_set_current_consensus(), node_has_preferred_descriptor(), node_ipv6_dir_preferred(), node_ipv6_or_preferred(), nodelist_add_node_and_family(), nodelist_set_consensus(), nodelist_set_routerinfo(), nodes_in_same_family(), on_hibernate_state_change(), options_act_bridge_stats(), options_act_dirauth(), options_act_dirauth_mtbf(), options_act_once_on_startup(), options_act_relay(), options_act_relay_accounting(), options_act_relay_bandwidth(), options_act_relay_desc(), options_act_relay_dir(), options_act_relay_dos(), options_act_server_transport(), options_commit_log_transaction(), options_create_directories(), options_save_current(), options_start_log_transaction(), options_switch_id(), options_trial_assign(), parse_reachable_addresses(), pathbias_check_close_success_count(), pathbias_check_use_success_count(), pathbias_measure_close_rate(), pathbias_measure_use_rate(), pathbias_scale_close_rates(), pathbias_scale_use_rates(), periodic_event_dispatch(), pick_intro_point(), pt_get_bindaddr_from_config(), pt_get_extra_info_descriptor_string(), pt_get_options_for_server_transport(), pubsub_connect(), purpose_needs_anonymity(), reachable_addr_allows(), reachable_addr_allows_rs(), reachable_addr_choose_from_rs(), record_num_bytes_transferred_impl(), refresh_all_country_info(), relay_address_new_suggestion(), rend_mid_rendezvous(), rep_hist_circbuilding_dormant(), rep_hist_dump_stats(), rep_history_clean(), rescan_periodic_events_cb(), retry_all_listeners(), rewrite_node_address_for_bridge(), route_len_for_purpose(), router_add_to_routerlist(), router_build_fresh_unsigned_extrainfo(), router_build_fresh_unsigned_routerinfo(), router_compare_to_my_exit_policy(), router_counts_toward_thresholds(), router_do_reachability_checks(), router_find_exact_exit_enclave(), router_get_my_extrainfo(), router_get_my_routerinfo_with_err(), router_have_minimum_dir_info(), router_initialize_tls_context(), router_is_active(), router_orport_found_reachable(), router_perform_bandwidth_test(), router_should_be_dirserver(), router_should_check_reachability(), router_upload_dir_desc_to_dirservers(), router_write_fingerprint(), routerparse_init(), routers_update_status_from_consensus_networkstatus(), safe_str_client_opts(), safe_str_opts(), select_scheduler(), server_identity_key_is_set(), should_apply_guardfraction(), signewnym_impl(), sr_act_post_consensus(), store_permanent_client_auth_credentials(), tor_cleanup(), update_all_descriptor_downloads(), update_consensus_networkstatus_downloads(), update_consensus_networkstatus_fetch_time(), update_consensus_networkstatus_fetch_time_impl(), update_consensus_router_descriptor_downloads(), update_expected_bandwidth(), update_extrainfo_downloads(), update_microdesc_downloads(), update_networkstatus_downloads(), update_router_descriptor_downloads(), update_router_have_minimum_dir_info(), update_send_buffer_size(), upload_descriptor_to_hsdir(), usable_consensus_flavor(), and warn_if_last_router_excluded().
or_options_t* get_options_mutable | ( | void | ) |
Returns the currently configured options.
Definition at line 910 of file config.c.
Referenced by get_options(), handle_cmdline_newpass(), handle_cmdline_no_passphrase(), options_act(), options_commit_listener_transaction(), and options_rollback_listener_transaction().
int get_protocol_warning_severity_level | ( | void | ) |
const char* get_torrc_fname | ( | int | defaults_fname | ) |
Return the location for our configuration file. May return NULL.
Definition at line 4738 of file config.c.
Referenced by options_save_current().
int getinfo_helper_config | ( | control_connection_t * | conn, |
const char * | question, | ||
char ** | answer, | ||
const char ** | errmsg | ||
) |
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.
void init_protocol_warning_severity_level | ( | void | ) |
Initialize the log warning severity level for protocol warnings. Call only once at startup.
Definition at line 1161 of file config.c.
Referenced by tor_run_main().
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 2644 of file config.c.
Referenced by handle_control_getconf().
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 2636 of file config.c.
Referenced by handle_control_getconf().
int option_is_recognized | ( | const char * | key | ) |
Return true iff key is a valid configuration option.
Definition at line 2628 of file config.c.
Referenced by handle_control_getconf().
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 7502 of file config.c.
Referenced by handle_missing_protocol_warning().
char* options_dump | ( | const or_options_t * | options, |
int | how_to_dump | ||
) |
char* options_get_dir_fname2_suffix | ( | const or_options_t * | options, |
directory_root_t | roottype, | ||
const char * | sub1, | ||
const char * | sub2, | ||
const char * | suffix | ||
) |
Return a newly allocated string holding a filename relative to the directory in options specified by roottype. If sub1 is present, it is the first path component after the data directory. If sub2 is also present, it is the second path component after the data directory. If suffix is present, it is appended to the filename.
Note: Consider using macros in config.h that wrap this function; you should probably never need to call it as-is.
void options_init | ( | or_options_t * | options | ) |
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:
Definition at line 4628 of file config.c.
Referenced by handle_control_loadconf().
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.
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 1958 of file config.c.
Referenced by config_load_geoip_file_().
or_options_t* options_new | ( | void | ) |
Return a new empty or_options_t. Used for testing.
int options_save_current | ( | void | ) |
Save the current configuration file value to disk. Return 0 on success, -1 on failure.
Definition at line 7034 of file config.c.
Referenced by handle_control_saveconf().
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 2659 of file config.c.
Referenced by control_setconf_helper().
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] ...
void parsed_cmdline_free_ | ( | parsed_cmdline_t * | cmdline | ) |
void port_cfg_free_ | ( | port_cfg_t * | port | ) |
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.
port_cfg_t* port_cfg_new | ( | size_t | namelen | ) |
Allocate and return a new port_cfg_t with reasonable defaults.
namelen is the length of the unix socket name (typically the filesystem path), not including the trailing NUL. It should be 0 for ports that are not zunix sockets.
int port_count_real_listeners | ( | const smartlist_t * | ports, |
int | listenertype, | ||
int | count_sockets | ||
) |
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.)
const tor_addr_t* portconf_get_first_advertised_addr | ( | 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 6799 of file config.c.
Referenced by routerconf_find_ipv6_or_ap(), and routerconf_has_ipv6_orport().
int portconf_get_first_advertised_port | ( | 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 6787 of file config.c.
Referenced by routerconf_find_or_port().
int pt_parse_transport_line | ( | const or_options_t * | options, |
const char * | line, | ||
int | validate_only, | ||
int | server | ||
) |
Read the contents of a ClientTransportPlugin or ServerTransportPlugin line from line, depending on the value of server. Return 0 if the line is well-formed, and -1 if it isn't.
If validate_only is 0, the line is well-formed, and the transport is needed by some bridge:
const char* safe_str_client_opts | ( | const or_options_t * | options, |
const char * | address | ||
) |
const char* safe_str_opts | ( | const or_options_t * | options, |
const char * | address | ||
) |
int set_options | ( | or_options_t * | new_val, |
char ** | msg | ||
) |
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.