0% found this document useful (0 votes)
59 views35 pages

Computer Communication Networks CS-418: Lecture 4 - 1 Data Link Layer Protocols - HDLC

The document discusses HDLC (High Level Data Link Control), a commonly used data link protocol. It describes HDLC's basic characteristics including the three types of stations (primary, secondary, combined), two link configurations (unbalanced, balanced), and three data transfer modes (normal response mode, asynchronous balanced mode, asynchronous response mode). It then explains the key components of an HDLC frame, including the flag fields, address field, control field, information field, and frame check sequence. Finally, it provides more details on the control field and how it distinguishes between different types of frames.

Uploaded by

Ali Memon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views35 pages

Computer Communication Networks CS-418: Lecture 4 - 1 Data Link Layer Protocols - HDLC

The document discusses HDLC (High Level Data Link Control), a commonly used data link protocol. It describes HDLC's basic characteristics including the three types of stations (primary, secondary, combined), two link configurations (unbalanced, balanced), and three data transfer modes (normal response mode, asynchronous balanced mode, asynchronous response mode). It then explains the key components of an HDLC frame, including the flag fields, address field, control field, information field, and frame check sequence. Finally, it provides more details on the control field and how it distinguishes between different types of frames.

Uploaded by

Ali Memon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Computer Communication Networks

CS-418

Course Teacher : Sumayya Zafar


Class : BE EE

Lecture 4 – 1
Data Link Layer Protocols - HDLC

Spring Semester 2021 1


Introduction
• In the following slides we will examine several widely used data
link protocols.
• The first one, HDLC, is a classical bit oriented protocol whose
variants have been in use for decades in many applications.

Spring Semester 2021 3


HDLC – High Level Data Link Control
• HDLC is a commonly used protocol developed by the ISO and used
to control data transfer over a link.
• It is derived from the data link protocol first used in the IBM
mainframe world: SDLC (Synchronous Data Link Control) protocol.
• It includes functions of flow control, link management and error
control.
• It thus serves as a good practical illustration of the principles
discussed in data link layer lectures.
• Not only is HDLC widely used, but it is the basis for many other
important data link control protocols.
Spring Semester 2021 4
HDLC - Basic Characteristics
• The protocol allows for a variety of different types of link.
• The two nodes at either end of the link are referred to as stations.
• To satisfy the requirements of variety of applications, HDLC defines
three types of stations, two link configurations, and three data
transfer modes of operation.

Spring Semester 2021 5


HDLC - Station Types
• A data link involves two or more
participating stations. The three station
types are:
• Primary station: Acts as a master and
responsible for controlling the operation of the
link. Frames issued by the primary are called
commands.
• Secondary station: Operates under the control
of the primary station. Frames issued by a
secondary are called responses. The primary
maintains a separate logical link with each
secondary station on the line.
• Combined station: Combines the features of
primary and secondary. A combined station
may issue both commands and responses.

Spring Semester 2021 6


HDLC - Link Configurations
• Two types of link configuration are:
• Unbalanced configuration: This is the situation in which a single
primary station has control over the operation of one or more
secondary stations and supports both full duplex and half
duplex transmission. Primary station establishes and maintains
the link and is responsible to error recovery.

Spring Semester 2021 7


HDLC - Link Configurations
• Two types of link configuration are:
• Balanced configuration: This refers to a point to point link
which has two combined stations, each capable of issuing a
command. Balanced configuration supports both full duplex and
half duplex transmission. Stations are peers on the link and are
and share equal responsibility for error recovery and line
management.

Spring Semester 2021 8


HDLC - Transfer Modes
• The three data transfer modes are:
• Normal response mode (NRM): Used with an unbalanced configuration. The primary may
initiate data transfer to a secondary, but a secondary may only transmit data in response
to a command from the primary.

Spring Semester 2021 9


HDLC - Transfer Modes
• The three data transfer modes are
• Asynchronous balanced mode (ABM): Used with a balanced configuration. Either combined station
may initiate transmission without receiving permission from the other combined station. Both
stations are equally responsible for error recovery and connection establishment.

• Asynchronous response mode (ARM): Used with an unbalanced configuration. The secondary may
initiate transmission without explicit permission of the primary. The primary still retains
responsibility for the line, including initialization, error recovery, and logical disconnection.

Spring Semester 2021 10


