You are on page 1of 100

Data Communication and

Networking
Dr. –Ing. Vo Que Son
Email: sonvq@hcmut.edu.vn

Telecomm. Dept. DCN


1
Faculty of EEE HCMUT
Content
Chapter 3: Data Link Layer Protocols
Flow Control
Error Control
Connection Management
Data Link Protocols
Chapter 4: Telecommunication Networks
802.x standard and TCP/IP Model
Ethernet, Token Pass, Token Ring
IP Addressing: Classfull and VLSM
Network devices
Switching and Routing
STP, VLAN
Telecomm. Dept. DCN
2
Faculty of EEE HCMUT
Framing

The data link layer needs to pack bits into frames, so


that each frame is distinguishable from another. Our
postal system practices a type of framing. The simple
act of inserting a letter into an envelope separates one
piece of information from another; the envelope serves
as the delimiter.
Topics discussed in this section:
Fixed-Size Framing
Variable-Size Framing

Telecomm. Dept. DCN


3
Faculty of EEE HCMUT
A frame in a character-oriented protocol

Telecomm. Dept. DCN


4
Faculty of EEE HCMUT
Byte stuffing and unstuffing

Byte stuffing is the process of adding 1 extra byte whenever there is a


flag or escape character in the text.
Telecomm. Dept. DCN
5
Faculty of EEE HCMUT
Figure 11.3 A frame in a bit-oriented protocol

Telecomm. Dept. DCN


6
Faculty of EEE HCMUT
Bit stuffing and unstuffing

Bit stuffing is the process of adding one extra 0 whenever five consecutive 1s follow a 0
in the data, so that the receiver does not mistake the pattern 0111110 for a flag.
Telecomm. Dept. DCN
7
Faculty of EEE HCMUT
Flow and Error Control
The most important responsibilities of the data link
layer are flow control and error control. Collectively,
these functions are known as data link control.
Flow control refers to a set of procedures used to restrict
the amount of data that the sender can send before
waiting for acknowledgment.
Error control in the data link layer is based on automatic
repeat request, which is the retransmission of data.
 Now let us see how the data link layer can combine framing,
flow control, and error control to achieve the delivery of data
from one node to another. The protocols are normally
implemented in software by using one of the common
programming languages.
Telecomm. Dept. DCN
8
Faculty of EEE HCMUT
Error Control
Forward Error Control (FEC)
Usually used in real-time application (e.g. voice, video)
Accept errors if can not correct
List some FEC methods?
Error Detection + ARQ (Automatic Retransmission Request)
Require absolutely correct data transmission
Used in non real-time application (e.g. email, file
transmission)
2 basic ARQ protocols:
• Stop and Wait ARQ: Bisync (IBM), XModem
• Continuous ARQ:
– Go-back N: e.g. HDLC, V.42
– Selective-Repeat: TCP, Service Specific Connection Oriented
Protocol
Telecomm. Dept. DCN
9
Faculty of EEE HCMUT
Protocols
Now let us see how the data link layer can combine
framing, flow control, and error control to achieve the
delivery of data from one node to another. The
protocols are normally implemented in software by
using one of the common programming languages. To
make our discussions language-free, we have written in
pseudocode a version of each protocol that
concentrates mostly on the procedure instead of
delving into the details of language rules.

Telecomm. Dept. DCN


10
Faculty of EEE HCMUT
Taxonomy of protocols

Telecomm. Dept. DCN


11
Faculty of EEE HCMUT
Noiseless Channels

Let us first assume we have an ideal channel in which


no frames are lost, duplicated, or corrupted. We
introduce two protocols for this type of channel.

Topics discussed in this section:


Simplest Protocol
Stop-and-Wait Protocol

Telecomm. Dept. DCN


12
Faculty of EEE HCMUT
The design of the simplest protocol with no flow or error control

Telecomm. Dept. DCN


13
Faculty of EEE HCMUT
Algorithm 11.1 Sender-site algorithm for the simplest protocol

Telecomm. Dept. DCN


