tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

reachability.h (1901B)


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