aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirauth/mode.h
blob: 8a0d3142f10a0169f0d7dcd80d0d3142f77d3ec4 (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
/* Copyright (c) 2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */

/**
 * \file mode.h
 * \brief Standalone header file for directory authority mode.
 **/

#ifndef TOR_DIRAUTH_MODE_H
#define TOR_DIRAUTH_MODE_H

#ifdef HAVE_MODULE_DIRAUTH

#include "router.h"

/* 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;
}

#else /* HAVE_MODULE_DIRAUTH */

/* Without the dirauth module, we can't be a v3 directory authority, ever. */

static inline int
authdir_mode_v3(const or_options_t *options)
{
  (void) options;
  return 0;
}

#endif /* HAVE_MODULE_DIRAUTH */

#endif /* TOR_MODE_H */