1.6 LwIP buffer management1.6.1 Packet buffer structureLwIP จัดการ packet buffers โดยใช้ a data structure ที่เรียกว่า pbuf. The pbuf structure ช่วยให้สามารถจัดสรร a dynamic memory เพื่อเก็บ a packet content และปล่อยให้ packets อยู่ใน the static memory.
Pbufs สามารถเชื่อมต่อกันเป็นสายโซ่ได้ จึงทำให้ packets สามารถทอดข้ามครอบคลุมไปหลาย pbufs ได้.

โดยที่
next บรรจุ the pointer ไปยัง the next pbuf ใน a pbuf chain
payload บรรจุ the pointer ไปยัง the packet data payload
len คือความยาวของ the data content ของ the pbuf
tot_len คือผลรวมของ pbuf len บวกกับทุก the len fields ของ the next pbufs ใน the chain
ref คือ the 4-bit reference count ที่แสดงให้เห็นจำนวนของ pointers ทีชี้ไปยัง the pbuf. A pbuf สามารถถูกปลดปล่อย
ออกจาก memory ได้ก็ต่อเมื่อ reference count ของมันเป็นศูนย์.
flags (บน 4 bits) แสดงให้เห็นประเภทของ pbuf.