HDLC - Transfer Modes
• Normal Response Mode is used on multidrop lines, in which a
number of terminals are connected to a host computer. The
computer polls each terminal for input. Normal Response Mode
is also sometimes used on point to point links, particularly if the
link connects a terminal or other peripheral to a computer.
• Asynchronous Balance Mode is the most widely used of the
three modes; it makes more efficient use of a full duplex point
to point link because there is no polling overhead.
• Asynchronous Response Mode is rarely used; it is applicable to
some special situations in which a secondary may need to
initiate transmission.
Spring Semester 2021 11
HDLC - Frame Format
• HDLC uses synchronous transmission.
• All transmissions are in the form of frames, and a single frame format suffices for all
types of data and control exchanges.
• HDLC frame consists of the following:
• Flag field,
• Address field, Header
• Control field,
• Information field,
• Frame Check Sequence (FCS)
• Flag field Trailer

Spring Semester 2021 12


HDLC - Flag Fields(8 Bit)
• Flag fields delimit the frame at both ends with the unique pattern of
01111110.
• A single flag may be used as the closing flag for one frame and the
opening flag for the next.
• On both sides of the user network interface, receivers are
continuously checking for the flag sequence to synchronize on the
start of a frame.
• Because the protocol allows the presence of arbitrary bit patterns
there is no assurance that the pattern 01111110 will not appear
somewhere inside the frame, thus destroying synchronization.
• To avoid this problem, a procedure known as bit stuffing is used. For
all bits between the starting and ending flags, the transmitter inserts
an extra 0 bit after each occurrence of five 1s in the frame.
Spring Semester 2021 13
HDLC - Flag Fields(8 Bit)
• After detecting a starting flag, the receiver monitors the bit stream.
• When a pattern of five 1s appears, the sixth bit is examined. If this bit is 0, it is
deleted. If the sixth bit is a 1 and the seventh bit is a 0, the combination is
accepted as a flag.
• If the sixth and seventh bits are both 1, the sender is indicating an abort
condition.
• With the use of bit stuffing, arbitrary bit patterns can be inserted into the data field
of the frame. This property is known as data transparency.

Original Pattern
111111111111011111101111110

After bit stuffing


1111101111101101111101011111010

Spring Semester 2021 14


HDLC - Address Field(8 Bits or extendable)

• The address field identifies the secondary station that transmitted or is to receive the
frame.
• This field is not needed for point to point links but is always included for the sake of
uniformity.
• The address field is usually 8 bits long but, by prior agreement, an extended format may be
used in which the actual address length is a multiple of 7 bits.
• The leftmost bit of each octet is 1 or 0 according as it is or is not the last octet of the
address field. The remaining 7 bits of each octet form part of the address.
• The single octet address of 11111111 is interpreted as the all stations address in both basic
and extended formats. It is used to allow the primary to broadcast a frame for reception by
all secondaries.

Spring Semester 2021 15


HDLC - Control Field(8 or 16 Bits)
• The control field distinguishes between the three different types of frame
used in HDLC, namely:
• Information Frame (I) ,
• Supervisory Frame (S) and
• Unnumbered Frame (U).
• The first one or two bits of the field determine the type of frame.
• The field also contains control information which is used for flow control and
link management.

Spring Semester 2021 16


HDLC - Control Field(8 or 16 Bits)

Spring Semester 2021 17


HDLC - Control Field For Information Frames

• Information frames (I-frames) carry the data to be transmitted for the user . Additionally, flow and error control
data, using the ARQ mechanism, are piggybacked on an information frame.
• An I-frame is distinguished by the first bit of the control field being a binary 0.
• The control field of an I-frame contains both a send sequence number, N(S), and a receive sequence number,
N(R), which are used to facilitate flow control.
• N(S) is the sequence number of frames sent and N(R) the sequence number of frames successfully received by
the sending node prior to the present frame being sent.
• Thus the first frame transmitted in a data transfer has send and receive sequence numbers 0,0.
• Since 3 bits are available for each of the sequence numbers N(S) and N(R), they can have values only between 0
and 7, that is they use modulo-8 numbering. This imposes a limit on the size of the windows used for flow control.
• I-frames also contain a poll/final (P/F) bit. This acts as a poll bit when used by a primary station and a final bit by
a secondary.
• A poll bit is set when a primary is transmitting to a secondary and requires a frame or frames to be returned in
response, and the final bit is set in the final frame of a response.

