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-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
12 void addressmap_init(void);
15 void addressmap_clean(time_t now);
18 void addressmap_free_all(void);
19 #define AMR_FLAG_USE_IPV4_DNS (1u<<0)
20 #define AMR_FLAG_USE_IPV6_DNS (1u<<1)
21 #define AMR_FLAG_USE_MAPADDRESS (1u<<2)
22 #define AMR_FLAG_USE_AUTOMAP (1u<<3)
23 #define AMR_FLAG_USE_TRACKEXIT (1u<<4)
24 int addressmap_rewrite(char *address, size_t maxlen, unsigned flags,
25  time_t *expires_out,
26  addressmap_entry_source_t *exit_source_out);
27 int addressmap_rewrite_reverse(char *address, size_t maxlen, unsigned flags,
28  time_t *expires_out);
29 int addressmap_have_mapping(const char *address, int update_timeout);
31 void addressmap_register(const char *address, char *new_address,
32  time_t expires, addressmap_entry_source_t source,
33  const int address_wildcard,
34  const int new_address_wildcard);
35 int parse_virtual_addr_network(const char *val,
36  sa_family_t family, int validate_only,
37  char **msg);
38 int client_dns_incr_failures(const char *address);
39 void client_dns_clear_failures(const char *address);
41  const char *address, const tor_addr_t *val,
42  const char *exitname, int ttl);
43 const char *addressmap_register_virtual_address(int type, char *new_address);
44 void addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
45  time_t max_expires, int want_expiry);
46 int address_is_in_virtual_range(const char *addr);
47 void clear_trackexithost_mappings(const char *exitname);
49  const char *address, const char *v,
50  const char *exitname, int ttl);
51 int addressmap_address_should_automap(const char *address,
52  const or_options_t *options);
55 typedef struct virtual_addr_conf_t {
56  tor_addr_t addr;
57  maskbits_t bits;
58 } virtual_addr_conf_t;
60 STATIC void get_random_virtual_addr(const virtual_addr_conf_t *conf,
61  tor_addr_t *addr_out);
62 #endif /* defined(ADDRESSMAP_PRIVATE) */
64 #endif /* !defined(TOR_ADDRESSMAP_H) */
void client_dns_clear_failures(const char *address)
Definition: addressmap.c:660
uint16_t sa_family_t
Definition: inaddr_st.h:77
int addressmap_have_mapping(const char *address, int update_expiry)
Definition: addressmap.c:545
int addressmap_address_should_automap(const char *address, const or_options_t *options)
Definition: addressmap.c:250
Definition: or.h:1019
void client_dns_set_addressmap(entry_connection_t *for_conn, const char *address, const tor_addr_t *val, const char *exitname, int ttl)
Definition: addressmap.c:724
void clear_trackexithost_mappings(const char *exitname)
Definition: addressmap.c:175
int addressmap_rewrite(char *address, size_t maxlen, unsigned flags, time_t *expires_out, addressmap_entry_source_t *exit_source_out)
Definition: addressmap.c:384
STATIC void get_random_virtual_addr(const virtual_addr_conf_t *conf, tor_addr_t *addr_out)
Definition: addressmap.c:875
uint8_t maskbits_t
Definition: address.h:62
void addressmap_get_mappings(smartlist_t *sl, time_t min_expires, time_t max_expires, int want_expiry)
Definition: addressmap.c:1115
void addressmap_init(void)
Definition: addressmap.c:91
int client_dns_incr_failures(const char *address)
Definition: addressmap.c:638
void addressmap_free_all(void)
Definition: addressmap.c:329
void addressmap_clean(time_t now)
Definition: addressmap.c:321
int address_is_in_virtual_range(const char *address)
Definition: addressmap.c:856
void addressmap_clear_configured(void)
Definition: addressmap.c:305
int addressmap_rewrite_reverse(char *address, size_t maxlen, unsigned flags, time_t *expires_out)
Definition: addressmap.c:504
void addressmap_register(const char *address, char *new_address, time_t expires, addressmap_entry_source_t source, const int wildcard_addr, const int wildcard_new_addr)
Definition: addressmap.c:577
void client_dns_set_reverse_addressmap(entry_connection_t *for_conn, const char *address, const char *v, const char *exitname, int ttl)
Definition: addressmap.c:763
Macros to implement mocking and selective exposure for the test code.
void addressmap_clear_excluded_trackexithosts(const or_options_t *options)
Definition: addressmap.c:198
void addressmap_clear_transient(void)
Definition: addressmap.c:312
int parse_virtual_addr_network(const char *val, sa_family_t family, int validate_only, char **msg)
Definition: addressmap.c:798
const char * addressmap_register_virtual_address(int type, char *new_address)
Definition: addressmap.c:996
void addressmap_clear_invalid_automaps(const or_options_t *options)
Definition: addressmap.c:272