X.25 Packet Layer Protocol (PLP)
The X.25 Packet Layer Protocol is the network layer (level 3) of X.25, and handles the virtual circuits, providing the multiplexing capability.
There are aspects of the PLP which apply to the link as a whole. Normally, Logical Channel Number Zero is reserved for link control traffic - this includes Restart and Diagnostic packets.
X.25 Packet Format
The X.25 Packet contains a Header, which is normally 3 bytes in length, followed by the packet body. The packet header can be 4 bytes in length when extended sequence numbers (modulo-128) are used, but only for certain packets types (Data Packets and Supervisoy Packets: Receive Ready, Receive Not Ready).
The top 4-bits of the first byte contain the GFI - General Format Identifier. The GFI contains an indication of whether modulo-8 or modulo-128 sequence numbers are being used, and also the Q-bit and D-bit.
The next 12-bits form the Logical Channel Number.
The remaining byte is the Packet Type identifier.
The Packet Type identifier field also contains the sequence numbers for those packets which have them - Data, RR, RNR and Reject packets. That's because of the way the Packet Type field is encoded - Data Packets have the least significant bit (LSB) set to 0, and all other packet types have the LSB set to 1. Similarly, the next LSB is set to 0 for Supervisory packets, and to 1 for other packet types (there is an exception to this, the Diagnostic packet, which is encoded 0xF1, or 11110001 in binary. However, it can be distinguished from Supervisory packets, because all Supervisory packets are of the form XXX0XX01).
Data packets contain both a Send Sequence Number P(S) and a Receive Sequence Number P(R). P(R) is the expected value of P(S) in the next Data Packet to be received. Supervisory packets (RR, RNR & Reject) just contain P(R).
Both sequence numbers start at 0 when the virtual circuit is established or reset.
Sequence numbers are used for flow control - the X.25 window ensures that only a limited number of Data Packets can be transmitted before an acknowledgement is received.
M-bit - More Data
The M-bit only appears in Data Packets (within the Packet Type field), and is used to link data packets together. This allows blocks of infinite length to be fragmented into data packets, and the receiver to reassemble the packets into the original block size.
However, there is a complication - only those packets which are full (that is, are of the maximum allowable size for the virtual circuit) should have the M-bit set. Networks are not obliged to maintain the setting of the M-bit if the packet is not full. The idea behind this is to reduce the buffering required within Network switches. As the M-bit is handled by the X.25 implementation, this is not an issue for applications to concern themselves over - the FarSync X.25 software ensures that M-bit packets are full.
However, it does mean that the X.25 packet size must be correctly configured, especially on those links which do not support Packet Size Negotiation.
D-bit - Delivery Confirmation
The D-bit only really applies to Data packets (it's one of the bits in the GFI). It's used to ensure that acknowledgment of Data packets is end-to-end. When not set, a local network node can acknowledge the receipt of a Data Packet before forwarding it on to the next node.
The D-bit can also be set in Call set-up packets to indicate that the D-bit will be used in Data packets once the call has been connected, but this is informational only and of little practical use.
Q-bit - Qualified Data
Qualified Data is a concept for which there is no equivalent in TCP/IP. It enables a parallel channel of data to be transferred at the same time as normal data, and is thus typically used for control information, for example in X.29 for Triple-X PADs.
The Q-bit only applies to Data packets, and is held within the GFI.
Interrupt Packets are again a feature of X.25 for which there is no real equivalent in TCP/IP. They provide a mechanism whereby a DTE can send a message which can overtake normal data flow - perhaps, useful if the virtual circuit is flow-controlled and the window is blocked, but in practice there are very few applications for Interrupt packets, other than Triple-X PADs.
Only a single Interrupt packet can be sent at a time - it's necessary to receive an Interrupt Confirm packet in response before another Interrupt packet can be transmitted.
The 1980 X.25 Recommendation only allowed for Interrupt Packets of a single byte in length; the 1984 Recommendation provided for Interrupt packets of between 0 and 32 bytes.
Virtual Circuits procedures
SVCs - Switched Virtual Circuits in detail, including call establishment.