/* *author : davidlin *Date : 2014-12-25pm *Email : [email protected] or [email protected] *world : the city of sz, in China *Ver : 000.000.001 *For : threads for rxtx! *history : editor time do * 1) linpeng 2014-12-25 created this file! *         2) */ signaling frames, the length of the data frame is different, The length of different data frames is more and more diverse, so the variable-length implementation of frames in communication protocols is of great practical significance. How to achieve: 1. Through the shift of the frame tail; 2. Increments the length item by layer. Like a 2-layer protocol typedef struct net_packet_t { ip_packet_t The ip; size_t size; //is used to obtain the IP packet length};typedef struct ip_packet_t { char head; char pay[max]; //need to shift and grow longer size_t chksum; char tail;}; Phy_tx (&net, net.size); //send format, sent according to the actual length of the frame
Protocol design: Implementation of variable long frames