Add uc_mbuf_extend_headroom function, for growing an mbuf

This commit is contained in:
Nils O. Selåsdal
2013-11-25 23:28:13 +01:00
parent 306a3d2a90
commit dbe2f174a8
3 changed files with 146 additions and 2 deletions
+12 -2
View File
@@ -12,8 +12,8 @@
enum UC_MBUF_FLAGS {
UC_MBUF_FL_MALLOC = 0x0001, //MBuf and MBuf->bufstart are seperatly malloc'd
UC_MBUF_FL_MALLOC_BUF = 0x0001, //MBuf is not malloc'd. MBuf->bufstart is malloc'd
UC_MBUF_FL_MALLOC_INLINE = 0x0002, //MBuf is one big malloc. Can't be resized
UC_MBUF_FL_STATIC = 0x0004, //MBuf and MBuf->bustart is user controlled. Can't be resized
UC_MBUF_FL_MALLOC_INLINE = 0x0002, //MBuf is one big malloc. Can't be extended
UC_MBUF_FL_STATIC = 0x0004, //MBuf and MBuf->bustart is user controlled. Can't be extended
};
struct MBuf {
@@ -187,6 +187,16 @@ uint8_t *uc_mbuf_push(struct MBuf *mbuf, uint32_t size);
**/
uint8_t *uc_mbuf_pull(struct MBuf *mbuf, uint32_t size);
/** Add more tailroom to an mbuf.
* Can only be done with mbufs with either
* UC_MBUF_FL_MALLOC or UC_MBUF_FL_MALLOC_BUF.
*
* @param len additional tailroom to add to mbuf
* @return 0 on success, otherwise failure
*
*/
int uc_mbuf_extend_tailroom(struct MBuf *mbuf, uint32_t len);
/** Get a pointer to the data of the buffer
*
* @return pointer to the start of the data (head)