summaryrefslogtreecommitdiffhomepage
path: root/contrib/fwd/src/fwd_config.h
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-12-09 02:15:59 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-12-09 02:15:59 +0000
commit2e9ac3b3420350737aa37d01c0418bede10ab401 (patch)
tree352ff51ea0379c7709deb28dc8a18318ba47f806 /contrib/fwd/src/fwd_config.h
parente8220d96a52be888db8611e2908cb3ba97dfe2f8 (diff)
contrib: fwd - initial C implementation of the uci firewall
Diffstat (limited to 'contrib/fwd/src/fwd_config.h')
-rw-r--r--contrib/fwd/src/fwd_config.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/contrib/fwd/src/fwd_config.h b/contrib/fwd/src/fwd_config.h
new file mode 100644
index 000000000..ba66dffea
--- /dev/null
+++ b/contrib/fwd/src/fwd_config.h
@@ -0,0 +1,29 @@
+#ifndef __FWD_CONFIG_H__
+#define __FWD_CONFIG_H__
+
+#include "fwd.h"
+#include "ucix.h"
+
+/* fwd_check_option(uci_ctx, section, name, type) */
+#define fwd_check_option(uci, sct, name, type) \
+ struct fwd_##type *name = NULL; \
+ if( fwd_read_##type(uci, sct, #name, &name) ) \
+ { \
+ printf("ERROR: section '%s' contains invalid %s in '%s'!\n", \
+ sct, #type, #name); \
+ return; \
+ }
+
+/* structure to access fwd_data* in uci iter callbacks */
+struct fwd_data_conveyor {
+ struct fwd_data *head;
+ struct fwd_data *cursor;
+};
+
+/* api */
+struct fwd_data * fwd_read_config(void);
+struct fwd_zone * fwd_lookup_zone(struct fwd_data *, const char *);
+
+void fwd_free_config(struct fwd_data *);
+
+#endif