ulog: implement ulog_close()
[project/libubox.git] / json_script.h
index e28b511..9475baa 100644 (file)
 #ifndef __JSON_SCRIPT_H
 #define __JSON_SCRIPT_H
 
-#include <libubox/avl.h>
-#include <libubox/blob.h>
-#include <libubox/blobmsg.h>
-#include <libubox/utils.h>
+#include "avl.h"
+#include "blob.h"
+#include "blobmsg.h"
+#include "utils.h"
 
 struct json_script_file;
 
@@ -97,6 +97,18 @@ void json_script_free(struct json_script_ctx *ctx);
 void json_script_run(struct json_script_ctx *ctx, const char *filename,
                     struct blob_attr *vars);
 
+void json_script_run_file(struct json_script_ctx *ctx, struct json_script_file *file,
+                         struct blob_attr *vars);
+/*
+ * json_script_eval_string - evaluate a string and store the result
+ *
+ * Can be used to process variable references outside of a script
+ * in a same way that they would be interpreted in the script context.
+ */
+int json_script_eval_string(struct json_script_ctx *ctx, struct blob_attr *vars,
+                           struct blob_buf *buf, const char *name,
+                           const char *pattern);
+
 struct json_script_file *
 json_script_file_from_blobmsg(const char *name, void *data, int len);