config.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 */
  6. /**
  7. * \file config.h
  8. * \brief Header file for config.c.
  9. **/
  10. #ifndef _TOR_CONFIG_H
  11. #define _TOR_CONFIG_H
  12. const char *get_dirportfrontpage(void);
  13. const or_options_t *get_options(void);
  14. or_options_t *get_options_mutable(void);
  15. int set_options(or_options_t *new_val, char **msg);
  16. void config_free_all(void);
  17. const char *safe_str_client(const char *address);
  18. const char *safe_str(const char *address);
  19. const char *escaped_safe_str_client(const char *address);
  20. const char *escaped_safe_str(const char *address);
  21. const char *get_version(void);
  22. int config_get_lines(const char *string, config_line_t **result);
  23. void config_free_lines(config_line_t *front);
  24. setopt_err_t options_trial_assign(config_line_t *list, int use_defaults,
  25. int clear_first, char **msg);
  26. int resolve_my_address(int warn_severity, const or_options_t *options,
  27. uint32_t *addr, char **hostname_out);
  28. int is_local_addr(const tor_addr_t *addr) ATTR_PURE;
  29. void options_init(or_options_t *options);
  30. char *options_dump(const or_options_t *options, int minimal);
  31. int options_init_from_torrc(int argc, char **argv);
  32. setopt_err_t options_init_from_string(const char *cf,
  33. int command, const char *command_arg, char **msg);
  34. int option_is_recognized(const char *key);
  35. const char *option_get_canonical_name(const char *key);
  36. config_line_t *option_get_assignment(const or_options_t *options,
  37. const char *key);
  38. int options_save_current(void);
  39. const char *get_torrc_fname(void);
  40. char *options_get_datadir_fname2_suffix(const or_options_t *options,
  41. const char *sub1, const char *sub2,
  42. const char *suffix);
  43. #define get_datadir_fname2_suffix(sub1, sub2, suffix) \
  44. options_get_datadir_fname2_suffix(get_options(), (sub1), (sub2), (suffix))
  45. /** Return a newly allocated string containing datadir/sub1. See
  46. * get_datadir_fname2_suffix. */
  47. #define get_datadir_fname(sub1) get_datadir_fname2_suffix((sub1), NULL, NULL)
  48. /** Return a newly allocated string containing datadir/sub1/sub2. See
  49. * get_datadir_fname2_suffix. */
  50. #define get_datadir_fname2(sub1,sub2) \
  51. get_datadir_fname2_suffix((sub1), (sub2), NULL)
  52. /** Return a newly allocated string containing datadir/sub1suffix. See
  53. * get_datadir_fname2_suffix. */
  54. #define get_datadir_fname_suffix(sub1, suffix) \
  55. get_datadir_fname2_suffix((sub1), NULL, (suffix))
  56. int get_num_cpus(const or_options_t *options);
  57. or_state_t *get_or_state(void);
  58. int did_last_state_file_write_fail(void);
  59. int or_state_save(time_t now);
  60. int options_need_geoip_info(const or_options_t *options,
  61. const char **reason_out);
  62. int getinfo_helper_config(control_connection_t *conn,
  63. const char *question, char **answer,
  64. const char **errmsg);
  65. const char *tor_get_digests(void);
  66. uint32_t get_effective_bwrate(const or_options_t *options);
  67. uint32_t get_effective_bwburst(const or_options_t *options);
  68. #ifdef CONFIG_PRIVATE
  69. /* Used only by config.c and test.c */
  70. or_options_t *options_new(void);
  71. #endif
  72. #endif