0% found this document useful (0 votes)
87 views127 pages

Unit 4 11 DLC

Uploaded by

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

Unit 4 11 DLC

Uploaded by

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

Data Link Control

(DLC)
CS44 Data Communications

Dr. Shilpa Chaudhari


Department of Computer Science and
Engineering
Ramaiah Institute of Technology Bangalore
Outline
• DLC SERVICES
◦ Framing
◦ Flow and Error Control
◦ Connectionless and Connection-Oriented
• DATA-LINK LAYER PROTOCOLS • POINT-TO-POINT
◦ Simple Protocol PROTOCOL (PPP)
◦ Stop-and-Wait Protocol ◦ Services
◦ Piggybacking ◦ Framing
◦ Transition Phases
• HDLC
◦ Configurations and Transfer Modes ◦ Multiplexing
◦ Framing

2
Summary of Layers

3
Revision
• Physical layer
◦ 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
• Data-link layer needs to pack bits into frames, so that each
frame is distinguishable from another

4
Data Link Layer - functions

5
Data Link Layer
Functions
• The data-link layer is divided into two sublayers
◦ Data link control (DLC)
◦ Deals with the design and procedures for communication between two adjacent nodes:
node-to-node communication
◦ DLC functions include
◦ Framing
◦ flow and error control
◦ Media access control (MAC)
◦ Deals how share the link

• To implement data link control, we need protocols that


provide smooth and reliable transmission of frames between
nodes
◦ a set of rules that need to be implemented in software and run by
the two nodes involved in data exchange at the data link layer
6
Framing
• 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
• Why the whole message not packed in one frame?
◦ 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?
◦ Fixed-Size Framing
◦ Variable-Size Framing

7
Framing …
• Fixed-Size Framing
◦ no need for defining 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
◦ ATM: Asynchronous Transfer Mode( connection oriented, high-speed network technology that is
used in both LAN and WAN over optical fiber and operates upto gigabit speed )

• Variable-Size Framing -
◦ 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 (or byte-oriented) approach
◦ a bit-oriented approach
◦ prevalent in local-area networks

8
Character-Oriented Framing
• Data to be carried are 8-bit characters from a coding
system such as ASCII
• The header (also multiples of 8 bits) normally carries
◦ the source and destination addresses
◦ other control information
◦ the trailer, which carries error detection redundant bits
• To separate one frame from the next, an 8-bit (1-byte) flag
is added at the beginning and the end of a frame
◦ The flag composed of protocol-dependent special characters

9
Problem with flag
• Text communication: flag could be selected to be any
character not used for text communication
• Sending other types of information such as graphs, audio,
and video: any character used for the flag could also be
part of the information
• If flag is a part of the information, the receiver, when it
encounters this pattern in the middle of the data, thinks it
has reached the end of the frame

10
Solution to Flag
Problem
• Add a byte-stuffing strategy 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
◦ called the escape character (ESC) and has a predefined bit pattern
• Whenever the receiver encounters the ESC character, it removes
it from the data section and treats the next character as data,
not as a delimiting flag
• 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

11
Byte stuffing and unstuffing

• The universal coding systems in use today, such as Unicode, have 16-bit and 32-
bit characters that conflict with 8-bit characters
◦ bit-oriented protocols

12
Bit-Oriented Framing
• 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
• In addition to headers (and possible trailers), 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 beginning and the end of the frame

13
Bit-Oriented Framing
• 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
• 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

14
Bit-Oriented Framing

15
Example 1
• Byte-stuff the following frame payload in which
◦ E is the escape byte
◦ F is the flag byte
◦ D is a data byte
◦ other than an escape or a flag character.

FDEEDDEFDDEEEEDEFDF

16
Example 2
• Unstuff the following frame payload in which
◦ E is the escape byte
◦ F is the flag byte
◦ D is a data byte
◦ other than an escape or a flag character.

E DFDDFEDDD

17
Example 3
• Bit-stuff the following frame payload:
0001111111001111101000111111111110000111

00011111011001111100100011111011111010000111

18
Example 4
• Unstuff the following frame payload:
00011111000001111101110100111011111000001111

00011111000001111101110100111011111000001111
00011111000011111111010011101111100001111

19
Programming
Examples
• Write and test a program that simulates the byte stuffing
and byte unstuffing
• Write and test a program that simulates the bit stuffing and
bit unstuffing

20
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

21
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 consumer must wait, and the system becomes less
efficient
• Flow control prevent losing the data items at the
consumer site

22
Flow 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
• In communication at the data-link layer, we are dealing
with four entities:
◦ Network and data-link layers at the sending node
◦ Network and data-link layers at the receiving node

23
Flow Control
• 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

24
Flow Control
• Many ways to implement:
◦ Use two buffers
◦ one at the sending data-link layer and the other at the receiving 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.

25
Error control
• Error control in the data link layer is based on automatic repeat
request, which is the retransmission of data.
• The physical layer is not fully reliable - need to implement error control
at the data-link layer to prevent the receiving node from delivering
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 where a CRC is
added to the frame header by the sender and checked by the receiver
Frame corrupted not corrupted
Method 1 silently discarded packet is delivered to the network layer
Method 2 silently discarded acknowledgment is sent to the sender

26
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
• A frame that carries an acknowledgment is normally called
an ACK to distinguish it from the data frame

27
Connectionless and Connection-
Oriented
• A DLC protocol can be either connectionless or connection-
oriented
• Connectionless Protocol: frames are sent from one node
to the next without any relationship between the frames;
each frame is independent
◦ Term connectionless does not mean that there is no physical
connection (transmission medium) between the nodes
◦ It means that there is no connection between frames
• As the frames are not numbered and there is no sense of
ordering, most of the data-link protocols for LANs are
connectionless protocols

28
Connectionless and Connection-
Oriented
• Connection-Oriented Protocol:
◦ 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)
• 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

29
Data-link Layer Protocols
• Data link layer protocols 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
• four protocols have been defined for the data-link layer to
deal with flow and error control:
◦ Simple
◦ Stop-and-Wait
◦ Go-Back-N
◦ Selective-Repeat

30
Data-link-layer protocol
Behavior
• Can be better shown as a finite state machine (FSM) -
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 associated with two reactions:
◦ defining the list (possibly empty) of actions to be performed
◦ 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

31
Data-link-layer protocol
Behavior
• Used rounded-corner 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
◦ replace the horizontal line with a slash

• The arrow shows the movement to the next state.


• a machine with three states
• only three possible events and
three possible actions
• starts in state I: 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 2 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 I.

32
Simple protocol
• The design of the simplest protocol with no flow or error
control
• Assumption: receiver can immediately handle any frame it
receives
◦ receiver can never be overwhelmed with incoming frames
• Sender gets a packet from its network layer, makes a frame
out of it, and sends the frame
• Receiver receives a frame from the link, extracts the packet
from the frame, and delivers the packet to its network layer
• Sender and receiver provide transmission services for their
network layers
33
Simple protocol - FSM
• Each FSM has only one state, the ready state
• The sender site should not send a frame until its network layer has a message to send.
◦ 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 receiver site cannot deliver a message to its network layer until a frame arrives
◦ 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

34
Simple protocol -
Example
• The sender sends frames one after another without even
thinking about the receiver
• To send two frames, two events occur at the sender site and
two events at the receiver site

35
Stop-and-Wait Protocol
• Uses both flow and error control
• Sender sends one frame at a time and waits for an acknowledgment before sending the
next one
• To detect corrupted frames, CRC is added to each data frame
• When a frame arrives at the receiver site, 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 acknowledgment arrives, the sender discards the copy and sends the next
frame if it is ready

36
Stop-and-Wait Protocol FSM

37
Stop-and-Wait Protocol FSM
Sender States
• The sender is initially in the ready state, but it can move between the
ready and blocking state
• Ready State: 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.
• Blocking State: three events can occur:
◦ If a time-out occurs, the sender resends the saved copy of the frame and restarts
the timer
◦ If a corrupted ACK arrives, it is discarded
◦ 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.

38
Stop-and-Wait Protocol FSM
Receiver States
• The receiver is always in the ready state. Two events may
occur:
◦ If an error-free frame arrives, the message in the frame is delivered
to the network layer and an ACK is sent
◦ If a corrupted frame arrives, the frame is discarded

39
Stop-and-Wait Protocol
• Cases of Operations:
1. Normal operation
2. The frame is lost
3. The Acknowledgment (ACK) is lost
4. The ACK is delayed

40
Stop-and-Wait Protocol Example -1
• The sender sends one
frame and waits for
feedback from the
receiver
• When the ACK
arrives, the sender
sends the next frame

