#include "avl.h"
#include "blob.h"
#include "blobmsg.h"
#include "utils.h"
Go to the source code of this file.
|
void | json_script_init (struct json_script_ctx *ctx) |
|
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) |
|
static void | json_script_abort (struct json_script_ctx *ctx) |
|
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) |
|
const char * | json_script_find_var (struct json_script_ctx *ctx, struct blob_attr *vars, const char *name) |
|
◆ json_script_abort()
◆ json_script_eval_string()
Definition at line 502 of file json_script.c.
static int eval_string(struct json_call *call, struct blob_buf *buf, const char *name, const char *pattern)
struct json_script_ctx * ctx
◆ json_script_file_from_blobmsg()
struct json_script_file* json_script_file_from_blobmsg |
( |
const char * |
name, |
|
|
void * |
data, |
|
|
int |
len |
|
) |
| |
Definition at line 38 of file json_script.c.
45 name_len = strlen(
name) + 1;
47 f =
calloc_a(
sizeof(*f) + len, &new_name, name_len);
#define calloc_a(len,...)
◆ json_script_find_var()
Definition at line 94 of file json_script.c.
static const char * blobmsg_name(const struct blob_attr *attr)
#define blobmsg_for_each_attr(pos, attr, rem)
static void * blobmsg_data(const struct blob_attr *attr)
const char *(* handle_var)(struct json_script_ctx *ctx, const char *name, struct blob_attr *vars)
◆ json_script_free()
Definition at line 652 of file json_script.c.
#define avl_remove_all_elements(tree, element, node_member, ptr)
void blob_buf_free(struct blob_buf *buf)
static void __json_script_file_free(struct json_script_file *f)
struct json_script_file * next
◆ json_script_init()
Definition at line 689 of file json_script.c.
int avl_strcmp(const void *k1, const void *k2, void *ptr)
void avl_init(struct avl_tree *tree, avl_tree_comp comp, bool allow_dups, void *ptr)
static int __default_handle_expr(struct json_script_ctx *ctx, const char *name, struct blob_attr *expr, struct blob_attr *vars)
static const char * __default_handle_var(struct json_script_ctx *ctx, const char *name, struct blob_attr *vars)
static void __default_handle_error(struct json_script_ctx *ctx, const char *msg, struct blob_attr *context)
static struct json_script_file * __default_handle_file(struct json_script_ctx *ctx, const char *name)
int(* handle_expr)(struct json_script_ctx *ctx, const char *name, struct blob_attr *expr, struct blob_attr *vars)
void(* handle_error)(struct json_script_ctx *ctx, const char *msg, struct blob_attr *context)
struct json_script_file *(* handle_file)(struct json_script_ctx *ctx, const char *name)
◆ json_script_run()
Definition at line 626 of file json_script.c.
static struct json_script_file * json_script_get_file(struct json_script_ctx *ctx, const char *filename)
void json_script_run_file(struct json_script_ctx *ctx, struct json_script_file *file, struct blob_attr *vars)
◆ json_script_run_file()
Definition at line 607 of file json_script.c.
610 static unsigned int _seq = 0;
static void __json_script_run(struct json_call *call, struct json_script_file *file, struct blob_attr *context)