uloop: Fix incorrect timeout
[project/libubox.git] / blobmsg.h
index 056f79a7dcd465fc3e835c13536acbf420345647..3eeec9b035ea63aca99b2a7f9e609d7b9d6df958 100644 (file)
--- a/blobmsg.h
+++ b/blobmsg.h
@@ -16,6 +16,7 @@
 #ifndef __BLOBMSG_H
 #define __BLOBMSG_H
 
+#include <stdarg.h>
 #include "blob.h"
 
 #define BLOBMSG_ALIGN  2
@@ -180,12 +181,26 @@ static inline uint32_t blobmsg_get_u32(struct blob_attr *attr)
 
 static inline uint64_t blobmsg_get_u64(struct blob_attr *attr)
 {
-       return be64_to_cpu(*(uint64_t *) blobmsg_data(attr));
+       uint32_t *ptr = blobmsg_data(attr);
+       uint64_t tmp = ((uint64_t) be32_to_cpu(ptr[0])) << 32;
+       tmp |= be32_to_cpu(ptr[1]);
+       return tmp;
+}
+
+static inline char *blobmsg_get_string(struct blob_attr *attr)
+{
+       return blobmsg_data(attr);
 }
 
 void *blobmsg_alloc_string_buffer(struct blob_buf *buf, const char *name, int maxlen);
+void *blobmsg_realloc_string_buffer(struct blob_buf *buf, int maxlen);
 void blobmsg_add_string_buffer(struct blob_buf *buf);
 
+void blobmsg_vprintf(struct blob_buf *buf, const char *name, const char *format, va_list arg);
+void blobmsg_printf(struct blob_buf *buf, const char *name, const char *format, ...)
+     __attribute__((format(printf, 3, 4)));
+
+
 /* blobmsg to json formatting */
 
 #define blobmsg_for_each_attr(pos, attr, rem) \