14
Faculty of EEE HCMUT
Algorithm 11.2 Receiver-site algorithm for the simplest protocol

Telecomm. Dept. DCN


15
Faculty of EEE HCMUT
Example 11.1

Figure 11.7 shows an example of


communication using this protocol. It
is very simple. The sender sends a
sequence of frames without even
thinking about the receiver. To send
three frames, three events occur at
the sender site and three events at
the receiver site. Note that the data
frames are shown by tilted boxes;
the height of the box defines the
transmission time difference
between the first bit and the last bit
in the frame.
Telecomm. Dept. DCN
16
Faculty of EEE HCMUT
Figure 11.7 Flow diagram for Example 11.1

Telecomm. Dept. DCN


17
Faculty of EEE HCMUT
Design of Stop-and-Wait Protocol

Telecomm. Dept. DCN


18
Faculty of EEE HCMUT
Algorithm 11.3 Sender-site algorithm for Stop-and-Wait Protocol

Telecomm. Dept. DCN


19
Faculty of EEE HCMUT
Algorithm 11.4 Receiver-site algorithm for Stop-and-Wait Protocol

Telecomm. Dept. DCN


20
Faculty of EEE HCMUT
Example 11.2
Figure 11.9 shows an example of
communication using this
protocol. It is still very simple.
The sender sends one frame and
waits for feedback from the
receiver. When the ACK arrives,
the sender sends the next frame.
Note that sending two frames in
the protocol involves the sender
in four events and the receiver in
two events.

Telecomm. Dept. DCN


21
Faculty of EEE HCMUT
Figure 11.9 Flow diagram for Example 11.2

Telecomm. Dept. DCN


22
Faculty of EEE HCMUT
Noisy Channels

Although the Stop-and-Wait Protocol gives us an idea


of how to add flow control to its predecessor, noiseless
channels are nonexistent. We discuss three protocols in
this section that use error control.

Topics discussed in this section:


Stop-and-Wait Automatic Repeat Request
Go-Back-N Automatic Repeat Request
Selective Repeat Automatic Repeat Request

Telecomm. Dept. DCN


23
Faculty of EEE HCMUT
Note
Error correction in Stop-and-Wait ARQ is done by
keeping a copy of the sent frame and retransmitting
of the frame when the timer expires.
In Stop-and-Wait ARQ, we use sequence numbers to
number the frames. The sequence numbers are
based on modulo-2 arithmetic.
In Stop-and-Wait ARQ, the acknowledgment number
always announces in modulo-2 arithmetic the
sequence number of the next frame expected.

Telecomm. Dept. DCN


24
Faculty of EEE HCMUT
Figure 11.10 Design of the Stop-and-Wait ARQ Protocol

Telecomm. Dept. DCN


25
Faculty of EEE HCMUT
Algorithm 11.5 Sender-site algorithm for Stop-and-Wait ARQ

(continued)
Telecomm. Dept. DCN
26
Faculty of EEE HCMUT
Algorithm 11.5 Sender-site algorithm for Stop-and-Wait ARQ

(continued)
Telecomm. Dept. DCN
27
Faculty of EEE HCMUT
Algorithm 11.6 Receiver-site algorithm for Stop-and-Wait ARQ Protocol

Telecomm. Dept. DCN


28
Faculty of EEE HCMUT
Example 11.3
Figure 11.11 shows an example of
Stop-and-Wait ARQ. Frame 0 is sent
and acknowledged. Frame 1 is lost
and resent after the time-out. The
resent frame 1 is acknowledged and
the timer stops. Frame 0 is sent and
acknowledged, but the
acknowledgment is lost. The sender
has no idea if the frame or the
acknowledgment is lost, so after the
time-out, it resends frame 0, which is
acknowledged.

Telecomm. Dept. DCN


29
Faculty of EEE HCMUT
Figure 11.11 Flow diagram for Example 11.3

Telecomm. Dept. DCN


30
Faculty of EEE HCMUT
Telecomm. Dept. DCN
31
Faculty of EEE HCMUT
Note

In the Go-Back-N Protocol, the sequence


