HDLC LAPB Link Layer

In the ISO layered protocol model, a link layer provides an "error-free" connection on a physical line. This is done by detecting lost or corrupted frames and requesting the remote end to retransmit them. This implementation conforms to CCITT X.25, 1988 (in the Blue Book).

Function Mapping

Function Mapping
ConnectRequest Sends a SABM with the poll bit set. If modulo 128 sequence numbering is used, a SABME is used instead of SABM.
ConnectAccept Not used. Receipt of a SABM or UA establishes the connection.
ConnectReject Not used.
Listen Sends a DM every T1 seconds until a response is received from the remote, or lgo_ListenCancel() is used to return the service to the open state. It is recommended that the Final-bit is set. This unsolicited DM is a signal for the remote end to initiate link setup when it is ready. While in listen state, if the remote sends unsolicited DMs of its own, sets up the link by sending a SABM.
DisconnectRequest Sends a DISC frame every T1 seconds up to Max Retransmissions times. When and if a DM or UA response is received or if there is no response, the link will be shut down and returned to the open state.
DisconnectConfirm Not used.
Write Sends an I frame.
WriteSpecial No special flags recognized.
Xoff Sends an RNR (Receiver Not Ready) frame. This asks the remote to stop sending I frames until an RR (Receiver Ready) or REJ (Reject) frame is sent by us to the remote. The remote can still receive any frame (including I frames), and can still send frames other than I frames. RNR frames can be sent automatically if the system buffer pool starts to run out of buffers.
Xon Sends an RR to indicate cancellation of the previous RNR.
ResetRequest Sends a SABM to reset the link. Unacknowledged I frames can be lost in any reset whether user initiated or automatically initiated due to line problems.
Reopen Immediately returns the link to the open state. It does send a DISC frame, but does not wait for any response.

Configuration Profile

Parameter Explanation
Is this side the DTE? TRUE if this end is the DTE. This affects the address byte of the frame. When configured as the DTE, an address of 1 is used for commands and 3 for responses. This is reversed when configured as the DCE.
Modulus 8? TRUE to use modulo 8 sequence numbering. FALSE means use modulo 128 sequence numbering. Modulo 128 increases the number of control bytes of Information and Supervisory frames from 2 to 3 bytes.
Send Window Size The number of unacknowledged I-Frames allowed for transmission. Must be set to remote site's receive window size. Maximum is one less than the modulus. Seven is common for modulo 8.
Receive Window Size The number of unacknowledged I-Frames allowed for transmission by the remote site. Must be set to remote site's send window size. Maximum is one less than the modulus. Seven is common for modulo 8.
Maximum Frame Size to Receive Maximum bytes allowed in a received frame including the LAPB header bytes (2 for mod 8, 3 for mod 128) but excluding the two CRC bytes.
Maximum Frame Size to Send Sending frames larger than the remote end is configured for will cause the remote to send an FRMR (Frame Reject) for every oversize frame you send. This will be seen as a resetting event at the link layer's controller.
Maximum Retransmissions If other end quits responding, retransmit a frame this many times before giving up.
Autodetect and Configure Address Field? TRUE to set the "Is this side the DTE?" parameter automatically. Do not use in loopback mode or with the remote end also set to autodetect.
Send DISC before SABM on connect? If TRUE, a connect request will result in a DISC being sent before the SABM to bring up the link.
Timer T1-retransmission Expiration of this timer initiates retransmission of frames.
Timer T1-alternate Set to same as T1.
Timer T2-acknowledge Expiration of this timer initiates acknowledgment of received I frames. Set to 1/2 or less of T1.
Timer T4-no traffic Expiration of this timer initiates a ping of remote end to see if they are still there. This end sends an RR frame with the poll bit set. Set this timer to be at least a few seconds more than T1.

It is essential that the local and remote LAPB configurations be consistent. Difficult to detect problems are likely to result if both ends are not carefully configured. The T1 timer must be long enough for a frame of the maximum size to be transmitted, received, and responded to. The best value is the send window size plus one, multiplied by the amount of time it takes to transmit the maximum frame. This means the T1 timer value is dependent on the speed at which the physical connection is operating. Setting T1 too high does no harm if there are few transmission errors. Setting it too low will cause continuous errors. If you do not know the settings at the remote site, try setting T1 high (five or ten seconds) and T2 low (200 milliseconds). This will cause delays in detecting transmission errors and extra Supervisory frames to be sent, but will not seriously degrade performance under normal conditions.