41
Stop-and-Wait Protocol Example -2

42
Stop-and-Wait Protocol Example -2
• 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
◦ Problem: The network layer at the receiver site receives two
copies of the third packet, which is not right
◦ Solution: use sequence numbers and acknowledgment numbers

43
Stop-and-Wait Protocol
Sequence and Acknowledgment Numbers
• Duplicate packets need to be avoided
• Add sequence numbers to the data frames and acknowledgment
numbers to the ACK frames
• The acknowledgment number always announces, in modulo-2
arithmetic, the sequence number of the next packet expected
◦ Sequence numbers are 0, 1, 0, 1, 0, 1, . . . ; the acknowledgment numbers can
also be 1, 0, 1, 0, 1, 0, …
◦ 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

44
Stop-and-Wait Protocol Example -3

45
Stop-and-Wait Protocol Example -3
• 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

46
Stop-and-Wait Protocol Example -4
• Delayed ACK and lost frame

47
Ex1
• Change the Stop-and-Wait Protocol to include a NAK
(negative feedback), which is used only when a corrupted
frame arrives and is discarded. Show this change.

48
Ex2
• Show the following scenario:
a. The first frame is sent and acknowledged.
b. The second frame is sent and acknowledged, but the
acknowledgment is lost.
c. The second frame is resent, but it is timed-out.
d. The second frame is resent and acknowledged.

49
Ex3
• 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 performs actions 1, 2, and 6 and moves to state I.

50
Piggybacking
• Simple/stop-and-wait protocols are designed
◦ unidirectional communication, in which data is flowing only in one
direction although the acknowledgment may travel in the other
direction
• To allow data to flow in both directions to make the
communication more efficient, the data in one direction is
piggybacked with the acknowledgment in the other direction
◦ 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 datalink
layer more complicated, it is not a common practice

51
Flow diagram using
piggybacking

52
Stop-and Wait - Limitations
• After each frame sent, the host must wait for an ACK
inefficient use of bandwidth
• To improve efficiency ACK should be sent after multiple frames
◦ Pipelining: A task is begun before the previous task has ended
 There is no pipelining in stop and wait ARQ because we need to wait
for a frame to reach the destination and be acknowledged before
the next frame can be sent
 Pipelining improves the efficiency of the transmission
◦ Alternatives: Sliding Window protocol
 Go-back-N ARQ
 Selective Repeat ARQ

53
Sliding window
protocols
 Sliding window protocols improve the efficiency
 Multiple frames should be in transition while waiting for
ACK - Let more than one frame to be outstanding.
 Outstanding frames: frames sent but not acknowledged
 Send up to W frames and keep a copy of these frames
(outstanding) until the ACKs arrive
 This procedures requires additional feature to be added :
sliding window

54
Go-Back-N Protocol
(GBN)
• Idea of Stop-and-Wait Protocol- how to add flow control to its
predecessor
◦ 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
• Go-Back-N send several packets before receiving ACKs but the
receiver can only buffer one packet
• Sender keep a copy of sent packets until ACKs arrive numbers are
The sequence
modulo 2m, where m is the
size of the sequence number
field in bits
The acknowledgment
number is cumulative and
defines the sequence number
of the next packet expected
to arrive
55
GBN Windows
• The send window is an abstract concept defining an imaginary
box of size 2m − 1 with three variables: Sf, Sn, and Ssize
◦ Covers the sequence numbers of the data packets that can be in transit
or can be sent
◦ The send window can slide one or more slots when a valid
acknowledgment arrives
◦ Ack number ahould be greater than or equal to Sf and less than Sn arrives

• 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 Rn =Rn+1
◦ Out-of order packet (Region I and III in receiver window packet) is discarded  need to be
resend

56
Send window for Go-Back-N ARQ
• Possible Sequence number (m=4) division – four and Sliding window size = 2 4-1 = 15

Division Division II Division III Division


I IV

Received ACK3

57
Receive window for Go-Back-N ARQ
• Possible ACK number division – three and Sliding window size = 1

D
i
v
is
Division I i Division III
o
n
II

Received packet with sequence number 3

58
Timer for sent frame
• Multiple frame sent but only one timer (for Sf) used
• As first outstanding packet always expire first
• If Sf timer expires all outstanding packets are represent
that is why GBN
• On a time-out the machine goes back N-locations and
resents all packets

