mode.h 799 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* Copyright (c) 2018-2018, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. /**
  4. * \file mode.h
  5. * \brief Standalone header file for directory authority mode.
  6. **/
  7. #ifndef TOR_DIRAUTH_MODE_H
  8. #define TOR_DIRAUTH_MODE_H
  9. #ifdef HAVE_MODULE_DIRAUTH
  10. #include "feature/relay/router.h"
  11. /* Return true iff we believe ourselves to be a v3 authoritative directory
  12. * server. */
  13. static inline int
  14. authdir_mode_v3(const or_options_t *options)
  15. {
  16. return authdir_mode(options) && options->V3AuthoritativeDir != 0;
  17. }
  18. #else /* HAVE_MODULE_DIRAUTH */
  19. /* Without the dirauth module, we can't be a v3 directory authority, ever. */
  20. static inline int
  21. authdir_mode_v3(const or_options_t *options)
  22. {
  23. (void) options;
  24. return 0;
  25. }
  26. #endif /* HAVE_MODULE_DIRAUTH */
  27. #endif /* TOR_MODE_H */