This is the second day of my participation in the August Challenge. For more details, see:August is more challenging
Encapsulation points with
Encapsulation points is a process of two diametrically opposed, encapsulation refers to the sender data shall be carried out in accordance with the reservation of different levels of agreement from top to bottom layers of encapsulation, and then transmit to the receiving party, and the points with refers to the recipient receives the data and protocol from the bottom up layer upon layer unlock combination, finally get the data process.
Encapsulation is the process of adding a protocol header to the head or tail of data and passing it to the next layer.
This is the Internet of a unified package with the graph, really easy to use, everyone use this picture to express their understanding of the packaging process, then I will parse this picture to express my understanding of the packaging process.
The encapsulation process is top-down, starting with application-layer encapsulation. Application layer encapsulation follows the application protocol. The encapsulation method adopted in the figure is to set the Appl header, which can contain the content, including the length of the sent data, and then the receiver will receive the following data according to the data length after obtaining the header. Another method is to add an end flag at the end of the data, similar to the HTTP protocol. When the receiver reads the end flag bit, it says the data transmission is complete!
The next layer is similar. On top of the protocols of the previous layer, we add the protocols of this layer. The transport layer encapsulates a TCP segment (UDP segment), which the network layer encapsulates, and so on. Finally, Ethernet frames are encapsulated at the data link layer, and the encapsulation is complete.
And the partition is the inverse process of encapsulation, it is worth noting that this inverse process is not so simple.
Because THE IP, ARP, and RARP protocols all use frames to transmit data, the header of the frame needs to provide a field (depending on the type of frame) to distinguish them.
Similarly, ICMP, TCP, and UDP all use IP, so the header of an IP datagram uses a 16-bit protocol field to distinguish them.
TCP segments and UDP datagrams distinguish upper-layer applications by the 16-bit port number field in their headers. (For example, DNS corresponds to port 53, HTTP corresponds to port 80). Generally speaking, in the process of encapsulation, because there are many different protocols in the same layer, in order to know which protocol is used for encapsulation in the next layer, it is necessary to add a protocol field in the head of the next layer in the encapsulation process to mark the distinction between them.