]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/networkd/config.h
networkd: Implement smarter handling of the configuration file hierarchy
[people/ms/network.git] / src / networkd / config.h
index 4b8bc01fb9570688d9977444a8bdc2b39d46d782..3e7c097729e8784d38bc36577018ebdbc9a2481f 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef NETWORKD_CONFIG_H
 #define NETWORKD_CONFIG_H
 
+#include <dirent.h>
 #include <stdio.h>
 
 #define NETWORK_CONFIG_KEY_MAX_LENGTH          128
@@ -52,6 +53,27 @@ int nw_config_set_int(nw_config* config, const char* key, const int value);
 int nw_config_get_bool(nw_config* config, const char* key);
 int nw_config_set_bool(nw_config* config, const char* key, const int value);
 
+/*
+       Directory
+*/
+
+typedef struct nw_configd nw_configd;
+
+int nw_configd_create(nw_configd** dir, const char* path);
+
+nw_configd* nw_configd_ref(nw_configd* dir);
+nw_configd* nw_configd_unref(nw_configd* dir);
+
+FILE* nw_configd_fopen(nw_configd* dir, const char* path, const char* mode);
+int nw_configd_open_config(nw_config** config, nw_configd* dir, const char* path);
+int nw_configd_unlink(nw_configd* dir, const char* path, int flags);
+
+nw_configd* nw_configd_descend(nw_configd* dir, const char* path);
+
+typedef int (*nw_configd_walk_callback)(struct dirent* entry, FILE* f, void* data);
+
+int nw_configd_walk(nw_configd* dir, nw_configd_walk_callback callback, void* data);
+
 /*
        Options
 */