tor

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

selftest.h (1717B)


      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 selftest.h
      9 * \brief Header file for selftest.c.
     10 **/
     11 
     12 #ifndef TOR_SELFTEST_H
     13 #define TOR_SELFTEST_H
     14 
     15 #ifdef HAVE_MODULE_RELAY
     16 
     17 struct or_options_t;
     18 #define router_all_orports_seem_reachable(opts) \
     19  router_orport_seems_reachable((opts),0)
     20 int router_orport_seems_reachable(
     21                                         const struct or_options_t *options,
     22                                         int family);
     23 
     24 void router_do_reachability_checks(void);
     25 void router_perform_bandwidth_test(int num_circs, time_t now);
     26 
     27 void router_orport_found_reachable(int family);
     28 
     29 void router_reset_reachability(void);
     30 
     31 #else /* !defined(HAVE_MODULE_RELAY) */
     32 
     33 #define router_all_orports_seem_reachable(opts)     \
     34  ((void)(opts), 0)
     35 #define router_orport_seems_reachable(opts, fam)  \
     36  ((void)(opts), (void)(fam), 0)
     37 #define router_dirport_seems_reachable(opts) \
     38  ((void)(opts), 0)
     39 
     40 static inline void
     41 router_do_reachability_checks(void)
     42 {
     43  tor_assert_nonfatal_unreached();
     44 }
     45 static inline void
     46 router_perform_bandwidth_test(int num_circs, time_t now)
     47 {
     48  (void)num_circs;
     49  (void)now;
     50  tor_assert_nonfatal_unreached();
     51 }
     52 static inline int
     53 inform_testing_reachability(const tor_addr_t *addr, uint16_t port)
     54 {
     55  (void) addr;
     56  (void) port;
     57  tor_assert_nonfatal_unreached();
     58  return 0;
     59 }
     60 
     61 #define router_orport_found_reachable() \
     62  STMT_NIL
     63 
     64 #define router_reset_reachability() \
     65  STMT_NIL
     66 
     67 #endif /* defined(HAVE_MODULE_RELAY) */
     68 
     69 #endif /* !defined(TOR_SELFTEST_H) */