High-Level Data Link Control
From Wikipedia, the free encyclopedia
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 0009 — 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 |
[edit] 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 , into the V.42 protocol as LAPM, into the Frame Relay protocol stack as LAPF and into the ISDN protocol stack as LAPD. It is now the basis for the framing mechanism used with the Point-to-Point Protocol on synchronous lines, as 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-carrier (E1) and SONET multichannel telephone lines. Some vendors, such as Cisco, implemented protocols such as Cisco HDLC that used the low-level HDLC framing techniques but didn't use the standard HDLC header.
[edit] 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 the beginning and end of each frame has to be identified. 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. Using the standard NRZI encoding from bits to line levels (0 bit = transition, 1 bit = no transition), this generates a continuous bit pattern:
0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 _____________ _____________ _____________ _____________ _/ \_/ \_/ \_/ \
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.
This also (again, assuming NRZI encoding of the output) provides a minimum of one transition per 6 bit times, so the receiver can stay in sync with the transmitter.
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 (counting from right to left and starting at zero) 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.
[edit] Structure
The contents of an HDLC frame, including the flag, are
Flag | Address | Control | Information | FCS | Flag |
---|---|---|---|---|---|
8 bits | 8 bits | 8 or 16 bits | Variable length, 0 or more bits, in multiples of 8 | 16 or 32 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. The Frame Check Sequence is either a 16-bit CRC-CCITT or a 32-bit CRC-32.
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 1×10−5 errors per bit. Digital data for computers normally requires a bit error rate better than 1×10−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 acknowledge. It then retransmits the failed frame. Modern optical networks have reliability substantially better than 1×10−5 errors per bit, but that simply makes HDLC even more reliable.
[edit] Types of Stations (Computers), and Data Transfer Modes
- Primary terminal is responsible for operation control over the link. It issues the frames which are called commands.
- Secondary terminal operates under the control of the primary. Frames issues, are responses only. Primary is linked with secondaries by multiple logical links.
- Combined terminal, has the features of both primary and secondary terminals. It issues both commands and responses.
[edit] HDLC Operations, and Frame Types
[edit] I-Frames (user data)
contain user data, sequence number of the transmitted frame, piggybacking acknowledgment number of received I-Frame. Their maximum window size is 7 or 127. I-Frames also contain poll/final (P/F) bit. Depending on response mode,
- In NRM the primary terminal sets the P-bit to poll. The secondary sets the F-bit in last I-frame to a response.
- IN ARM and ABM, the P/F bits are used to force response.
[edit] S-Frames (control)
Used both for flow and error control.
[edit] Receive Ready (RR)
- used as positive acknowledgement (thruN(r)-1) and a request that no more I-frames be sent until a subsequent RR is in use.
- Primary terminal can issue a POLL by P-bit setting
- Secondary terminal responds with F-bit set, if it has no data to send.
[edit] Receive Not Ready (RNR)
- Used as positive ACK and a request that no more i-frames should be sent till the subsequent RR is received.
- Either Primary or Combined station can set P-bit to solicit the receive status of a secondary/combined station.
- Secondary/Combined station response to Poll with F-bit set if the station is busy.
[edit] Reject (REJ)
Uses Go-Back-N technique (Retransmitt from N(r))
[edit] Selective Reject
Uses Selective Repeat Technique ((Repeat N(r))
[edit] U-Frames
- Mode settings (SNRM, SNRME, SARM, SARME, SABM, SABME, UA, DM, RIM, SIM, RD, DISC)
- Information Transfer(UP, UI)
- Recovery (FRMR, RSET)
- Invalid Control Field
- Data Field Too Long
- Data field not allowed with received Frame Type
- Invalid Receive Count
- Miscalleneaous (XID, TEST)
[edit] Link Configurations
Link configurations can be categorized as being either:
- Unbalanced, which consists of one primary terminal, and one or more secondary terminals.
- Balanced, which consists of two peer terminals.
The three link configurations are:
- Normal Response Mode (NRM) is an unbalanced configuration in which only the primary terminal may initiate data transfer. The secondary terminal transmits data only in response to commands from the primary terminal. The primary terminal polls the secondary terminal(s) to determine whether they have data to transmit, and then selects one to transmit.
- Asynchronous Response Mode (ARM) is an unbalanced configuration in which secondary terminals may transmit without permission from the primary terminal. However, the primary terminal still retains responsibility for line initialization, error recovery, and logical disconnect.
- Asynchronous Balanced Mode (ABM) is a balanced configuration in which either station may initiate the transmission.
[edit] HDLC Command and response repertoire
- Commands (I, RR, RNR, (SNRM or SARM or SABM) DISC
- Responses (I, RR, RNR, UA, DM, FRMR)
[edit] Basic Operations
- Initialization can be requested by either side. When the six-mode set-command is issued. This command:
- Signals the other side that initialization is requested
- Specifies the mode, NRM, ABM, ARM
- Specifies whether 3 or 7 bit sequence numbers are in use.
The HDLC module on the other end transmitts (UA) frame when the request is accepted. And if the request is rejected it sends (DM) disconnect mode frame.
[edit] Functional Extensions (Options)
- For Switched Circuits
- Commands: ADD - XID
- Responses: ADD - XID, RD
- For 2-way Simultaneous commands & responses are ADD - REJ
- For Single Frame Retransmission commands & responses: ADD - SREJ
- For Information Commands & Responses: ADD - Ul
- For Initialization
- Commands: ADD - SIM
- Responses: ADD - RIM
- For Group Polling
- Commands: ADD - UP
- Extended Addressing
- Delete Response I Frames
- Delete Command I Frames
- Extended Numbering
- For Mode Reset (ABM only) Commands are: ADD - RSET
- Data Link Test Commands & Responses are: ADD - TEST
- Request Disconnect. Responses are ADD - RD
- 32-bit FCS
[edit] HDLC Command/Response Repertoire
Type Of Frame | Name | Command/
Response |
Description | Info | C-Field Format
8...7...6...5...4...3...2...1..... |
---|---|---|---|---|---|
Information(I) | C/R | User exchange data | .-N(R)-... P/F.....-N(S)-..0 | ||
Supervisory (S) | Receive Ready (RR) | C/R | Positive Acknowledgement | Ready to receive I-Frame | .-N(R)-... P/F...0...0...0...1 |
Receive Not Ready (RNR) | C/R | Positive Acknowledgement | Not Ready to receive | .-N(R)-... P/F...0...1...0...1 | |
Reject (REJ) | C/R | Negative Acknowledgement | go back N | .-N(R)-... P/F...1...0...0...1 | |
Selective Reject (SREJ) | C/R | Negative Acknowledgement | selective reject | .-N(R)-... P/F...1...1...0...1 |
[edit] Unnumbered Frames
Unnumbered frames are identified by the low two bits being 1. With the P/F flag, that leaves 5 bits as a frame type. Even though less than 32 values are in use, some types have different meanings depending on the direction they are sent: as a request or as a response. The relationship between the DISC (disconnect) command and the RD (request disconnect) response seems clear enough, but the reason for making SARM command numerically equal to the DM response is obscure.
Name | Command/
Response |
Description | Info | C-Field Format
8...7...6...5...4...3...2...1..... |
---|---|---|---|---|
Set normal response SNRM | C | Set mode | = 3 bit sequence number | ..1...0...0..P....0...0...1...1 |
Set normal response extended mode SNRME | C | Set mode; extended | = 7 bit sequence number | ..1...1...0..P....1...1...1...1 |
Set asynchronouse response SARM | C | Set mode | = 3 bit sequence number | ..0...0...0..P....1...1...1...1 |
Set asynchronouse response extended mode SARME | C | Set mode; extended | = 7 bit sequence number | ..0...1...0..P....1...1...1...1 |
Set asynchronouse balanced/extended mode SABM | C | Set mode | = 3 bit sequence number | ..0...0...1..P....1...1...1...1 |
Set asynchronouse balanced extended mode SABME | C | Set mode; extended | = 7 bit sequence number | ..0...1...1..P....1...1...1...1 |
Set initialization mode SIM | C | Initialize link control function | in the addressed station | ..0...0...0..P....0...1...1...1 |
Disconnect DISC | C | Terminate logical link connection | Future commands return RD | ..0...1...0..P....0...0...1...1 |
Unnumbered Acknowledgement UA | R | Acknowledge acceptance | of one of the set-mode commands. | ..0...1...1....F..0...0...1...1 |
Disconnect Mode DM | R | Responder in Disconnect Mode | mode set required | ..0...0...0....F..1...1...1...1 |
Request Disconnect RD | R | Solicitation for DISC Command | ..0...1...0....F..0...0...1...1 | |
Request Initialization Mode RIM | R | Initialization needed | Request for SIM command | ..0...0...0....F..0...1...1...1 |
Unnumbered Information UI | C/R | Unacknowledged data | has a payload | ..0...0...0..P/F..0...0...1...1 |
Unnumbered Poll (UP) | C | Used to solicit | control information | ..0...0...1..P....0...0...1...1 |
Reset RSET | C | Used for recovery | Resets N(R), N(S) | ..1...0...0..P....1...1...1...1 |
Exchange Indication XID | C/R | Used to Request/ | Report capabilities | ..1...0...1..P/F..1...1...1...1 |
Test TEST | C/R | Exchange identical information | fields for testing | ..1...1...1..P/F..0...0...1...1 |
Frame Reject FRMR | R | Report receipt | of unaccaptable frame | ..1...1...0....F..0...1...1...1 |
[edit] 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 page
[edit] Bibliography
- Computer Communications (course notes) by Chaim Zieglier PhD, Brooklyn College.
- Data and Computer communications, by Willam Stallings. (Seventh Edition, Prentice Hall)