Protocol Stack Model

Networking is very complex. What if every application you wrote had to know how to communicate over Ethernet? We must build on something rather than always reinvent.

A means for humans to deal with complexities is to form abstractions, then encapsulate these abstractions with an interface. The implementation of the abstraction may be complex, but from the outside only the interface is available, and the users of the interface aren't concerned with the insides. An encapsulated complexity isn't a complexity.

Abstractions and interfaces aren't enough. Some means must be found to organize them. In networking, as in operating systems, this means a layered model, or a protocol stack.

layers
protocol between peer layers
interface between layers
physical medium
Each layer provides services to the layer above it, and in turn uses the services of the layer below it. The services are defined by the layers interface. No communication outside of the above/below layer is allowed. The implementation of each layer may be quite complex, but this is made transparent to the layer above by the interface.

When two computers using a layered protocol stack communicate they do so layer-to-layer. Corresponding layers have a protocol which defines how the layers in the two computers talk to each other. Each layer in a protocol stack communicates only with its peer layer in the protocol stack on the other computer.

A protocol is the implentation of a layer. As such, it is hidden from the layer above it via the service interface. A protocol may be changed (on both ends, of course) without causing confusion to the layer above as long as the service interface is maintained.

Complexity

Think about the things you must deal with that can go wrong when communicating between two computers:
networking hardware failures
media failures
noise and data corruption
congested networks & finite buffers
variable delay in delivering data
duplicated data
lost data
data out of order with respect to how it was sent
There are simply too many details and too many problems to be mastered when communicating for a single magic protocol or layer to handle them all. The problem has to be broken into smaller pieces.

Comer makes an analogy between a protocol stack model and programming in a high level language. Both processes:

divide a big problem into manageable pieces
are arranged linearly

Data movement

Simplistic picture
<sender and receiver, N layers, identical objects, peer protocol conversations>

What's ignored: the actual flow of data (down, across, up).

Actual movement
As data is passed down to each layer, the data has information added to it in the form of a header (or a trailer). When it reaches the other stack, the headers (trailers) are stripped off and the result is passed upwards.
<header being added at each layer, becoming next layer down data field, trailer on data link layer>
In communicating through protocol stack architecture, a message is passed down, across and up. Even though we talk about protocols between peer layers, the flow of data is down, across, and up. The conceptual flow is horizontal, peer-to-peer.

The messages or data units at each layer are identical on the sender and the receiver.

OSI Reference Model

ISO (International Standards Organization) developed a model for the architecture of data communications called the ISO Reference Model Open System Interconnection (OSI).

OSI does a good job of making explicit the separate concepts of services, interfaces, and protocols. The model was designed (by committee) before any protocols (implentation) was done. This is good for the clean separation of concepts, but bad for creating a protocol stack that's useful in the real world.

Application layer (7)

Presentation layer (6) Session layer (5) Transport layer (4) Network layer (3) Data Link (2) Physical layer (1)

TCP/IP Reference Model

TCP/IP was written before it was designed, just the opposite of the OSI model. The protocols were developed, then the model. Sponsored research of DARPA, at UCB, concurrent with UNIX. One of the goals was robustness in the face of dynamic reconfiguration.

Application layer

Transport layer Internet layer Host-to-Network

OSI stack next to TCP/IP stack

Data movement, take 2

The simplistic picture we drew earlier ignored the actal flow of data through the network. We can correct this and show it for TCP/IP.

<sender and receiver, intermediary nodes>
<Comer, Figure 11.7>

Example Communication Services

The Internet

The Internet is a loose hierarchy with a common pattern (perhaps fractal?).

End systems (hosts, computers, devices) are attached to local networks or dynamically join local networks.

Individual machines and small local networks are attached to local ISPs.

The local ISPs pay their bill to regional ISPs for connectivity.

The regional ISPs have connections to national access points or places where national ISPs come together. Possibly they connect directly to NSP hubs.

The NSPs themselves consist of long distance backbone networks of very high capacity.

The NAPs are usually small but very high capacity internetworks with many links and switches located in large metropolitan areas.

X.25

Old standard for connecting to public packet switched networks. Provides virtual circuit services.

Each host can have 4095 simultaneous, multiplexed (switched) virtual circuits going to other hosts.  Each circuit would correspond to a process. Permanent virtual circuits are also supported.

Physical layer

Data link layer Packet (network) layer

Frame Relay

Bare-bones, connection-oriented. Came into being as telephone networks became fast, digital and cheap, computers fast and cheap. Speeds like T1 leased-line (1.5Mbps).

Like a virtual leased-line. You must keep the average traffic below a certain level, but you get higher peak service speeds.

The only service provided is to distinguish the start/stop of each frame sent, and whether a frame was corrupted in transit. Anything else is up to the user of the frame relay.

Broadband ISDN (B-ISDN) and ATM

The service to end all services. High speeds, support for all types of applications and services (telephone, video, email, music, LANs, etc). The first speeds for ATM are 155Mbps and 622Mbps. ATM is set to replace the circuit-switching infrastructure of existing telephone systems.

Based on ATM (Asynchronous Transfer Mode). ATM supports all types of services by using a small, fixed length packets (53 bytes) called cells. For this reason, the services provided by ATM are known as cell relay (analogous to frame relay).

Cell switching has the advantages that packet switching has over circuit switching, but is more flexible. Fixed size cells can also be switched faster, which is important given that gigabit speeds will be used in ATM.

ATM is connection-oriented, but only partially reliable (cells are delivered in order, but may be lost). Being connection-oriented allows for quality-of-service guarantees for synchronous data like voice, video.

ATM reference model is quite different than OSI or TCP/IP. <figure 1.30>

Physical layer
PMD (physical medium dependent) sublayer - deals with a real medium, signalling, frequencies, voltages, etc
TC (transmission convergence) sublayer - takes cells and converts them to a stream of bits for the PMD
ATM layer
takes 48 byte chunks of data to make cells, adds header
flow control, cell header generation, virtual circuit management
AAL layer
SAR (segmentation and reassembly) sublayer - chops packets into cells for apps that don't think in terms of cells
CS (convergence sublayer) - offers different services for different types of applications

Services

Type of communication Dimensions of service
Connectivity
Two types of services offered by the layers: connection-oriented and connectionless service. Connection-oriented establishes a connection, transfers data, tears the connection down. More overhead in starting, but each message can assume that the connection has already been established. Analogous to a human conversation.

By contrast, connectionless service means each packet carries all the information needed to deliver it. No connection is made ahead of time. Analogous to sending a postal letter.

Reliability
Reliability refers to whether data may be lost, out of sequence, or duplicated. It does not refer to whether corrupted data may be received unknowingly.
Message boundaries
Byte pipe versus discrete messages.
Some possibilities are:
connection-oriented
By far the two most common services are:
Connection-oriented, reliable, byte stream
and
Connectionless, unreliable, message

Design issues

Terminology

Each unit of data exchanged or processed by the layers in the protocol stack has a distinct name. Using the proper names (or at least some consistent set of names) helps avoid confusion.

Layer Data unit
Application message
Transport segment
Network packet
Data Link frame
Physical bit