numbers are modulo 2m,
where m is the size of the sequence
number field in bits.

Telecomm. Dept. DCN


35
Faculty of EEE HCMUT
Figure 11.12 Send window for Go-Back-N ARQ

Telecomm. Dept. DCN


36
Faculty of EEE HCMUT
Note

The send window is an abstract concept


defining an imaginary box of size 2m − 1
with three variables: Sf, Sn, and Ssize.

The send window can slide one


or more slots when a valid
acknowledgment arrives.

Telecomm. Dept. DCN


37
Faculty of EEE HCMUT
Figure 11.13 Receive window for Go-Back-N ARQ

Telecomm. Dept. DCN


38
Faculty of EEE HCMUT
Note

The receive window is an abstract


concept defining an imaginary box
of size 1 with one single variable Rn.
The window slides
when a correct frame has arrived;
sliding occurs one slot at a time.

Telecomm. Dept. DCN


39
Faculty of EEE HCMUT
Figure 11.14 Design of Go-Back-N ARQ

Telecomm. Dept. DCN


40
Faculty of EEE HCMUT
Figure 11.15 Window size for Go-Back-N ARQ

Telecomm. Dept. DCN


41
Faculty of EEE HCMUT
Note

In Go-Back-N ARQ, the size of the send


window must be less than 2m;
the size of the receiver window
is always 1.

Telecomm. Dept. DCN


42
Faculty of EEE HCMUT
Algorithm 11.7 Go-Back-N sender algorithm

(continued)
Telecomm. Dept. DCN
43
Faculty of EEE HCMUT
Algorithm 11.7 Go-Back-N sender algorithm

(continued)
Telecomm. Dept. DCN
44
Faculty of EEE HCMUT
Algorithm 11.8 Go-Back-N receiver algorithm

Telecomm. Dept. DCN


45
Faculty of EEE HCMUT
Example 11.6
Figure 11.16 shows an example of Go-Back-N. This is an example of
a case where the forward channel is reliable, but the reverse is
not. No data frames are lost, but some ACKs are delayed and one
is lost. The example also shows how cumulative acknowledgments
can help if acknowledgments are delayed or lost. After
initialization, there are seven sender events. Request events are
triggered by data from the network layer; arrival events are
triggered by acknowledgments from the physical layer. There is no
time-out event here because all outstanding frames are
acknowledged before the timer expires. Note that although ACK 2
is lost, ACK 3 serves as both ACK 2 and ACK 3.

Telecomm. Dept. DCN


46
Faculty of EEE HCMUT
Figure 11.16 Flow diagram for Example 11.6

Telecomm. Dept. DCN


47
Faculty of EEE HCMUT
Example 11.7
Figure 11.17 shows what happens when a frame is lost. Frames 0, 1,
2, and 3 are sent. However, frame 1 is lost. The receiver receives
frames 2 and 3, but they are discarded because they are received
out of order. The sender receives no acknowledgment about frames
1, 2, or 3. Its timer finally expires. The sender sends all outstanding
frames (1, 2, and 3) because it does not know what is wrong. Note
that the resending of frames 1, 2, and 3 is the response to one single
event. When the sender is responding to this event, it cannot
accept the triggering of other events. This means that when ACK 2
arrives, the sender is still busy with sending frame 3.

Telecomm. Dept. DCN


48
Faculty of EEE HCMUT
Example 11.7 (continued)
The physical layer must wait until this event is
completed and the data link layer goes back to its
sleeping state. We have shown a vertical line to indicate
the delay. It is the same story with ACK 3; but when ACK
3 arrives, the sender is busy responding to ACK 2. It
happens again when ACK 4 arrives. Note that before the
second timer expires, all outstanding frames have been
sent and the timer is stopped.

Telecomm. Dept. DCN


49
Faculty of EEE HCMUT
Figure 11.17 Flow diagram for Example 11.7

Telecomm. Dept. DCN


50
Faculty of EEE HCMUT
Note

Stop-and-Wait ARQ is a special case of


Go-Back-N ARQ in which the size of the
send window is 1.

