#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.
|
#define | ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
|
|
enum | {
FOO_STRING
, FOO_INT64_MAX
, FOO_INT64_MIN
, FOO_INT32_MAX
,
FOO_INT32_MIN
, FOO_INT16_MAX
, FOO_INT16_MIN
, FOO_INT8_MAX
,
FOO_INT8_MIN
, FOO_DOUBLE_MAX
, FOO_DOUBLE_MIN
, __FOO_MAX
} |
|
◆ ARRAY_SIZE
#define ARRAY_SIZE |
( |
|
x | ) |
(sizeof(x) / sizeof((x)[0])) |
◆ anonymous enum
Enumerator |
---|
FOO_STRING | |
FOO_INT64_MAX | |
FOO_INT64_MIN | |
FOO_INT32_MAX | |
FOO_INT32_MIN | |
FOO_INT16_MAX | |
FOO_INT16_MIN | |
FOO_INT8_MAX | |
FOO_INT8_MIN | |
FOO_DOUBLE_MAX | |
FOO_DOUBLE_MIN | |
__FOO_MAX | |
Definition at line 10 of file test-blobmsg-types.c.
◆ dump_message()
static void dump_message |
( |
struct blob_buf * |
buf | ) |
|
|
static |
Definition at line 123 of file test-blobmsg-types.c.
128 fprintf(stderr,
"Parse failed\n");
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 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 uint8_t blobmsg_get_u8(struct blob_attr *attr)
static const struct blobmsg_policy pol[]
◆ dump_message_cast_s64()
static void dump_message_cast_s64 |
( |
struct blob_buf * |
buf | ) |
|
|
static |
Definition at line 187 of file test-blobmsg-types.c.
192 fprintf(stderr,
"Parse failed\n");
static int64_t blobmsg_cast_s64(struct blob_attr *attr)
◆ dump_message_cast_s64_json()
static void dump_message_cast_s64_json |
( |
struct blob_buf * |
buf | ) |
|
|
static |
Definition at line 287 of file test-blobmsg-types.c.
292 fprintf(stderr,
"Parse failed\n");
static const struct blobmsg_policy pol_json[]
◆ dump_message_cast_u64()
static void dump_message_cast_u64 |
( |
struct blob_buf * |
buf | ) |
|
|
static |
Definition at line 155 of file test-blobmsg-types.c.
160 fprintf(stderr,
"Parse failed\n");
static uint64_t blobmsg_cast_u64(struct blob_attr *attr)
◆ dump_message_cast_u64_json()
static void dump_message_cast_u64_json |
( |
struct blob_buf * |
buf | ) |
|
|
static |
◆ dump_message_json()
static void dump_message_json |
( |
struct blob_buf * |
buf | ) |
|
|
static |
◆ fill_message()
static void fill_message |
( |
struct blob_buf * |
buf | ) |
|
|
static |
Definition at line 320 of file test-blobmsg-types.c.
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 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 335 of file test-blobmsg-types.c.
342 fprintf(stderr,
"[*] blobmsg dump:\n");
344 fprintf(stderr,
"[*] blobmsg dump cast_u64:\n");
346 fprintf(stderr,
"[*] blobmsg dump cast_s64:\n");
353 fprintf(stderr,
"\n[*] blobmsg to json: %s\n", json);
359 fprintf(stderr,
"\n[*] blobmsg from json:\n");
361 fprintf(stderr,
"\n[*] blobmsg from json/cast_u64:\n");
363 fprintf(stderr,
"\n[*] blobmsg from json/cast_s64:\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_cast_s64(struct blob_buf *buf)
static void dump_message(struct blob_buf *buf)
static void dump_message_cast_u64_json(struct blob_buf *buf)
static void dump_message_cast_u64(struct blob_buf *buf)
static void dump_message_cast_s64_json(struct blob_buf *buf)
static void dump_message_json(struct blob_buf *buf)
◆ pol
◆ pol_json