summaryrefslogtreecommitdiffstats
path: root/src/config.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-06-10 20:46:52 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-06-10 20:46:52 +0200
commit6b139d613ae6fa127bdce1be5c634ed4b53b1efd (patch)
treefe55f6e36831ee0e2702ea085fab0e29aff8a578 /src/config.h
parent65a09a09d6cc3e26be9488e69895154ab2ae14fd (diff)
downloadfastd-6b139d613ae6fa127bdce1be5c634ed4b53b1efd.tar
fastd-6b139d613ae6fa127bdce1be5c634ed4b53b1efd.zip
Clean up peer config loading
Instead of changing the peer list and peer group in the main conf during (re-)loading, add a parser state which contains this information.
Diffstat (limited to 'src/config.h')
-rw-r--r--src/config.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/config.h b/src/config.h
index 3231f6d..f4e1de5 100644
--- a/src/config.h
+++ b/src/config.h
@@ -35,20 +35,31 @@
#include "fastd.h"
+/** State of the config parser */
+struct fastd_parser_state {
+ fastd_peer_group_t *peer_group; /**< The current peer group */
+ fastd_peer_config_t *peer; /**< The peer currently being loaded */
+
+ const char *const filename; /**< The filename of the currently parsed file */
+ const int depth; /**< The include depth */
+};
+
+
void fastd_config_protocol(const char *name);
void fastd_config_method(const char *name);
void fastd_config_cipher(const char *name, const char *impl);
void fastd_config_mac(const char *name, const char *impl);
void fastd_config_bind_address(const fastd_peer_address_t *address, const char *bindtodev, bool default_v4, bool default_v6);
-void fastd_config_peer_group_push(const char *name);
-void fastd_config_peer_group_pop(void);
void fastd_config_release(void);
void fastd_config_handle_options(int argc, char *const argv[]);
void fastd_config_verify(void);
+bool fastd_config_read(const char *filename, fastd_peer_group_t *peer_group, fastd_peer_config_t *peer_config, int depth);
+void fastd_config_peer_group_push(fastd_parser_state_t *state, const char *name);
+void fastd_config_peer_group_pop(fastd_parser_state_t *state);
+void fastd_config_add_peer_dir(fastd_peer_group_t *group, const char *dir);
+
void fastd_configure(int argc, char *const argv[]);
void fastd_config_check(void);
void fastd_config_load_peer_dirs(void);
-void fastd_add_peer_dir(const char *dir);
-bool fastd_read_config(const char *filename, bool peer_config, int depth);