Server transports should be instructed to bind on INADDR_ANY by default.
[tor.git] / src / or / config.h
blob88258c133e57fcebd08010a4c14ab51c9bbcc82b
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-2011, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
7 /**
8 * \file config.h
9 * \brief Header file for config.c.
10 **/
12 #ifndef _TOR_CONFIG_H
13 #define _TOR_CONFIG_H
15 const char *get_dirportfrontpage(void);
16 const or_options_t *get_options(void);
17 or_options_t *get_options_mutable(void);
18 int set_options(or_options_t *new_val, char **msg);
19 void config_free_all(void);
20 const char *safe_str_client(const char *address);
21 const char *safe_str(const char *address);
22 const char *escaped_safe_str_client(const char *address);
23 const char *escaped_safe_str(const char *address);
24 const char *get_version(void);
26 int config_get_lines(const char *string, config_line_t **result, int extended);
27 void config_free_lines(config_line_t *front);
28 setopt_err_t options_trial_assign(config_line_t *list, int use_defaults,
29 int clear_first, char **msg);
30 int resolve_my_address(int warn_severity, const or_options_t *options,
31 uint32_t *addr, char **hostname_out);
32 int is_local_addr(const tor_addr_t *addr);
33 void options_init(or_options_t *options);
34 char *options_dump(const or_options_t *options, int minimal);
35 int options_init_from_torrc(int argc, char **argv);
36 setopt_err_t options_init_from_string(const char *cf_defaults, const char *cf,
37 int command, const char *command_arg, char **msg);
38 int option_is_recognized(const char *key);
39 const char *option_get_canonical_name(const char *key);
40 config_line_t *option_get_assignment(const or_options_t *options,
41 const char *key);
42 int options_save_current(void);
43 const char *get_torrc_fname(int defaults_fname);
44 char *options_get_datadir_fname2_suffix(const or_options_t *options,
45 const char *sub1, const char *sub2,
46 const char *suffix);
47 #define get_datadir_fname2_suffix(sub1, sub2, suffix) \
48 options_get_datadir_fname2_suffix(get_options(), (sub1), (sub2), (suffix))
49 /** Return a newly allocated string containing datadir/sub1. See
50 * get_datadir_fname2_suffix. */
51 #define get_datadir_fname(sub1) get_datadir_fname2_suffix((sub1), NULL, NULL)
52 /** Return a newly allocated string containing datadir/sub1/sub2. See
53 * get_datadir_fname2_suffix. */
54 #define get_datadir_fname2(sub1,sub2) \
55 get_datadir_fname2_suffix((sub1), (sub2), NULL)
56 /** Return a newly allocated string containing datadir/sub1suffix. See
57 * get_datadir_fname2_suffix. */
58 #define get_datadir_fname_suffix(sub1, suffix) \
59 get_datadir_fname2_suffix((sub1), NULL, (suffix))
61 int get_num_cpus(const or_options_t *options);
63 or_state_t *get_or_state(void);
64 int did_last_state_file_write_fail(void);
65 int or_state_save(time_t now);
67 const smartlist_t *get_configured_ports(void);
68 int get_first_advertised_port_by_type_af(int listener_type,
69 int address_family);
70 #define get_primary_or_port() \
71 (get_first_advertised_port_by_type_af(CONN_TYPE_OR_LISTENER, AF_INET))
72 #define get_primary_dir_port() \
73 (get_first_advertised_port_by_type_af(CONN_TYPE_DIR_LISTENER, AF_INET))
75 int options_need_geoip_info(const or_options_t *options,
76 const char **reason_out);
78 void save_transport_to_state(const char *transport_name,
79 const tor_addr_t *addr, uint16_t port);
80 char *get_bindaddr_for_transport(const char *transport);
82 int getinfo_helper_config(control_connection_t *conn,
83 const char *question, char **answer,
84 const char **errmsg);
86 const char *tor_get_digests(void);
87 uint32_t get_effective_bwrate(const or_options_t *options);
88 uint32_t get_effective_bwburst(const or_options_t *options);
90 #ifdef CONFIG_PRIVATE
91 /* Used only by config.c and test.c */
92 or_options_t *options_new(void);
93 #endif
95 void config_register_addressmaps(const or_options_t *options);
97 #endif