aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dirauth/authmode.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-09-25 15:18:19 -0400
committerNick Mathewson <nickm@torproject.org>2018-09-25 15:18:21 -0400
commit9385b7ec5f6effce97ae26aa6cda08df5b90309b (patch)
treef06277853f07a568e76ad4f5f6da0a005bad6ce7 /src/feature/dirauth/authmode.h
parent8a350e088bf59355f5e2fa3a05fa545923d4e74d (diff)
downloadtor-9385b7ec5f6effce97ae26aa6cda08df5b90309b.tar.gz
tor-9385b7ec5f6effce97ae26aa6cda08df5b90309b.zip
Rename dirauth/mode.h to dirauth/authmode.h
This is preparation for having a routermode.h as well
Diffstat (limited to 'src/feature/dirauth/authmode.h')
-rw-r--r--src/feature/dirauth/authmode.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/feature/dirauth/authmode.h b/src/feature/dirauth/authmode.h
new file mode 100644
index 0000000000..8bb961dffb
--- /dev/null
+++ b/src/feature/dirauth/authmode.h
@@ -0,0 +1,38 @@
+/* Copyright (c) 2018-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 "feature/relay/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 */
+