Spring Semester 2021 18


HDLC - Control Field For Supervisor Frames

• Supervisory frames (S-frames) provide the ARQ mechanism when piggybacking is


not used.
• S-frames are distinguished by the first 2 bits of the control field being 10. These
frames are used as acknowledgements for flow and error control. HDLC allows for
both go back n and selective repeat ARQ.
• They also contain two function bits which allow for four functions which lists the
supervisory commands/responses.
• The S-frames contain only a receive sequence number since they relate to the
acknowledgement of I-frames and not to their transmission.
• The three bits from N(R), indicate that all I-frames numbered up to 𝑁(𝑅) − 1 have
been correctly received and the receiver is expecting the I-frame numbered 𝑁(𝑅).

Spring Semester 2021 19


HDLC - Control Field For Supervisor Frames

• Four types of S-frames are:


• Receive Ready (RR) - An RR frame
confirms receipt of frames numbered
up to 𝑁(𝑅) − 1 and indicates that it
is ready to receive frame number
𝑁(𝑅).
• An RR frame with the poll bit set to
1 may be used by a primary station
to poll a secondary station.

Spring Semester 2021 20


HDLC - Control Field For Supervisor Frames

• Four types of S-frames are:


• Reject (REJ)- An REJ frame is used to
indicate that a transmission error has
been detected by the primary or
secondary station.
• A station requests retransmission of
information frame number 𝑁(𝑅) and
those that follow it.
• It implies that I-frames numbered
𝑁(𝑅) − 1 and below have been correctly
received.
• This strategy is similar to Go Back N
protocol.
Spring Semester 2021 21
HDLC - Control Field For Supervisor Frames

• Four types of S-frames are:


• Receive Not Ready (RNR) - An RNR frame
indicates a temporary busy condition.
• The station which sends the RNR frame
acknowledges I-frames up to 𝑁(𝑅) − 1 ,
expects I-frame number 𝑁(𝑅) , and
indicates that it cannot accept any more I-
frames.
• When the condition has been repaired, the
receiver sends a RECEIVE READY, REJECT,
or certain control frames.

Spring Semester 2021 22


HDLC - Control Field For Supervisor Frames

• Four types of S-frames are:


• Selective Reject (SREJ) - An SREJ frame is
used by the primary or secondary to
request retransmission of the single I-
frame numbered 𝑁(𝑅).
• All frames up to 𝑁 𝑅 − 1 have been
received correctly but 𝑁(𝑅) has not.
• Once SREJ has been transmitted, the only
I-frames accepted are the frame N(R) and
those that follow it.
• This strategy is similar to Selective Repeat
protocol.
Spring Semester 2021 23
HDLC - Control Field For Unnumbered Frames

• Unnumbered frames do not contain any sequence numbers and are used for various control functions.
• They have five function bits which allow for the fairly large number of commands and responses , but not all 32
possibilities are used.

24
Spring Semester 2021
HDLC - Information & FCS Field

• The information field is present only in I-frames and some U-


frames. The field can contain any sequence of bits but must
consist of an integral number of octets. The length of the
information field is variable up to some system defined
maximum.
• The frame check sequence (FCS) is an error detecting code
calculated from the remaining bits of the frame, exclusive of
flags. The normal code is the 16-bit CRC-CCITT defined as
follows: 𝐶𝑅𝐶 − 𝐶𝐶𝐼𝑇𝑇 = 𝑥 16 + 𝑥 12 + 𝑥 5 + 1

