Dynamic data buffer. More...
Go to the source code of this file.
Data Structures | |
struct | wpabuf |
Functions | |
int | wpabuf_resize (struct wpabuf **buf, size_t add_len) |
struct wpabuf * | wpabuf_alloc (size_t len) |
Allocate a wpabuf of the given size. | |
struct wpabuf * | wpabuf_alloc_ext_data (u8 *data, size_t len) |
struct wpabuf * | wpabuf_alloc_copy (const void *data, size_t len) |
struct wpabuf * | wpabuf_dup (const struct wpabuf *src) |
void | wpabuf_free (struct wpabuf *buf) |
Free a wpabuf. | |
void * | wpabuf_put (struct wpabuf *buf, size_t len) |
struct wpabuf * | wpabuf_concat (struct wpabuf *a, struct wpabuf *b) |
Concatenate two buffers into a newly allocated one. | |
struct wpabuf * | wpabuf_zeropad (struct wpabuf *buf, size_t len) |
Pad buffer with 0x00 octets (prefix) to specified length. | |
void | wpabuf_printf (struct wpabuf *buf, char *fmt,...) PRINTF_FORMAT(2 |
Dynamic data buffer.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
Alternatively, this software may be distributed under the terms of BSD license.
See README and COPYING for more details.
Definition in file wpabuf.h.
struct wpabuf* wpabuf_alloc | ( | size_t | len | ) | [read] |
Concatenate two buffers into a newly allocated one.
a | First buffer | |
b | Second buffer |
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 141 of file wpabuf.c.
void wpabuf_free | ( | struct wpabuf * | buf | ) |
Pad buffer with 0x00 octets (prefix) to specified length.
buf | Buffer to be padded | |
len | Length for the padded buffer |
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 182 of file wpabuf.c.