Lines Matching refs:wpabuf
13 #include "wpabuf.h"
22 static struct wpabuf_trace * wpabuf_get_trace(const struct wpabuf *buf)
30 static void wpabuf_overflow(const struct wpabuf *buf, size_t len)
35 wpa_printf(MSG_ERROR, "wpabuf: invalid magic %x",
39 wpa_printf(MSG_ERROR, "wpabuf %p (size=%lu used=%lu) overflow len=%lu",
42 wpa_trace_show("wpabuf overflow");
47 int wpabuf_resize(struct wpabuf **_buf, size_t add_len)
49 struct wpabuf *buf = *_buf;
62 wpa_printf(MSG_ERROR, "wpabuf: invalid magic %x",
80 sizeof(struct wpabuf) +
85 buf = (struct wpabuf *) (trace + 1);
87 sizeof(struct wpabuf) + buf->used, 0,
90 nbuf = os_realloc(buf, sizeof(struct wpabuf) +
94 buf = (struct wpabuf *) nbuf;
95 os_memset(nbuf + sizeof(struct wpabuf) + buf->used, 0,
109 * wpabuf_alloc - Allocate a wpabuf of the given size
111 * Returns: Buffer to the allocated wpabuf or %NULL on failure
113 struct wpabuf * wpabuf_alloc(size_t len)
117 sizeof(struct wpabuf) + len);
118 struct wpabuf *buf;
122 buf = (struct wpabuf *) (trace + 1);
124 struct wpabuf *buf = os_zalloc(sizeof(struct wpabuf) + len);
135 struct wpabuf * wpabuf_alloc_ext_data(u8 *data, size_t len)
139 sizeof(struct wpabuf));
140 struct wpabuf *buf;
144 buf = (struct wpabuf *) (trace + 1);
146 struct wpabuf *buf = os_zalloc(sizeof(struct wpabuf));
160 struct wpabuf * wpabuf_alloc_copy(const void *data, size_t len)
162 struct wpabuf *buf = wpabuf_alloc(len);
169 struct wpabuf * wpabuf_dup(const struct wpabuf *src)
171 struct wpabuf *buf = wpabuf_alloc(wpabuf_len(src));
179 * wpabuf_free - Free a wpabuf
180 * @buf: wpabuf buffer
182 void wpabuf_free(struct wpabuf *buf)
208 void wpabuf_clear_free(struct wpabuf *buf)
217 void * wpabuf_put(struct wpabuf *buf, size_t len)
232 * Returns: wpabuf with concatenated a + b data or %NULL on failure
237 struct wpabuf * wpabuf_concat(struct wpabuf *a, struct wpabuf *b)
239 struct wpabuf *n = NULL;
267 * Returns: wpabuf padded to len octets or %NULL on failure
275 struct wpabuf * wpabuf_zeropad(struct wpabuf *buf, size_t len)
277 struct wpabuf *ret;
298 void wpabuf_printf(struct wpabuf *buf, char *fmt, ...)
314 * wpabuf_parse_bin - Parse a null terminated string of binary data to a wpabuf
316 * Returns: wpabuf or %NULL on failure
320 struct wpabuf * wpabuf_parse_bin(const char *buf)
323 struct wpabuf *ret;