X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=blobmsg.h;h=c4bf10d404abb231fa34a88aa994e3a3e2a1eeab;hb=d01922625d21f97fcab757d0299586178333f1e0;hp=f5043510b04fceecc3161841f01e0ecb98fc0014;hpb=f1494cde4d22f5df91d581ef7242e80b1cb367de;p=project%2Flibubox.git diff --git a/blobmsg.h b/blobmsg.h index f504351..c4bf10d 100644 --- a/blobmsg.h +++ b/blobmsg.h @@ -78,9 +78,11 @@ static inline int blobmsg_data_len(const struct blob_attr *attr) } bool blobmsg_check_attr(const struct blob_attr *attr, bool name); -bool blobmsg_check_attr_list(const struct blob_attr *attr, int type, bool name); +bool blobmsg_check_attr_list(const struct blob_attr *attr, int type); int blobmsg_parse(const struct blobmsg_policy *policy, int policy_len, struct blob_attr **tb, void *data, int len); +int blobmsg_parse_array(const struct blobmsg_policy *policy, int policy_len, + struct blob_attr **tb, void *data, int len); int blobmsg_add_field(struct blob_buf *buf, int type, const char *name, const void *data, int len); @@ -178,10 +180,19 @@ 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); /* blobmsg to json formatting */