aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dirauth/dirauth_config.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-12-15 11:46:55 -0500
committerNick Mathewson <nickm@torproject.org>2019-12-19 07:54:56 -0500
commitffa3499d81823eb21811a479c31b59f1bfb5bc61 (patch)
tree3841d1247c282792a1f4c3952ab09c305b66e718 /src/feature/dirauth/dirauth_config.c
parent419ba97df5bd168bf773478270c0043f20328e15 (diff)
downloadtor-ffa3499d81823eb21811a479c31b59f1bfb5bc61.tar.gz
tor-ffa3499d81823eb21811a479c31b59f1bfb5bc61.zip
Add config object for dirauth; move one option there.
I've chosen the "AuthDirMaxServersPerAddr" option here for simplicity, since it is used literally nowhere else besides the dirauth module. Once we have all the infrastructure in place for this, we can move more options into this structure.
Diffstat (limited to 'src/feature/dirauth/dirauth_config.c')
-rw-r--r--src/feature/dirauth/dirauth_config.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/feature/dirauth/dirauth_config.c b/src/feature/dirauth/dirauth_config.c
index 552f851461..b7e160c241 100644
--- a/src/feature/dirauth/dirauth_config.c
+++ b/src/feature/dirauth/dirauth_config.c
@@ -15,6 +15,7 @@
#include "lib/encoding/confline.h"
#include "lib/confmgt/confmgt.h"
+#include "lib/conf/confdecl.h"
/* Required for dirinfo_type_t in or_options_t */
#include "core/or/or.h"
@@ -28,6 +29,7 @@
#include "feature/dirauth/dirauth_periodic.h"
#include "feature/dirauth/dirvote.h"
#include "feature/dirauth/guardfraction.h"
+#include "feature/dirauth/dirauth_options_st.h"
/* Copied from config.c, we will refactor later in 29211. */
#define REJECT(arg) \
@@ -438,3 +440,23 @@ options_act_dirauth_stats(const or_options_t *old_options,
return 0;
}
+
+/* Declare the options field table for dirauth_options */
+#define CONF_CONTEXT TABLE
+#include "feature/dirauth/dirauth_options.inc"
+#undef CONF_CONTEXT
+
+/** Magic number for dirauth_options_t. */
+#define DIRAUTH_OPTIONS_MAGIC 0x41757448
+
+/**
+ * Declare the configuration options for the dirauth module.
+ **/
+const config_format_t dirauth_options_fmt = {
+ .size = sizeof(dirauth_options_t),
+ .magic = { "dirauth_options_t",
+ DIRAUTH_OPTIONS_MAGIC,
+ offsetof(dirauth_options_t, magic) },
+ .vars = dirauth_options_t_vars,
+};
+