Interaction Between OSI Layers

Imagine a Web browser displaying a Web page that it received from a Web server. Before that happened, the browser somehow interacted with the software implementing other layers of TCP/IP on the client computer, causing a request to flow to the server. Likewise, the broswer application somehow communicated with the Web server application, telling the server what Web page the browser wanted to display. A fancy way to describe these two ideas that is "interaction between OSI layers." The process of how layers interact on the same computer, as well as how the same layer processes on different computers communicate with each other, is all interrelated. The software or hardware products implementing the logic of some of the OSI protocol layers provide two general functions:

• Each layer provides a service to the layer above it in the protocol specification.

• Each layer communicates some information with the same layer's software or hardware on other computers. In some cases, the other computer is connected to the same media; in other cases, the other computer is on the other end of the network.

Interactions Between Adjacent Layers on the Same Computer

The post office analogy provides an easy comparison to networking and interactions between adjacent layers. The words in my letter to Mike Z are the application data. While still at my office, I put the letter in an envelope because the USPS will not just deliver the paper; it requires me to provide an envelope. On that envelope, I provide an address that meets USPS specifications for addresses. Having done that, and after putting on the correct postage stamp, I expect the USPS to deliver the letter. That's exactly the same concept of the interactions between layers on the same computer. When sending data, the higher layers expect the lower layers to help deliver the data. However, the lower layers expect the higher layers to give them the data in a certain format, with certain header and address information attached. (The header acts like the envelope in the analogy.)

So, to provide services to the next higher layer, the layer must know about the standard interfaces defined between itself and the next higher layer. These interfaces include definitions of what Layer N+1 must provide to Layer N to get services, as well as what information Layer N must provide back to Layer N+1 when data has been received. And these details are all part of the protocol specifications.

Figure 3-2 presents a graphical representation of two computers and provides an excellent backdrop for a discussion of interactions between layers on the same computer.

Figure 3-2 Example for Discussion of Adjacent-Layer Interactions

Application Presentation Session Transport Network Data Link Physical

Figure 3-2 Example for Discussion of Adjacent-Layer Interactions

L7

Data

L6

L7

Data

L5

L6

L7

Data

L4

L5

L6

L7

Data

L3

L4

L5

L6

L7

Data

L2H

L3

L4

L5

L6

L7

Data

Send bits

Application Presentation © Session Transport Network Data Link Physical

L7

Data

L6

L7

Data

L5

L6

L7

Data

L4

L5

L6

L7

Data

L3

L4

L5

L6

L7

Data

L2H

L3

L4

L5

L6

L7

Data

Receive bits

L# - Layer # header L#H - Layer # header L#T - Layer # trailer

The data is created by some application on Host A. For example, an e-mail message is typed by the user. Each layer creates a header and passes the data down to the next layer. (The arrows in Figure 3-2, Step 1, denote the passing of data between layers.) Just as I had to put an envelope around my letter to Mike, a layer typically has to put some header around its data before giving it to the next lower layer that is providing service. Passing the data down to the next layer implies that the lower layer needs to perform some services for the higher layer; to perform these services, the lower layer adds some information in a header or trailer. For example, the transport layer hands off its data and header; the network layer adds a header with the correct destination network layer address so that the packet can be delivered to the other computer.

From each layer's perspective, the bits after that layer's header are considered to be data. For instance, Layer 4 considers the Layer 5, 6, and 7 headers, along with the original user data, to be one large data field.

After the application creates the data, the software and hardware implementing each layer perform their work, adding the appropriate header and trailer. The physical layer can use the media to send a signal for physical transmission, as shown in Step 2 in Figure 3-2.

Upon receipt (Step 3), Host B begins the adjacent layer interactions on Host B. The right side of Figure 3-2 shows an arrow pointing next to the computer (Step 4), signifying that the received data is being processed as it goes up the protocol stack. In fact, thinking about what each layer does in the OSI model can help you decide what information could be in each header.

The following sequence outlines the basics of processing at each layer and shows how each lower layer provides a service to the next higher layer. Consider the receipt of data by the host on the right side of Figure 3-2:

Step 1 The physical layer (Layer 1) ensures bit synchronization and places the received binary pattern into a buffer. It notifies the data link layer that a frame has been received after decoding the incoming signal into a bit stream. Therefore, Layer 1 has provided delivery of a stream of bits across the medium.