Telecomm. Dept. DCN


51
Faculty of EEE HCMUT
Figure 11.18 Send window for Selective Repeat ARQ

Telecomm. Dept. DCN


52
Faculty of EEE HCMUT
Figure 11.19 Receive window for Selective Repeat ARQ

Telecomm. Dept. DCN


53
Faculty of EEE HCMUT
Figure 11.20 Design of Selective Repeat ARQ

Telecomm. Dept. DCN


54
Faculty of EEE HCMUT
Figure 11.21 Selective Repeat ARQ, window size

Telecomm. Dept. DCN


55
Faculty of EEE HCMUT
Note

In Selective Repeat ARQ, the size of the


sender and receiver window
must be at most one-half of 2m.

Telecomm. Dept. DCN


56
Faculty of EEE HCMUT
Algorithm 11.9 Sender-site Selective Repeat algorithm

(continued)
Telecomm. Dept. DCN
57
Faculty of EEE HCMUT
Algorithm 11.9 Sender-site Selective Repeat algorithm

(continued)
Telecomm. Dept. DCN
58
Faculty of EEE HCMUT
Algorithm 11.10 Receiver-site Selective Repeat algorithm

Telecomm. Dept. DCN


59
Faculty of EEE HCMUT
Algorithm 11.10 Receiver-site Selective Repeat algorithm

Telecomm. Dept. DCN


60
Faculty of EEE HCMUT
Figure 11.22 Delivery of data in Selective Repeat ARQ

Telecomm. Dept. DCN


61
Faculty of EEE HCMUT
Example 11.8
This example is similar to Example 11.3 in which frame 1 is lost.
We show how Selective Repeat behaves in this case. Figure 11.23
shows the situation. One main difference is the number of timers.
Here, each frame sent or resent needs a timer, which means that
the timers need to be numbered (0, 1, 2, and 3). The timer for
frame 0 starts at the first request, but stops when the ACK for this
frame arrives. The timer for frame 1 starts at the second request,
restarts when a NAK arrives, and finally stops when the last ACK
arrives. The other two timers start when the corresponding frames
are sent and stop at the last arrival event.

Telecomm. Dept. DCN


62
Faculty of EEE HCMUT
Example 11.8 (continued)
At the receiver site we need to distinguish between the
acceptance of a frame and its delivery to the network layer. At the
second arrival, frame 2 arrives and is stored and marked, but it
cannot be delivered because frame 1 is missing. At the next
arrival, frame 3 arrives and is marked and stored, but still none of
the frames can be delivered. Only at the last arrival, when finally a
copy of frame 1 arrives, can frames 1, 2, and 3 be delivered to
the network layer. There are two conditions for the delivery of
frames to the network layer: First, a set of consecutive frames
must have arrived. Second, the set starts from the beginning of
the window.

Telecomm. Dept. DCN


63
Faculty of EEE HCMUT
Example 11.8 (continued)
Another important point is that a NAK is sent after the
second arrival, but not after the third, although both
situations look the same. The reason is that the protocol
does not want to crowd the network with unnecessary
NAKs and unnecessary resent frames. The second NAK
would still be NAK1 to inform the sender to resend
frame 1 again; this has already been done. The first NAK
sent is remembered (using the nakSent variable) and is
not sent again until the frame slides. A NAK is sent once
for each window position and defines the first slot in the
window.

Telecomm. Dept. DCN


64
Faculty of EEE HCMUT
Example 11.8 (continued)
The next point is about the ACKs. Notice that only two
ACKs are sent here. The first one acknowledges only the
first frame; the second one acknowledges three frames.
In Selective Repeat, ACKs are sent when data are
delivered to the network layer. If the data belonging to
n frames are delivered in one shot, only one ACK is sent
for all of them.

Telecomm. Dept. DCN


65
Faculty of EEE HCMUT
Figure 11.23 Flow diagram for Example 11.8

Telecomm. Dept. DCN


66
Faculty of EEE HCMUT
Figure 11.24 Design of piggybacking in Go-Back-N ARQ

