tor/src/feature/relay/selftest.h
Nick Mathewson bc9979a670 Split "can reach ipv4 orport" from "can reach ipv6 orport".
I've managed to keep this change mainly contained to our
self-testing module.  The changes here are:

  * There are two different variables for tracking "is our orport
    reachable".

  * We have a new function that says whether we can skip a single
    family's orport reachability test; the old function for this now
    tells whether we can skip _all_ orport reachability testing.

    (The name, router_should_skip_orport_reachability_test, is not
    so good.  I will rename it later if I can think of a good
    replacement.)

  * The function that launches orport reachability tests now only
    launches the ones that haven't completed.

  * The function that notes that we're reachable on an ORPort now
    takes a family.

  * Various log messages are cleaned up.
2020-06-18 16:05:16 -04:00

76 lines
2.0 KiB
C

/* 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_should_skip_orport_reachability_check(opts) \
router_should_skip_orport_reachability_check_family((opts),0)
int router_should_skip_orport_reachability_check_family(
const struct or_options_t *options,
int family);
int router_should_skip_dirport_reachability_check(
const struct or_options_t *options);
void router_do_reachability_checks(int test_or, int test_dir);
void router_perform_bandwidth_test(int num_circs, time_t now);
int inform_testing_reachability(void);
void router_orport_found_reachable(int family);
void router_dirport_found_reachable(void);
void router_reset_reachability(void);
#else /* !defined(HAVE_MODULE_RELAY) */
#define router_should_skip_orport_reachability_check(opts) \
((void)(opts), 0)
#define router_should_skip_orport_reachability_check_family(opts, fam) \
((void)(opts), (void)(fam), 0)
#define router_should_skip_dirport_reachability_check(opts) \
((void)(opts), 0)
static inline void
router_do_reachability_checks(int test_or, int test_dir)
{
(void)test_or;
(void)test_dir;
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(void)
{
tor_assert_nonfatal_unreached();
return 0;
}
#define router_orport_found_reachable() \
STMT_NIL
#define router_dirport_found_reachable() \
STMT_NIL
#define router_reset_reachability() \
STMT_NIL
#endif /* defined(HAVE_MODULE_RELAY) */
#endif /* !defined(TOR_SELFTEST_H) */