How does the VxWorks IP protocol stack flexibly add headers and data?

The VxWorks IPNET protocol stack provides five functions for allocating the header space and the header space, which can help to understand how this function is implemented.

pkt * ipcom_pkt_malloc(int size,int flag)      //size=sizeof(IP_HEADER)+sizeof(TCP)+sizeof(payLoad) but except for linklayer header
void* ipcom_pkt_push_back(Ipcom_pkt *pkt,int data_len)
void* ipcom_pkt_push_front(Ipcom_pkt *pkt,int data_len)
void* ipcom_pkt_pop_front(Ipcom_pkt *pkt,int data_len)
void *ipcom_pkt_pop_back(Ipcom_pkt *pkt, int data_len)

write picture description here

write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325477524&siteId=291194637