Telecomm. Dept. DCN


67
Faculty of EEE HCMUT
Idle-RQ (Stop-and-Wait RQ)
 Link utilization:

 In case BER=0:
Tix Tix 1 1
U=  = =
Tt Tix +2Tp 1+2Tp /Tix 1+2a

 What is the meaning of parameter a?

Telecomm. Dept. DCN


68
Faculty of EEE HCMUT
Idle-RQ (Stop-and-Wait RQ)
 Remember:
Tp
a= (length of the link in bits)
Tix
 If a < 1 (i.e. Tix > Tp ): when
1st transmitted bit reaches S,
P will still be transmitting.
Hence U is close 100%
 If a > 1 (i.e. Tix < Tp) frame
transmission is completed
before 1st bit reaches S.
Hence U is low.
a>1 a<1
 Idle-RQ is efficient for links
where a << 1 (long frames
compared to propagation
time)

Telecomm. Dept. DCN


69
Faculty of EEE HCMUT
Idle-RQ (Stop-and-Wait RQ)
 In case BER>0 (channel with errors): in order to transmit 1 I-
frame successfully, sender needs to retransmit Nr frames:
Tix Tix 1 1
U= = = =
Nr .Tt Nr (Tix +2Tp ) Nr (1+2Tp /Tix ) Nr (1+2a)
 If we call Pf is the FER, and 1 frame has Ni bits:
Pf =1-(1-BER)Ni
 Probability that i transmissions are needed to deliver frame
successfully ( i-1 transmission in error and the ith transmission is
error free ):

