1 #ifndef __LUNAIX_BUFFER_H
2 #define __LUNAIX_BUFFER_H
4 #include <lunaix/ds/llist.h>
5 #include <lunaix/types.h>
15 struct llist_header components;
21 * @brief Free a vectorized buffer
26 vbuf_free(struct vecbuf* vbuf);
29 * @brief Allocate a buffer, or append to `vec` (if not NULL) as a component
30 * thus to form a vectorized buffer.
32 * @param vec the buffer used to construct a vectorized buffer.
33 * @param buf a memeory region that holds data or partial data if vectorized
34 * @param len maximum number of bytes should recieved.
35 * @return struct vecbuf*
38 vbuf_alloc(struct vecbuf* vec, void* buf, size_t len);
41 vbuf_size(struct vecbuf* vbuf)
48 list_entry(vbuf->components.prev, struct vecbuf, components);
52 #endif /* __LUNAIX_BUFFER_H */