dns.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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-2016, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file dns.h
  8. * \brief Header file for dns.c.
  9. **/
  10. #ifndef TOR_DNS_H
  11. #define TOR_DNS_H
  12. int dns_init(void);
  13. int has_dns_init_failed(void);
  14. void dns_free_all(void);
  15. uint32_t dns_clip_ttl(uint32_t ttl);
  16. int dns_reset(void);
  17. void connection_dns_remove(edge_connection_t *conn);
  18. void assert_connection_edge_not_dns_pending(edge_connection_t *conn);
  19. void assert_all_pending_dns_resolves_ok(void);
  20. MOCK_DECL(void,dns_cancel_pending_resolve,(const char *question));
  21. int dns_resolve(edge_connection_t *exitconn);
  22. void dns_launch_correctness_checks(void);
  23. int dns_seems_to_be_broken(void);
  24. int dns_seems_to_be_broken_for_ipv6(void);
  25. void dns_reset_correctness_checks(void);
  26. void dump_dns_mem_usage(int severity);
  27. #ifdef DNS_PRIVATE
  28. #include "dns_structs.h"
  29. STATIC uint32_t dns_get_expiry_ttl(uint32_t ttl);
  30. MOCK_DECL(STATIC int,dns_resolve_impl,(edge_connection_t *exitconn,
  31. int is_resolve,or_circuit_t *oncirc, char **hostname_out,
  32. int *made_connection_pending_out, cached_resolve_t **resolve_out));
  33. MOCK_DECL(STATIC void,send_resolved_cell,(edge_connection_t *conn,
  34. uint8_t answer_type,const cached_resolve_t *resolved));
  35. MOCK_DECL(STATIC void,send_resolved_hostname_cell,(edge_connection_t *conn,
  36. const char *hostname));
  37. cached_resolve_t *dns_get_cache_entry(cached_resolve_t *query);
  38. void dns_insert_cache_entry(cached_resolve_t *new_entry);
  39. MOCK_DECL(STATIC int,
  40. set_exitconn_info_from_resolve,(edge_connection_t *exitconn,
  41. const cached_resolve_t *resolve,
  42. char **hostname_out));
  43. MOCK_DECL(STATIC int,
  44. launch_resolve,(cached_resolve_t *resolve));
  45. #endif
  46. #endif