wpa_supplicant / hostapd 2.0
Functions

wpabuf.c File Reference

Dynamic data buffer. More...

#include "includes.h"
#include "common.h"
#include "trace.h"
#include "wpabuf.h"

Functions

int wpabuf_resize (struct wpabuf **_buf, size_t add_len)
struct wpabufwpabuf_alloc (size_t len)
 Allocate a wpabuf of the given size.
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)
 Free a wpabuf.
void * wpabuf_put (struct wpabuf *buf, size_t len)
struct wpabufwpabuf_concat (struct wpabuf *a, struct wpabuf *b)
 Concatenate two buffers into a newly allocated one.
struct wpabufwpabuf_zeropad (struct wpabuf *buf, size_t len)
 Pad buffer with 0x00 octets (prefix) to specified length.
void wpabuf_printf (struct wpabuf *buf, char *fmt,...)

Detailed Description

Dynamic data buffer.

Copyright
Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi>

This software may be distributed under the terms of the BSD license. See README for more details.


Function Documentation

struct wpabuf* wpabuf_alloc ( size_t  len) [read]

Allocate a wpabuf of the given size.

Parameters:
lenLength for the allocated buffer
Returns:
Buffer to the allocated wpabuf or NULL on failure
struct wpabuf* wpabuf_concat ( struct wpabuf a,
struct wpabuf b 
) [read]

Concatenate two buffers into a newly allocated one.

Parameters:
aFirst buffer
bSecond 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.

void wpabuf_free ( struct wpabuf buf)

Free a wpabuf.

Parameters:
bufwpabuf buffer
struct wpabuf* wpabuf_zeropad ( struct wpabuf buf,
size_t  len 
) [read]

Pad buffer with 0x00 octets (prefix) to specified length.

Parameters:
bufBuffer to be padded
lenLength 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.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines