Memory management for socket. More...
Typedefs |
|
| typedef uint32_t(* | mbuf_read_fn )(void *p_ctx, uint32_t read_offset, uint8_t *p_dest, uint32_t dest_len) |
|
Function for reading data from a buffer.
|
|
| typedef uint32_t(* | mbuf_buf_len_fn )(void *p_ctx) |
|
Function for checking buffer length.
|
|
| typedef void(* | mbuf_free_fn )(void *p_ctx) |
|
Function for freeing a buffer.
|
|
Functions |
|
| uint32_t | mbuf_init ( mbuf_t *p_mbuf, mbuf_read_fn read_fn, mbuf_buf_len_fn buf_len_fn, mbuf_free_fn free_fn, uint32_t nmemb) |
|
Function for initializing the memory buffer manager.
More...
|
|
| void | mbuf_deinit ( mbuf_t *p_mbuf) |
|
Function for deinitializing the memory buffer manager.
More...
|
|
| uint32_t | mbuf_write ( mbuf_t *p_mbuf, void *p_ctx) |
|
Function for putting a data buffer in the mbuf.
More...
|
|
| uint32_t | mbuf_read ( mbuf_t *p_mbuf, void *p_buf, uint32_t buf_size) |
|
Function for reading data from the mbuf.
More...
|
|
| bool | mbuf_empty ( mbuf_t *p_mbuf) |
|
Function for checking if the mbuf is empty.
More...
|
|
Detailed Description
Memory management for socket.
Function Documentation
| void mbuf_deinit | ( | mbuf_t * | p_mbuf | ) |
Function for deinitializing the memory buffer manager.
This function releases any resources allocated for mbuf instance pointed by p_mbuf.
- Parameters
-
[in,out] p_mbuf Pointer to the mbuf structure to deinitialize.
| bool mbuf_empty | ( | mbuf_t * | p_mbuf | ) |
Function for checking if the mbuf is empty.
- Parameters
-
[in] p_mbuf Pointer to the mbuf structure that shall be checked.
- Returns
- True if mbuf is empty, false otherwise.
| uint32_t mbuf_init | ( | mbuf_t * | p_mbuf , |
| mbuf_read_fn | read_fn , | ||
| mbuf_buf_len_fn | buf_len_fn , | ||
| mbuf_free_fn | free_fn , | ||
| uint32_t | nmemb | ||
| ) |
Function for initializing the memory buffer manager.
This function allocates resources for the mbuf FIFO and initializes the mbuf.
- Parameters
-
[in,out] p_mbuf Pointer to the mbuf structure to initialize. [in] read_fn Function for reading data from a buffer. [in] buf_len_fn Function for checking buffer length. [in] free_fn Function for freeing a buffer. [in] nmemb Maximum number of data buffers.
- Returns
- NRF_SUCCESS on success, otherwise error code is returned.
| uint32_t mbuf_read | ( | mbuf_t * | p_mbuf , |
| void * | p_buf , | ||
| uint32_t | buf_size | ||
| ) |
Function for reading data from the mbuf.
- Parameters
-
[in,out] p_mbuf Pointer to the mbuf structure to read data from. [in] p_buf Pointer to the buffer where data shall be read from. [out] buf_size Size of the buffer pointed by p_buf.
- Returns
- NRF_SUCCESS on success, otherwise error code is returned.
| uint32_t mbuf_write | ( | mbuf_t * | p_mbuf , |
| void * | p_ctx | ||
| ) |
Function for putting a data buffer in the mbuf.
- Parameters
-
[in,out] p_mbuf Pointer to the mbuf structure that shall store the buffer. [in] p_ctx Pointer to the data buffer to store.
- Returns
- NRF_SUCCESS on success, otherwise error code is returned.