authmode.h 1.36 KB
Newer Older
Nick Mathewson's avatar
Nick Mathewson committed
1
/* Copyright (c) 2018-2019, The Tor Project, Inc. */
2
3
4
/* See LICENSE for licensing information */

/**
5
6
 * \file authmode.h
 * \brief Header file for directory authority mode.
7
8
9
10
11
 **/

#ifndef TOR_DIRAUTH_MODE_H
#define TOR_DIRAUTH_MODE_H

12
13
#include "feature/relay/router.h"

14
15
#ifdef HAVE_MODULE_DIRAUTH

16
17
18
19
20
int authdir_mode(const or_options_t *options);
int authdir_mode_handles_descs(const or_options_t *options, int purpose);
int authdir_mode_publishes_statuses(const or_options_t *options);
int authdir_mode_tests_reachability(const or_options_t *options);
int authdir_mode_bridge(const or_options_t *options);
21
22
23
24
25
26
27
28
29

/* Return true iff we believe ourselves to be a v3 authoritative directory
 * server. */
static inline int
authdir_mode_v3(const or_options_t *options)
{
  return authdir_mode(options) && options->V3AuthoritativeDir != 0;
}

Nick Mathewson's avatar
Nick Mathewson committed
30
31
#define have_module_dirauth() (1)

32
33
#else /* HAVE_MODULE_DIRAUTH */

34
35
36
37
38
39
40
#define authdir_mode(options) (((void)(options)),0)
#define authdir_mode_handles_descs(options,purpose) \
  (((void)(options)),((void)(purpose)),0)
#define authdir_mode_publishes_statuses(options) (((void)(options)),0)
#define authdir_mode_tests_reachability(options) (((void)(options)),0)
#define authdir_mode_bridge(options) (((void)(options)),0)
#define authdir_mode_v3(options) (((void)(options)),0)
41

Nick Mathewson's avatar
Nick Mathewson committed
42
43
#define have_module_dirauth() (0)

44
45
46
#endif /* HAVE_MODULE_DIRAUTH */

#endif /* TOR_MODE_H */