#include <stdio.h>
#include <float.h>
#include <limits.h>
#include <stdint.h>
#include <inttypes.h>
#include "blobmsg.h"
#include "blobmsg_json.h"
Go to the source code of this file.
◆ ARRAY_SIZE
#define ARRAY_SIZE |
( |
|
x | ) |
(sizeof(x) / sizeof((x)[0])) |
◆ indent_printf
#define indent_printf |
( |
|
indent, |
|
|
|
... |
|
) |
| |
Value: do { \
if (indent > 0) \
fprintf(stderr, __VA_ARGS__); \
} while(0)
static const char * indent_str
Definition at line 12 of file test-blobmsg.c.
◆ anonymous enum
Enumerator |
---|
FOO_MESSAGE | |
FOO_LIST | |
FOO_TESTDATA | |
Definition at line 68 of file test-blobmsg.c.
◆ dump_attr_data()
static void dump_attr_data |
( |
struct blob_attr * |
data, |
|
|
int |
indent, |
|
|
int |
next_indent |
|
) |
| |
|
static |
Definition at line 36 of file test-blobmsg.c.
static size_t blobmsg_data_len(const struct blob_attr *attr)
static uint16_t blobmsg_get_u16(struct blob_attr *attr)
static char * blobmsg_get_string(struct blob_attr *attr)
static uint32_t blobmsg_get_u32(struct blob_attr *attr)
static uint64_t blobmsg_get_u64(struct blob_attr *attr)
static double blobmsg_get_double(struct blob_attr *attr)
static void * blobmsg_data(const struct blob_attr *attr)
static uint8_t blobmsg_get_u8(struct blob_attr *attr)
#define indent_printf(indent,...)
static void dump_table(struct blob_attr *head, size_t len, int indent, bool array)
◆ dump_message()
static void dump_message |
( |
struct blob_buf * |
buf | ) |
|
|
static |
Definition at line 93 of file test-blobmsg.c.
98 fprintf(stderr,
"Parse failed\n");
105 fprintf(stderr,
"List: ");
109 fprintf(stderr,
"Testdata: ");
static size_t blob_len(const struct blob_attr *attr)
static void * blob_data(const 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 const struct blobmsg_policy pol[]
◆ dump_table()
static void dump_table |
( |
struct blob_attr * |
head, |
|
|
size_t |
len, |
|
|
int |
indent, |
|
|
bool |
array |
|
) |
| |
|
static |
Definition at line 21 of file test-blobmsg.c.
#define __blob_for_each_attr(pos, attr, rem)
static void dump_attr_data(struct blob_attr *data, int indent, int next_indent)
◆ fill_message()
static void fill_message |
( |
struct blob_buf * |
buf | ) |
|
|
static |
Definition at line 115 of file test-blobmsg.c.
static void * blobmsg_open_table(struct blob_buf *buf, const char *name)
static void blobmsg_close_table(struct blob_buf *buf, void *cookie)
static int blobmsg_add_u8(struct blob_buf *buf, const char *name, uint8_t val)
static int blobmsg_add_u64(struct blob_buf *buf, const char *name, uint64_t val)
static int blobmsg_add_string(struct blob_buf *buf, const char *name, const char *string)
static int blobmsg_add_u16(struct blob_buf *buf, const char *name, uint16_t val)
static void * blobmsg_open_array(struct blob_buf *buf, const char *name)
static int blobmsg_add_double(struct blob_buf *buf, const char *name, double val)
static int blobmsg_add_u32(struct blob_buf *buf, const char *name, uint32_t val)
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 153 of file test-blobmsg.c.
160 fprintf(stderr,
"[*] blobmsg dump:\n");
167 fprintf(stderr,
"\n[*] blobmsg to json: %s\n", json);
173 fprintf(stderr,
"\n[*] blobmsg from json:\n");
static int blobmsg_buf_init(struct blob_buf *buf)
bool blobmsg_add_json_from_string(struct blob_buf *b, const char *str)
static char * blobmsg_format_json(struct blob_attr *attr, bool list)
static void fill_message(struct blob_buf *buf)
static void dump_message(struct blob_buf *buf)
◆ indent_str
const char* indent_str = "\t\t\t\t\t\t\t\t\t\t\t\t\t" |
|
static |
◆ pol
Initial value:= {
.name = "message",
},
.name = "list",
},
.name = "testdata",
},
}
Definition at line 36 of file test-blobmsg.c.