X.25 Data Link Layer

The purpose of the link layer is essentially to provide a reliable mechanism to exchange data between one end of the link and the other. The link layer protocol therefore provides procedure for error detection and correction.

Link Access Procedures

There are 2 types of Link Access Procedures (the Data Link protocol) employed by X.25:

  • LAP (Link Access Procedure)
  • LAPB (Link Access Procedure Balanced)

Both of these are variants of the HDLC (High-level Data Link Control) protocol, and conform to the HDLC frame structure. HDLC is a bit-oriented protocol - it can carry units of information of any number of bits. HDLC frames need not necessarily be byte aligned, but they invariably are for real-world applications, such as X.25.

In practice, LAP is never used (it contains a flaw that can potentially result in a deadlock) and so LAPB is always used by real X.25 links. LAP is therefore not discussed further within this guide.

LAPB in Detail

HDLC Framing This page describes contents of HDLC frames
LAPB Frame Types This page contains a reference guide for the different types of LAPB frame, and the purpose for which they are used
LAPB Procedure Description This section describes how LAPB works

LAPB Procedure Description

There are 4 phases of operation for a LAPB link:

  • Disconnected Phase
  • Link Set-up Phase
  • Information Transfer Phase
  • Link Disconnection Phase

The Disconnected Phase would seem to be of little interest, as when the link is disconnected it's not possible to transfer data, but some DTEs deliberately start up in the Disconnected Phase by transmitting a DISC frame. Indeed, there are advantages in doing so, as it ensures that the other end of the link is reset to the disconnected state, as this will clear any active X.25 calls. (It's possible in the case of a system reboot that the other end of the link won't detect an X.25 link failure.) Whilst in Disconnected Phase, a DTE will respond with DM frames to all commands, except when it's able to enter Information Transfer.

The Link Setup Phase is transient - if successful, the link enters the Information Transfer phases, and if unsuccessful the link re-enters the Disconnected Phase. It is initiated by one side transmitting a SABM (or SABME) frame, and completed by the other side responding with a UA frame.

In Information Transfer Phase, the link is operational, and X.25 layer 3 packets can be exchanged. This is dealt with in more detail below.

The Link Disconnection Phase is initiated from Information Transfer by transmitting a DISC frame. The link will (eventually) end-up in the Disconnected Phase regardless of whether a response is received, but the other side of the link should respond with a UA frame if it receives a DISC in the Information Transfer state.

LAPB Information Transfer

This is the what the Link Layer is all about - transferring frames one from side to the other in a reliable way - that is, ensuring that they are delivered in the correct order without corruption.

The FCS is used to ensure that that frames are delivered intact, and the sequence numbers used to ensure that frames are delivered in the correct order. In addition, a timeout on each frame ensures that the need to retransmission is detected in a timely manner.

When an I-frame is transmitted, a timer is started; this timer is then stopped when a frame is received which acknowledges all outstanding I-frames. If only some of the I-frames are acknowledged by a received frame, the timer is restarted; this allows frames to be exchanged continuously without the need to recover from timer expiry.

If the timer does expire with unacknowledged frames outstanding, then a command frame is transmitted with the Poll bit set; no further frames can be sent until an response with the Final bit set is received. On receiving the frame with the Final bit set, the sequence number is examined; it's then possible to determine whether any I-frames need to be retransmitted.

If an I-frame goes missing and a further I-frame is sent, then the receiver will detect that from the sequence number that a frame needs to be retransmitted, and will send a REJ frame to request the other end to start retransmitting from the gap in the sequence numbers.

Link Failure

A failing link can be detected in 2 ways:

  1. at the Physical Layer, if a control circuit drops
  2. at the Data Link Layer, by polling the peer periodically, using RR command frames; if not response if received after a number of retries, then the link is reset, and then goes to disconnected mode after a further timeout, causing any active virtual circuits to be disconnected.

14-Sep-2016