0% found this document useful (0 votes)
449 views32 pages

Ch11.data Link Control PDF

Uploaded by

ALlan ABiang
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)
449 views32 pages

Ch11.data Link Control PDF

Uploaded by

ALlan ABiang
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/ 32

CHAPTER 11

Data Link
Control (DLC)

A s we discussed in Chapter 9, the data-link layer is divided into two sublayers. In


this chapter, we discuss the upper sublayer of the data-link layer (DLC). The lower
sublayer, multiple access control (MAC) will be discussed in Chapter 12. We have
already discussed error detection and correction, an issue that is encountered in several
layers, in Chapter 10.
This chapter is divided into four sections.
o The first section discusses the general services provided by the DLC sublayer. It
first describes framing and two types of frames used in this sublayer, The section
then discusses flow and error control. Finally, the section explains that a DLC pro-
tocol can be either connectionless or connection-oriented.
o The second section discusses some simple and common data-link protocols that
are implemented at the DLC sublayer. The section first describes the Simple Proto-
col. It then explains the Stop-and- Wait Protocol.
o The third section introduces HDLC, a protocol that is the basis of all common
data-link protocols in use today such as PPP and Ethernet. The section first talks
about configurations and transfer modes. It then describes framing and three differ-
ent frame formats used in this protocol.
o The fourth section discusses PPP, a very common protocol for point-to-point
access. It first introduces the services provided by the protocol. The section also
describes the format of the frame in this protocol. It then describes the transition
mode in the protocol using an FSM. The section finally explains multiplexing in
PPP.

293
294 PART III DATA-LINK LAYER

11.1 DLC SERVICES


The data link control (DLC) deals with procedures for communication between two
adjacent nodes-node-to-node communication-no matter whether the link is dedi-
cated or broadcast. Data link control functions include framing and flow and error
control. In this section, we first discuss framing, or how to organize the bits that are
carried by the physical layer. We then discuss flow and error control.

11.1.1 Framing
Data transmission in the physical layer means moving bits in the form of a signal from
the source to the destination. The physical layer provides bit synchronization to ensure
that the sender and receiver use the same bit durations and timing. We discussed the
physical layer in Part II of the book.
The data-link layer, on the other hand, 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. In addition, each envelope defines
the sender and receiver addresses, which is necessary since the postal system is a many-
to-many carrier facility.
Framing in the data-link layer separates a message from one source to a destination
by adding a sender address and a destination address. The destination address defines
where the packet is to go; the sender address helps the recipient acknowledge the
receipt.
Although the whole message could be packed in one frame, that is not normally
done. One reason is that a frame can be very large, making flow and error control very
inefficient. When a message is carried in one very large frame, even a single-bit error
would require the retransmission of the whole frame. When a message is divided into
smaller frames, a single-bit error affects only that small frame.

Frame Size
Frames can be of fixed or variable size. Infixed-size framing, there is no need for defin-
ing the boundaries of the frames; the size itself can be used as a delimiter. An example
of this type of framing is the ATM WAN, which uses frames of fixed size called cells.
We discuss ATM in Chapter 14.
Our main discussion in this chapter concerns variable-size framing, prevalent in
local-area networks. In variable-size framing, we need a way to define the end of one
frame and the beginning of the next. Historically, two approaches were used for this
purpose: a character-oriented approach and a bit-oriented approach.

Character-Oriented Framing
In character-oriented (or byte-oriented) framing, data to be carried are 8-bit characters
from a coding system such as ASCII (see Appendix A). The header, which normally
carries the source and destination addresses and other control information, and the
trailer, which carries error detection redundant bits, are also multiples of 8 bits. To
separate one frame from the next, an 8-bit (I-byte) flag is added at the beginning and the
end of a frame. The flag, composed of protocol-dependent special characters, signals the
CHAPTER 11 DATA LINK CONTROL (DLC) 295

start or end of a frame. Figure 11.1 shows the format of a frame in a character-oriented
protocol.

Figure 11.1 Aframe in a character-oriented protocol

Data from upper layer


Variable number of characters

Character-oriented framing was popular when only text was exchanged by the
data-link layers. The flag could be selected to be any character not used for text com-
munication. Now, however, we send other types of information such as graphs, audio,
and video; any character used for the flag could also be part of the information. If this
happens, the receiver, when it encounters this pattern in the middle of the data, thinks it
has reached the end of the frame. To fix this problem, a byte-stuffing strategy was
added to character-oriented framing. In byte stuffing (or character stuffing), a special
byte is added to the data section of the frame when there is a character with the same
pattern as the flag. The data section is stuffed with an extra byte. This byte is usually
called the escape character (ESe) and has a predefined bit pattern. Whenever the
receiver encounters the ESe character, it removes it from the data section and treats the
next character as data, not as a delimiting flag. Figure 11.2 shows the situation.

Figure 11.2 Byte stuffing and unstuffing

Data from upper layer

Sent frame Stuffed

Received frame Unstuffed

Data to upper layer

Byte stuffing is the process of adding one extra byte whenever


there is a flag or escape character in the text.

Byte stuffing by the escape character allows the presence of the flag in the data
section of the frame, but it creates another problem. What happens if the text contains
one or more escape characters followed by a byte with the same pattern as the flag? The
296 PART III DATA-LINK LAYER

receiver removes the escape character, but keeps the next byte, which is incorrectly
interpreted as the end of the frame. To solve this problem, the escape characters that are
part of the text must also be marked by another escape character. In other words, if the
escape character is part of the text, an extra one is added to show that the second one is
part of the text.
Character-oriented protocols present another problem in data communications.
The universal coding systems in use today, such as Unicode, have 16-bit and 32-bit
characters that conflict with 8-bit characters. We can say that, in general, the tendency
is moving toward the bit-oriented protocols that we discuss next.

Bit-Oriented Framing
In bit-oriented framing, the data section of a frame is a sequence of bits to be interpreted by
the upper layer as text, graphic, audio, video, and so on. However, in addition to headers
(and possible trailers), we still need a delimiter to separate one frame from the other. Most
protocols use a special 8-bit pattern flag, 01111110, as the delimiter to define the begin-
ning and the end of the frame, as shown in Figure 11.3.

Figure 11.3 Aframe in a bit-oriented protocol

Data from upper layer

Flag I' Variable number of bits

01111110 Header 01111010110 ••• 1

This flag can create the same type of problem we saw in the character-oriented
protocols. That is, if the flag pattern appears in the data, we need to somehow inform
the receiver that this is not the end of the frame. We do this by stuffing 1 single bit
(instead of 1 byte) to prevent the pattern from looking like a flag. The strategy is called
bit stuffing. In bit stuffing, if a 0 and five consecutive 1 bits are encountered, an extra
o is added. This extra stuffed bit is eventually removed from the data by the receiver.
Note that the extra bit is added after one 0 followed by five IS regardless of the value of
the next bit. This guarantees that the flag field sequence does not inadvertently appear
in the frame.

