Transport Interfaces Programming Guide

Layered Protocols

A protocol is a set of rules and conventions that describe how information is to be exchanged between two entities. Networking tasks often require more than one protocol to perform a task, such as file transfer.

These protocols are often conceptualized in a model consisting of a series of layers, each of which deals with one functional aspect of the communication. Each layer has a well-defined interface to the layer immediately above and below it. The left side of Figure 1-2 shows that data is passed down through the interface to the layer below. Each layer adds the necessary information to the data so that the receiving system understands how to handle the data and is able to route the data. At the bottom layer on the sending side, the data is physically transmitted across some medium to the receiving system. It is passed up through the layers on the right side of Figure 1-2, with each layer removing the information added by the corresponding layers on the sending system. A set of protocols layered in this way is called a protocol stack. A layer can have more than one protocol defined for it.

Figure 1-2 Layered Protocols


Two well-known reference models are discussed in the following sections: open systems interconnection (OSI) reference model and Internet (TCP/IP) protocol suite.

Open Systems Interconnection (OSI) Reference Model

The OSI reference model is used to conceptualize network service architectures and as a convenient framework for explaining networking concepts. It is not the basis for the Internet protocol suite, but the Internet protocol's four-layer model can be mapped to the more general OSI reference model. The OSI protocol suite follows the OSI reference model closely.

The OSI reference model divides networking functions into seven layers, as shown in Figure 1-3. Each protocol layer performs services for the layer above it. The ISO definition of the protocol layers gives designers considerable freedom in implementation. For example, some applications skip the presentation and session layers (layers 5 and 6) to interface directly with the transport layer. In this case, the application performs any needed presentation and session services.

Industry standards have been or are being defined for each layer of the reference model.

Figure 1-3 OSI Reference Model


OSI Reference Model Description

The following section explains each layer the OSI reference model.

Layer 1: Physical Layer

This layer specifies the physical media connecting hosts and networks, and the procedures used to transfer data between machines using a specified media. This layer is commonly referred to as the hardware layer of the model.

Layer 2: Data-Link Layer

This layer manages the reliable delivery of data across the physical network. For example, it provides the abstraction of a reliable connection over the potentially unreliable physical layer.

Layer 3: Network Layer

This layer is responsible for routing machine-to machine communications. It determines the path a transmission must take, based upon the destination machine's address. This layer must also respond to network congestion problems.

Layer 4: Transport Layer

This layer provides end-to-end sequenced delivery of data. It is the lowest layer that provides applications and higher layers with end-to-end service. This layer hides the topology and characteristics of the underlying network from users. It provides reliable end-to-end data delivery if the service characteristics require it.

Layer 5: Session Layer

This layer manages sessions between cooperating applications.

Layer 6: Presentation Layer

This layer performs the translation between the data representation local to the computer and the processor-independent format that is sent across the network. It can also negotiate the transfer formats in some protocol suites. Typical examples include standard routines that compress text or convert graphic images into bit streams for transmission across a network.

Layer 7: Application Layer

This layer consists of the user-level programs and network services. Some examples are telnet, ftp, and tftp.

TCP/IP Internet Protocol Suite

TCP/IP is a widely used protocol suite for internetworking, a term that refers to the connection of various physical networks to form one large virtual network. Any system connected to a TCP/IP internetwork should be able to communicate with any other system within the internetwork, regardless of which physical network the systems actually reside. Networks are linked together by a system that functions as a gateway between systems.

While TCP/IP has a closely associated history with UNIX systems, the TCP/IP protocols themselves are independent of the operating system, the network topology, and the connection medium. TCP/IP operates on Ethernet and Token Ring local area networks (LANs), across wide area links such as X.25, and serial connections. Support for TCP/IP networking has been an integral part of SunOS in all versions of the operating system.

TCP/IP Protocol Stack

The TCP/IP protocol suite can be described using a reference model similar to the OSI reference model. Figure 1-4 shows the corresponding OSI layers and some example services at each layer. TCP/IP does not delineate the presentation and session layers as the OSI model does; application code provides the necessary presentation or session functionality.

The TCP/IP protocols are defined in documents called Requests for Comments (RFCs). RFCs are maintained by the Network Information Center (NIC), the organization that handles address registration for the Internet.

RFCs define a number of applications, the most widely used being telnet, a terminal emulation service on remote hosts, and ftp, which allows files to be transferred between systems.

Figure 1-4 TCP/IP Protocol Stack


TCP/IP Protocol Stack Description

The following section describes the sections of the TCP/IP protocol stack.

Device Drivers

The device driver layer (also called the Network Interface) is the lowest TCP/IP layer and is responsible for accepting IP datagrams and transmitting them over a specific network. A network interface might consist of a device driver or a complex subsystem that uses its own data link protocol.

Internet Protocol (IP) Layer

The Internet Protocol layer handles communication from one machine to another. It accepts requests to send data from the transport layer along with an identification of the machine to which the data is to be sent. It encapsulates the data into an IP datagram, fills in the datagram header, uses the routing algorithm to determine how to deliver the datagram, and passes the datagram to the appropriate device driver for transmission.

The IP layer corresponds to the network layer in the OSI reference model. IP provides a connectionless, "unreliable" packet-forwarding service which routes packets from one system to another.

Transport Layer

The primary purpose of the transport layer is to provide communication from one application program to another. The transport software divides the stream of data being transmitted into smaller pieces called packets in the ISO terminology and passes each packet along with the destination information to the next layer for transmission.

This layer consists of Transport Control Protocol (TCP), a connection-oriented transport service (COTS), and the user datagram protocol (UDP), a connectionless transport service (CLTS).

Application Layer

The application layer consists of user invoked application programs that access services available across a TCP/IP Internet. The application program passes data in the requires form to the transport layer for delivery.