From 72adf25cf21490aef012bb9314357f9b381934f9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 24 Sep 2013 11:53:48 +0200 Subject: proto-shell: move more core to handler.c Signed-off-by: Felix Fietkau --- handler.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'handler.h') diff --git a/handler.h b/handler.h index de403e1..d4b0334 100644 --- a/handler.h +++ b/handler.h @@ -16,7 +16,7 @@ #include -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); -- cgit v1.2.1