18#ifndef NET_STACK_MEMORY_MANAGER_H
19#define NET_STACK_MEMORY_MANAGER_H
43typedef void net_stack_mem_buf_t;
57 virtual net_stack_mem_buf_t *
alloc_heap(uint32_t size, uint32_t align) = 0;
70 virtual net_stack_mem_buf_t *
alloc_pool(uint32_t size, uint32_t align) = 0;
89 virtual void free(net_stack_mem_buf_t *buf) = 0;
99 virtual uint32_t
get_total_len(
const net_stack_mem_buf_t *buf)
const = 0;
110 virtual void copy(net_stack_mem_buf_t *to_buf,
const net_stack_mem_buf_t *from_buf) = 0;
123 virtual void copy_to_buf(net_stack_mem_buf_t *to_buf,
const void *ptr, uint32_t len);
135 virtual uint32_t
copy_from_buf(
void *ptr, uint32_t len,
const net_stack_mem_buf_t *from_buf)
const;
147 virtual void cat(net_stack_mem_buf_t *to_buf, net_stack_mem_buf_t *cat_buf) = 0;
157 virtual net_stack_mem_buf_t *
get_next(
const net_stack_mem_buf_t *buf)
const = 0;
165 virtual void *
get_ptr(
const net_stack_mem_buf_t *buf)
const = 0;
173 virtual uint32_t
get_len(
const net_stack_mem_buf_t *buf)
const = 0;
184 virtual void set_len(net_stack_mem_buf_t *buf, uint32_t len) = 0;
virtual uint32_t get_pool_alloc_unit(uint32_t align) const =0
Get memory buffer pool allocation unit.
virtual void copy_to_buf(net_stack_mem_buf_t *to_buf, const void *ptr, uint32_t len)
Copy to a memory buffer chain.
virtual net_stack_mem_buf_t * alloc_pool(uint32_t size, uint32_t align)=0
Allocates memory buffer chain from a pool.
virtual void cat(net_stack_mem_buf_t *to_buf, net_stack_mem_buf_t *cat_buf)=0
Concatenate two memory buffer chains.
virtual uint32_t copy_from_buf(void *ptr, uint32_t len, const net_stack_mem_buf_t *from_buf) const
Copy from a memory buffer chain.
virtual net_stack_mem_buf_t * alloc_heap(uint32_t size, uint32_t align)=0
Allocates memory buffer from the heap.
virtual void * get_ptr(const net_stack_mem_buf_t *buf) const =0
Return pointer to the payload of the buffer.
virtual uint32_t get_len(const net_stack_mem_buf_t *buf) const =0
Return payload size of the buffer.
virtual void free(net_stack_mem_buf_t *buf)=0
Free memory buffer chain.
virtual net_stack_mem_buf_t * get_next(const net_stack_mem_buf_t *buf) const =0
Returns the next buffer.
virtual void copy(net_stack_mem_buf_t *to_buf, const net_stack_mem_buf_t *from_buf)=0
Copy a memory buffer chain.
virtual void set_len(net_stack_mem_buf_t *buf, uint32_t len)=0
Sets the payload size of the buffer.
virtual uint32_t get_total_len(const net_stack_mem_buf_t *buf) const =0
Return total length of a memory buffer chain.