The Data Encapsulation Process

The Data Encapsulation Process

Packet creation - adding headers

The process of passing information through the layers of the OSI is called encapsulation or packetization. Packetization is the process of creating IP packets. The packet creation process begins with Layer 7 (the application layer) of the OSI/RM, and continues through Layer 1 (the physical layer). For example, when you transfer a file from one computer to another, this file undergoes a transformation from a discrete (complete) file into smaller pieces of information (packets). Beginning with the application layer of the OSI/RM, the file continues to be divided until the initial discrete file becomes smaller, more manageable pieces of information sent across the transmission medium at the physical layer.

A Protocol Data Unit (PDU) is a packet of information created by a computer and passed from one layer of the OSI/RM to another. A PDU contains information specific to each layer. Each layer adds its own information (in the form of a header) to the packet. This information enables each layer to communicate with the other layers and allows the receiving computer to process the information.

Each layer considers what has been passed down to it from an upper layer to be "data." It treats the entire higher-layer message as a data payload. At the end of the encapsulation process, a frame is formed.

The following figure illustrates how each layer appends a header to the PDU it receives from the layer above it. Notice that Layer 2 also adds a footer (or trailer). Notice also that there is no header added at Layer 1.




As you learned in Lesson 3, the terms data, segment, packet and frame are the protocol data unit names assigned to information at specific points in the encapsulation process. An item of information is considered data as it is generated and passed down through the upper three layers of the OSI, which are often collectively known as the application layer.

At Layer 4
Data is passed down to the transport layer (Layer 4) where it is encapsulated to include source and destination port numbers that identify the applications (such as FTP or e-mail) between which the data should be passed. At this point, the data is considered a segment.

At Layer 3
A segment is passed down to the network layer (Layer 3), where it is encapsulated and given source and destination IP addresses. At this point, the segment becomes a packet.

At Layer 2
A packet is passed down to the data link layer (Layer 2), where it is encapsulated and given a source and destination MAC address. A footer is also appended to the packet. The footer contains an error-checking mechanism called a cyclical redundancy check (CRC). At this point, the packet becomes a frame.

The cyclical redundancy check (CRC) is a mathematical calculation that allows the receiving computer to verify whether a packet is valid. When a sending host transmits a packet, it calculates a CRC by summing all the ones in the payload and storing this sum as a hexadecimal number, which is then stored in the trailer. When the receiving host reads the packet, it runs its own CRC, then compares it with the CRC stored in the trailer. If the two match, the packet is not damaged, and the receiving host processes the packet. If the CRCs do not match, the receiving host discards the entire packet.

At Layer 1
Frames are passed down to the physical layer (Layer 1) where they are sent across the transmission medium as a bit stream.

Removing headers
When a receiving host processes a packet, it reverses the packet-creation process and de-encapsulates or removes each header, beginning with Layer 1 and ending with Layer 7. All that is left at the end of this process is the original, unaltered data, which the host can then process.