X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=blobdiff_plain;f=blobmsg.h;h=728f9e3e1d895f5b8d7bbb6d264f477a94433923;hp=e51c39d662bb4173437deb231cdc85a9e55471f7;hb=01ad5162b27b29fd0bfe5b862a1a719ba4870e0a;hpb=be416140606328d677283247553c122314e8ce8f;ds=sidebyside diff --git a/blobmsg.h b/blobmsg.h index e51c39d..728f9e3 100644 --- a/blobmsg.h +++ b/blobmsg.h @@ -162,7 +162,18 @@ static inline uint64_t blobmsg_get_u64(struct blob_attr *attr) void *blobmsg_alloc_string_buffer(struct blob_buf *buf, const char *name, int maxlen); void blobmsg_add_string_buffer(struct blob_buf *buf); -char *blobmsg_format_json(struct blob_attr *attr, bool list); +/* blobmsg to json formatting */ + +typedef const char *(*blobmsg_json_format_t)(void *priv, struct blob_attr *attr); + +char *blobmsg_format_json_with_cb(struct blob_attr *attr, bool list, + blobmsg_json_format_t cb, void *priv); + +static inline char *blobmsg_format_json(struct blob_attr *attr, bool list) +{ + return blobmsg_format_json_with_cb(attr, list, NULL, NULL); +} + #define blobmsg_for_each_attr(pos, attr, rem) \ for (rem = blobmsg_data_len(attr), pos = blobmsg_data(attr); \