Bit stuffing is the process of adding one extra 0 whenever five consecutive Is follow a 0
in the data, so that the receiver does not mistake the pattern 0111110 for a flag.

Figure 11.4 shows bit stuffing at the sender and bit removal at the receiver. Note that
even if we have a 0 after five Is, we still stuff a O.The 0 will be removed by the receiver.
This means that if the flaglike pattern 01111110 appears in the data, it will change
to 011111010 (stuffed) and is not mistaken for a flag by the receiver. The real flag
01111110 is not stuffed by the sender and is recognized by the receiver.
CHAPTER J I DATA LINK CONTROL (DLC) 297

Figure 11.4 Bit stuffing and unstuffing

Data from upper layer

Frame sent
Header

Frame received
Header

11.1.2 Flow and Error Control


We briefly defined flow and error control in Chapter 9; we elaborate on these two
issues here. One of the responsibilities of the data-link control sublayer is flow and
error control at the data-link layer.

Flow Control
Whenever an entity produces items and another entity consumes them, there should be
a balance between production and consumption rates. If the items are produced faster
than they can be consumed, the consumer can be overwhelmed and may need to discard
some items. If the items are produced more slowly than they can be consumed, the con-
sumer must wait, and the system becomes less efficient. Flow control is related to the
first issue. We need to prevent losing the data items at the consumer site.
In communication at the data-link layer, we are dealing with four entities: network
and data-link layers at the sending node and network and data-link layers at the receiv-
ing node. Although we can have a complex relationship with more than one producer
and consumer (as we will see in Chapter 23), we ignore the relationships between net-
works and data-link layers and concentrate on the relationship between two data-link
layers, as shown in Figure 11.S.

Figure 11.5 Flow control at the data-link layer

Data-link Frames are pushed Data-link


layer layer

Flow control
298 PART III DATA-LINK LAYER

The figure shows that the data-link layer at the sending node tries to push frames
toward the data-link layer at the receiving node. If the receiving node cannot process
and deliver the packet to its network at the same rate that the frames arrive, it becomes
overwhelmed with frames. Flow control in this case can be feedback from the receiving
node to the sending node to stop or slow down pushing frames.

Buffers
Although flow control can be implemented in several ways, one of the solutions is nor-
mally to use two buffers; one at the sending data-link layer and the other at the receiv-
ing data-link layer. A buffer is a set of memory locations that can hold packets at the
sender and receiver. The flow control communication can occur by sending signals
from the consumer to the producer. When the buffer of the receiving data-link layer is
full, it informs the sending data-link layer to stop pushing frames.

Example 11.1
The above discussion requires that the consumers communicate with the producers on two
occasions: when the buffer is full and when there are vacancies. If the two parties use a buffer
with only one slot, the communication can be easier. Assume that each data-link layer uses one
single memory slot to hold a frame. When this single slot in the receiving data-link layer is
empty, it sends a note to the network layer to send the next frame.

Error Control
Since the underlying technology at the physical layer is not fully reliable, we need to
implement error control at the data- link layer to prevent the receiving node from deliver-
ing corrupted packets to its network layer. Error control at the data-link layer is normally
very simple and implemented using one of the following two methods. In both methods, a
CRC is added to the frame header by the sender and checked by the receiver.
o In the first method, if the frame is corrupted, it is silently discarded; if it is not cor-
rupted, the packet is delivered to the network layer. This method is used mostly in
wired LANs such as Ethernet.
o In the second method, if the frame is corrupted, it is silently discarded; if it is not
corrupted, an acknowledgment is sent (for the purpose of both flow and error con-
trol) to the sender.

Combination of Flow and Error Control


Flow and error control can be combined. In a simple situation, the acknowledgment that
is sent for flow control can also be used for error control to tell the sender the packet has
arrived uncorrupted. The lack of acknowledgment means that there is a problem in the
sent frame. We show this situation when we discuss some simple protocols in the next
section. A frame that carries an acknowledgment is normally called an ACK to distin-
guish it from the data frame.

11.1.3 Connectionless and Connection-Oriented


A DLC protocol can be either connectionless or connection-oriented. We will discuss
this issue very briefly here, but we return to this topic in the network and transport
layer.
CHAPTER 11 DATA LINK CONTROL (DLC) 299

Connectionless Protocol
In a connectionless protocol, frames are sent from one node to the next without any
relationship between the frames; each frame is independent. Note that the term connec-
tionless here does not mean that there is no physical connection (transmission medium)
between the nodes; it means that there is no connection between frames. The frames are
not numbered and there is no sense of ordering. Most of the data-link protocols for
LANs are connectionless protocols.

Connection-Oriented Protocol
In a connection-oriented protocol, a logical connection should first be established
between the two nodes (setup phase). After all frames that are somehow related to each
other are transmitted (transfer phase), the logical connection is terminated (teardown
phase). In this type of communication, the frames are numbered and sent in order. If
they are not received in order, the receiver needs to wait until all frames belonging to the
same set are received and then deliver them in order to the network layer. Connection-
oriented protocols are rare in wired LANs, but we can see them in some point-to-point
protocols, some wireless LANs, and some WANs.

11.2 DATA-LINK LAYER PROTOCOLS


Traditionally four protocols have been defined for the data-link layer to deal with flow
and error control: Simple, Stop-and-Wait, Go-Back-N, and Selective-Repeat. Although
the first two protocols still are used at the data-link layer, the last two have disap-
peared. We therefore briefly discuss the first two protocols in this chapter, in which we
need to understand some wired and wireless LANs. We postpone the discussion of all
four, in full detail, to Chapter 23, where we discuss the transport layer.
The behavior of a data-link-layer protocol can be better shown as a finite state
machine (FSM). An FSM is thought of as a machine with a finite number of states.
The machine is always in one of the states until an event occurs. Each event is associ-
ated with two reactions: defining the list (possibly empty) of actions to be performed
and determining the next state (which can be the same as the current state). One of the
states must be defined as the initial state, the state in which the machine starts when it
turns on. In Figure 11.6, we show an example of a machine using FSM. We have used
rounded-comer rectangles to show states, colored text to show events, and regular black
text to show actions. A horizontal line is used to separate the event from the actions,
although later we replace the horizontal line with a slash. The arrow shows the move-
ment to the next state.
The figure shows a machine with three states. There are only three possible events
and three possible actions. The machine starts in state 1. If event 1 occurs, the machine
performs actions 1 and 2 and moves to state II. When the machine is in state II, two
events may occur. If event 1 occurs, the machine performs action 3 and remains in the
same state, state II. If event 3 occurs, the machine performs no action, but move to
state 1.
300 PART III DATA-LINK LAYER

Figure 11.6 Connectionless and connection-oriented service represented as FSMs

Event 1
Note: Action I.
The colored Action 2.
arrow shows the
l I
---4
starting state.

State I ) l State II
J Event 2
Action 3.
t I t
Event 3

11.2.1 Simple Protocol


