summaryrefslogtreecommitdiff
path: root/src/common/address.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-07-25 15:11:21 +0000
committerNick Mathewson <nickm@torproject.org>2008-07-25 15:11:21 +0000
commit056d97da0c6c69aa2da9855675b6726f471b5f5a (patch)
tree7ea7884cc6b035e6d0985b750a1e3d29f067720f /src/common/address.h
parent016adc9a08bdccf395b41709b5b534edf2298f6e (diff)
downloadtor-056d97da0c6c69aa2da9855675b6726f471b5f5a.tar.gz
tor-056d97da0c6c69aa2da9855675b6726f471b5f5a.zip
r17391@pc-10-8-1-079: nickm | 2008-07-25 17:11:17 +0200
Tor_addr_compare did a semantic comparison, such that ::1.2.3.4 and 1.2.3.4 were "equal". we sometimes need an exact comparison. Add a feature to do that. svn:r16210
Diffstat (limited to 'src/common/address.h')
-rw-r--r--src/common/address.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/common/address.h b/src/common/address.h
index fb415fee48..fd4b7879e8 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -81,11 +81,19 @@ tor_addr_to_in(const tor_addr_t *a)
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;
-
int get_interface_address6(int severity, sa_family_t family, tor_addr_t *addr);
-int tor_addr_compare(const tor_addr_t *addr1, const tor_addr_t *addr2);
+
+/** DOCDOC */
+typedef enum {
+ CMP_EXACT,
+ CMP_SEMANTIC,
+} tor_addr_comparison_t;
+
+int tor_addr_compare(const tor_addr_t *addr1, const tor_addr_t *addr2,
+ tor_addr_comparison_t how);
int tor_addr_compare_masked(const tor_addr_t *addr1, const tor_addr_t *addr2,
- maskbits_t mask);
+ maskbits_t mask, tor_addr_comparison_t how);
+
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;