summaryrefslogtreecommitdiff
path: root/src/feature/relay/selftest.h
blob: 3d7fa2f307b0b548f3b0a358aa928682d096993a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* Copyright (c) 2001 Matej Pfajfar.
 * Copyright (c) 2001-2004, Roger Dingledine.
 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 * Copyright (c) 2007-2020, The Tor Project, Inc. */
/* See LICENSE for licensing information */

/**
 * \file selftest.h
 * \brief Header file for selftest.c.
 **/

#ifndef TOR_SELFTEST_H
#define TOR_SELFTEST_H

#ifdef HAVE_MODULE_RELAY

struct or_options_t;
#define router_all_orports_seem_reachable(opts) \
  router_orport_seems_reachable((opts),0)
int router_orport_seems_reachable(
                                         const struct or_options_t *options,
                                         int family);
int router_dirport_seems_reachable(
                                         const struct or_options_t *options);

void router_do_reachability_checks(void);
void router_perform_bandwidth_test(int num_circs, time_t now);

void router_orport_found_reachable(int family);

void router_reset_reachability(void);

#else /* !defined(HAVE_MODULE_RELAY) */

#define router_all_orports_seem_reachable(opts)     \
  ((void)(opts), 0)
#define router_orport_seems_reachable(opts, fam)  \
  ((void)(opts), (void)(fam), 0)
#define router_dirport_seems_reachable(opts) \
  ((void)(opts), 0)

static inline void
router_do_reachability_checks(void)
{
  tor_assert_nonfatal_unreached();
}
static inline void
router_perform_bandwidth_test(int num_circs, time_t now)
{
  (void)num_circs;
  (void)now;
  tor_assert_nonfatal_unreached();
}
static inline int
inform_testing_reachability(const tor_addr_t *addr, uint16_t port)
{
  (void) addr;
  (void) port;
  tor_assert_nonfatal_unreached();
  return 0;
}

#define router_orport_found_reachable() \
  STMT_NIL

#define router_reset_reachability() \
  STMT_NIL

#endif /* defined(HAVE_MODULE_RELAY) */

#endif /* !defined(TOR_SELFTEST_H) */