aboutsummaryrefslogtreecommitdiff
path: root/src/lib/net/resolve.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-10-03 07:50:18 -0400
committerNick Mathewson <nickm@torproject.org>2019-10-04 08:02:56 -0400
commit9c24ceeb3f2082193bf76a77ad6d6d011561e239 (patch)
tree0e79e48dbc666a0a2aedbe566826bc9cfc1962e3 /src/lib/net/resolve.h
parentac8f6d51f4200b27adc0da9fc1eeb44b89c8ebab (diff)
downloadtor-9c24ceeb3f2082193bf76a77ad6d6d011561e239.tar.gz
tor-9c24ceeb3f2082193bf76a77ad6d6d011561e239.zip
Make tor_addr_lookup_host_impl mockable.
Diffstat (limited to 'src/lib/net/resolve.h')
-rw-r--r--src/lib/net/resolve.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/net/resolve.h b/src/lib/net/resolve.h
index d7b60be917..b979b2fb41 100644
--- a/src/lib/net/resolve.h
+++ b/src/lib/net/resolve.h
@@ -24,12 +24,18 @@
struct tor_addr_t;
+/*
+ * Primary lookup functions.
+ */
MOCK_DECL(int, tor_lookup_hostname,(const char *name, uint32_t *addr));
MOCK_DECL(int, tor_addr_lookup,(const char *name, uint16_t family,
struct tor_addr_t *addr_out));
int tor_addr_port_lookup(const char *s, struct tor_addr_t *addr_out,
uint16_t *port_out);
+/*
+ * Sandbox helpers
+ */
struct addrinfo;
#ifdef USE_SANDBOX_GETADDRINFO
/** Pre-calls getaddrinfo in order to pre-record result. */
@@ -55,4 +61,13 @@ void tor_free_getaddrinfo_cache(void);
void sandbox_disable_getaddrinfo_cache(void);
void tor_make_getaddrinfo_cache_active(void);
+/*
+ * Internal resolver wrapper; exposed for mocking.
+ */
+#ifdef RESOLVE_PRIVATE
+MOCK_DECL(STATIC int, tor_addr_lookup_host_impl, (const char *name,
+ uint16_t family,
+ struct tor_addr_t *addr));
+#endif
+
#endif /* !defined(TOR_RESOLVE_H) */