59
FSMs for the GBN protocol
• Modulo 2m arithmetic
• Sender FSM: two states
◦ ready  4-events can occur  numbered as 1R,2R, 3R, 4R
◦ Blocking  3-events may occur  numbered as 1B,2B, 3B
• The sender starts in the ready state
◦ The two variables are normally initialized to 0 (Sf = Sn = 0)

60
Sender FSM
1R

4R

3B

1B
3R 2B

2R

61
Receiver FSM
• Rn = 0 initially
• Only one state  3 states

62
Size of send window
• Why the size of send window must be less than 2m?
◦ For m=2, window size < 2m = 3
◦ If all 3 - ACK lost, timer expires and all three packets are resend
◦ For m=2, window size = 2m = 4
◦ If all 4 - ACK lost, timer expires and all four packets are resend which are accepted as
new data erroneously even through duplicate

• Hence the size of the send window must be less than 2m;
the size of the receive window is always 1

63
Size of send window

64
GBN Example 1
• The forward channel is reliable, but the reverse is not. No
data packets 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.

65
GBN Example 1

66
GBN Example 1
• There is no time-out event for sender events because all
outstanding packets are acknowledged before the timer
expires
• Although ACK 2 is lost, ACK 3 is cumulative and serves as
both ACK 2 and ACK 3
• There are four events at the receiver site

67
GBN Example 2
• What happens when a packet is lost.
• Packets 0, 1, 2, and 3 are sent. However, packet 1 is lost.
• The receiver receives packets 2 and 3, but they are discarded
because they are received out of order (packet 1 is expected)
• When the receiver receives packets 2 and 3, it sends ACK1 to show
that it expects to receive packet 1.
• However, these ACKs are not useful for the sender because the
ackNo is equal to Sf , not greater than Sf. So the sender discards
them.
• When the time-out occurs, the sender resends packets 1, 2, and 3,
which are acknowledged.

68
GBN
Examp
le 2

69
Go-Back-N versus Stop-and-
Wait
• Similarity between the Go-Back-N protocol and the Stop-
and- Wait protocol
◦ The Stop-and-Wait protocol is actually a Go-Back-N protocol in
which there are only two sequence numbers and the send window
size is 1
◦ m = 1 and 2m − 1 = 1

• In Go-Back-N, we said that the arithmetic is modulo 2m; in


Stop-and-Wait it is modulo 2, which is the same as 2m when
m = 1.

70
GBN Analysis
• Advantage: Simplifies the process at the receiver
◦ Receiver keeps track of only one variable
◦ No need to buffer out-of-order packets
◦ simply discarded

• Disadvantage: Inefficient if the underlying network protocol loses


a lot of packets
◦ Each time a single packet is lost or corrupted, the sender resends all
outstanding packets, even though some of these packets may have been
received safe and sound but out of order
◦ If the network layer is losing many packets because of congestion in the
network, the resending of all of these outstanding packets makes the
congestion worse, and eventually more packets are lost
◦ This has an avalanche effect that may result in the total collapse of the
network
◦ Solution Selective Repeat
71
Selective-Repeat (SR)
protocol
• Name implies, resends only selective packets, those that
are actually lost

72
SR protocol windows
• two windows: a send window and a receive window
SR protocol windows GBN protocol windows
Maximum size of the send The send window is 2m−1
window is much smaller
(maximum 2m−1)
The receive window is the same The receive window is 1
size as the send window
(maximum 2m−1)
if m = 4, the sequence if m = 4, the sequence
numbers go from 0 to 15, but the numbers go from 0 to 15 the size
maximum size of the window is of the window is 15
just 8

73
Send window for SR protocol

74
SR protocol
• Allows as many packets as the size of the receive window
to arrive out of order and be kept until there is a set of
consecutive packets to be delivered to the application layer
• Because the sizes of the send window and receive window
are the same, all the packets in the send packet can arrive
out of order and be stored until they can be delivered
• A reliable protocol never delivers packets out of order to
the application layer

75
Receive window for SR protocol
• Shaded slots inside the window define packets that have
arrived out of order and are waiting for the earlier
transmitted packet to arrive before delivery to the
application layer

76
SR protocol Timer
• Theoretically, one timer for each outstanding packet
• When a timer expires, only the corresponding packet is
resent
• GBN treats outstanding packets as a group; SR treats them
individually
• However, most transport-layer protocols that implement
SR use only a single timer

77
SR protocol Acknowledgments
• GBN an ackNo is cumulative (defines the sequence number
of the next packet expected, confirming that all previous
packets have been received safe and sound)
• The semantics of acknowledgment is different in SR
◦ An ackNo defines the sequence number of a single packet that is
received safe and sound; there is no feedback for any other

78
SR protocol Example
• Assume a sender sends 6 packets: packets 0, 1, 2, 3, 4, and
5. The sender receives an ACK with ackNo = 3. What is the
interpretation if the system is using GBN or SR?
◦ If the system is using GBN, it means that packets 0, 1, and 2 have
been received uncorrupted and the receiver is expecting packet 3
◦ If the system is using SR, it means that packet 3 has been received
uncorrupted; the ACK does not say anything about other packets

79
SR Protocol FSM
• Modulo 2m arithmetic
• Sender FSM: two states
◦ ready  4-events can occur  numbered as 1R,2R, 3R, 4R
◦ Blocking  3-events may occur  numbered as 1B,2B, 3B
• The sender starts in the ready state

80
SR Protocol Sender
FSM

4R 1R

3B

3R 1B
2B

2R

81
SR Protocol Receiver
FSM
• always in the ready state

3
2

82
SR Protocol

send
window
slides
• Packets 0,
1, 2, and 3
are sent.
However,
packet 1 is
lost.

send
window
slides 83
SR Protocol Window Sizes
• Why the size of the sender and receiver windows can be at most one-
half of 2m?
• For m = 2, size of the window is 2m/2 or 2(m−1) = 2
• If the size of the window is 2 and all acknowledgments are lost, the timer
for packet 0 expires and packet 0 is resent. However, the window of the
receiver is now expecting packet 2, not packet 0, so this duplicate packet
is correctly discarded (the sequence number 0 is not in the window)
• When the size of the window is 3 and all acknowledgments are lost, the
sender sends a duplicate of packet 0
◦ However, this time, the window of the receiver expects to receive packet 0 (0 is
part of the window), so it accepts packet 0, not as a duplicate, but as a packet in
the next cycle
◦ This is clearly an error

84
SR Protocol Window
Sizes

• The size of the sender and receiver window must be at


most one-half of 2m

85
Ex1
• Using 5-bit sequence numbers, what is the maximum size
of the send and receive windows for each of the following
protocols?
a. Stop-and-Wait
b. Go-Back-N
c. Selective-Repeat

86
Programming Assignmnets
• Write a program to simulate the sending-site FSMs for the
simple protocol
• Write a program to simulate the sending-site FSMs for the
Stop-and-Wait protocol
• Write a program to simulate the sending-site FSMs for the
Go-Back-N protocol
• Write a program to simulate the sending-site FSMs for the
Selective Repeat protocol

87
High-level Data Link Control
• High-level Data Link Control (HDLC) is a bit-oriented
protocol for communication over point-to-point and
multipoint links
◦ implements the Stop-and-Wait protocol ARQ mechanisms
• theoretical issue than practical, but is the basis for other
practical protocols such as PPP
• Two common transfer modes used in different
configurations:
◦ Normal response mode (NRM)
◦ Asynchronous balanced mode (ABM)

88
HDLC: Normal response mode
• Normal response mode (NRM): unbalanced station
configuration
◦ one primary station (send commands ) and multiple secondary
stations (only respond)
◦ used for both point-to-point and multipoint links

89
Asynchronous balanced mode
• Configuration is balanced
• The link is point-to-point, and each station can function as
a primary and a secondary (acting as peers)
• This is the common mode today

90
HDLC: Framing
• To provide the flexibility necessary to support all the options
possible in the modes and configurations, HDLC defines three
types of frames:
◦ Information frames (I-frames) :
◦ designed to carry user data from the network layer
◦ include flow- and error-control information (piggybacking)
◦ Supervisory frames (S-frames) : used only to transport control
information
◦ used for flow and error control whenever piggybacking is either impossible or inappropriate
◦ Unnumbered frames (U-frames): reserved for system management
(intended for managing the link itself)
◦ used to exchange session management and control information between connected devices

• Each type of frame serves as an envelope for the transmission


of a different type of message
91
HDLC frames
• Each frame in HDLC may contain up to six fields
1.A beginning flag field
2.An address field
3.A control field
4.An information field
5.A frame check sequence (FCS) field
6.An ending flag field
• In multiple-frame transmissions, the ending flag of one
frame can serve as the beginning flag of the next frame

