aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay/routermode.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/feature/relay/routermode.h')
-rw-r--r--src/feature/relay/routermode.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/feature/relay/routermode.h b/src/feature/relay/routermode.h
index a391a6485e..ddf621e5c7 100644
--- a/src/feature/relay/routermode.h
+++ b/src/feature/relay/routermode.h
@@ -12,6 +12,8 @@
#ifndef TOR_ROUTERMODE_H
#define TOR_ROUTERMODE_H
+#ifdef HAVE_MODULE_RELAY
+
int dir_server_mode(const or_options_t *options);
MOCK_DECL(int, server_mode, (const or_options_t *options));
@@ -20,4 +22,21 @@ MOCK_DECL(int, advertised_server_mode, (void));
void set_server_advertised(int s);
+/* Is the relay module enabled? */
+#define have_module_relay() (1)
+
+#else
+
+#define dir_server_mode(options) (((void)(options)),0)
+#define server_mode(options) (((void)(options)),0)
+#define public_server_mode(options) (((void)(options)),0)
+#define advertised_server_mode() (0)
+
+/* We shouldn't be publishing descriptors when relay mode is disabled. */
+#define set_server_advertised(s) tor_assert_nonfatal(!(s))
+
+#define have_module_relay() (0)
+
+#endif
+
#endif /* !defined(TOR_ROUTERMODE_H) */