pbuf_alloc_reference() function
Allocates a pbuf for referenced data. Referenced data can be volatile (PBUF_REF) or long-lived (PBUF_ROM). The actual memory allocated for the pbuf is determined by the layer at which the pbuf is allocated and the requested size (from the size parameter). - PBUF_ROM: It is assumed that the memory used is really similar to ROM in that it is immutable and will not be changed. Memory which is dynamic should generally not be attached to PBUF_ROM pbufs. Use PBUF_REF instead. - PBUF_REF: It is assumed that the pbuf is only being used in a single thread. If the pbuf gets queued, then pbuf_take should be called to copy the buffer.
Arguments
payload
referenced payload
length
size of the pbuf's payload
type
this parameter decides how and where the pbuf should be allocated as follows:
Return value
the allocated pbuf.