Our first protocol is a simple protocol with neither flow nor error control. We assume that
the receiver can immediately handle any frame it receives. In other words, the receiver
can never be overwhelmed with incoming frames. Figure 11.7 shows the layout for this
protocol.

Figure 11.7 Simple protocol

Network ~H Frame
L~ Network

Data-linkL~
__
~t~~===~;;;;;;;;;;L====4=~lL=!'I
Logical link _
Data-link

Sending node Receiving node

The data-link layer at the sender gets a packet from its network layer, makes a
frame out of it, and sends the frame. The data-link layer at the receiver receives a frame
from the link, extracts the packet from the frame, and delivers the packet to its network
layer. The data-link layers of the sender and receiver provide transmission services for
their network layers.

FSMs
The sender site should not send a frame until its network layer has a message to send.
The receiver site cannot deliver a message to its network layer until a frame arrives. We
can show these requirements using two FSMs. Each FSM has only one state, the ready
state. The sending machine remains in the ready state until a request comes from the
process in the network layer. When this event occurs, the sending machine encapsulates
the message in a frame and sends it to the receiving machine. The receiving machine
remains in the ready state until a frame arrives from the sending machine. When this
event occurs, the receiving machine decapsulates the message out of the frame and
delivers it to the process at the network layer. Figure 11.8 shows the FSMs for the sim-
ple protocol. We'll see more in Chapter 23, which uses this protocol.
CHAPTER 11 DATA LINK CONTROL (DLC) 301

Figure 11.8 FSMs for the simple protocol

Packet came from network layer. Frame arrived.


Make a frame and send it. Deliver the packet to network layer.

I I
Start ~ Ready ). Start ~ Ready J'
Sending node Receiving node

Example 11.2
Figure 11.9 shows an example of communication using this protocol. It is very simple. The
sender sends frames one after another without even thinking about the receiver.

Figure 11.9 Flow diagram for Example 11.2

Sending node

I
I
I
Packet I
-+-L Frame
I
I
I
I

l Packet
I-------+-r--
l---------------~l--
Frame I
!~c.!'~t_ ~lI
I I I Packet I

.
I I • -~------~I
I I • I I

:
y
:
y
:
y
:
y
Time Time Time Time

11.2.2 Stop-and- Wait Protocol


Our second protocol is called the Stop-and- Wait protocol, which uses both flow and
error control. We show a primitive version of this protocol here, but we discuss the
more sophisticated version in Chapter 23 when we have learned about sliding windows.
In this protocol, the sender sends one frame at a time and waits for an acknowledg-
ment before sending the next one. To detect corrupted frames, we need to add a CRC
(see Chapter 10) to each data frame. When a frame arrives at the receiver site, it is
checked. If its CRC is incorrect, the frame is corrupted and silently discarded. The
silence of the receiver is a signal for the sender that a frame was either corrupted or lost.
Every time the sender sends a frame, it starts a timer. If an acknowledgment arrives
before the timer expires, the timer is stopped and the sender sends the next frame (if it
has one to send). If the timer expires, the sender resends the previous frame, assuming
that the frame was either lost or corrupted. This means that the sender needs to keep
a copy of the frame until its acknowledgment arrives. When the corresponding
302 PART III DATA-LINK LAYER

acknowledgment arrives, the sender discards the copy and sends the next frame if it is
ready. Figure 11.10 shows the outline for the Stop-and-Wait protocol. Note that only
one frame and one acknowledgment can be in the channels at any time.

Figure 11.10 Stop-and- Wait protocol

N'~"kl=~
Data-link
Sending node

_
Frame

CRC
-rCR:..t~
ACK

Logical link (duplex)


Receiving node

rdWO,k
Data-link

®Timer

FSMs
Figure 11.11 shows the FSMs for our primitive Stop-and- Wait protocol.

Figure 11.11 FSM for the Stop-and- Wait protocol

Sending node

Packet came from network layer.


Make a frame, save a copy, and send the frame.
Start the timer.

