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 illustrates the relationship between the 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.
The socket interprocess communication (IPC) facilities, illustrated by the Operating System Layer Examples figure, are layered on top of networking facilities. Data flows from an application program through the socket layer to the networking support. A protocol-related state is maintained in auxiliary data structures that are specific to the supporting protocols. The socket level passes responsibility for storage associated with transmitted data to the network level.
Some of the communication domains supported by the socket IPC facility provide access to network protocols. These protocols are implemented as a separate software layer logically below the socket software in the kernel. The kernel provides ancillary services, such as buffer management, message routing, standardized interfaces to the protocols, and interfaces to the network interface drivers for the use of the various network protocols.
User request and control output subroutines serve as the interface from the socket subroutines to the communication protocols.
Note: Socket error codes issued for network communication errors are defined as codes 57 through 81 and are in the /usr/include/sys/errno.h file.