libubox
C utility functions for OpenWrt.
|
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include "utils.h"
Go to the source code of this file.
Data Structures | |
struct | blob_attr |
struct | blob_attr_info |
struct | blob_buf |
Macros | |
#define | BLOB_COOKIE 0x01234567 |
#define | BLOB_ATTR_ID_MASK 0x7f000000 |
#define | BLOB_ATTR_ID_SHIFT 24 |
#define | BLOB_ATTR_LEN_MASK 0x00ffffff |
#define | BLOB_ATTR_ALIGN 4 |
#define | BLOB_ATTR_EXTENDED 0x80000000 |
#define | blob_put_int8 blob_put_u8 |
#define | blob_put_int16 blob_put_u16 |
#define | blob_put_int32 blob_put_u32 |
#define | blob_put_int64 blob_put_u64 |
#define | __blob_for_each_attr(pos, attr, rem) |
#define | blob_for_each_attr(pos, attr, rem) |
#define | blob_for_each_attr_len(pos, attr, attr_len, rem) |
Enumerations | |
enum | { BLOB_ATTR_UNSPEC , BLOB_ATTR_NESTED , BLOB_ATTR_BINARY , BLOB_ATTR_STRING , BLOB_ATTR_INT8 , BLOB_ATTR_INT16 , BLOB_ATTR_INT32 , BLOB_ATTR_INT64 , BLOB_ATTR_DOUBLE , BLOB_ATTR_LAST } |
Functions | |
struct blob_attr | __attribute__ ((packed)) |
static void * | blob_data (const struct blob_attr *attr) |
static unsigned int | blob_id (const struct blob_attr *attr) |
static bool | blob_is_extended (const struct blob_attr *attr) |
static size_t | blob_len (const struct blob_attr *attr) |
static size_t | blob_raw_len (const struct blob_attr *attr) |
static size_t | blob_pad_len (const struct blob_attr *attr) |
static uint8_t | blob_get_u8 (const struct blob_attr *attr) |
static uint16_t | blob_get_u16 (const struct blob_attr *attr) |
static uint32_t | blob_get_u32 (const struct blob_attr *attr) |
static uint64_t | blob_get_u64 (const struct blob_attr *attr) |
static int8_t | blob_get_int8 (const struct blob_attr *attr) |
static int16_t | blob_get_int16 (const struct blob_attr *attr) |
static int32_t | blob_get_int32 (const struct blob_attr *attr) |
static int64_t | blob_get_int64 (const struct blob_attr *attr) |
static const char * | blob_get_string (const struct blob_attr *attr) |
static struct blob_attr * | blob_next (const struct blob_attr *attr) |
void | blob_fill_pad (struct blob_attr *attr) |
void | blob_set_raw_len (struct blob_attr *attr, unsigned int len) |
bool | blob_attr_equal (const struct blob_attr *a1, const struct blob_attr *a2) |
int | blob_buf_init (struct blob_buf *buf, int id) |
void | blob_buf_free (struct blob_buf *buf) |
bool | blob_buf_grow (struct blob_buf *buf, int required) |
struct blob_attr * | blob_new (struct blob_buf *buf, int id, int payload) |
void * | blob_nest_start (struct blob_buf *buf, int id) |
void | blob_nest_end (struct blob_buf *buf, void *cookie) |
struct blob_attr * | blob_put (struct blob_buf *buf, int id, const void *ptr, unsigned int len) |
bool | blob_check_type (const void *ptr, unsigned int len, int type) |
int | blob_parse (struct blob_attr *attr, struct blob_attr **data, const struct blob_attr_info *info, int max) |
int | blob_parse_untrusted (struct blob_attr *attr, size_t attr_len, struct blob_attr **data, const struct blob_attr_info *info, int max) |
struct blob_attr * | blob_memdup (struct blob_attr *attr) |
struct blob_attr * | blob_put_raw (struct blob_buf *buf, const void *ptr, unsigned int len) |
static struct blob_attr * | blob_put_string (struct blob_buf *buf, int id, const char *str) |
static struct blob_attr * | blob_put_u8 (struct blob_buf *buf, int id, uint8_t val) |
static struct blob_attr * | blob_put_u16 (struct blob_buf *buf, int id, uint16_t val) |
static struct blob_attr * | blob_put_u32 (struct blob_buf *buf, int id, uint32_t val) |
static struct blob_attr * | blob_put_u64 (struct blob_buf *buf, int id, uint64_t val) |
Variables | |
uint32_t | id_len |
char | data [] |
struct blob_attr_info | __attribute__ |
#define __blob_for_each_attr | ( | pos, | |
attr, | |||
rem | |||
) |
#define blob_for_each_attr | ( | pos, | |
attr, | |||
rem | |||
) |
#define blob_for_each_attr_len | ( | pos, | |
attr, | |||
attr_len, | |||
rem | |||
) |
#define blob_put_int16 blob_put_u16 |
#define blob_put_int32 blob_put_u32 |
#define blob_put_int64 blob_put_u64 |
#define blob_put_int8 blob_put_u8 |
anonymous enum |
struct blob_attr __attribute__ | ( | (packed) | ) |
void blob_buf_free | ( | struct blob_buf * | buf | ) |
bool blob_buf_grow | ( | struct blob_buf * | buf, |
int | required | ||
) |
Definition at line 57 of file blob.c.
int blob_buf_init | ( | struct blob_buf * | buf, |
int | id | ||
) |
bool blob_check_type | ( | const void * | ptr, |
unsigned int | len, | ||
int | type | ||
) |
|
inlinestatic |
void blob_fill_pad | ( | struct blob_attr * | attr | ) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
void blob_nest_end | ( | struct blob_buf * | buf, |
void * | cookie | ||
) |
Definition at line 185 of file blob.c.
void* blob_nest_start | ( | struct blob_buf * | buf, |
int | id | ||
) |
Definition at line 175 of file blob.c.
|
inlinestatic |
int blob_parse | ( | struct blob_attr * | attr, |
struct blob_attr ** | data, | ||
const struct blob_attr_info * | info, | ||
int | max | ||
) |
Definition at line 296 of file blob.c.
int blob_parse_untrusted | ( | struct blob_attr * | attr, |
size_t | attr_len, | ||
struct blob_attr ** | data, | ||
const struct blob_attr_info * | info, | ||
int | max | ||
) |
Definition at line 272 of file blob.c.
|
inlinestatic |
Definition at line 207 of file blob.h.
|
inlinestatic |
void blob_set_raw_len | ( | struct blob_attr * | attr, |
unsigned int | len | ||
) |
__attribute__ |
Definition at line 107 of file ulog.c.