aboutsummaryrefslogtreecommitdiff
path: root/src/common/address.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-12-19 18:52:00 +0000
committerNick Mathewson <nickm@torproject.org>2008-12-19 18:52:00 +0000
commit029be5ad02cfec8d9b96b3466a03a353183f561a (patch)
tree1cd1a87b153e8aabfef10d8d6d8f8813f6e1bdf0 /src/common/address.h
parentefb863189cd4500e9cdaf8f5665f9756ae12dfde (diff)
downloadtor-029be5ad02cfec8d9b96b3466a03a353183f561a.tar.gz
tor-029be5ad02cfec8d9b96b3466a03a353183f561a.zip
Move in-addr.arpa parsing and generation into address.c, and simplify the code that does it elsewhere. Incidentally, this lets exit servers answer requests for ip6.arpa addresses.
svn:r17707
Diffstat (limited to 'src/common/address.h')
-rw-r--r--src/common/address.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/common/address.h b/src/common/address.h
index 5f9e01910a..fa2ac1b5bc 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -90,6 +90,7 @@ tor_addr_eq_ipv4h(const tor_addr_t *a, uint32_t u)
int tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr_out);
char *tor_dup_addr(const tor_addr_t *addr) ATTR_MALLOC;
+void tor_addr_assign(tor_addr_t *dest, const tor_addr_t *src);
const char *fmt_addr(const tor_addr_t *addr);
int get_interface_address6(int severity, sa_family_t family, tor_addr_t *addr);
@@ -113,6 +114,15 @@ int tor_addr_compare_masked(const tor_addr_t *addr1, const tor_addr_t *addr2,
unsigned int tor_addr_hash(const tor_addr_t *addr);
int tor_addr_is_v4(const tor_addr_t *addr);
int tor_addr_is_internal(const tor_addr_t *ip, int for_listening) ATTR_PURE;
+
+/** Longest length that can be required for a reverse lookup name. */
+/* 32 nybbles, 32 dots, 8 characters of "ip6.arpa", 1 NUL: 73 characters. */
+#define REVERSE_LOOKUP_NAME_BUF_LEN 73
+int tor_addr_to_reverse_lookup_name(char *out, size_t outlen,
+ const tor_addr_t *addr);
+int tor_addr_parse_reverse_lookup_name(tor_addr_t *result, const char *address,
+ int family, int accept_regular);
+
int tor_addr_port_parse(const char *s, tor_addr_t *addr_out,
uint16_t *port_out);
int tor_addr_parse_mask_ports(const char *s,