LAPB


Link Access Procedure, Balanced implements the data link layer as defined in the X.25 protocol suite. LAPB is a bit-oriented protocol derived from HDLC that ensures that frames are error free and in the correct sequence. LAPB is specified in ITU-T Recommendation X.25 and ISO/IEC 7776. It implements the connection-mode data link service in the OSI Reference Model as defined by ITU-T Recommendation X.222.
LAPB is used to manage communication and packet framing between data terminal equipment and the data circuit-terminating equipment devices in the X.25 protocol stack. LAPB is essentially HDLC in Asynchronous Balanced Mode. LAPB sessions can be established by either the DTE or DCE. The station initiating the call is determined to be the primary, and the responding station is the secondary.

Protocol structure

Frame types

Flag – The value of the flag is always 0x7E. In order to ensure that the bit pattern of the frame delimiter flag does not appear in the data field of the frame, a technique known as Bit stuffing is used by both the transmitter and the receiver.
Address field – In LAPB, this field has no meaning since the protocol works in a point to point mode and the DTE network address is represented in the layer 3 packets. This byte is therefore put to a different use; it separates the link commands from the responses and can have only two values: 0x01 and 0x03. 01 identifies frames containing commands from DTE to DCE and responses to these commands from DCE to DTE. 03 is used for frames containing commands from DCE to DTE and for responses from DTE to DCE. Therefore, one side must be configured as a Layer 2 DTE and the other as a Layer 2 DCE.
Control field – it serves to identify the type of the frame. In addition, it includes sequence numbers, control features and error tracking according to the frame type.
Modes of operation – LAPB works in the Asynchronous Balanced Mode. This mode is balanced and is signified by the SABM/SM frame. Each station may initialize, supervise, recover from errors, and send frames at any time. The DTE and DCE are treated as equals.
FCS – The Frame Check Sequence enables a high level of physical error control by allowing the integrity of the transmitted frame data to be checked.
Window size – LAPB supports an extended window size where the maximum number of outstanding frames for acknowledgment is raised from 7 to 127 and 32767.

Protocol operation

LAPB has no master/slave node relationships. The sender uses the Poll bit in command frames to insist on an immediate response. In the response frame this same bit becomes the receivers Final bit. The receiver always turns on the Final bit in its response to a command from the sender with the Poll bit set. The P/F bit is generally used when either end becomes unsure about proper frame sequencing because of a possible missing acknowledgment, and it is necessary to re-establish a point of reference. It is also used to trigger an acknowledgment of outstanding I-frames.

Node addressing

The following table shows which addresses are placed into the LAPB frame when issuing commands and responses from DTE to DCE and DCE to DTE using single link operation or multilink operation:

Protocol commands and responses

Command frame sent with P = 1Response frame returned with F = 1Info
SABM, SABME, SMUA, DM
I-frameRR, RNR, REJ, SREJ
I-frameFRMR
RR, RNR, REJRR, RNR, REJ, SREJ
FRMRFRMR
DISCUA, DM