85 uint32_t data_start_offset,
const struct mmbuf_ops *ops)
222 memcpy(dest, data, len);
258 memcpy(dest, data, len);
337#define MMBUF_LIST_INIT { NULL, NULL, 0 }
421 return (list->
head == NULL);
static uint8_t * mmbuf_append(struct mmbuf *mmbuf, uint32_t len)
Reserves space immediately after the data currently in the given mmbuf and returns a pointer to this ...
static uint32_t mmbuf_available_space_at_end(struct mmbuf *mmbuf)
Returns the amount of space available for appending to the data in the buffer.
static uint32_t mmbuf_get_data_length(struct mmbuf *mmbuf)
Gets the length of the data currently in the mmbuf.
static struct mmbuf * mmbuf_list_dequeue_all(struct mmbuf_list *list)
Remove all mmbufs from the list and return as a linked list.
static uint8_t * mmbuf_get_data_end(struct mmbuf *mmbuf)
Gets a pointer to the end of the data in the mmbuf.
void mmbuf_list_prepend(struct mmbuf_list *list, struct mmbuf *mmbuf)
Add an mmbuf to the start of an mmbuf list.
struct mmbuf * mmbuf_list_dequeue_tail(struct mmbuf_list *list)
Remove the mmbuf at the tail of the list and return it.
static uint8_t * mmbuf_remove_from_end(struct mmbuf *mmbuf, uint32_t len)
Remove data from the end of the mmbuf.
void mmbuf_list_clear(struct mmbuf_list *list)
Free all the packets in the given list and reset the list to empty state.
static bool mmbuf_list_is_empty(struct mmbuf_list *list)
Checks whether the given mmbuf list is empty.
static uint8_t * mmbuf_remove_from_start(struct mmbuf *mmbuf, uint32_t len)
Remove data from the start of the mmbuf.
static uint8_t * mmbuf_prepend(struct mmbuf *mmbuf, uint32_t len)
Reserves space immediately before the data currently in the given mmbuf and returns a pointer to this...
struct mmbuf * mmbuf_alloc_on_heap(uint32_t space_at_start, uint32_t space_at_end)
Allocate a new mmbuf on the heap (using mmosal_malloc()).
static uint32_t mmbuf_available_space_at_start(struct mmbuf *mmbuf)
Returns the amount of space available for prepending to the data in the buffer.
bool mmbuf_list_remove(struct mmbuf_list *list, struct mmbuf *mmbuf)
Remove an mmbuf from an mmbuf list.
void mmbuf_release(struct mmbuf *mmbuf)
Release a reference to the given mmbuf.
static void mmbuf_append_data(struct mmbuf *mmbuf, const uint8_t *data, uint32_t len)
Appends the given data to the data already in the mmbuf.
static struct mmbuf * mmbuf_list_peek_tail(struct mmbuf_list *list)
Returns the tail of the mmbuf list.
static void mmbuf_list_init(struct mmbuf_list *list)
Initialization function for mmbuf_list, for cases where MMBUF_LIST_INIT cannot be used.
static void mmbuf_prepend_data(struct mmbuf *mmbuf, const uint8_t *data, uint32_t len)
Prepends the given data to the data already in the mmbuf.
static void mmbuf_truncate(struct mmbuf *mmbuf, uint32_t len)
Truncate the mmbuf data to the given length.
struct mmbuf * mmbuf_list_dequeue(struct mmbuf_list *list)
Remove the mmbuf at the head of the list and return it.
static uint8_t * mmbuf_get_data_start(struct mmbuf *mmbuf)
Gets a pointer to the start of the data in the mmbuf.
static void mmbuf_init(struct mmbuf *mmbuf, uint8_t *buf, uint32_t buf_len, uint32_t data_start_offset, const struct mmbuf_ops *ops)
Initialize an mmbuf header with the given values.
void mmbuf_list_append(struct mmbuf_list *list, struct mmbuf *mmbuf)
Add an mmbuf to the end of an mmbuf list.
static struct mmbuf * mmbuf_list_peek(struct mmbuf_list *list)
Returns the head of the mmbuf list.
struct mmbuf * mmbuf_make_copy_on_heap(struct mmbuf *original)
Make a copy of the given mmbuf.
#define MMOSAL_ASSERT(expr)
Assert that the given expression evaluates to true and abort execution if not.
char buf[1408]
Statically allocated buffer for HTTP GET request, just under 1 packet size.
Structure that can be used as the head of a linked list of mmbufs that counts its length.
volatile uint32_t len
Length of the list.
struct mmbuf *volatile head
First mmbuf in the list.
struct mmbuf *volatile tail
Last mmbuf in the list.
Operations data structure for mmbuf.
void(* free_mmbuf)(void *mmbuf)
Free the given mmbuf.
Core mmbuf data structure.
struct mmbuf *volatile next
Pointer that can be used to construct linked lists.
uint32_t start_offset
Offset where actual data starts in the buffer.
const struct mmbuf_ops * ops
Reference to operations data structure for this mmbuf.
uint32_t buf_len
Length of the buffer.
uint8_t * buf
The buffer where data is stored.
uint32_t data_len
Length of actual data in the buffer.