add a blobmsg-to-json function
[project/libubox.git] / blobmsg.h
index 3085d00..c64cedb 100644 (file)
--- a/blobmsg.h
+++ b/blobmsg.h
@@ -49,6 +49,12 @@ static inline int blobmsg_hdrlen(int namelen)
        return BLOBMSG_PADDING(sizeof(struct blobmsg_hdr) + namelen + 1);
 }
 
+static inline void *blobmsg_name(struct blob_attr *attr)
+{
+       struct blobmsg_hdr *hdr = blob_data(attr);
+       return &hdr->name;
+}
+
 static inline void *blobmsg_data(struct blob_attr *attr)
 {
        struct blobmsg_hdr *hdr = blob_data(attr);
@@ -133,4 +139,6 @@ static inline int blobmsg_buf_init(struct blob_buf *buf)
        return blob_buf_init(buf, BLOBMSG_TYPE_TABLE);
 }
 
+char *blobmsg_format_json(struct blob_attr *attr);
+
 #endif