EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
Data Structures | Macros | Functions
wpabuf.h File Reference

Dynamic data buffer. More...

#include "common.h"
#include "utils/allocs.h"
#include "utils/os.h"
Include dependency graph for wpabuf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  wpabuf
 

Macros

#define WPABUF_FLAG_EXT_DATA   BIT(0)
 

Functions

int wpabuf_resize (struct wpabuf **buf, size_t add_len)
 
struct wpabufwpabuf_alloc (size_t len)
 
struct wpabufwpabuf_alloc_ext_data (u8 *data, size_t len)
 
struct wpabufwpabuf_alloc_copy (const void *data, size_t len)
 
struct wpabufwpabuf_dup (const struct wpabuf *src)
 
void wpabuf_free (struct wpabuf *buf)
 
void wpabuf_clear_free (struct wpabuf *buf)
 
void * wpabuf_put (struct wpabuf *buf, size_t len)
 
struct wpabufwpabuf_concat (struct wpabuf *a, struct wpabuf *b)
 
struct wpabufwpabuf_zeropad (struct wpabuf *buf, size_t len)
 
void wpabuf_printf (struct wpabuf *buf, char *fmt,...) PRINTF_FORMAT(2
 
void struct wpabufwpabuf_parse_bin (const char *buf)
 

Detailed Description

Dynamic data buffer.

Author
Alexandru Mereacre, Alois Klink, Jouni Malinen
Version
Adapted from hostap 2.10 - src/utils/wpabuf.h

Macro Definition Documentation

◆ WPABUF_FLAG_EXT_DATA

#define WPABUF_FLAG_EXT_DATA   BIT(0)

Function Documentation

◆ wpabuf_alloc()

struct wpabuf* wpabuf_alloc ( size_t  len)

wpabuf_alloc - Allocate a wpabuf of the given size @len: Length for the allocated buffer Returns: Buffer to the allocated wpabuf or NULL on failure

◆ wpabuf_alloc_copy()

struct wpabuf* wpabuf_alloc_copy ( const void *  data,
size_t  len 
)

◆ wpabuf_alloc_ext_data()

struct wpabuf* wpabuf_alloc_ext_data ( u8 data,
size_t  len 
)

◆ wpabuf_clear_free()

void wpabuf_clear_free ( struct wpabuf buf)

◆ wpabuf_concat()

struct wpabuf* wpabuf_concat ( struct wpabuf a,
struct wpabuf b 
)

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.

◆ wpabuf_dup()

struct wpabuf* wpabuf_dup ( const struct wpabuf src)

◆ wpabuf_free()

void wpabuf_free ( struct wpabuf buf)

wpabuf_free - Free a wpabuf @buf: wpabuf buffer

◆ wpabuf_parse_bin()

void struct wpabuf* wpabuf_parse_bin ( const char *  buf)

wpabuf_parse_bin - Parse a null terminated string of binary data to a wpabuf @buf: Buffer with null terminated string (hexdump) of binary data Returns: wpabuf or NULL on failure

The string len must be a multiple of two and contain only hexadecimal digits.

◆ wpabuf_printf()

void wpabuf_printf ( struct wpabuf buf,
char *  fmt,
  ... 
)

◆ wpabuf_put()

void* wpabuf_put ( struct wpabuf buf,
size_t  len 
)

◆ wpabuf_resize()

int wpabuf_resize ( struct wpabuf **  buf,
size_t  add_len 
)

◆ wpabuf_zeropad()

struct wpabuf* wpabuf_zeropad ( struct wpabuf buf,
size_t  len 
)

wpabuf_zeropad - Pad buffer with 0x00 octets (prefix) to specified length @buf: Buffer to be padded @len: 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.