High-Level Data Link Control
From Free net encyclopedia
←Older revision | Newer revision→
High-Level Data Link Control (HDLC) is a bit-oriented synchronous data link layer protocol developed by the International Organization for Standardization (ISO). The original ISO standards for HDLC were:
- ISO 3309 — Frame Structure
- ISO 4335 — Elements of Procedure
- ISO 6159 — Unbalanced Classes of Procedure
- ISO 6256 — Balanced Classes of Procedure
The current standard for HDLC is ISO 13239, which replaces all of those standards.
HDLC provides both connection oriented and connectionless service.
HDLC can be used for point to multipoint connections, but is now used almost exclusively to connect one device to another, using what is known as Asynchronous Balanced Mode (ABM). The other modes are Normal Response Mode and Asynchronous Response Mode.
Contents |
History
HDLC is based on IBM's SDLC protocol, which is the layer 2 protocol for IBM's Systems Network Architecture (SNA). It was imported by the ITU into the X.25 protocol stack as LAPB. It is now the basis for synchronous PPP (point to point protocol) used by many servers to connect to a wide area network, most commonly the Internet. A mildly different version is also used as the control channel for E-1 and SONET multichannel telephone lines.
Framing
HDLC frames can be transmitted over synchronous or asynchronous links. Those links have no mechanism to mark the beginning or end of a frame, so we have to identify the beginning and end of each frame. This is done by using a frame delimiter, or "flag", which is a unique sequence of bits that is guaranteed not to be seen inside a frame. This sequence is '01111110', or, in hexadecimal notation, 7E. Each frame begins and ends with a frame delimiter.
When no frames are being transmitted on a synchronous link, a frame delimiter is continuously transmitted on the link. This generates a continuous bit pattern:
01111110011111100111111001111110 ______ ______ ______ ______ _ __ __ __ _
This is used by modems to train and synchronize their clocks via phase-locked loops.
Actual binary data could easily have a sequence of bits that is the same as the flag sequence. So the data's bit sequence must be transmitted so that it doesn't appear to be a frame delimiter.
On synchronous links, this is done with bit stuffing. The sending device ensures that any sequence of 5 contiguous 1-bits is automatically followed by a 0-bit. A simple digital circuit inserts a 0-bit after 5 1-bits. The receiving device knows this is being done, and will automatically strip out the extra 0-bits. So if a flag is received, it will have 6 contiguous 1-bits. The receiving device see 6 1-bits and knows it is a flag — otherwise the 6th bit would have been a 0-bit.
Asynchronous links using serial ports or UARTs just send bits in groups of 8. They lack the special bit-stuffing digital circuits. Instead they use "control-octet transparency", also called "byte stuffing" or "octet stuffing". The frame boundary octet is 01111110, (7E in hexadecimal notation). A "control escape octet", has the bit sequence '01111101', (7D hexadecimal). The escape octet is sent before a data byte with the same value as either an escape or frame octet. Then, the following data has bit 5 inverted. For example, the data sequence "01111110" (7E hex) would be transmitted as "01111101 01011110" ("7D 5E" hex). Any octet value can be escaped in the same fashion.
Structure
The contents of an HDLC frame, including the flag, are
Flag | Address | Control | Information | FCS | (Optional Flag) |
---|---|---|---|---|---|
8 bits | 8 bits | 8 or 16 bits | Variable length, 0 or more bits, in multiples of 8 | 16 bits | 8 bits |
Note that the end flag of one frame can be (but does not have to be) the beginning (start) flag of the next frame.
Note that the data comes in groups of 8 bits. The telephone and teletype systems arranged most long-haul digital transmission media to send bits eight at a time, and HDLC simply adapts that standard to send bulk binary data. Voice is encoded by A-law or u-law into 8-bit samples. Teletypes send 8-bit codes to represent each character.
The FCS is the Frame Check Sequence, and is a more sophisticated version of the parity bit. The field contains the result of a binary calculation that uses the bit sequences that make up the 'Address', 'Control' and 'Information' fields. The calculation is designed to detect errors in the transmission of the frame — lost bits, flipped bits, extraneous bits so that the frame can be dropped by the receiver if an error is detected. It is this method of detecting errors that can set an upper bound on the size of the data portion of the frame. Essentially, the longer the length of the data portion of the frame becomes, the harder it is to guarantee that certain types of transmission errors will be found. There are multiple types of Frame Check Sequence, and the most commonly used in this context will be CRC-16 or CRC-CCITT.
The FCS is needed to detect transmission errors. When HDLC was designed, long-haul digital media were designed for telephone systems, which only need a bit error rate of 1x10-5 errors per bit. Digital data for computers normally requires a bit error rate better than 1x10-12 errors per bit. By checking the FCS, the receiver can discover bad data. If the data is ok, it sends an "acknowledge" packet back to the sender. The sender can then send the next frame. If the receiver sends a "negative acknowledge" or simply drops the bad frame, the sender either receives the negative acknowledge, or runs into its time limit while waiting for the acknowldge. It then retransmits the failed frame. Modern optical networks have reliability substantially better than 1x10-5 bits per bit, but that simply makes HDLC even more reliable.
See also
- PPP, SDLC, SLIP
- RFC 2687, Proposed Standard, PPP in a Real-time Oriented HDLC-like Framing
- RFC 1662, standard 51, PPP in HDLC-like Framing
- HDLC information pageda:HDLC
de:High-Level Data Link Control es:HDLC fr:High Level Data Link Control he:High-level Data Link Control pl:HDLC pt:HDLC fi:HDLC zh:高级数据链路控制