|typedef struct rxbuf_s rxbuf_s|
At minimum, the rxbuffer needs a usecount attaching. There are several possibilities.
- Define a structure with the usecount ahead of the data. This allows a size field too and variable size data blocks. However, it does not work in an OS/Stack where the raw packet is used and the space ahead of the data is filled with UDP and IP headers.
- As previous, but in the case of a stack supplying a raw packet, the UDP/IP headers get overwritten by the usecount. Only works if the stack will tolerate this.
- Place the usecount after the end of the data. This limits the data buffer to a fixed size so we know where the usecount is.
- Use a separate structure supplying the usecount and a pointer to the data buffer. This adds the overhead of memory management for a very small structure. In many impolementations, the pointer to the buffer is bigger than the whole of the rest of the structure.
The definition here assumes the first.