92
HDLC frames …

93
HDLC frames …
• Flag field: contains synchronization pattern 01111110, which identifies both
the beginning and the end of a frame
• Address 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 a from address
◦ The address field can be one byte or several bytes long, depending on the needs of the
network
• Control field: one or two bytes used for flow and error control
◦ Also determines the type of frame and defines its functionality
• Information field: contains the user’s data from the network layer or
management information
◦ Its length can vary from one network to another.
• Frame check sequence (FCS) field : HDLC error detection field
◦ can contain either a 2- or 4-byte CRC

94
Control field format
type : 0 sequence number of 1-bit poll or final: has meaning only when bit = 1
means the the frame (between 0 Poll : frame is sent by a primary station to a secondary
frame is an I- and 7 as 3-bit field) (address field = address of the receiver)
frame Final : frame is sent by a secondary to a primary (address
field = address of the sender)

3-bit acknowledgment
number when piggybacking

control field means the


frame is an S-frame 3-bit acknowledgment
number or negative
acknowledgment number,
Define the type of depending on the type of S-
S-frame itself frame

codes are divided into two sections: a 2-bit prefix before the P/ F 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 U-frames

95
Types of S-frames
types of Subfield Name Meaning the value of the
S-frames value N(R)
Receive 00 RR S- acknowledges the receipt of a safe and sound acknowledgment
ready (RR) frame frame or group of frames number
Receive 10 RNR RR frame with additional functions acknowledgment
not ready Sframe • Acknowledges the receipt of a frame or group of number
(RNR) frames
• Announces that the receiver is busy and cannot
receive more frames
• Kind of congestion-control mechanism by asking
the sender to slow down
Reject 01 REJ S- NAK frame that can be used in Go-Back-N ARQ to negative
(REJ). frame - improve the efficiency of the process by informing acknowledgment
the sender, before the sender timer expires, that number
the last frame is lost or damaged
Selective 11 SREJ NAK frame used in Selective Repeat ARQ negative
reject Sframe (selective reject instead of selective repeat) acknowledgment
(SREJ) number

96
U-frame control command and response

97
HDLC Example 1
• 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).
98
Exchange using piggybacking without error
• 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.
• 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 and 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.

99
Exchange using piggybacking with error
• 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
( suppose Go-Back-N with the special use
of an REJ frame as a NAK frame is used)
• 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
100
Point-to-Point Protocol
• Today, millions of Internet users who need to connect their
home computers to the server of an Internet service
provider use most common protocols for point-to-point
access Point-to-Point Protocol (PPP)
• The majority of these users have a traditional modem
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 a byte-oriented protocol

101
PPP Services
Services Provided by PPP
• Format of the frame to be exchanged between devices
• How two devices can negotiate the establishment of the link and
the exchange of data
• Accept payloads from several network layers (not only IP)
• Optional authentication
• The new version of PPP, called Multilink PPP, provides connections
over multiple links
• Network address configuration
• useful when a home user needs a temporary network address to
connect to the Internet
102
PPP Services
Services Not Provided by PPP
• No flow control - A sender can send several frames one after
another with no concern about overwhelming the receiver
• 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

• No a sophisticated addressing mechanism to handle frames


in a multipoint configuration

103
PPP frame format
• a character-oriented (or byte-oriented) frame
• starts and ends with a 1-byte flag with the bit pattern
01111110
defines what is being carried frame check sequence (FCS)
a constant value and in the data field: either user is simply a 2-byte or 4-byte
set to 11111111 data or other information standard CRC
(broadcast address)

constant value 00000011 carries either the user data or other


(imitating unnumbered information (byte-stuffed with escape byte
frames in HDLC) as 01111101) - maximum of 1500 bytes;
but this can be changed during negotiation

104
Transition Phases
(FSM)

105
Transition Phases (FSM)

• Starts with the dead state- 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
◦ Negotiate options between the two parties through several packets exchange
◦ Eg. If the two parties agree that they need authentication then the system
needs to do authentication (an extra step); otherwise, the parties can simply
start communication.
• Data transfer takes place in the open state
◦ The connection remains in this state until one of the endpoints wants to
terminate the connection
• System goes to the terminate state when one of the endpoints wants to
terminate the connection
• The system remains in this state until the carrier (physical-layer signal) is
dropped, which moves the system to the dead state again
106
Multiplexing in PPP
• Powerful PPP at a link-layer uses another set of protocols
to
◦ establish the link Link Control Protocol (LCP)
◦ authenticate the parties involved  two Authentication Protocols
(APs)
◦ carry the network-layer data  several Network Control Protocols
(NCPs)
• PPP packet can carry data from one of these protocols in
its data field
◦ Data may also come from several different network layers

