High Level Data Link Control (HDLC) Encapsulation

In this tutorial, you will learn about the High-Level Data Link Control (HDLC) protocol. After reading this tutorial, you will learn why HDLC protocol is used over the network and the purpose, transfer modes, and frames of the HDLC protocol.

Contents:

  1. What is HDLC protocol?
  2. Purpose of HDLC
  3. HDLC Transfer Modes
  4. HDLC Frame
  5. Types of HDLC Frames
  6. Information Frames (I-Frames)
  7. Supervisory Frames (S-Frames)
  8. Unnumbered Frames (U-Frames)

What is HDLC protocol?

HDLC is a protocol of the data link layer. Since it works at the data link layer, it organizes the data in the form of frames. HDLC is a bit-oriented protocol and is applicable for point-to-point and multipoint connections.

  • Flag bytes with bit stuffing, a well-known framing method, were created only for the HDLC protocol.
  • Generally, HDLC is a set of protocols of the data link layer that ensure communication for transmitting frames between network devices.
  • HDLC implements Automatic Repeat Request (ARQ) in the sliding window protocol. Automatic Repeat Request (ARQ) is a technique to resend lost or damaged frames.

Purpose of HDLC

As we have discussed in the previous section that HDLC is the data link layer protocol. It is used for point-to-point or multipoint access.

  • The HDLC protocol can be used in wide area networks. Similar to Ethernet, PPP, and frame relay protocols, HDLC also transmits frames from sender to receiver.
  • For example, between two devices on a WAN, a private communication channel is established, providing point-to-point access. The sender will use the HDLC protocol to send the data to the nearest router.
  • When the router receives an HDLC frame, it de-encapsulates the frame, creating a new frame for the WAN, and sends it to the receiver. By using the HDLC protocol, devices can achieve faster communication.
  • Additionally, the HDLC protocol provides flow and error control mechanisms, which make communication between devices reliable.
  • An effective advantage of the HDLC protocol is that it requires minimal configuration to communicate between devices.

advertisement
advertisement

HDLC Transfer Modes

Two types of transfer modes are provided by HDLC that can be used in various configurations:

  1. Normal Response Mode (NRM)
  2. Asynchronous Balanced Mode (ABM)

Normal Response Mode (NRM): In NRM, the configuration between network devices is unbalanced. There is one primary station and several secondary stations in NRM mode. In this, the command and response process takes place during transmission.

  • The primary station sends commands, and a secondary station can only respond.
  • NRM is used for point-to-point (P2P) and multipoint networks.

The diagram below explains the configuration in normal response mode.

Normal Response Mode of HDLC
  • As shown in the figure, NRM is used for both P2P and multipoint networks. P2P consists of a primary station and a secondary station, in which the primary station sends the command, and the secondary station sends the response.
  • In a multipoint network, one primary station is sending commands and several secondary stations are sending responses.

Asynchronous Balanced Mode (ABM): In ABM, the configuration is balanced between network devices. ABM is applicable only for point-to-point networks. Each station can function as either a primary station or a secondary station. ABM mode is commonly used in today’s networks.

The figure below explains the configuration in asynchronous balanced mode.

configuration in asynchronous balanced mode

As shown in the figure above, the primary station and secondary station are using a point-to-point network. They can both function as a primary station or a secondary station. Also, as shown in the diagram above, both stations can command or respond.

HDLC Frame

In the HDLC protocol, each frame consists of six fields. The structure of the frame varies according to the type of HDLC frame used. The following are the fields of HDLC frames:

  1. Flag
  2. Address
  3. Control
  4. Payload/Data
  5. Frame Check Sequence (FCS)
  • Flag: A flag is an 8-bit sequence located at the beginning and end of a frame. The flag describes the beginning and end of the frame. The flag bit pattern is 01111110.
  • Address: The Address field contains the address of the recipient. The size of the address byte is 1 byte or more bytes depending on the network requirement. Frames on the sending side contain the address of one or more secondary stations, while frames on the secondary station contain only the address of the primary station.
  • Control: The control field of ​​an HDLC frame is 1 or 2 bytes, used for flow and error control.
  • Payload: The data in the payload is in packet format, received from the network layer. The payload length varies by network.
  • FCS: Frame check sequence is used for error detection. It is of 2 or 4 bytes. Cyclic redundancy code (CRC) is used for error detection in FCS.

advertisement

Types of HDLC Frames

