Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-02-06 23:23:28 +0300
committerFelix Fietkau <nbd@openwrt.org>2011-02-06 23:23:28 +0300
commit0918243e90e64117d898d782de683597216f3137 (patch)
tree84e66d0ceac0a306afabf29a2b5e944cef3a7c46 /blobmsg_json.h
parent677e7bc0b332a09fde6142119f42e5bac11979d3 (diff)
move json formatting to the blobmsg_json library
Diffstat (limited to 'blobmsg_json.h')
-rw-r--r--blobmsg_json.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/blobmsg_json.h b/blobmsg_json.h
index 0ba5f86..49a8b9b 100644
--- a/blobmsg_json.h
+++ b/blobmsg_json.h
@@ -18,10 +18,19 @@
#include <json/json.h>
#include <stdbool.h>
-
-struct blob_buf;
+#include "blobmsg.h"
bool blobmsg_add_json_element(struct blob_buf *b, const char *name, json_object *obj);
bool blobmsg_add_json_from_string(struct blob_buf *b, const char *str);
+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);
+}
+
#endif