Networking / Beginners

How the Layers Fit Together

In a pure implementation of the model each layer has contact only with the layers immediately above and below it.

A possible OSI encapsulation

Going downward, data in each layer is passed to the next below via encapsulation. This is just transforming the data in such a way that the layer below can cope with it transparently and in such a way that it can be untransformed back to the original data at the other end.

The transformation might:

  • add an identifying header or trailer (or both);
  • encode certain bit patterns that might otherwise be misinterpreted or mis-transmitted by the next layer;
  • put items into a standard form, e.g., ensuring integers are in a universally recognized format;
  • do some arbitrarily complex manipulation;
  • do nothing at all!

This process starts when the user data from some program is passed to the application layer. This might add some stuff: for example, a standard email header on an email message.

This is passed to the presentation layer. As far as this layer is concerned, it just gets a bunch of bits from the application layer. It doesn't (or shouldn't) know that the first few bits are an application header. This layer may transform the data in some way (e.g., convert characters to a particular format) and may prepend its own header that contains useful information for the process that eventually unpacks the data.

And so on down through the layers. Each layer may perform any transform on the data and may prepend headers. Or a layer may do nothing at all: it all depends what you need to do for the job in hand. For example, the data link layer sometimes has a header and a trailer: this is so the start and end of a frame are clearly marked in the physical layer.

At the other end the receiving stack of layers unwraps and untransforms each layer appropriately. Sometimes the untransform is not successful: one example is matching between different character sets in the presentation layer since different character sets on different operating systems do not always contain representations of the same collection of characters (think of sending a message in Japanese to a European machine). In such cases the unwrapper just has to hope for the best.

[Previous] [Contents] [Next]