E[# of transmission in error]= (i-1).Pr [ # of trans. in error = i-1]
i=1
 
Pf
  (i-1).P .(1-Pf ) = (1-Pf ).Pf  (i-1).P =
f
i-1
f
i-2

i=1 i=1 1-Pf


Telecomm. Dept. DCN
70
Faculty of EEE HCMUT
Stop-and-Wait RQ
 Number of transmissions:
Pf 1
Nr =1+ =
1-Pf 1-Pf
 Utilization:
1-Pf
U=
(1+2a)
 Total average delay per frame?
 Utilization Performance when working with high speed and long
propagation delay?

Tt

Telecomm. Dept. DCN


71
Faculty of EEE HCMUT
Stop and Wait ARQ: Example
A series of 1000-bit frames is to be transmitted using
an Stop and Wait ARQ protocol. Determine the link
utilization for the following types of data link
assuming a data transmission rate of (i) 1 kbps and
(ii) 1 Mbps. The velocity of propagation of the link is
2.108 m/s and the BER is negligible
A twisted pair cable 1 km in length
A leased line 200 km in length
A satellite link of 50,000 km
Solution?

Telecomm. Dept. DCN


72
Faculty of EEE HCMUT
Continuous RQ
 Link Utilization:
 In general, the link utilization U for a send window K:
• If K  1+2a :
U=1
• If K  1+2a :
K.Tix K.Tix K
U= = =
Tt (Tix +2Tp ) (1+2a)

 Using Selective Repeat: impact by choosing K


• If K  1+2a :
U = 1-Pf
• If K  1+2a :
K.Tix K.Tix K.(1-Pf )
U= = =
Nr .Tt Nr .(Tix +2Tp ) (1+2a)
Telecomm. Dept. DCN
73
Faculty of EEE HCMUT
Continuous RQ
 Link Utilization:
 Using Go-back-N: impact by choosing K
• If K  1+2a:
(1+2a).(1-Pf ) 1-Pf
U= =
(1+2a).(1+Pf (K-1)) 1+Pf (K-1)
• If K  1+2a:
K.(1-Pf ) K.(1-Pf )
U= =
(1+2a)+(1+2a).Pf .(K-1) (1+2a).(1+Pf (K-1))

Telecomm. Dept. DCN


74
Faculty of EEE HCMUT
Example of sliding window: perfect link
 A series of 1000-bit frames is to be transmitted using a
continuous RQ protocol. Determine the link efficiency for
the following type of data link if the velocity of
propagation is 2.108 m/s and the bit error rates of the
links are all negligibly low:
A 1 km link of 1 Mbps and a send window K = 2
A 10 km link of 200 Mbps and a send window K=7
A 50 000 km satellite link of 2 Mbps, a send window K
=127

 Solution?

Telecomm. Dept. DCN


75
Faculty of EEE HCMUT
Example of link utilization: lossy link
A series of 1000-bit frames is to be transmitted
across a data link 100 km in length at 20 Mbps. If the
link has a velocity of propagation is 2.108 m/s and a
BER of 4.10-5, determine the link utilization using the
following protocols:
Stop and Wait RQ
Selective Repeat and a send window of 8
Go-back-N and a send window of 7

Solution?

Telecomm. Dept. DCN


76
Faculty of EEE HCMUT
Protocol Classification
 Character-oriented Protocols:
 Asynchronous transmission
• XMODEM, YMODEM
• Simplex Protocol: Kermit protocol
 Synchronous transmission:
• Half-duplex protocol: BSC
• Full-duplex protocol: APRANET IMP-to-IMP protocol
 Bit-oriented Protocols
 High-level Data Link Control: single link procedure
 Link access procedure version B (LAPB): extension of LAPA, used in
X.25 networks
 Multilink procedure: extension of LAPB
 Link access procedure for modems (LAPM): used in error correction
modems (e.g. V32)
 Link access procedure for D-channel (LAPD): used in ISDN networks

Telecomm. Dept. DCN


77
Faculty of EEE HCMUT
Binary Synchronous Communication
BSC Protocol:
Character-oriented
Error control: Idle RQ
Synchronous transmission control
Connection-oriented
Half-duplex
Topology: Point-to-point, Multipoint, Multi-drop network
Data transparency: using DLE character to transmit pure
binary data (DLE/STX, DLE/ETX)
Frame formats
Data frame
Supervisory
Telecomm. Dept. DCN
78
Faculty of EEE HCMUT
BSC Control Characters

Telecomm. Dept. DCN


79
Faculty of EEE HCMUT
Binary Synchronous Communication
Data frame:
Simple frame
SYN SYN STX Data (128bytes) ETX BCC

Simple frame
with header SYN SYN SOH Header Data (128bytes) ETX BCC

Multi-block SYN SYN SOH Header STX Data IBT BCC STX Data ETX ETX
BCC
frame
Data block

Frame First frame


SYN SYN SOH Header STX Data ETB BCC
structure of
Multi-frame
Last frame
SYN SYN SOH Header STX Data ETX BCC

SOH – Start of Header STX – Start of Text ETX – End of Text


BCC – Block (sum) Check Character ETB – End of Tranmission Block

Telecomm. Dept. DCN


80
Faculty of EEE HCMUT
Binary Synchronous Communication
 Supervisory frame: the
ACK and NAK control
characters have 2
functions:
 As an acknowledgement:
one or other is returned to
a previously transmitted
data block and hence
contains an sequence
number.
 AS a response to a select
control message: an ACK
indicates that the selected
station is able to receive a
data block whereas a NAK
indicates that it is not
Telecomm. Dept. DCN
81
Faculty of EEE HCMUT
Binary Synchronous Communication
 Supervisory frame:
The ENQ control character is used in both Poll and Select
control frames. The address of the polled or selected slave
station is followed by either a P (for Poll) or an S( for Select)
character, which is in turn followed by the ENQ character
The EOT control character has 2 functions:
• To signal the end of a complete message exchange
sequence and clear the logical link between the 2
communicating parties
• To provides a means of resetting the link to the idle state

Telecomm. Dept. DCN


82
Faculty of EEE HCMUT
Binary Synchronous Communication
 Protocol operation:
 Poll and Select schematic

 Select operation
 Master sends data to a specific slave
 Put the slave address in the Select control
frame
 If the Slave is unready: reply by NAK.
Otherwise, return ACK

Telecomm. Dept. DCN


83
Faculty of EEE HCMUT
Binary Synchronous Communication
 Polling mechanism:

 Protocol performance:
 Low link utilization (Idle RQ),
used with multi-drop links,
operating at data rates up to
64 kbps
 Average time to poll each
station:
Tmin
Tavr =
1-Mr .Tix
 Tmin: the minimum time to poll
all stations, Mr is the average
rate at which messages are
generated
Telecomm. Dept. DCN
84
Faculty of EEE HCMUT
Example
 A BSC protocol is to be used to control the flow of messages between a
computer (Master station) and 10 block-mode terminals (secondaries) over
a multipoint data link. The link data rate, R, is 10 kbps and the average
length of a message, Ni, is 1000 bits. If a poll message and its associated ACK
is 30 bits and the total time to process these messages is 1ms, determine
the average time each terminal will be polled if the average rate at which
messages are generated is:
 1 message per minute
 6 message per second
The bit error rate and signal propagation delay times of the link can be assumed
to be negligible
 Solution:
 Tix=100ms
 Time to transmit a poll and its ACK: 30/104=3 ms
 Time to poll a single secondary: 3 + 1 = 4 ms
 Minimum time to poll all secondaries: Tmin=10x4 = 40 ms
 Mr = 1 msg/minute = 10-3/60 msg/ms: Tavr=40 ms

Telecomm. Dept. DCN


85
Faculty of EEE HCMUT
HDLC
High-level Data Link Control (HDLC) is a bit-oriented
protocol for communication over point-to-point and
multipoint links. It implements the ARQ mechanisms
we discussed in this chapter.

Topics discussed in this section:


Configurations and Transfer Modes
Frames
Control Field

Telecomm. Dept. DCN


86
Faculty of EEE HCMUT
Operation Modes

Normal Response Mode (NRM)

Asynchronous Balanced Mode (ABM)


Telecomm. Dept. DCN
87
Faculty of EEE HCMUT
HDLC
 Operational modes:
 Normal Response Mode (NRM)
• Used in unbalanced configuration
• Slave stations (secondaries) can transmit only when specially instructed
by the master (primary) station.
• The link may be point-to-point, multipoint (only 1 primary allowed)
 Asynchronous Response Mode (ARM)
• Used in unbalanced configuration
• Allow a secondary to initiate a transmission without receiving
permission from the primary
• Normally used in point-to-point configuration and duplex links
 Asynchronous Balanced Mode (ABM)
• Mainly used on duplex point-to-point links
• Each station has an equal status and performs both primary and
secondary functions

Telecomm. Dept. DCN


88
Faculty of EEE HCMUT
HDLC
 Frame formats: both data and control messages are carried in a standard format
frame.

 Flag Field (0x7E):


 determine the beginning and the end of a frame
 Receiver must hunt this value for synchronization
 Bit stuffing if there is a 5 continuous bits “1”
 If receiver detects 5 continuous bits “1”:
• If the next bit is bit 0, it will be removed
• If the next bit is bit 1, and 7th bit is bit 0: Flag
• If the next bit is bit 1, and 7th bit is bit 1: continue to count number of bits 1
– If number of bits 1<15: receiver stops
– If number of bits 1>=15: idle channel

Telecomm. Dept. DCN


89
Faculty of EEE HCMUT
HDLC
 Address Field:
Depending on operational mode. In NRM mode, multi-drop line: each
station has 1 unique address. If the primary wants to connect with the
slave, it will put the slave address in this address field. Certain
addresses known as group address can be assigned to more than one
secondary. If the address is all bits 1: broadcast address.
Not used in ABM mode (point-to-point). Instead, it is used to indicate
the direction of commands and their associated responses
8 bit in length, can be expanded with multiple of 7 bits. Last octet will
have the first bit equal to 1

Telecomm. Dept. DCN


90
Faculty of EEE HCMUT
HDLC
Control field: There are 3 frame types in HDLC:
 Unnumbered frames (U—frame): used for such functions as link setup
and disconnection. They do not contain any acknowledgement
information
 Information frame (I-frame): carry the actual information. I-frames can
be used to piggyback acknowledgement information if the operational
mode is ABM or ARM
 Supervisory frame (S-frame): are used for error and flow control and
hence contain send and receive sequence numbers

Telecomm. Dept. DCN


91
Faculty of EEE HCMUT
HDLC
 Control field:
1 byte or 2 bytes in length
1 or 2 first bits define the frame type (S,I,U)
N(S): send sequence number
N(R): receive sequence number
P/F: Poll or Select depending on the context:
• Command: bit P, request the response from a secondary
• Response: bit F, indicating this is the response to a command

o Primary to Secondary: If
P=1, address is destination
00
o Secondary to Primary: If 10
F=1, address is source 01
11

Telecomm. Dept. DCN


92
Faculty of EEE HCMUT
HDLC

Telecomm. Dept. DCN


93
Faculty of EEE HCMUT
HDLC
Extended control bit field definitions

Telecomm. Dept. DCN


94
Faculty of EEE HCMUT
HDLC
Information field:
Contained in I-frame and U-frame
Variable length
Multiple of bytes
FCS field:
Error detection
CRC 16 or CRC32

Telecomm. Dept. DCN


95
Faculty of EEE HCMUT
Example 11.9
Figure 11.29 shows how U-frames can be used for
connection establishment and connection release. Node
A asks for a connection with a set asynchronous
balanced mode (SABM) frame; node B gives a positive
response with an unnumbered acknowledgment (UA)
frame. After these two exchanges, data can be
transferred between the two nodes (not shown in the
figure). After data transfer, node A sends a DISC
(disconnect) frame to release the connection; it is
confirmed by node B responding with a UA
(unnumbered acknowledgment).
Telecomm. Dept. DCN
96
Faculty of EEE HCMUT
Figure 11.29 Example of connection and disconnection

Telecomm. Dept. DCN


97
Faculty of EEE HCMUT
Example 11.10
Figure 11.30 shows an exchange using piggybacking.
Node A begins the exchange of information with an
I-frame numbered 0 followed by another I-frame
numbered 1. Node B piggybacks its acknowledgment of
both frames onto an I-frame of its own. Node B’s first
I-frame is also numbered 0 [N(S) field] and contains a 2
in its N(R) field, acknowledging the receipt of A’s frames
1 and 0 and indicating that it expects frame 2 to arrive
next. Node B transmits its second and third I-frames
(numbered 1 and 2) before accepting further frames
from node A.
Telecomm. Dept. DCN
98
Faculty of EEE HCMUT
Example 11.10 (continued)
Its N(R) information, therefore, has not changed: B
frames 1 and 2 indicate that node B is still expecting A’s
frame 2 to arrive next. Node A has sent all its data.
Therefore, it cannot piggyback an acknowledgment onto
an I-frame and sends an S-frame instead. The RR code
indicates that A is still ready to receive. The number 3 in
the N(R) field tells B that frames 0, 1, and 2 have all been
accepted and that A is now expecting frame number 3.

Telecomm. Dept. DCN


99
Faculty of EEE HCMUT
Figure 11.30 Example of piggybacking without error

Telecomm. Dept. DCN


100
Faculty of EEE HCMUT
Example 11.11
Figure 11.31 shows an exchange in which a frame is lost.
Node B sends three data frames (0, 1, and 2), but frame 1
is lost. When node A receives frame 2, it discards it and
sends a REJ frame for frame 1. Note that the protocol
being used is Go-Back-N with the special use of an REJ
frame as a NAK frame. The NAK frame does two things
here: It confirms the receipt of frame 0 and declares that
frame 1 and any following frames must be resent. Node
B, after receiving the REJ frame, resends frames 1 and 2.
Node A acknowledges the receipt by sending an RR frame
(ACK) with acknowledgment number 3.

Telecomm. Dept. DCN


101
Faculty of EEE HCMUT
Figure 11.31 Example of piggybacking with error

Telecomm. Dept. DCN


102
Faculty of EEE HCMUT
HDLC
 Some other cases:

Telecomm. Dept. DCN


103
Faculty of EEE HCMUT

You might also like