reachability.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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-2019, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file reachability.h
  8. * \brief Header file for reachability.c.
  9. **/
  10. #ifndef TOR_REACHABILITY_H
  11. #define TOR_REACHABILITY_H
  12. /** What fraction (1 over this number) of the relay ID space do we
  13. * (as a directory authority) launch connections to at each reachability
  14. * test? */
  15. #define REACHABILITY_MODULO_PER_TEST 128
  16. /** How often (in seconds) do we launch reachability tests? */
  17. #define REACHABILITY_TEST_INTERVAL 10
  18. /** How many seconds apart are the reachability tests for a given relay? */
  19. #define REACHABILITY_TEST_CYCLE_PERIOD \
  20. (REACHABILITY_TEST_INTERVAL*REACHABILITY_MODULO_PER_TEST)
  21. void dirserv_single_reachability_test(time_t now, routerinfo_t *router);
  22. void dirserv_test_reachability(time_t now);
  23. #ifdef HAVE_MODULE_DIRAUTH
  24. int dirserv_should_launch_reachability_test(const routerinfo_t *ri,
  25. const routerinfo_t *ri_old);
  26. void dirserv_orconn_tls_done(const tor_addr_t *addr,
  27. uint16_t or_port,
  28. const char *digest_rcvd,
  29. const struct ed25519_public_key_t *ed_id_rcvd);
  30. #else /* !defined(HAVE_MODULE_DIRAUTH) */
  31. static inline int
  32. dirserv_should_launch_reachability_test(const routerinfo_t *ri,
  33. const routerinfo_t *ri_old)
  34. {
  35. (void)ri;
  36. (void)ri_old;
  37. return 0;
  38. }
  39. static inline void
  40. dirserv_orconn_tls_done(const tor_addr_t *addr,
  41. uint16_t or_port,
  42. const char *digest_rcvd,
  43. const struct ed25519_public_key_t *ed_id_rcvd)
  44. {
  45. (void)addr;
  46. (void)or_port;
  47. (void)digest_rcvd;
  48. (void)ed_id_rcvd;
  49. }
  50. #endif /* defined(HAVE_MODULE_DIRAUTH) */
  51. #endif /* !defined(TOR_REACHABILITY_H) */