Back to index

tor  0.2.3.18-rc
config.h
Go to the documentation of this file.
00001 /* Copyright (c) 2001 Matej Pfajfar.
00002  * Copyright (c) 2001-2004, Roger Dingledine.
00003  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
00004  * Copyright (c) 2007-2012, The Tor Project, Inc. */
00005 /* See LICENSE for licensing information */
00006 
00012 #ifndef _TOR_CONFIG_H
00013 #define _TOR_CONFIG_H
00014 
00015 const char *get_dirportfrontpage(void);
00016 const or_options_t *get_options(void);
00017 or_options_t *get_options_mutable(void);
00018 int set_options(or_options_t *new_val, char **msg);
00019 void config_free_all(void);
00020 const char *safe_str_client(const char *address);
00021 const char *safe_str(const char *address);
00022 const char *escaped_safe_str_client(const char *address);
00023 const char *escaped_safe_str(const char *address);
00024 const char *get_version(void);
00025 const char *get_short_version(void);
00026 
00027 int config_get_lines(const char *string, config_line_t **result, int extended);
00028 void config_free_lines(config_line_t *front);
00029 setopt_err_t options_trial_assign(config_line_t *list, int use_defaults,
00030                                   int clear_first, char **msg);
00031 int resolve_my_address(int warn_severity, const or_options_t *options,
00032                        uint32_t *addr, char **hostname_out);
00033 int is_local_addr(const tor_addr_t *addr);
00034 void options_init(or_options_t *options);
00035 char *options_dump(const or_options_t *options, int minimal);
00036 int options_init_from_torrc(int argc, char **argv);
00037 setopt_err_t options_init_from_string(const char *cf_defaults, const char *cf,
00038                             int command, const char *command_arg, char **msg);
00039 int option_is_recognized(const char *key);
00040 const char *option_get_canonical_name(const char *key);
00041 config_line_t *option_get_assignment(const or_options_t *options,
00042                                      const char *key);
00043 int options_save_current(void);
00044 const char *get_torrc_fname(int defaults_fname);
00045 char *options_get_datadir_fname2_suffix(const or_options_t *options,
00046                                         const char *sub1, const char *sub2,
00047                                         const char *suffix);
00048 #define get_datadir_fname2_suffix(sub1, sub2, suffix) \
00049   options_get_datadir_fname2_suffix(get_options(), (sub1), (sub2), (suffix))
00050 
00052 #define get_datadir_fname(sub1) get_datadir_fname2_suffix((sub1), NULL, NULL)
00053 
00055 #define get_datadir_fname2(sub1,sub2) \
00056   get_datadir_fname2_suffix((sub1), (sub2), NULL)
00057 
00059 #define get_datadir_fname_suffix(sub1, suffix) \
00060   get_datadir_fname2_suffix((sub1), NULL, (suffix))
00061 
00062 int get_num_cpus(const or_options_t *options);
00063 
00064 or_state_t *get_or_state(void);
00065 int did_last_state_file_write_fail(void);
00066 int or_state_save(time_t now);
00067 
00068 const smartlist_t *get_configured_ports(void);
00069 int get_first_advertised_port_by_type_af(int listener_type,
00070                                          int address_family);
00071 #define get_primary_or_port() \
00072   (get_first_advertised_port_by_type_af(CONN_TYPE_OR_LISTENER, AF_INET))
00073 #define get_primary_dir_port() \
00074   (get_first_advertised_port_by_type_af(CONN_TYPE_DIR_LISTENER, AF_INET))
00075 
00076 char *get_first_listener_addrport_string(int listener_type);
00077 
00078 int options_need_geoip_info(const or_options_t *options,
00079                             const char **reason_out);
00080 
00081 void save_transport_to_state(const char *transport_name,
00082                              const tor_addr_t *addr, uint16_t port);
00083 char *get_stored_bindaddr_for_server_transport(const char *transport);
00084 
00085 int getinfo_helper_config(control_connection_t *conn,
00086                           const char *question, char **answer,
00087                           const char **errmsg);
00088 
00089 const char *tor_get_digests(void);
00090 uint32_t get_effective_bwrate(const or_options_t *options);
00091 uint32_t get_effective_bwburst(const or_options_t *options);
00092 
00093 #ifdef CONFIG_PRIVATE
00094 /* Used only by config.c and test.c */
00095 or_options_t *options_new(void);
00096 #endif
00097 
00098 void config_register_addressmaps(const or_options_t *options);
00099 
00100 #endif
00101