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 int router_dirport_seems_reachable(
24 const struct or_options_t *options);
25
26 void router_do_reachability_checks(void);
27 void router_perform_bandwidth_test(int num_circs, time_t now);
28
29 void router_orport_found_reachable(int family);
30
31 void router_reset_reachability(void);
32
33 #else /* !defined(HAVE_MODULE_RELAY) */
34
35 #define router_all_orports_seem_reachable(opts) \
36 ((void)(opts), 0)
37 #define router_orport_seems_reachable(opts, fam) \
38 ((void)(opts), (void)(fam), 0)
39 #define router_dirport_seems_reachable(opts) \
40 ((void)(opts), 0)
41
42 static inline void
router_do_reachability_checks(void)43 router_do_reachability_checks(void)
44 {
45 tor_assert_nonfatal_unreached();
46 }
47 static inline void
router_perform_bandwidth_test(int num_circs,time_t now)48 router_perform_bandwidth_test(int num_circs, time_t now)
49 {
50 (void)num_circs;
51 (void)now;
52 tor_assert_nonfatal_unreached();
53 }
54 static inline int
inform_testing_reachability(const tor_addr_t * addr,uint16_t port)55 inform_testing_reachability(const tor_addr_t *addr, uint16_t port)
56 {
57 (void) addr;
58 (void) port;
59 tor_assert_nonfatal_unreached();
60 return 0;
61 }
62
63 #define router_orport_found_reachable() \
64 STMT_NIL
65
66 #define router_reset_reachability() \
67 STMT_NIL
68
69 #endif /* defined(HAVE_MODULE_RELAY) */
70
71 #endif /* !defined(TOR_SELFTEST_H) */
72