Step 2 The data link layer examines the frame check sequence (FCS) in the trailer to determine whether errors occurred in transmission (error detection). If an error has occurred, the frame is discarded. (Some data link protocols perform error recovery, and some do not.) The data link address(es) are examined so that Host B can decide whether to process the data further. If the data is addressed to host B, the data between the Layer 2 header and trailer is given to the Layer 3 software. The data link has delivered the data across that link.

Step 3 The network layer (Layer 3) destination address is examined. If the address is Host B's address, processing continues (logical addressing) and the data after the Layer 3 header is given to the transport layer (Layer 4) software. Layer 3 has provided the service of end-to-end delivery.

Step 4 If error recovery was an option chosen for the transport layer (Layer 4), the counters identifying this piece of data are encoded in the Layer 4 header along with acknowledgment information (error recovery). After error recovery and reordering of the incoming data, the data is given to the session layer.

Step 5 The session layer (Layer 5) can be used to ensure that a series of messages is completed. For example, this data could be meaningless if the next four exchanges are not completed. The Layer 5 header could include fields signifying that this is a middle flow in a chain, not an ending flow. After the session layer ensures that all flows are completed, it passes the data after the Layer 5 header to the Layer 6 software.

Step 6 The presentation layer (Layer 6) defines and manipulates data formats. For example, if the data is binary instead of character data, the header denotes that fact. The receiver does not attempt to convert the data using the default ASCII character set of Host B. Typically, this type of header is included only for initialization flows, not with every message being transmitted (data formats). After the data formats have been converted, the data (after the Layer 6 header) is then passed to the application layer (Layer 7) software.

Step 7 The application layer (Layer 7) processes the final header and then can examine the true end-user data. This header signifies agreement to operating parameters by the applications on Host A and Host B. The headers are used to signal the values for all parameters; therefore, the header typically is sent and received at application initialization time only. For example, for file transfer, the size of the file to be transferred and the file formats used would be communicated (application parameters).

Interactions Between the Same Layers on Different Computers

Layer N must interact with Layer N on another computer to successfully implement its functions. For example, the transport layer (Layer 4) can send data, but if another computer does not acknowledge that the data was received, the sender will not know when to perform error recovery. Likewise, the sending computer encodes a destination network layer address (Layer 3) in the network layer header. If the intervening routers do not cooperate by performing their network layer tasks, the packet will not be delivered to the true destination.

The post office analogy can help in this case as well. If I write the letter to Mike and put the address but not his name on the envelope, the letter gets to the office because I gave the USPS enough information to deliver the letter. No one knows to whom to give the letter, though. In real life, someone would open the letter and see that it's addressed to Mike—but, of course, the office might have more than one Mike! With real networking, the sending application needs to put some header around the data so that the receiving computer knows what application should receive the data.

To interact with the same layer on another computer, each layer defines a header and, in some cases, a trailer. Headers and trailers are additional data bits, created by the sending computer's software or hardware, that are placed before or after the data given to Layer N by Layer N+1. The information needed for this layer to communicate with the same layer process on the other computer is encoded in the header and trailer. The receiving computer's Layer N software or hardware interprets the headers and trailers created by the sending computer's Layer N, learning how Layer N's processing is being handled, in this case.

Figure 3-3 provides a conceptual perspective on the same-layer interactions. The application layer on Host A communicates with the application layer on Host B. Likewise, the transport, session, and presentation layers on Host A and Host B also communicate. The bottom three layers of the OSI model have to do with delivery of the data; Router 1 is involved in that process.

Host A's network, physical, and data link layers communicate with Router 1; likewise, Router 1 communicates with Host B's physical, data link, and network layers. Figure 3-3 provides a visual representation of the same-layer interaction concepts.

Figure 3-3 Same-Layer Interactions on Different Computers

Application

Application

Presentation

Presentation

Session

Session

Transport

Transport

Network

Network

Network

Data link

Data link

Data link

Physical

Physical

Physical

Host A

Router 1

Host B

The post office analogy again helps. I, Wendell, the letter writer, is the equivalent of Host A. I write the letter, put it in the envelope, address and stamp the envelope, and drop it off at the local post office. The post office forwards the letter through many other mail-sorting centers because our home office, where Mike is, is 2,000 miles away. The mailing centers look at only the address—in fact, only at the ZIP code—until the letter makes it to Campbell, California. So I, the sender (Host A), put the address on the letter, which is used by many mailing centers (routers) who deliver the letter to our home office (host B), where the letter is given to the correct individual (correct application).

Was this article helpful?

+3 -1

Responses

  • Tomi
    How do the layers interact with each other?
    6 months ago
  • cristian
    How application program interface communicates with lower layers of OSI?
    4 months ago

Post a comment