wpabuf.h File Reference
Go to the source code of this file.
Classes |
struct | wpabuf |
Functions |
struct wpabuf * | wpabuf_alloc (size_t len) |
struct wpabuf * | wpabuf_alloc_copy (const void *data, size_t len) |
struct wpabuf * | wpabuf_alloc_ext_data (u8 *data, size_t len) |
struct wpabuf * | wpabuf_concat (struct wpabuf *a, struct wpabuf *b) |
struct wpabuf * | wpabuf_dup (const struct wpabuf *src) |
void | wpabuf_free (struct wpabuf *buf) |
static const void * | wpabuf_head (const struct wpabuf *buf) |
static const u8 * | wpabuf_head_u8 (const struct wpabuf *buf) |
static size_t | wpabuf_len (const struct wpabuf *buf) |
static void * | wpabuf_mhead (struct wpabuf *buf) |
static u8 * | wpabuf_mhead_u8 (struct wpabuf *buf) |
void | wpabuf_printf (struct wpabuf *buf, char *fmt,...) PRINTF_FORMAT(2 |
void * | wpabuf_put (struct wpabuf *buf, size_t len) |
static void | wpabuf_put_be16 (struct wpabuf *buf, u16 data) |
static void | wpabuf_put_be24 (struct wpabuf *buf, u32 data) |
static void | wpabuf_put_be32 (struct wpabuf *buf, u32 data) |
static void | wpabuf_put_buf (struct wpabuf *dst, const struct wpabuf *src) |
static void | wpabuf_put_data (struct wpabuf *buf, const void *data, size_t len) |
static void | wpabuf_put_le16 (struct wpabuf *buf, u16 data) |
static void | wpabuf_put_str (struct wpabuf *dst, const char *str) |
static void | wpabuf_put_u8 (struct wpabuf *buf, u8 data) |
int | wpabuf_resize (struct wpabuf **buf, size_t add_len) |
static void | wpabuf_set (struct wpabuf *buf, const void *data, size_t len) |
void static size_t | wpabuf_size (const struct wpabuf *buf) |
static size_t | wpabuf_tailroom (const struct wpabuf *buf) |
struct wpabuf * | wpabuf_zeropad (struct wpabuf *buf, size_t len) |
Function Documentation
struct wpabuf* wpabuf_alloc |
( |
size_t |
len |
) |
[read] |
wpabuf_alloc - Allocate a wpabuf of the given size : Length for the allocated buffer Returns: Buffer to the allocated wpabuf or NULL on failure
Definition at line 118 of file wpabuf.c.
struct wpabuf* wpabuf_alloc_copy |
( |
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | [read] |
struct wpabuf* wpabuf_alloc_ext_data |
( |
u8 * |
data, |
|
|
size_t |
len | |
|
) |
| | [read] |
wpabuf_concat - Concatenate two buffers into a newly allocated one : First buffer : Second buffer Returns: wpabuf with concatenated a + b data or NULL on failure
Both buffers a and b will be freed regardless of the return value. Input buffers can be NULL which is interpreted as an empty buffer.
Definition at line 229 of file wpabuf.c.
struct wpabuf* wpabuf_dup |
( |
const struct wpabuf * |
src |
) |
[read] |
void wpabuf_free |
( |
struct wpabuf * |
buf |
) |
|
wpabuf_free - Free a wpabuf : wpabuf buffer
Definition at line 185 of file wpabuf.c.
static const void* wpabuf_head |
( |
const struct wpabuf * |
buf |
) |
[inline, static] |
wpabuf_head - Get pointer to the head of the buffer data : wpabuf buffer Returns: Pointer to the head of the buffer data
Definition at line 79 of file wpabuf.h.
static const u8* wpabuf_head_u8 |
( |
const struct wpabuf * |
buf |
) |
[inline, static] |
static size_t wpabuf_len |
( |
const struct wpabuf * |
buf |
) |
[inline, static] |
wpabuf_len - Get the current length of a wpabuf buffer data : wpabuf buffer Returns: Currently used length of the buffer
Definition at line 59 of file wpabuf.h.
static void* wpabuf_mhead |
( |
struct wpabuf * |
buf |
) |
[inline, static] |
wpabuf_mhead - Get modifiable pointer to the head of the buffer data : wpabuf buffer Returns: Pointer to the head of the buffer data
Definition at line 96 of file wpabuf.h.
static u8* wpabuf_mhead_u8 |
( |
struct wpabuf * |
buf |
) |
[inline, static] |
void wpabuf_printf |
( |
struct wpabuf * |
buf, |
|
|
char * |
fmt, |
|
|
|
... | |
|
) |
| | |
void* wpabuf_put |
( |
struct wpabuf * |
buf, |
|
|
size_t |
len | |
|
) |
| | |
static void wpabuf_put_be16 |
( |
struct wpabuf * |
buf, |
|
|
u16 |
data | |
|
) |
| | [inline, static] |
static void wpabuf_put_be24 |
( |
struct wpabuf * |
buf, |
|
|
u32 |
data | |
|
) |
| | [inline, static] |
static void wpabuf_put_be32 |
( |
struct wpabuf * |
buf, |
|
|
u32 |
data | |
|
) |
| | [inline, static] |
static void wpabuf_put_buf |
( |
struct wpabuf * |
dst, |
|
|
const struct wpabuf * |
src | |
|
) |
| | [inline, static] |
static void wpabuf_put_data |
( |
struct wpabuf * |
buf, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | [inline, static] |
static void wpabuf_put_le16 |
( |
struct wpabuf * |
buf, |
|
|
u16 |
data | |
|
) |
| | [inline, static] |
static void wpabuf_put_str |
( |
struct wpabuf * |
dst, |
|
|
const char * |
str | |
|
) |
| | [inline, static] |
static void wpabuf_put_u8 |
( |
struct wpabuf * |
buf, |
|
|
u8 |
data | |
|
) |
| | [inline, static] |
int wpabuf_resize |
( |
struct wpabuf ** |
buf, |
|
|
size_t |
add_len | |
|
) |
| | |
static void wpabuf_set |
( |
struct wpabuf * |
buf, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | [inline, static] |
void static size_t wpabuf_size |
( |
const struct wpabuf * |
buf |
) |
[inline, static] |
wpabuf_size - Get the currently allocated size of a wpabuf buffer : wpabuf buffer Returns: Currently allocated size of the buffer
Definition at line 49 of file wpabuf.h.
static size_t wpabuf_tailroom |
( |
const struct wpabuf * |
buf |
) |
[inline, static] |
wpabuf_tailroom - Get size of available tail room in the end of the buffer : wpabuf buffer Returns: Tail room (in bytes) of available space in the end of the buffer
Definition at line 69 of file wpabuf.h.
struct wpabuf* wpabuf_zeropad |
( |
struct wpabuf * |
buf, |
|
|
size_t |
len | |
|
) |
| | [read] |
wpabuf_zeropad - Pad buffer with 0x00 octets (prefix) to specified length : Buffer to be padded : Length for the padded buffer Returns: wpabuf padded to len octets or NULL on failure
If buf is longer than len octets or of same size, it will be returned as-is. Otherwise a new buffer is allocated and prefixed with 0x00 octets followed by the source data. The source buffer will be freed on error, i.e., caller will only be responsible on freeing the returned buffer. If buf is NULL, NULL will be returned.
Definition at line 269 of file wpabuf.c.