summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2018-04-24 15:28:47 -0400
committerDavid Goulet <dgoulet@torproject.org>2018-04-27 11:40:44 -0400
commit79a1112a495f76542d13eab4992ff4fd50f7f830 (patch)
treed42979d0a9ad27167f267e02ea3dbad4e4d01d9e /src/or
parentbdcf3a383932cc48a360c9a75b93b44a6968171e (diff)
downloadtor-79a1112a495f76542d13eab4992ff4fd50f7f830.tar.gz
tor-79a1112a495f76542d13eab4992ff4fd50f7f830.zip
sr: Static inline functions if no dirauth module
Add static inline dirauth public functions used outside of the dirauth module so they can be seen by the tor code but simply do nothing. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or')
-rw-r--r--src/or/dirauth/shared_random.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/or/dirauth/shared_random.h b/src/or/dirauth/shared_random.h
index d1b2ac2e25..1778ce8f09 100644
--- a/src/or/dirauth/shared_random.h
+++ b/src/or/dirauth/shared_random.h
@@ -101,11 +101,40 @@ typedef struct sr_commit_t {
/* API */
-/* Public methods: */
+/* Public methods used _outside_ of the module.
+ *
+ * We need to nullify them if the module is disabled. */
+#ifdef HAVE_MODULE_DIRAUTH
int sr_init(int save_to_disk);
void sr_save_and_cleanup(void);
void sr_act_post_consensus(const networkstatus_t *consensus);
+
+#else /* HAVE_MODULE_DIRAUTH */
+
+static inline int
+sr_init(int save_to_disk)
+{
+ (void) save_to_disk;
+ /* Always return success. */
+ return 0;
+}
+
+static inline void
+sr_save_and_cleanup(void)
+{
+}
+
+static inline void
+sr_act_post_consensus(const networkstatus_t *consensus)
+{
+ (void) consensus;
+}
+
+#endif /* HAVE_MODULE_DIRAUTH */
+
+/* Public methods used only by dirauth code. */
+
void sr_handle_received_commits(smartlist_t *commits,
crypto_pk_t *voter_key);
sr_commit_t *sr_parse_commit(const smartlist_t *args);