107
Multiplexing in PPP ...

108
Multiplexing in PPP :
LCP
• Responsible for establishing, maintaining, configuring,
and terminating links
• Provides negotiation mechanisms to set options between
the two endpoints to reach an agreement about the
options before the link can be established
• All LCP packets are carried in the payload field of the PPP
frame with the protocol field set to C021 in hexadecimal

109
used for link used for link
used for link
monitoring and termination during
configuration during
debugging the termination
the establish phase
phase

• The code field defines the type of LCP packet  11 types of packets
Multiplexing in PPP : LCP ...

110
Multiplexing in PPP : LCP ...
• 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
◦ Information field is divided into three fields: option type, option length, and option data

111
Multiplexing in PPP : LCP ...
• Common options

112
Multiplexing in PPP :
AP
• 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 validating the identity of a user who
needs to access a set of resources
• PPP has created two protocols for authentication used
during the authentication phase:
◦ Password Authentication Protocol
◦ Challenge Handshake Authentication Protocol

113
Multiplexing in PPP : AP...
• Password Authentication Protocol (PAP) is a simple two-step
authentication procedure
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.
• Three types of packets used by PAP
◦ authenticate-request - used by the user to send the user name and
password
◦ authenticate-ack - used by the system to allow access
◦ authenticate-nak - used by the system to deny access
• When a PPP frame is carrying any PAP packets, the value of the
protocol field is 0xC023
114
Multiplexing in PPP : AP...
• PAP packets encapsulated in a PPP frame

115
Multiplexing in PPP : AP...
• Challenge Handshake Authentication Protocol (CHAP) is a three-way
handshaking authentication protocol
• Password is kept secret; it is never sent online.
a. The system sends the user a challenge packet containing a challenge value,
usually 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 that is send as response packet to the
system
c. The system also applies the same function to the password of the user (known to
the system) and the challenge value to create a result
◦ If the 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
116
Multiplexing in PPP : AP...
• CHAP packets
encapsulated
in a PPP frame

117
Multiplexing in PPP : AP...
• CHAP packets are encapsulated in the PPP frame with the
protocol value C223 in hexadecimal
• There are four CHAP packets:
◦ Challenge - used by the system to send the challenge value
◦ Response - used by the user to return the result of the calculation
◦ Success - used by the system to allow access to the system
◦ Failure - used by the system to deny access to the system

118
Multiplexing in PPP :
NCPs
• PPP is a multiple-network-layer protocol
• PPP has defined a specific Network Control Protocol for
each network protocol defined by the Internet, OSI, Xerox,
DECnet, AppleTalk, Novel, and so on
◦ 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
• None of the NCP packets carry network-layer data - just
configure the link at the network layer for the incoming
data

119
Multiplexing in PPP :
NCPs
• Internet Protocol Control Protocol (IPCP) configures the link used
to carry IP packets in the Internet
• Value of the protocol field in the format of an IPCP packet is
hexadecimal is 8021
◦ 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.

120
Multiplexing in PPP :
NCPs
• IPCP defines seven packets, distinguished by their code
values

121
Multiplexing in PPP :
NCPs
• After the network-layer configuration is completed by one of
the NCP protocols, the users can exchange data packets from
the network layer
• 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
• IP datagram encapsulated in a PPP frame

122
Multilink PPP
• The availability of multiple channels in a single point-to-
point link motivated the development of Multilink PPP
• 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
◦ To show that the actual PPP frame is carrying a fragment of a
logical PPP frame, the protocol field is set to (003d)16
◦ 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

123
Multilink PPP

124
Multilink PPP

125
Multilink PPP

126
Multilink PPP
Phases followed by a network layer packet as it is transmitted through a PPP
connection
• Link establishment have chosen two options 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
• After data transfer, the user then terminates the data link connection, which is
acknowledged by the system
◦ The user or the system could have chosen to terminate the network layer IPCP and keep the
data link layer running if it wanted to run another NCP protocol.

127

You might also like