25
Spring Semester 2021
HDLC Operation
• HDLC operation consists of the exchange of I-frames, S-frames,
and U-frames between two stations.
• The operation of HDLC involves three phases.
• First, one side or another initializes the data link so that
frames may be exchanged in an orderly fashion. During this
phase, the options that are to be used are agreed upon.
• After initialization, the two sides exchange user data and the
control information to exercise flow and error control.
• Finally, one of the two sides signals the termination of the
operation.
26
Spring Semester 2021
HDLC Operation - Initialization
• Either side may request initialization by issuing one of the set mode
commands. This command serves three purposes:
• It signals the other side that initialization is requested.
• It specifies which of the three modes (NRM,ABM,ARM) is
requested.
• It specifies whether 3- or 7-bit sequence numbers are to be used.
• If the other side accepts this request, then the HDLC module on that
end transmits an unnumbered acknowledged (UA) frame back to the
initiating side.
• If the request is rejected, then a disconnected mode (DM) frame is
sent.
27
Spring Semester 2021
• Figure shows the frames involved in link setup and
disconnect.
• The HDLC protocol entity for one side issues an SABM
command to the other side and starts a timer.
• The other side, upon receiving the SABM, returns a UA
response and sets local variables and counters to their initial
values.
• The initiating entity receives the UA response, sets its
variables and counters, and stops the timer.
• The logical connection is now active, and both sides may
begin transmitting frames.
• If the timer expire without a response to an SABM, the
originator will repeat the SABM.
• This would be repeated until a UA or DM is received or until,
after a given number of tries, the entity attempting initiation
gives up and reports failure.
• The figure shows the disconnect procedure. One side issues
a DISC command, and the other responds with a UA
response.
Spring Semester 2021 28
HDLC Operation – Data Transfer
• When the initialization has been requested and accepted, then a logical
connection is established.
• Both sides may begin to send user data in I-frames, starting with
sequence number 0.
• The 𝑁(𝑆) and 𝑁(𝑅) fields of the I-frame are sequence numbers that
support flow control and error control.
• An HDLC module sending a sequence of I-frames will number them
sequentially, modulo 8 or 128, depending on whether 3- or 7-bit sequence
numbers are used, and place the sequence number in 𝑁(𝑆).
• 𝑁(𝑅) is the acknowledgment for I-frames received; it enables the HDLC
module to indicate which number I-frame it expects to receive next.

29
Spring Semester 2021
• Figure shows full duplex exchange of I-frames.
• When an entity sends a number of I-frames in a
row with no incoming data, then the receive
sequence number is simply repeated.
• When an entity receives a number of I-frames in a
row with no outgoing frames, then the receive
sequence number in the next outgoing frame
must reflect the cumulative activity.
• Note that, in addition to I-frames, data exchange
may involve supervisory frames.

Spring Semester 2021 30


• Figure shows an operation involving a busy condition. Such
a condition may arise because an HDLC entity is not able to
process I-frames as fast as they are arriving, or the
intended user is not able to accept data as fast as they
arrive in I-frames. – Flow Control
• In either case, the entity’s receive buffer fills up and it must
halt the incoming flow of I-frames, using an RNR command.
• In this example, A issues an RNR, which requires B to halt
transmission of I-frames.
• The station receiving the RNR will usually poll the busy
station at some periodic interval by sending an RR with the
P bit set.
• This requires the other side to respond with either an RR or
an RNR. When the busy condition has cleared, A returns an
RR, and I-frame transmission from B can resume.

Spring Semester 2021 31


• Figure shows error recovery using the REJ
command. – Go Back N Protocol
• A transmits I-frames numbered 3, 4, and 5.
• Number 4 suffers an error and is lost.
When B receives I-frame number 5, it
discards this frame because it is out of
order and sends an REJ with an 𝑁(𝑅) of 4.
• This causes A to initiate retransmission of
I-frames previously sent, beginning with
frame 4.
• A may continue to send additional frames
after the retransmitted frames.

Spring Semester 2021 32


• Figure shows error recovery using a timeout.
• A transmits I-frame number 3 as the last in a sequence of I-
frames. The frame suffers an error.
• B detects the error and discards it. However, B cannot send
an REJ, because there is no way to know if this was an I-
frame. If an error is detected in a frame, all of the bits of
that frame are suspect, and the receiver has no way to act
upon it.
• A, however, would have started a timer as the frame was
transmitted. This timer has a duration long enough to span
the expected response time. When the timer expires, A
initiates recovery action. This is usually done by polling the
other side with an RR command with the P bit set, to
determine the status of the other side.
• Because the poll demands a response, the entity will receive
a frame containing an 𝑁(𝑅) field and be able to proceed.
• In this case, the response indicates that frame 3 was lost,
which A retransmits.

Spring Semester 2021 33


HDLC Operation – Disconnect
• Either HDLC module can initiate a disconnect.
• HDLC issues a disconnect by sending a disconnect (DISC)
frame.
• The remote entity must accept the disconnect by replying with
a UA.

34
Spring Semester 2021
• The figure shows the disconnect procedure. One side issues
a DISC command, and the other responds with a UA
response.

Spring Semester 2021 35


Questions?

Spring Semester 2021 37

You might also like