21 #define WPABUF_FLAG_EXT_DATA BIT(0)
54 static inline
size_t wpabuf_size(const struct
wpabuf *
buf) {
return buf->size; }
61 static inline size_t wpabuf_len(
const struct wpabuf *
buf) {
return buf->used; }
68 static inline size_t wpabuf_tailroom(
const struct wpabuf *
buf) {
69 return buf->size -
buf->used;
78 static inline int wpabuf_cmp(
const struct wpabuf *a,
const struct wpabuf *b) {
81 if (a && b && wpabuf_size(a) == wpabuf_size(b))
91 static inline const void *wpabuf_head(
const struct wpabuf *
buf) {
95 static inline const u8 *wpabuf_head_u8(
const struct wpabuf *
buf) {
96 return (
const u8 *)wpabuf_head(
buf);
104 static inline void *wpabuf_mhead(
struct wpabuf *
buf) {
return buf->buf; }
106 static inline u8 *wpabuf_mhead_u8(
struct wpabuf *
buf) {
107 return (
u8 *)wpabuf_mhead(
buf);
110 static inline void wpabuf_put_u8(
struct wpabuf *
buf,
u8 data) {
115 static inline void wpabuf_put_le16(
struct wpabuf *
buf,
u16 data) {
117 WPA_PUT_LE16(pos, data);
120 static inline void wpabuf_put_le32(
struct wpabuf *
buf,
u32 data) {
122 WPA_PUT_LE32(pos, data);
125 static inline void wpabuf_put_le64(
struct wpabuf *
buf,
u64 data) {
127 WPA_PUT_LE64(pos, data);
130 static inline void wpabuf_put_be16(
struct wpabuf *
buf,
u16 data) {
132 WPA_PUT_BE16(pos, data);
135 static inline void wpabuf_put_be24(
struct wpabuf *
buf,
u32 data) {
137 WPA_PUT_BE24(pos, data);
140 static inline void wpabuf_put_be32(
struct wpabuf *
buf,
u32 data) {
142 WPA_PUT_BE32(pos, data);
145 static inline void wpabuf_put_be64(
struct wpabuf *
buf,
u64 data) {
147 WPA_PUT_BE64(pos, data);
150 static inline void wpabuf_put_data(
struct wpabuf *
buf,
const void *data,
156 static inline void wpabuf_put_buf(
struct wpabuf *dst,
157 const struct wpabuf *src) {
158 wpabuf_put_data(dst, wpabuf_head(src), wpabuf_len(src));
161 static inline void wpabuf_set(
struct wpabuf *
buf,
const void *data,
163 buf->buf = (
u8 *)data;
165 buf->size =
buf->used = len;
168 static inline void wpabuf_put_str(
struct wpabuf *dst,
const char *str) {
169 wpabuf_put_data(dst, str,
os_strlen(str));
File containing the definition of the allocs functionalities.
#define os_memcpy(d, s, n)
Definition: allocs.h:63
#define os_memcmp(s1, s2, n)
Definition: allocs.h:72
File containing the common definitions used by radius and eap.
uint64_t u64
Definition: common.h:22
uint8_t u8
Definition: common.h:25
uint16_t u16
Definition: common.h:24
uint32_t u32
Definition: common.h:23
#define PRINTF_FORMAT(a, b)
Definition: log.h:50
File containing the definition of the os functionalities.
#define os_strlen(s)
Definition: os.h:53
size_t used
Definition: wpabuf.h:30
size_t size
Definition: wpabuf.h:29
unsigned int flags
Definition: wpabuf.h:32
u8 * buf
Definition: wpabuf.h:31
#define WPABUF_FLAG_EXT_DATA
Definition: wpabuf.h:21
struct wpabuf * wpabuf_zeropad(struct wpabuf *buf, size_t len)
Definition: wpabuf.c:251
int wpabuf_resize(struct wpabuf **buf, size_t add_len)
Definition: wpabuf.c:46
struct wpabuf * wpabuf_concat(struct wpabuf *a, struct wpabuf *b)
Definition: wpabuf.c:215
void wpabuf_printf(struct wpabuf *buf, char *fmt,...) PRINTF_FORMAT(2
struct wpabuf * wpabuf_alloc_ext_data(u8 *data, size_t len)
Definition: wpabuf.c:126
struct wpabuf * wpabuf_alloc(size_t len)
Definition: wpabuf.c:106
struct wpabuf * wpabuf_dup(const struct wpabuf *src)
Definition: wpabuf.c:156
void wpabuf_free(struct wpabuf *buf)
Definition: wpabuf.c:167
void struct wpabuf * wpabuf_parse_bin(const char *buf)
Definition: wpabuf.c:292
struct wpabuf * wpabuf_alloc_copy(const void *data, size_t len)
Definition: wpabuf.c:149
void * wpabuf_put(struct wpabuf *buf, size_t len)
Definition: wpabuf.c:197
void wpabuf_clear_free(struct wpabuf *buf)
Definition: wpabuf.c:190