To support all possible options of NRM and ABM, 3 types of HDLC frames are used. They are also used to provide flexibility between devices. All these frames act as envelopes for the transmission of various data. They are as follows:

  1. Information Frames (I-Frames)
  2. Supervisory Frames (S-Frames)
  3. Unnumbered Frames (U-Frames)
  • I-Frames: I-Frames are used to transmit user data and control information of the data link layer related to a user.
  • S-Frames: S-Frames transmit control information to the data link layer.
  • U-Frames: U-Frames are reserved for system management, and the information stored in U-Frames is for managing links.

The figure below shows the three types of HDLC frames.

three types of HDLC frames

The above diagram shows 3 types of HDLC frames, with each frame having a different control field that determines the type of frame and defines its functionality.

Information Frames (I-Frames)

HDLC’s I-Frames are used to carry user data to the network layer. I-Frames also ensure reliable communication by providing flow and error control information. The subfields of I-Frames define flow and error control.

advertisement

The figure below explains the control field of I-Frames.

control field of I-Frames
  • The above diagram describes the control field of I-Frames. Here, the first bit of the control field defines the type of frame. The first bit of the control field is 0, which indicates that the frame is an I-frame.
  • The next three bits of the control field in the I-frame are called N(S), which define the sequence number. The last three bits, called N(R), define the acknowledgment number.
  • In the control field of the I-frame, a single-bit P/F is located between N(S) and N(R). The P/F bit has a value of 0 or 1 and is a dual-purpose single-bit, used only if it is set to 1.
  • P means pole when the primary station sent the frame to the secondary station. F means final when a secondary station sent the frame to the primary station.

Supervisory Frames (S-Frames)

S-Frames contain the control information of the data link layer and do not have a payload field. When the station has no frames to send to the receiver or needs to send a command or response instead of an acknowledgment, S-Frames are used for flow and error control.

The figure below explains the control field of S-Frames.

control field of S-Frames
  • As shown in the figure, the first two bits of the control field are 10, which means that the frame is an S-frame.
  • The last 3 bits of the control field, known as N(R), can be either a positive acknowledgment or a negative acknowledgment, depending on the type of S-frame used.
  • The middle 2 bits are known as codes, which subdivide the types of S-frames. The code is of 2 bits and has 4 possibilities, as you can see in the diagram.

Unnumbered Frames (U-Frames)

U-Frames are used for the exchange of session management and control information between connected devices on the channel. U-Frames have a payload field, but this is used for system management information, not user data. Most of the information carried by the U-frame is contained in the code of the control field.

The figure below explains the control field of U-Frames.

Control Field of the Unnumbered Frame (U-Frame)
  • As shown in the figure, the first two bits of the control field are 11, which indicates that it is a U-frame. U-Frames do not have N(R) or N(S).
  • U-Frame consists of a 5-bit code block with 2 bits coming before the P/F and 3 bits coming after the P/F, making up 32 different types of U-Frames.

We can also use U-Frames for connection establishment and connection release. The diagram below shows the connection establishment and connection release mechanism in U-Frames.

Connection Establishment and Connection Release Using U-Frames
  • As shown in the figure, the primary station is asked for connection with a set asynchronous balanced mode frame (SABM-11100), one of 32 U-frames. As a response, the secondary station returns an unnumbered acknowledgment frame (UA-00110), which is also one of 32 U-frames.
  • After completing the communication, the primary station sends a DISC (disconnect-00010) frame to release the connection, and the secondary station sends a confirmation by returning a UA frame.

Key Points to Remember

Here is the list of key points we need to remember about “High-Level Data Link Control Protocol”.

  • HDLC is the protocol of the data link layer. It organizes the data in the form of frames. HDLC is a bit-oriented protocol and is applicable for point-to-point and multipoint connections.
  • The HDLC protocol can be used in wide area networks. Similar to Ethernet, PPP, and frame relay protocols, HDLC also transmits frames from sender to receiver.
  • Two types of transfer modes are provided by HDLC that can be used in various configurations:
    1. Normal Response Mode (NRM)
    2. Asynchronous Balanced Mode (ABM)
  • In NRM and ABM, the station configuration is unbalanced and balanced, respectively.
  • Flag, Address, Control, Payload/Data, and Frame Check Sequence (FCS) are the fields of HDLC Frame.
  • To support all possible options of NRM and ABM, 3 types of HDLC frames provide flexibility between devices.
    1. Information Frames (I-Frames)
    2. Supervisory Frames (S-Frames)
    3. Unnumbered Frames (U-Frames)
  • I-Frames, S-Frames, and U-Frames are used for carrying user data, transmitting control information, and exchanging session management and control information, respectively.
  • If the first bit of the control field is set to 0, it is an I-frame. If the first two bits of the control fields are 10 and 11, these are S-frames and U-frames, respectively.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.