summaryrefslogtreecommitdiffhomepage
path: root/handler.h
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-09-24 11:53:48 +0200
committerFelix Fietkau <nbd@openwrt.org>2013-10-22 14:10:33 +0200
commit72adf25cf21490aef012bb9314357f9b381934f9 (patch)
tree78adc9931f90b29937196f6cfa85c45ba3de5a11 /handler.h
parentf88b0173d22e7f86ad8441c9a5bc76cee77f721a (diff)
proto-shell: move more core to handler.c
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'handler.h')
-rw-r--r--handler.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/handler.h b/handler.h
index de403e1..d4b0334 100644
--- a/handler.h
+++ b/handler.h
@@ -16,7 +16,7 @@
#include <libubox/blobmsg_json.h>
-typedef void (*script_dump_cb)(const char *name, json_object *obj);
+typedef void (*script_dump_cb)(const char *script, const char *name, json_object *obj);
static inline json_object *
json_check_type(json_object *obj, json_type type)
@@ -30,6 +30,12 @@ json_check_type(json_object *obj, json_type type)
return obj;
}
+static inline json_object *
+json_get_field(json_object *obj, const char *name, json_type type)
+{
+ return json_check_type(json_object_object_get(obj, name), type);
+}
+
int netifd_open_subdir(const char *name);
void netifd_init_script_handlers(int dir_fd, script_dump_cb cb);
char *netifd_handler_parse_config(struct uci_blob_param_list *config, json_object *obj);