2012-10-28 21:13:58 +01:00
|
|
|
/* Copyright (c) 2001 Matej Pfajfar.
|
|
|
|
* Copyright (c) 2001-2004, Roger Dingledine.
|
|
|
|
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
2018-06-20 14:13:28 +02:00
|
|
|
* Copyright (c) 2007-2018, The Tor Project, Inc. */
|
2012-10-28 21:13:58 +01:00
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
|
|
|
#ifndef TOR_ADDRESSMAP_H
|
|
|
|
#define TOR_ADDRESSMAP_H
|
|
|
|
|
2018-06-21 19:12:23 +02:00
|
|
|
#include "lib/testsupport/testsupport.h"
|
2013-06-06 23:58:28 +02:00
|
|
|
|
2012-10-28 21:13:58 +01:00
|
|
|
void addressmap_init(void);
|
|
|
|
void addressmap_clear_excluded_trackexithosts(const or_options_t *options);
|
|
|
|
void addressmap_clear_invalid_automaps(const or_options_t *options);
|
|
|
|
void addressmap_clean(time_t now);
|
|
|
|
void addressmap_clear_configured(void);
|
|
|
|
void addressmap_clear_transient(void);
|
|
|
|
void addressmap_free_all(void);
|
2014-04-09 00:02:03 +02:00
|
|
|
#define AMR_FLAG_USE_IPV4_DNS (1u<<0)
|
|
|
|
#define AMR_FLAG_USE_IPV6_DNS (1u<<1)
|
|
|
|
#define AMR_FLAG_USE_MAPADDRESS (1u<<2)
|
|
|
|
#define AMR_FLAG_USE_AUTOMAP (1u<<3)
|
|
|
|
#define AMR_FLAG_USE_TRACKEXIT (1u<<4)
|
2012-11-25 19:45:36 +01:00
|
|
|
int addressmap_rewrite(char *address, size_t maxlen, unsigned flags,
|
|
|
|
time_t *expires_out,
|
2012-10-28 21:13:58 +01:00
|
|
|
addressmap_entry_source_t *exit_source_out);
|
2012-11-25 19:45:36 +01:00
|
|
|
int addressmap_rewrite_reverse(char *address, size_t maxlen, unsigned flags,
|
2012-10-28 21:13:58 +01:00
|
|
|
time_t *expires_out);
|
|
|
|
int addressmap_have_mapping(const char *address, int update_timeout);
|
|
|
|
|
|
|
|
void addressmap_register(const char *address, char *new_address,
|
|
|
|
time_t expires, addressmap_entry_source_t source,
|
|
|
|
const int address_wildcard,
|
|
|
|
const int new_address_wildcard);
|
2012-11-23 23:31:53 +01:00
|
|
|
int parse_virtual_addr_network(const char *val,
|
|
|
|
sa_family_t family, int validate_only,
|
2012-10-28 21:13:58 +01:00
|
|
|
char **msg);
|
|
|
|
int client_dns_incr_failures(const char *address);
|
|
|
|
void client_dns_clear_failures(const char *address);
|
2012-11-25 19:45:36 +01:00
|
|
|
void client_dns_set_addressmap(entry_connection_t *for_conn,
|
2012-10-31 23:27:48 +01:00
|
|
|
const char *address, const tor_addr_t *val,
|
2012-10-28 21:13:58 +01:00
|
|
|
const char *exitname, int ttl);
|
|
|
|
const char *addressmap_register_virtual_address(int type, char *new_address);
|
|
|
|
void addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
|
|
|
|
time_t max_expires, int want_expiry);
|
|
|
|
int address_is_in_virtual_range(const char *addr);
|
|
|
|
void clear_trackexithost_mappings(const char *exitname);
|
2012-11-25 19:45:36 +01:00
|
|
|
void client_dns_set_reverse_addressmap(entry_connection_t *for_conn,
|
2012-10-28 22:13:37 +01:00
|
|
|
const char *address, const char *v,
|
2012-10-28 21:13:58 +01:00
|
|
|
const char *exitname, int ttl);
|
2012-11-25 20:31:35 +01:00
|
|
|
int addressmap_address_should_automap(const char *address,
|
|
|
|
const or_options_t *options);
|
2012-10-28 21:13:58 +01:00
|
|
|
|
2012-11-23 23:31:53 +01:00
|
|
|
#ifdef ADDRESSMAP_PRIVATE
|
|
|
|
typedef struct virtual_addr_conf_t {
|
|
|
|
tor_addr_t addr;
|
|
|
|
maskbits_t bits;
|
|
|
|
} virtual_addr_conf_t;
|
|
|
|
|
2013-06-06 23:58:28 +02:00
|
|
|
STATIC void get_random_virtual_addr(const virtual_addr_conf_t *conf,
|
|
|
|
tor_addr_t *addr_out);
|
2017-09-15 22:24:44 +02:00
|
|
|
#endif /* defined(ADDRESSMAP_PRIVATE) */
|
2012-11-23 23:31:53 +01:00
|
|
|
|
2017-09-15 22:24:44 +02:00
|
|
|
#endif /* !defined(TOR_ADDRESSMAP_H) */
|
2012-10-28 21:13:58 +01:00
|
|
|
|