Unit 3

Lesson 2 - Layers of Protocols and Services

   How Layers Work Together

As we have seen thus far, a protocol provides services to the layer above it, and uses the services of the layer below it. Whenever different layers of protocols work together, they use the following basic techniques:

Encapsulation and protocol headers

Segmentation

Decapsulation

Reassembly

Encapsulation and Protocol Headers

In the letter-writing example, each of the "layers" below the CEO placed its own envelope around the envelope it received from above. None of those layers removed the envelope added by the previous layer. Thus, the message was wrapped in several layers of envelopes as it was transmitted.

Virtually all modern communication systems use this approach, called "encapsulation." As data moves down the protocol stack, each layer that receives data from above "repackages" it by adding its own protocol header to the transmission, as shown on the Encapsulation Diagram. Some protocols also add data to the end of a message; this data is called a "trailer."

Encapsulation

Encapsulation

Each protocol header contains several items of data that are useful to a peer process at the other end of the communication. Each of these items is called a "field." Each protocol specifies the order and length (in bits) of its header fields. The number, length, and content of header fields vary among different protocols. For example, one protocol header may assign 8 bits to describe the length of the encapsulated data, 32 bits to carry the address of the sender, and 32 bits to carry the address of the recipient. Another protocol may include fields that describe the priority of a message or the type of data it contains.

Real Audio Clip

What is the correlation between peer communicating processes and the protocol headers that are transmitted with the information that is sent across a network?

   Segmentation

Suppose an upper layer process has a long message to send to its peer process. If the message is too long, the lower layers cannot carry it, just as a delivery service has rules that limit the maximum size of a shipping box.

If you must transport a shipment that is too large for one container, you can divide it into several small boxes. To tell the recipient the total number and order of the boxes, you can add sequencing information to each box, such as "1 of 5," "2 of 5," and so on.

In the same way, some protocols can divide a long message into shorter segments or fragments. The protocol header includes fields that specify the relative position of each piece in the complete message, and the total number of pieces in the message. All segments are then passed to the layer below.

A possible alternative approach is to insert this sequencing information into the message itself, indicating that there are multiple parts and where each part fits in the whole message. However, that would require lower layers to open each envelope and look at the original message to determine the order in which the individual letter parts must be passed to the higher layers on the other end. This makes the highest layers involved in the operation of the lower layers, which defeats the many advantages of a layered communication architecture.

Decapsulation

As the message is passed down the protocol layers on the sending computer, it has been encapsulated within several protocol headers. When that message reaches the destination computer, the encapsulation process is reversed. Starting with the bottom layer, each process removes its own header (opens its own envelope) and passes the encapsulated data up to the layer above. This process is called "decapsulation."

Each program only removes the header added by its peer process. It does not disturb the encapsulated data in any way, but simply passes it to the layer just above, as shown on the Decapsulation Diagram. By the time the data reaches the highest layer, only the original message is left. The highest level program never sees the lower layer protocol headers that wrapped the message during transmission.

Decapsulation

Decapsulation

Reassembly

If the original message was segmented into a series of smaller transmissions, one of the processes on the receiving end places the segments in order before decapsulating them. It then reassembles the segments into their correct order, then passes the restored message up to the layer above.

Real Audio Clip

Can networks that use different protocol stacks communicate?

   Activities

See the Activities and Extended Activities section in Unit 3 Lesson 2 in your textbook Introduction to Networking to test what you have learned so far.

[ Previous Section ] [ Unit Contents ] [ Next Lesson ]