22 #define BLOBMSG_ALIGN 2
23 #define BLOBMSG_PADDING(len) (((len) + (1 << BLOBMSG_ALIGN) - 1) & ~((1 << BLOBMSG_ALIGN) - 1))
65 return (
const char *)(hdr + 1);
105 return blob_len(attr) - (end - start);
179 const void *
data,
unsigned int len);
301 uint64_t tmp = ((uint64_t)
be32_to_cpu(ptr[0])) << 32;
364 #define blobmsg_for_each_attr(pos, attr, rem) \
365 for (rem = attr ? blobmsg_data_len(attr) : 0, \
366 pos = (struct blob_attr *) (attr ? blobmsg_data(attr) : NULL); \
367 rem >= sizeof(struct blob_attr) && (blob_pad_len(pos) <= rem) && \
368 (blob_pad_len(pos) >= sizeof(struct blob_attr)); \
369 rem -= blob_pad_len(pos), pos = blob_next(pos))
371 #define __blobmsg_for_each_attr(pos, attr, rem) \
372 for (pos = (struct blob_attr *) (attr ? blobmsg_data(attr) : NULL); \
373 rem >= sizeof(struct blob_attr) && (blob_pad_len(pos) <= rem) && \
374 (blob_pad_len(pos) >= sizeof(struct blob_attr)); \
375 rem -= blob_pad_len(pos), pos = blob_next(pos))
void blob_nest_end(struct blob_buf *buf, void *cookie)
int blob_buf_init(struct blob_buf *buf, int id)
static bool blob_is_extended(const struct blob_attr *attr)
static size_t blob_len(const struct blob_attr *attr)
static void * blob_data(const struct blob_attr *attr)
static unsigned int blob_id(const struct blob_attr *attr)
bool blobmsg_check_attr_list(const struct blob_attr *attr, int type)
static size_t blobmsg_data_len(const struct blob_attr *attr)
static void * blobmsg_open_table(struct blob_buf *buf, const char *name)
static int blobmsg_add_blob(struct blob_buf *buf, struct blob_attr *attr)
static size_t blobmsg_len(const struct blob_attr *attr)
static void blobmsg_close_table(struct blob_buf *buf, void *cookie)
int blobmsg_vprintf(struct blob_buf *buf, const char *name, const char *format, va_list arg)
static int blobmsg_add_u8(struct blob_buf *buf, const char *name, uint8_t val)
static uint16_t blobmsg_get_u16(struct blob_attr *attr)
static const char * blobmsg_name(const struct blob_attr *attr)
static int blobmsg_add_u64(struct blob_buf *buf, const char *name, uint64_t val)
static char * blobmsg_get_string(struct blob_attr *attr)
static int blobmsg_add_string(struct blob_buf *buf, const char *name, const char *string)
static void blobmsg_close_array(struct blob_buf *buf, void *cookie)
int blobmsg_printf(struct blob_buf *buf, const char *name, const char *format,...) __attribute__((format(printf
bool blobmsg_check_attr_len(const struct blob_attr *attr, bool name, size_t len)
int blobmsg_add_field(struct blob_buf *buf, int type, const char *name, const void *data, unsigned int len)
int blobmsg_check_array_len(const struct blob_attr *attr, int type, size_t len)
static int blobmsg_add_u16(struct blob_buf *buf, const char *name, uint16_t val)
void * blobmsg_open_nested(struct blob_buf *buf, const char *name, bool array)
static uint16_t blobmsg_namelen(const struct blobmsg_hdr *hdr)
static int blobmsg_buf_init(struct blob_buf *buf)
bool blobmsg_check_attr_list_len(const struct blob_attr *attr, int type, size_t len)
void * blobmsg_alloc_string_buffer(struct blob_buf *buf, const char *name, unsigned int maxlen)
static uint32_t blobmsg_get_u32(struct blob_attr *attr)
static int blobmsg_parse_array_attr(const struct blobmsg_policy *policy, int policy_len, struct blob_attr **tb, struct blob_attr *data)
static void blobmsg_clear_name(struct blob_attr *attr)
static uint64_t blobmsg_cast_u64(struct blob_attr *attr)
static int blobmsg_parse_attr(const struct blobmsg_policy *policy, int policy_len, struct blob_attr **tb, struct blob_attr *data)
int blobmsg_check_array(const struct blob_attr *attr, int type)
void blobmsg_add_string_buffer(struct blob_buf *buf)
bool blobmsg_check_attr(const struct blob_attr *attr, bool name)
static void * blobmsg_open_array(struct blob_buf *buf, const char *name)
static uint64_t blobmsg_get_u64(struct blob_attr *attr)
#define BLOBMSG_PADDING(len)
static double blobmsg_get_double(struct blob_attr *attr)
static int blobmsg_hdrlen(unsigned int namelen)
static void * blobmsg_data(const struct blob_attr *attr)
static int blobmsg_add_double(struct blob_buf *buf, const char *name, double val)
static bool blobmsg_get_bool(struct blob_attr *attr)
int blobmsg_parse_array(const struct blobmsg_policy *policy, int policy_len, struct blob_attr **tb, void *data, unsigned int len)
struct blobmsg_policy __attribute__
static uint8_t blobmsg_get_u8(struct blob_attr *attr)
static int64_t blobmsg_cast_s64(struct blob_attr *attr)
int blobmsg_parse(const struct blobmsg_policy *policy, int policy_len, struct blob_attr **tb, void *data, unsigned int len)
static int blobmsg_add_u32(struct blob_buf *buf, const char *name, uint32_t val)
void * blobmsg_realloc_string_buffer(struct blob_buf *buf, unsigned int maxlen)