addressmap.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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-2013, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. #ifndef TOR_ADDRESSMAP_H
  7. #define TOR_ADDRESSMAP_H
  8. #include "testsupport.h"
  9. void addressmap_init(void);
  10. void addressmap_clear_excluded_trackexithosts(const or_options_t *options);
  11. void addressmap_clear_invalid_automaps(const or_options_t *options);
  12. void addressmap_clean(time_t now);
  13. void addressmap_clear_configured(void);
  14. void addressmap_clear_transient(void);
  15. void addressmap_free_all(void);
  16. #define AMR_FLAG_USE_IPV4_DNS (1u<<0)
  17. #define AMR_FLAG_USE_IPV6_DNS (1u<<1)
  18. int addressmap_rewrite(char *address, size_t maxlen, unsigned flags,
  19. time_t *expires_out,
  20. addressmap_entry_source_t *exit_source_out);
  21. int addressmap_rewrite_reverse(char *address, size_t maxlen, unsigned flags,
  22. time_t *expires_out);
  23. int addressmap_have_mapping(const char *address, int update_timeout);
  24. void addressmap_register(const char *address, char *new_address,
  25. time_t expires, addressmap_entry_source_t source,
  26. const int address_wildcard,
  27. const int new_address_wildcard);
  28. int parse_virtual_addr_network(const char *val,
  29. sa_family_t family, int validate_only,
  30. char **msg);
  31. int client_dns_incr_failures(const char *address);
  32. void client_dns_clear_failures(const char *address);
  33. void client_dns_set_addressmap(entry_connection_t *for_conn,
  34. const char *address, const tor_addr_t *val,
  35. const char *exitname, int ttl);
  36. const char *addressmap_register_virtual_address(int type, char *new_address);
  37. void addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
  38. time_t max_expires, int want_expiry);
  39. int address_is_in_virtual_range(const char *addr);
  40. void clear_trackexithost_mappings(const char *exitname);
  41. void client_dns_set_reverse_addressmap(entry_connection_t *for_conn,
  42. const char *address, const char *v,
  43. const char *exitname, int ttl);
  44. int addressmap_address_should_automap(const char *address,
  45. const or_options_t *options);
  46. #ifdef ADDRESSMAP_PRIVATE
  47. typedef struct virtual_addr_conf_t {
  48. tor_addr_t addr;
  49. maskbits_t bits;
  50. } virtual_addr_conf_t;
  51. STATIC void get_random_virtual_addr(const virtual_addr_conf_t *conf,
  52. tor_addr_t *addr_out);
  53. #endif
  54. #endif