Pbuf struct of LWIP protocol stack

Source: Internet
Author: User

The pbuf struct is located in src/include/LWIP/pbuf. h.

The data received by the Ethernet interruption is first stored in the data link composed of the structure, and then delivered to the upper-layer protocol.

This struct can be said to be ubiquitous.

Struct pbuf {/** next pbuf in singly linked pbuf chain points to the next pbuf */struct pbuf * next; /** pointer to the actual data in the buffer points to the valid data zone */void * payload; /*** total length of this buffer and all next buffers in chain * belonging to the same packet. * Total data link length * for non-queue packet chains this is the invariant: * P-> tot_len = p-> Len + (p-> next? P-> next-> tot_len: 0) */u16_t tot_len;/** length of this buffer */u16_t Len; /** pbuf_type as u8_t instead of Enum to save space pbuf type, including pbuf_ram, pbuf_rom, pbuf_ref, and pbuf_pool, these types indicate the Data Type pointed to by the pointer payload */u8_t/* pbuf_type */type;/** MISC flags mixed flag bits, each representing a flag */u8_t flags; /*** the reference count always equals the number of pointers * that refer to this pbuf. this can be pointers from an application, * the stack itself, or pbuf-> next pointers from a chain. count the number of pointers pointing to this pbuf. these pointers may be applied. Program The pointer of the protocol stack, or the pbuf-> next pointer in the data link. The pbuf */u16_t ref can be released only when the ref is 0; # If lwip_ptpd // If the precision clock synchronization protocol standard of the Network Measurement and Control System is enabled/* the time at which the packet was received, seconds component */u32_t time_s; /* the time at which the packet was received, nanoseconds component */u32_t time_ns; # endif/* # If lwip_ptpd */};

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.