netbuf_alloc() — Allocate space in a netbuf


void *netbuf_alloc (struct netbuf *buf , u16_t size );


Allocates buffer memory with size number of bytes for the netbuf buf. The function returns a pointer to the allocated memory. Any memory previously allocated to the netbuf buf is deallocated. The allocated memory can later be deallocated with the netbuf_free() function. Since protocol headers are expected to precede the data when it should be sent, the function allocates memory for protocol headers as well as for the actual data.