A communications protocol defines the rules for sending blocks of data (each known as a Protocol Data Unit (PDU)) from one node in a network to another node. Protocols are normally defined in a layered manner and provide all or part of the services specified by a layer of the OSI reference model. A protocol specification defines the operation of the protocol and may also suggest how the protocol should be implemented. It consists of three parts:
- Definition of Protocol Control Information (PCI) format which forms the PDU header
- Definition of procedures for transmitting and receiving PDUs
- Definition of services provided by the protocol layers
A Protocol Data Unit
The PDUs exchanged have two parts: a header (also known as the Protocol Control Information (PCI)) and a payload (also known as a Service Data Unit (SDU)). The protocol does not define or constrain the data carried in the payload part. It does specify the format of the PCI, defining the fields which are present and the way in which the patterns of bits are to be interpreted.
A protocol also defines the procedures which determine how the PDU will be processed at the transmit and receive nodes. The procedures specify the valid values for the PCI fields, and the action be taken upon reception of each PCI value (usually based on stored control information). Examples of procedures which are implemented in protocols include:
- error recovery (e.g. the checkpoint procedure, the go-back-n procedure)
- flow control
- segmentation
- service access point selection
- connection management
The documents which define a protocol procedures are usually large and are seldom concrete (i.e. they may not be directly translated to executable programs). They typically define the actions to be taken when a particular condition is detected, but not how the condition is to be detected. It has been said that "Part of what makes a protocol mature is good implementation guidelines and folklore". The success of the TCP/IP protocol suite is largely due to the "industrial strength" code available in freely distributed reference implementations.
A protocol implemented by several processes (represented by circles) communicating using queues of PDUs, a shared information area (shown as a rectangle) and function calls between the processes (represented by arrows)
Protocols are usually implemented by writing a number of programs (processes) which communicate with one another through queues and by function calls. One or more timers are also usually required to ensure correct operation of the protocol. To start and stop timers, a protocol normally uses an interface to the computer's operating system. This interface is also used to request new (empty) buffers for received PDUs (or PDUs created by the layer) and to release buffers which are no longer needed by the protocol.
Protocols are generally described using a layered architecture known as the OSI reference model. Which abstracts the details of the protocol and allows a simple description of the service provided by the protocol to the protocol layer above and the service required by protocol layer from the layer below.