(d'd
Start Error-free ACK arrived.
Corrupted ACK arrived.
Discard the ACK.
Stop the timer.
Discard the saved frame.

Receiving node

Corrupted frame arrived.


Error-free frame arrived.
Discard the frame. -~.
Extract and deliver the packet to network layer.
Start~ SendACK.

We describe the sender and receiver states below.

Sender States
The sender is initially in the ready state, but it can move between the ready and block-
ing state.
CHAPTER 11 DATA LINK CONTROL (DLC) 303

D Ready State. When the sender is in this state, it is only waiting for a packet from
the network layer. If a packet comes from the network layer, the sender creates a
frame, saves a copy of the frame, starts the only timer and sends the frame. The
sender then moves to the blocking state.
D Blocking State. When the sender is in this state, three events can occur:
a. If a time-out occurs, the sender resends the saved copy of the frame and restarts
the timer.
b. If a corrupted ACK arrives, it is discarded.
c. If an error-free ACK arrives, the sender stops the timer and discards the saved
copy of the frame. It then moves to the ready state.
Receiver
The receiver is always in the ready state. Two events may occur:
a. If an error-free frame arrives, the message in the frame is delivered to the net-
work layer and an ACK is sent.
b. If a corrupted frame arrives, the frame is discarded.

Example 11.3
Figure 11.12 shows an example. The first frame is sent and acknowledged. The second frame is
sent, but lost. After time-out, it is resent. The third frame is sent and acknowledged, but the
acknowledgment is lost. The frame is resent. However, there is a problem with this scheme. The
network layer at the receiver site receives two copies of the third packet, which is not right. In the
next section, we will see how we can correct this problem using sequence numbers and acknowl-
edgment numbers.

Sequence and Acknowledgment Numbers


We saw a problem in Example 11.3 that needs to be addressed and corrected. Duplicate packets,
as much as corrupted packets, need to be avoided. As an example, assume we are ordering some
item online. If each packet defines the specification of an item to be ordered, duplicate packets
mean ordering an item more than once. To correct the problem in Example 11.3, we need to add
sequence numbers to the data frames and acknowledgment numbers to the ACK frames. How-
ever, numbering in this case is very simple. Sequence numbers are 0, 1,0, 1,0, 1, ... ; the
acknowledgment numbers can also be 1,0, 1,0, 1,0, ... In other words, the sequence numbers
start with 0, the acknowledgment numbers start with 1. An acknowledgment number always
defines the sequence number of the next frame to receive.

Example 11.4
Figure 11.13 shows how adding sequence numbers and acknowledgment numbers can prevent
duplicates. The first frame is sent and acknowledged. The second frame is sent, but lost. After
time-out, it is resent. The third frame is sent and acknowledged, but the acknowledgment is lost.
The frame is resent.

FSMs with Sequence and Acknowledgment Numbers


We can change the FSM in Figure 11.11 to include the sequence and acknowledgment
numbers, but we leave this as a problem at the end of the chapter.
304 PART III DATA-LINK lAYER

Figure 11.12 Flow diagram for Example 11.3

Packet F
Legend -------~'1
••,~~1~~1~n~e----------~
.: Packet '
• Start the timer. 0.-__----~AC~K~----~~~:
o
o
Stop the timer.

Restart a time-out timer.


:~
, :'"
,
L;;7
cb-Frame (resent)
Notes: •. ,~'_Pa_c_ke_t
...•.•
A lost frame means
,
either lost or corrupted.
A lost ACKmeans either
$,
Packet
Packet
lost or corrupted. '. Frame .:
ACK~
: ~Lost:
o Frame (resent) .,: Packet
~:
'
: ~
0----- !
Duplicate '

t t t t
Time Time Time Time

11.2.3 Piggybacking
The two protocols we discussed in this section are designed for unidirectional commu-
nication, in which data is flowing only in one direction although the acknowledgment
may travel in the other direction. Protocols have been designed in the past to allow data
to flow in both directions. However, to make the communication more efficient, the
data in one direction is piggybacked with the acknowledgment in the other direction. In
other words, when node A is sending data to node B, Node A also acknowledges the
data received from node B. Because piggybacking makes communication at the data-
link layer more complicated, it is not a common practice. We discuss two-way commu-
nication and piggybacking in more detail in Chapter 23.

11.3 HDLC
High-level Data Link Control (HDLC) is a bit-oriented protocol for communication
over point -to-point and multipoint links. It implements the Stop-and- Wait protocol we
discussed earlier. Although this protocol is more a theoretical issue than practical, most
of the concept defined in this protocol is the basis for other practical protocols such as
PPP, which we discuss next, or the Ethernet protocol, which we discuss in wired LANs
(Chapter 13), or in wireless LANs (Chapter 15).
CHAPTER 11 DATA LINK CONTROL (DLC) 305

Figure 11.13 Flow diagram for Example 11.4

Legend ,

• Start the timer. '


,
Packet
~.~.~~l~~m~e~O~--------~
'F
_: Packet

o Stop the timer. 0~ ___----~A~C~K~I~_:----~~


:
o Restart a time-out timer.
:~
: : Lost
Notes:
A lost frame means cb!rame 1 (resent) •. ,
Packet
either lost or corrupted. : ACKO ~,------.,
A lost ACK means either
lost or corrupted.
$
Packet •• Frame 0
.. ' Packet
ACK l~
, ";;: Lost
Frame 0 is discarded
®Frame 0 (resent) ,
because the receiver
: ACK1 •.
:.••.
expects frame 1.
0~
y t
Time Time Time Time

11.3.1 Configurations and Transfer Modes


HDLC provides two common transfer modes that can be used in different configurations:
normal response mode (NRM) and asynchronous balanced mode (ABM). In normal
response mode (NRM), the station configuration is unbalanced. We have one primary
station and multiple secondary stations. A primary station can send commands; a
secondary station can only respond. The NRM is used for both point-to-point and mul-
tipoint links, as shown in Figure 11.14.
In ABM, the configuration is balanced. The link is point-to-point, and each station
can function as a primary and a secondary (acting as peers), as shown in Figure 1l.15.
This is the common mode today.

11.3.2 Framing
To provide the flexibility necessary to support all the options possible in the modes and
configurations just described, HDLC defines three types of frames: information frames
(I-frames}, supervisory frames (S-frames), and unnumbered frames (V-frames). Each type
of frame serves as an envelope for the transmission of a different type of message. 1-
frames are used to data-link user data and control information relating to user data (piggy-
backing). S-frames are used only to transport control information. U-frames are reserved
for system management. Information carried by U-frames is intended for managing the
306 PART III DATA-LINK LAYER

Figure 11.14 Normal response mode

Primary Secondary
~

a. Point-to-point

T' liili"!!i!i!i'.
(l!L_p_ri_m_ary-----'====
Y
-~~-s-e-co-n-d-ar-y--~='
YSecondary
~~
b. Multipoint

Figure 11.15 Asynchronous balanced mode

Combined~ I Command/response~ combined~

~Command/response I

link itself. Each frame in HDLC may contain up to six fields, as shown in Figure 11.16: a
beginning flag field, an address field, a control field, an information field, a frame check
sequence (FCS) field, and an ending flag field. In multiple-frame transmissions, the end-
ing flag of one frame can serve as the beginning flag of the next frame.

Figure 11.16 HDLC frames

User
information
III Flag I-frame

I FCS I Flag IS-frame


Management
information
III Fla
g
If-frame

Let us now discuss the fields and their use in different frame types.
D Flag field. This field contains synchronization pattern 01111110, which identifies
both the beginning and the end of a frame.
D Address field. This field contains the address of the secondary station. If a primary
station created the frame, it contains a to address. If a secondary station creates the
frame, it contains afrom address. The address field can be one byte or several bytes
long, depending on the needs of the network.
CHAPTER 11 DATA LINK CONTROL (DLC) 307

o Controlfield. The control field is one or two bytes used for flow and error control.
The interpretation of bits are discussed later.
o Information field. The information field contains the user's data from the network
layer or management information. Its length can vary from one network to another.
o FCS field. The frame check sequence (FCS) is the HDLC error detection field. It
can contain either a 2- or 4-byte CRC.
The control field determines the type of frame and defines its functionality. So let
us discuss the format of this field in detail. The format is specific for the type of frame,
as shown in Figure 11.17.

Figure 11.17 Controlfieldformatfor the differentframe types

I-frame S-frame U-frame

0
1 1 I I I~FI I I I ~
N(S) N(R) Code N(R) Code Code

Control Fieldfor I-Frames


I-frames are designed to carry user data from the network layer. In addition, they can
include flow- and error-control information (piggybacking). The subfields in the con-
trol field are used to define these functions. The first bit defines the type. If the first
bit of the control field is 0, this means the frame is an I-frame. The next 3 bits, called
N(S), define the sequence number of the frame. Note that with 3 bits, we can define a
sequence number between 0 and 7. The last 3 bits, called N(R), correspond to the
acknowledgment number when piggybacking is used. The single bit between N(S)
and N(R) is called the PIF bit. The PIF field is a single bit with a dual purpose. It has
meaning only when it is set (bit = 1) and can mean poll or final. It means poll when
the frame is sent by a primary station to a secondary (when the address field contains
the address of the receiver). It means final when the frame is sent by a secondary to a
primary (when the address field contains the address of the sender).

Control Fieldfor S-Frames


Supervisory frames are used for flow and error control whenever piggybacking is either
impossible or inappropriate. S-frames do not have information fields. If the first 2 bits of
the control field are 10, this means the frame is an S-frame. The last 3 bits, called N(R),
correspond to the acknowledgment number (ACK) or negative acknowledgment num-
ber (NAK), depending on the type of S-frame. The 2 bits called code are used to define
the type of S-frame itself. With 2 bits, we can have four types of S-frames, as described
below:
o Receive ready (RR). If the value of the code subfield is 00, it is an RR S-frame.
This kind of frame acknowledges the receipt of a safe and sound frame or
group of frames. In this case, the value of the N(R) field defines the acknowledg-
ment number.
308 PART III DATA-LINK LAYER

o Receive not ready (RNR). If the value of the code subfield is 10, it is an RNR S-
frame. This kind of frame is an RR frame with additional functions. It acknowl-
edges the receipt of a frame or group of frames, and it announces that the receiver
is busy and cannot receive more frames. It acts as a kind of congestion-control
mechanism by asking the sender to slow down. The value of N(R) is the acknowl-
edgment number.
o Reject (REJ). If the value of the code subfield is 01, it is an REJ S-frame. This is a
NAK frame, but not like the one used for Selective Repeat ARQ. It is a NAK that
can be used in Go-Back-N ARQ to improve the efficiency of the process by
informing the sender, before the sender timer expires, that the last frame is lost or
damaged. The value of N(R) is the negative acknowledgment number.
o Selective reject (SREJ). If the value of the code subfield is 11, it is an SREJ S-
frame. This is a NAK frame used in Selective Repeat ARQ. Note that the HDLC
Protocol uses the term selective reject instead of selective repeat. The value of
N(R) is the negative acknowledgment number.

Control Fieldfor V-Frames


Unnumbered frames are used to exchange session management and control informa-
tion between connected devices. Unlike S-frames, U-frames contain an information
field, but one used for system management information, not user data. As with S-frames,
however, much of the information carried by If-frames is contained in codes included in
the control field. If-frame codes are divided into two sections: a 2-bit prefix before the PI
F bit and a 3-bit suffix after the PIP bit. Together, these two segments (5 bits) can be used
to create up to 32 different types ofU-frames.

Control Fieldfor V-Frames


Unnumbered frames are used to exchange session management and control information
between connected devices. Unlike S-frames, U-frames contain an information field,
but one used for system management information, not user data. As with S-frames,
however, much of the information carried by U-frames is contained in codes included
in the control field. U-frame codes are divided into two sections: a 2-bit prefix before
the PIP bit and a 3-bit suffix after the P/F bit. Together, these two segments (5 bits) can
be used to create up to 32 different types of If-frames.

Example 11.5
Figure 11.18 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).

Example 11.6
Figure 11.19 shows two exchanges using piggybacking. The first is the case where no error has
occurred; the second is the case where an error has occurred and some frames are discarded.
CHAPTER 11 DATA LiNK CONTROL (DLC) 309

Figure 11.18 Example of connection and disconnection

Node A NodeB

o I
o I

Data transfer

I
I

t y
Time Time

11.4 POINT -TO-POINT PROTOCOL (PPP)


One of the most common protocols for point-to-point access is the Point-to-Point
Protocol (PPP). Today, millions of Internet users who need to connect their home
computers to the server of an Internet service provider use PPP. The majority of these
users have a traditional modem; they are connected to the Internet through a telephone
line, which provides the services of the physical layer. But to control and manage
the transfer of data, there is a need for a point-to-point protocol at the data-link layer.
PPP is by far the most common.

11.4.1 Services
The designers of PPP have included several services to make it suitable for a point-to-
point protocol, but have ignored some traditional services to make it simple.

Services Provided by PPP


PPP defines the format of the frame to be exchanged between devices. It also defines how
two devices can negotiate the establishment of the link and the exchange of data. PPP is
designed to accept payloads from several network layers (not only IP). Authentication is
also provided in the protocol, but it is optional. The new version of PPP, called Multilink
P P P, provides connections over multiple links. One interesting feature of PPP is that it pro-
vides network address configuration. This is particularly useful when a home user needs a
temporary network address to connect to the Internet.
310 PART III DATA-LINK lAYER

Figure 11.19 Example a/piggybacking with and without error

Node A NodeB Node A NodeB

U
,
, I-frame (data frame 0)
LJJD
, , I-frame (data frame 0) o

+
Time Time
,----1
,,
,
~ ...
-,,
,,
t t
Time Time
a. The case of no error b. The case with error

Services Not Provided by PPP


PPP does not provide flow control. A sender can send several frames one after another
with no concern about overwhelming the receiver. PPP has a very simple mechanism
for error control. A CRC field is used to detect errors. If the frame is corrupted, it is
silently discarded; the upper-layer protocol needs to take care of the problem. Lack of
error control and sequence numbering may cause a packet to be received out of order.
PPP does not provide a sophisticated addressing mechanism to handle frames in a mul-
tipoint configuration.

11.4.2 Framing
PPP uses a character-oriented (or byte-oriented) frame. Figure 11.20 shows the format
of a PPP frame. The description of each field follows:
o Flag. A PPP frame starts and ends with a l-byte flag with the bit pattern 01111110.
CHAPTER 11 DATA LINK CONTROL (DLC) 311

Figure 11.20 PPP framefarmat

(OOOOOOllh
Protocol Payload _ Flag

1 byte 1byte 1 byte 1-2 bytes Variable 2-4 bytes 1 byte

o Address. The address field in this protocol is a constant value and set to 11111111
(broadcast address).
D Control. This field is set to the constant value 00000011 (imitating unnumbered
frames in HDLC). As we will discuss later, PPP does not provide any flow control.
Error control is also limited to error detection.
o Protocol. The protocol field defines what is being carried in the data field: either
user data or other information. This field is by default 2 bytes long, but the two
parties can agree to use only 1 byte.
o Payload field. This field carries either the user data or other information that we
will discuss shortly. The data field is a sequence of bytes with the default of a
maximum of 1500 bytes; but this can be changed during negotiation. The data field
is byte-stuffed if the flag byte pattern appears in this field. Because there is no field
defining the size of the data field, padding is needed if the size is less than the max-
imum default value or the maximum negotiated value.
D FCS. The frame check sequence (FCS) is simply a 2-byte or 4-byte standard CRe.

Byte Stuffing
Since PPP is a byte-oriented protocol, the flag in PPP is a byte that needs to be escaped
whenever it appears in the data section of the frame. The escape byte is 01111101,
which means that every time the flag like pattern appears in the data, this extra byte is
stuffed to tell the receiver that the next byte is not a flag. Obviously, the escape byte
itself should be stuffed with another escape byte.

11.4.3 Transition Phases


A PPP connection goes through phases which can be shown in a transition phase diagram
(see Figure 11.21). The transition diagram, which is an FSM, starts with the dead state. In
this state, there is no active carrier (at the physical layer) and the line is quiet. When one
of the two nodes starts the communication, the connection goes into the establish state. In
this state, options are negotiated between the two parties. If the two parties agree that they
need authentication (for example, if they do not know each other), then the system needs
to do authentication (an extra step); otherwise, the parties can simply start communica-
tion. The link-control protocol packets, discussed shortly, are used for this purpose. Sev-
eral packets may be exchanged here. Data transfer takes place in the open state. When a
connection reaches this state, the exchange of data packets can be started. The connection
remains in this state until one of the endpoints wants to terminate the connection. In this
case, the system goes to the terminate state. The system remains in this state until the car-
rier (physical-layer signal) is dropped, which moves the system to the dead state again.
312 PART 111 DATA-LINK LAYER

Figure 11.21 Transition phases

Start~
Dead
Carrier
Carrier detected
dropped

Authentication failed
Terminate

Done

Data Transfer State Network-layer


configuration
Open

11.4.4 Multiplexing
Although PPP is a link-layer protocol, it uses another set of protocols to establish the
link, authenticate the parties involved, and carry the network-layer data. Three sets of
protocols are defined to make PPP powerful: the Link Control Protocol (LCP), two
Authentication Protocols (APs), and several Network Control Protocols (NCPs). At any
moment, a PPP packet can carry data from one of these protocols in its data field, as
shown in Figure 11.22. Note that there are one LCP, two APs, and several NCPs. Data
may also come from several different network layers.

Link Control Protocol


The Link Control Protocol (LCP) is responsible for establishing, maintaining, config-
uring, and terminating links. It also provides negotiation mechanisms to set options
between the two endpoints. Both endpoints of the link must reach an agreement about
the options before the link can be established. See Figure 11.21.

Figure 11.22 Multiplexing in PPP

Legend
LCP: Link control protocol
AP: Authentication protocol
NCP: Network control protocol

Protocol values:
LCP: OxC021
AP: OxC023 and OxC223
NCP: Ox8021 and .
Data: Ox0021 and .
CHAPTER 11 DATA LiNK CONTROL (DLC) 313

All LCP packets are carried in the payload field of the PPP frame with the protocol
field set to C021 in hexadecimal (see Figure 11.23).

Figure 11.23 LCP packet encapsulated in a frame

2 Variable

Address Control

The code field defines the type of LCP packet. There are 11 types of packets, as
shown in Table 11.1.

Table 11.1 u:r packets

Code Packet Type Description

OxOl Configure-request Contains the list of proposed options and their values
Ox02 Configure-ack Accepts all options proposed
Ox03 Configure-nak Announces that some options are not acceptable
Ox04 Configure-reject Announces that some options are not recognized
OxOS Termi nate-request Request to shut down the line
Ox06 Terminate-ack Accept the shutdown request
Ox07 Code-reject Announces an unknown code
Ox08 Protocol-reject Announces an unknown protocol

Ox09 Echo-request A type of hello message to check if the other end is alive
OxOA Echo-reply The response to the echo-request message
OxOB Discard-request A request to discard the packet

There are three categories of packets. The first category, comprising the first
four packet types, is used for link configuration during the establish phase. The
second category, comprising packet types 5 and 6, is used for link termination dur-
ing the termination phase. The last five packets are used for link monitoring and
debugging.
The ID field holds a value that matches a request with a reply. One endpoint inserts
a value in this field, which will be copied into the reply packet. The length field defines
the length of the entire LCP packet. The information field contains information, such as
options, needed for some LCP packets.
There are many options that can be negotiated between the two endpoints. Options
are inserted in the information field of the configuration packets. In this case, the
314 PART III DATA-LINK LAYER

information field is divided into three fields: option type, option length, and option
data. We list some of the most common options in Table 11.2.
Table 11.2 Common options

Option Default
Maximum receive unit (payload field size) 1500
Authentication protocol None
Protocol field compression Off
Address and control field compression Off

Authentication Protocols
Authentication plays a very important role in PPP because PPP is designed for use over
dial-up links where verification of user identity is necessary. Authentication means val-
idating the identity of a user who needs to access a set of resources. PPP has created
two protocols for authentication: Password Authentication Protocol and Challenge
Handshake Authentication Protocol. Note that these protocols are used during the
authentication phase.

PAP
The Password Authentication Protocol (PAP) is a simple authentication procedure
with a two-step process:
a. The user who wants to access a system sends an authentication identification
(usually the user name) and a password.
b. The system checks the validity of the identification and password and either
accepts or denies connection.

Figure 11.24 shows the three types of packets used by PAP and how they are actually
exchanged. When a PPP frame is carrying any PAP packets, the value of the protocol
field is OxC023. The three PAP packets are authenticate-request, authenticate-ack, and
authenticate-nak. The first packet is used by the user to send the user name and pass-
word. The second is used by the system to allow access. The third is used by the system
to deny access.

CHAP
The Challenge Handshake Authentication Protocol (CHAP) is a three-way hand-
shaking authentication protocol that provides greater security than PAP. In this method,
the password is kept secret; it is never sent online.
a. The system sends the user a challenge packet containing a challenge value, usu-
ally a few bytes.
b. The user applies a predefined function that takes the challenge value and the
user's own password and creates a result. The user sends the result in the
response packet to the system.
c. The system does the same. It applies the same function to the password of the
user (known to the system) and the challenge value to create a result. If the
CHAPTER 11 DATA LiNK CONTROL (DLC) 315

Figure 11.24 PAP packets encapsulated in a PPP frame

System
User
Authenticate-request

Authenticate-ack or authenticate-nak

1------------------------------------------------------------,
I I 2 1 Variable 1 Variable :
I
I

result created is the same as the result sent in the response packet, access is
granted; otherwise, it is denied. CHAP is more secure than PAP, especially if
the system continuously changes the challenge value. Even if the intruder learns
the challenge value and the result, the password is still secret. Figure 11.25
shows the packets and how they are used.

Figure 11.25 CHAP packets encapsulated in a PPP frame

System
User
Challenge

Success 1 Code: 31 ID 1 Length 1 Message

Failure 1 Code: 41 ID 1 Length 1 Message


CHAP packets
316 PART III DATA-LINK LAYER

CHAP packets are encapsulated in the PPP frame with the protocol value C223 in
hexadecimal. There are four CHAP packets: challenge, response, success, and failure.
The first packet is used by the system to send the challenge value. The second is used by
the user to return the result of the calculation. The third is used by the system to allow
access to the system. The fourth is used by the system to deny access to the system.

Network Control Protocols


PPP is a multiple-network-layer protocol. It can carry a network-layer data packet from
protocols defined by the Internet, OSI, Xerox, DECnet, AppleTalk, Novel, and so on.
To do this, PPP has defined a specific Network Control Protocol for each network pro-
tocol. For example, IPCP (Internet Protocol Control Protocol) configures the link for
carrying IP data packets. Xerox CP does the same for the Xerox protocol data packets,
and so on. Note that none of the NCP packets carry network-layer data; they just
configure the link at the network layer for the incoming data.

IPCP
One NCP protocol is the Internet Protocol Control Protocol (IPCP). This protocol
configures the link used to carry IP packets in the Internet. IPCP is especially of interest
to us. The format of an IPCP packet is shown in Figure 11.26. Note that the value of the
protocol field in hexadecimal is 8021.

Figure 11.26 IPCP packet encapsulated in PPP frame

Payload I
(and padding)

IPCP defines seven packets, distinguished by their code values, as shown in


Table 11.3.

Table 11.3 Code value for IPCP packets

Code IPCP Packet


OxOl Configure- req uest
Ox02 Configure-ack
Ox03 Configure- nak
Ox04 Configure-reject
Ox 05 Terminate-request
Ox06 Terminate-ack
Ox07 Code- rej ect
CHAPTER 11 DATA LiNK CONTROL (DLC) 317

Other Protocols
There are other NCP protocols for other network-layer protocols. The OSI Network
Layer Control Protocol has a protocol field value of 8023; the Xerox NS IDP Control
Protocol has a protocol field value of 8025; and so on.

Datafrom the Network Layer


After the network-layer configuration is completed by one of the NCP protocols, the
users can exchange data packets from the network layer. Here again, there are different
protocol fields for different network layers. For example, if PPP is carrying data from
the IP network layer, the field value is 0021 (note that the three rightmost digits are the
same as for IPCP). If PPP is carrying data from the OSI network layer, the value of the
protocol field is 0023, and so on. Figure 11.27 shows the frame for IP.

Figure 11.27 IP datagram encapsulated in a PPPframe

Payload
(and padding)

Multilink PPP
PPP was originally designed for a single-channel point-to-point physical link. The
availability of multiple channels in a single point-to-point link motivated the develop-
ment of Multilink PPP. In this case, a logical PPP frame is divided into several actual
PPP frames. A segment of the logical frame is carried in the payload of an actual PPP
frame, as shown in Figure 11.28. To show that the actual PPP frame is carrying a frag-
ment of a logical PPP frame, the protocol field is set to (003dh6' This new development
adds complexity. For example, a sequence number needs to be added to the actual PPP
frame to show a fragment's position in the logical frame.

Figure 11.28 Multilink PPP

Logical PPP • Payload •


318 PART III DATA-LINK LAYER

Example 11.7
Let us go through the phases followed by a network layer packet as it is transmitted through a
PPP connection. Figure 11.29 shows the steps. For simplicity, we assume unidirectional move-
ment of data from the user site to the system site (such as sending an e-rnail through an ISP).

Figure 11.29 An example

System
User
,
,

:J

, •...
~
:]"'""
:
,
I Z
,
I

I
I
I
I

Data Transfer
,
I

o I

''§ I

·s"l::
" I

~ :
r-------------------~~
I
I
I

t t
Time Time

The first two frames show link establishment. We have chosen two options (not shown in the
figure): using PAP for authentication and suppressing the address control fields. Frames 3 and 4
are for authentication. Frames 5 and 6 establish the network layer connection using IPCP.
The next several frames show that some IP packets are encapsulated in the PPP frame. The
system (receiver) may have been running several network layer protocols, but it knows that the
incoming data must be delivered to the IP protocol because the NCP protocol used before the data
transfer was IPCP.
CHAPTER 11 DATA LINK CONTROL (DLC) 319

After data transfer, the user then terminates the data-link connection, which is acknowl-
edged by the system. Of course the user or the system could have chosen to terminate the
network-layerIPCP and keep the data-link layer running if it wanted to run another NCP protocol.

11.5 END-CHAPTER MATERIALS


11.5.1 Recommended Reading
For more details about subjects discussed in this chapter, we recommend the following
books. The items in brackets [... J refer to the reference list at the end of the text.

Books
Several books discuss link-layer issues. Among them we recommend [Ham 80], [Zar 02],
[Ror 96], [Tan 03], [GW 04], [For 03], [KMK 04], [Sta 04], [Kes 02], [PD 03],
[Kei 02], [Spu 00], [KCK 98], [Sau 98], [Izz 00], [Per 00], and [WV 00].

11.5.2 Key Terms


acknowledgment number Internet Protocol Control Protocol (IPCP)
bit stuffing Link Control Protocol (LCP)
byte stuffing Password Authentication Protocol (PAP)
ChallengeHandshakeAuthentication piggybacking
Protocol (CHAP) Point-to-Point Protocol (PPP)
data link control (DLC) sequence number
finite state machine (FSM) Simple Protocol
flag Stop-and-Wait Protocol
High-level Data Link Control (HDLC)

11.5.3 Summary
Data link control deals with the design and procedures for communication between two
adjacent nodes: node-to-node communication. Framing in the data-link layer separates
one packet from another. In fixed-size framing, there is no need for defining the boundar-
ies of frames; in variable-size framing, we need a delimiter (flag) to define the boundary
of two frames. Variable-size framing uses two categories of protocols: byte-oriented (or
character-oriented) and bit-oriented. In a byte-oriented protocol, the data section of a
frame is a sequence of bytes; in a bit-oriented protocol, the data section of a frame is a
sequence of bits. In byte-oriented protocols, we use byte stuffing; in bit-oriented
protocols, we use bit stuffing.
Another duty of DLC is flow and error control. At the data-link layer, flow control
means creating a balance between the frames sent by a node and the frames that can be
handled by the next node. Error control at the data-link layer is normally implemented
very simply. Corrupted frames are silently discarded; uncorrupted frames are accepted
with or without sending acknowledgments to the sender.
A DLC protocol can be either connectionless or connection-oriented. In a connec-
tionless protocol, frames are sent from one node to the next without any relationship
between the frames; each frame is independent. In a connection-oriented protocol, a logi-
cal connection should first be established between the two nodes before sending the data
frames. After all related frames are transmitted, the logical connection is terminated.
320 PART III DATA-LINK LAYER

Data-link protocols have been designed to handle communication between two


nodes. We discussed two protocols in this chapter. In the Simple Protocol, there is no
flow and error control. In the Stop-and-Wait Protocol, there are both flow and error
controls, but communication is a frame at a time.
High-level Data Link Control (HDLC) is a bit-oriented protocol for communica-
tion over point-to-point and multipoint links. It implements the Stop-and-Wait protocol.
It is the basis of many protocols in practice today. HDLC defines three types of frames:
information frames, supervisory frames, and unnumbered frames. The informational
frames are used to carry data frames. Supervisory frames are used only to transport con-
trol information for flow and error control. Unnumbered frames are reserved for system
management and provide connection-oriented service.
One of the most common protocols for point-to-point access is the Point-to-Point
Protocol (PPP). PPP uses only one type of frame, but allows multiplexing of different
payloads to achieve a kind of connection-oriented service authentication. Encapsulat-
ing different packets in a frame allows PPP to move to different states to provide neces-
sary services.

11.6 PRACTICE SET


11.6.1 Quizzes
A set of interactive quizzes for this chapter can be found on the book website. It is
strongly recommended that the student take the quizzes to check his/her understanding
of the materials before continuing with the practice set.

11.6.2 Questions
Qll-l. DefineJraming and give the reason it is needed.
Qll-2. Define piggybacking and its benefit.
Qll-3. In PPP, we normally talk about user and system instead of sending and receiv-
ing nodes; explain the reason.
Qll-4. Explain why flags are needed when we use variable-size frames.
Qll-5. In Figure 1l.9, we show the packet path as a horizontal line, but the frame
path as a diagonal line. Can you explain the reason?
Qll-6. Compare Figure 1l.6 and Figure 1l.2l. If both are FSMs, why are there no
event/action pairs in the second?
Qll-7. In Figure 1l.11, do the ready and blocking states use the same timer? Explain.
Qll-8. In Figure 11.12, explain why we need a timer at the sending site, but none at
the receiving site.
Qll-9. In a bit-oriented protocol, should we first unstuff the extra bits and then
remove the flags or reverse the process?
Qll-IO. In a byte-oriented protocol, should we first unstuff the extra bytes and then
remove the flags or reverse the process?
Qf l-Ll, Compare and contrast byte-stuffing and bit-stuffing.
CHAPTER 11 DATA LiNK CONTROL (DLC) 321

Ql1-12. In Figure 11.20, explain why we need only one address field. Explain why the
address is set to the predefined value of (11111111 h.
Qll-13. In Example 11.4 (Figure 11.13) how many frames are in transit at the same
time?
Qll-14. Compare and contrast byte-oriented and bit-oriented protocols.
Qll-15. Compare the flag byte and the escape byte in PPP. Are they the same?
Explain.
Qll-16. In the traditional Ethernet protocol (Chapter 13), the frames are sent with the
CRe. If the frame is corrupted, the receiving node just discards it. Is this an
example of a Simple Protocol or the Stop-and-Wait Protocol? Explain.
Qll-17. In the Stop-and-Wait Protocol, assume that the sender has only one slot in
which to keep the frame to send or the copy of the sent frame. What happens if
the network layer delivers a packet to the data-link layer at this moment?
Qll-18. Compare and contrast flow control and error control.
Qll-19. In Figure 11.16, which frame type can be used for acknowledgment?
Qll-20. Compare and contrast HDLC with PPP.
Qll-21. Assume a new character-oriented protocol is using the 16-bit Unicode as the
character set. What should the size of the flag be in this protocol?
Qll-22. Explain why there is no need for CRC in the Simple Protocol.
Qll-23. Does the duplex communication in Figure 11.10 necessarily mean we need
two separate media between the two nodes? Explain.
Qll-24. In Example 11.3 (Figure 11.12) how many frames are in transit at the same
time?

11.6.3 Problems
Pl l-L Assume PPP is in the established phase; show payload encapsulated in the
frame.
Pll-2. Using the following specifications, draw a finite state machine with three
states (I, II, and III), six events, and four actions:
a. If the machine is in state I, two events can occur. If event 1 occurs, the
machine moves to state III. If event 3 occurs, the machine performs actions
2 and 4 and moves to state II.
b. If the machine is in state II, two events can occur. If event 4 occurs, the
machine remains in state II. If event 6 occurs, the machine performs actions
1 and 2 and moves to state III.
c. If the machine is in state III, three events can occur. If event 2 occurs, the
machine remains in state III. If event 6 occurs, the machine performs
actions 2, 3, 4, and 5 moves to state I. If event 4 occurs, the machine per-
forms actions 1 and 2 and moves to state I.
Pll-3. Redraw Figure 11.12 using the following scenario:
a. The first frame is sent and acknowledged.
b. The second frame is sent and acknowledged, but the acknowledgment is
lost.
322 PART III DATA-LINK LAYER

c. The second frame is resent, but it is timed-out.


d. The second frame is resent and acknowledged.
Pl1-4. In Example 11.4 (Figure 11.13), assume the round trip time for a frame is
50 milliseconds. Explain what will happen if we set the time-out in each of the
following cases.
a. 45 milliseconds b. 55 milliseconds c. 50 milliseconds

Pll-S. Byte-stuff the following frame payload in which E is the escape byte, F is the
flag byte, and D is a data byte other than an escape or a flag character.

Pl1-6. In Figure 11.11, show what happens in each of the following cases:
a. The receiver is in the ready state and a packet comes from the network
layer.
b. The receiver is in the ready state and a corrupted frame arrives.
c. The receiver is in the ready state and an acknowledgment arrives.
Pl1-7. In Figure 11.11, show what happens in each of the following cases:
a. The sender is at the ready state and an error-free ACK arrives.
b. The sender is at the blocking state and a time-out occurs.
c. The sender is at the ready state and a time-out occurs.
Pll-S. Redraw Figure 11.21 with the system not using authentication.
Pl1-9. Using the following specifications, draw a finite state machine with three
states (I, II, and III), five events, and six actions:
a. If the machine is in state I, two events can occur. If event 1 occurs, the
machine moves to state II. If event 2 occurs, the machine performs actions
1 and 2 and moves to state III.
b. If the machine is in state II, two events can occur. If event 3 occurs, the
machine remains in state II. If event 4 occurs, the machine moves to
state III.
c. If the machine is in state III, three events can occur. If event 2 occurs, the
machine remains in state III. If event 3 occurs, the machine performs
actions 1,2,4, and 5 moves to state II. If event 5 occurs, the machine per-
forms actions 1, 2, and 6 and moves to state I.
Pll-l0. Redraw Figure 11.2 using the following scenario:
a. Frame 0 is sent, but lost.
b. Frame 0 is resent and acknowledged.
c. Frame 1 is sent and acknowledged, but the acknowledgment is lost.
d. Frame 1 is resent and acknowledged.
Pll-11. Bit-stuff the following frame payload:
0001111100001111101000111111011110000111
CHAPTER 11 DATA LINK CONTROL (DLC) 323

Pll-12. Assume the only computer in the residence uses PPP to communicate with the
ISP. If the user sends 10 network-layer packets to ISP, how many frames are
exchanged in each of the following cases:
a. Using no authentication?
b. Using PAP for authentication?
c. Using CHAP for authentication?
Pll-13. Assume PPP is in the authentication phase, show payload exchanged between
the nodes if PPP is using
a. PAP
b. CHAP
Pll-14. Un stuff the following frame payload:
I 00011111000001011101110100111011111001101111

Pll-IS. Redraw Figure 11.11 using a variable to hold the one-bit sequence number
and a variable to hold the one-bit acknowledgment number.
Pll-16. Un stuff the following frame payload in which E is the escape byte, F is the
flag byte, and D is a data byte other than an escape or a flag character.

Pll-17. Assume we change the Stop-and-Wait Protocol to include a NAK (negative


feedback), which is used only when a corrupted frame arrives and is dis-
carded. Redraw Figure 11.9 to show this change.
Pll-18. Redraw Figure 11.10 using piggybacking.

11.7 SIMULATION EXPERIMENTS


11.7.1 Applets
We have created some Java applets to show some of the main concepts discussed in this
chapter. It is strongly recommended that the students activate these applets on the book
website and carefully examine the protocols in action.

11.8 PROGRAMMING ASSIGNMENTS


For each of the following assignments, write a program in the programming language
you are familiar with.
Prgll-l. Write and test a program that simulates the byte stuffing and byte un stuffing
as shown in Figure 11.2.
Prgll-2. Write and test a program that simulates the bit stuffing and bit un stuffing as
shown in Figure 11.4.

You might also like