Sockets Interface

The kernel structure consists of three layers: the socket layer, the protocol layer, and the device layer.

The socket layer supplies the interface between the subroutines and lower layers, the protocol layer contains the protocol modules used for communication, and the device layer contains the device drivers that control the network devices. Protocols and drivers are dynamically loadable. The Socket Label figure (Figure 1) illustrates the relationship between the layers.

Figure 1. Socket Label
This diagram shows the client process on the left with the socket layer beneath it, and the protocol layer and device layer below. The protocol layer is between the other two layers. Corresponding layers are below the server process on the right. A U-shaped dashed line representing the network runs through all six layers and connects the server and client processes. Along this line are network drivers in the device layers and TCP/IP, which is in the protocol layers.

Processes communicate using the client and server model. In this model, a server process, one end point of a two-way communication path, listens to a socket. The client process, the other end of the communication path, communicates to the server process over another socket. The client process can be on another machine. The kernel maintains internal connections and routes data from client to server.

Within the socket layer, the socket data structure is the focus of activity. The system-call interface subroutines manage the activities related to a subroutine, collecting the subroutine parameters and converting program data into the format expected by second-level subroutines.

Most of the socket facilities are implemented within second-level subroutines. These second-level subroutines directly manipulate socket data structures and manage the synchronization between asynchronous activities.