Download as pdf or txt
Download as pdf or txt
You are on page 1of 41

Data Link Layer Protocols

EE534
Sonali Chouhan
Dept of EEE
IITG
DLL

Network “Packet” Network


layer layer

Data link “Frame” Data link


layer layer

Physical Physical
layer layer
Data Link Protocols
Packets Packets

Data link Data link


layer Frames layer
A B
Physical Physical
layer layer

Examples
 PPP

 HDLC

 Ethernet LAN

 IEEE 802.11 (WiFi) LAN


Framing
transmitted received
 Bit stream - frames
frames frames  Three approaches
to find frame and
idle fill boundaries:
Framing 1) Character oriented
framing
2) Length counts
0110110111
0111110101

- fixed length
3) Bit oriented
protocols (flags)
Character based framing

SYN is synchronous idle


STX is start text
ETX is end text
• Standard character codes such as ASCII and
EBCDIC contain special communication characters
that cannot appear in data

Entire transmission is based on a character code
 Transmission of printable characters using ASCII
 Octets with HEX value < 0x20 are nonprintable
 Use control characters: STX (start of text) = 0x02; ETX (end of text) = 0x03.
Character based framing
 What about transmission of data (including
non-printable characters)?
 Use transparent mode
 Introduce DLE (data link escape) = 0x10
 DLE STX (DLE ETX) used to indicate
beginning (end) of frame
 Insert extra DLE in front of occurrence of
DLE STX (DLE ETX) in frame
 All DLEs occur in pairs except at frame
boundaries.
Data to be sent
A DLE B ETX DLE STX E
After stuffing and framing
DLE STX A DLE DLE B ETX DLE DLE STX E DLE ETX
Issues with character based
framing

Character code dependent

How do you send binary data?

Frames must be integer number of
characters

Errors in control characters are
messy (abruptly detect end frame or
do not detect end of frame)
Length field approach

Use a header field to give the length
of the frame (in bits or bytes)

Receiver can count until the end of
the frame to find the start of the
next frame

Receiver looks at the respective
length field in the next packet
header to find that packet’s length
Length field approach

For representing length in binary
length field must be
log2(Max_Size_Packet) + 1 bits long

This restricts the packet size to be
used

Issues with length counts

Difficult to recover from errors

Resynchronization is needed after an
error in the length count
Bit Oriented Framing (Flags)

A flag is some fixed string of bits to indicate
the start and end of a packet

A single flag can be used to indicate
both the start and the end of a packet

In principle, any string could be used, but
appearance of flag must be prevented
somehow in data

Standard protocols use the 8-bit string
01111110 as a flag

Use 01111111..1110 (<16 bits) as abort
under error conditions

Constant flags or 1's is considered an idle
state
Bit Oriented Framing (Flags)

Thus 0111111 is the actual bit string
that must not appear in data

INVENTED ~ 1970 by IBM for SDLC
(synchronous data link protocol)
Bit Stuffing (transmitter)
• Flag consists of the byte 01111110
• Bit Stuffing is used to prevent the
occurrence of flag inside the HDLC
frame
• Insert an extra 0 after consecutive
five 1’s
• 0110111111111100
• after bit stuffing
011011111011111000
Bit Destuffing (receiver)
 Receiver checks for five consecutive 1s
 if next bit = 0, it is removed
 if next two bits are 10, then flag is
detected
 If next two bits are 11, then frame has
errors
Example: Bit stuffing
(a) Data to be sent

0110111111111100
After stuffing and framing

0111111001101111101111100001111110

(b) Data received

01111110000111011111011111011001111110
After destuffing and deframing

*000111011111-11111-110*
Framing Errors

All framing techniques are sensitive to errors

An error in a length count field causes the frame to be
terminated at the wrong point (and makes it tricky to
find the beginning of the next frame)

An error in DLE, STX, or ETX causes the same
problems

An error in a flag, or a flag created by an error causes
a frame to disappear or an extra frame to appear

Flag approach is least sensitive to errors because a flag
will eventually appear again to indicate the end of a next
packet

Only thing that happens is that an erroneous packet
was created

This erroneous packet can be removed through an
error detection technique
Example: Framing in Ethernet
 Ethernet complies to standard IEEE
802.3
 An illegal manchester coding is used
for framing.
 A character count is also included in
the header.
 All frames have an integral number
of bytes. If not, the frame is
considered to be received in error.
Standard Data Link Layer
Protocols:
PPP & HDLC
PPP: Point-to-Point Protocol
 A data link layer protocol.
 Encapsulating IP packets over point-to-point
links.
 Router-router;
 Dial-up to router (PC to Internet service provider
(ISP))
 Functions:
 Provides Framing and Error Detection
 Link Control Protocols
 Set up, configure, testing, maintain, terminate;
 Authentication: Password Authentication Protocol,
etc.
 Network Control Protocols
 Configure network layer protocols
 E.g., IP, IPX (Novell), Appletalk
PPP Frame Format
1 or 2 variable 2 or 4
Flag Address Control Protocol Information Flag
FCS
01111110 1111111 00000011 01111110

CRC 16 or
All stations are to
CRC 32
accept the frame

HDLC
Unnumbered frame

• Can support multiple network protocols simultaneously


• Specifies what kind of packet is contained in the payload
High-Level Data Link Control (HDLC)

 Bit-oriented data link control


 Derived from IBM Synchronous Data
Link Control (SDLC)
High-level Data Link Control

HDLC – High Level Data Link
Control

Provides unified data link control
protocols

Format structure, mechanisms

Three types of stations

Two link configurations

Three data transfer modes of
operation
HDLC Station Types
Primary station

Controls operation of link

Frames issued are called commands

Maintains separate logical link to each
secondary station
Secondary station

Under control of primary station

Frames issued called responses
Combined station

May issue commands and responses
HDLC Link Configurations
Unbalanced
•One primary and
one or more
secondary stations
•Supports full duplex
and half duplex
Balanced
•Two combined
stations
Supports full duplex
and half duplex
HDLC Transfer Modes [1]
Normal Response Mode (NRM)
•Used in unbalanced configuration
•Primary initiates transfer to secondary
•Secondary may only transmit data in response
to command from primary command
•Used on multidrop lines
• Host computer as primary
Response on demand
• Terminals as secondary
• Host polls each terminal
•Sometimes used in point-to-point link (with
one station identified as primary, the other as
secondary)
HDLC Transfer Modes [2]
Asynchronous Balanced Mode (ABM)
•Used in balanced configuration
•Either station may initiate transmission
without receiving permission
•Most widely used
•No polling overhead
Command and response

 Mode is selected during connection establishment


HDLC Transfer Modes [3]
Asynchronous Response Mode (ARM)
Unbalanced configuration
Secondary may initiate transmission
without permission form primary
Primary responsible for line initialization,
error recovery, disconnection
rarely used command

Respond
unilaterally
HDLC Frame Structure
•Synchronous transmission
•All transmissions in frames
•Single frame format for all data and
control exchanges
HDLC Frame Format

Flag Address Control Information FCS Flag

• Control field gives HDLC its functionality


• Codes in fields have specific meanings and uses
• Flag: delineate frame boundaries
• Address: identify secondary station (1 or more octets)
• In ABM mode, a station can act as primary or secondary so
address changes accordingly
• Control: purpose & functions of frame (1 or 2 octets)
• Information: contains user data; length not standardized,
but implementations impose maximum
• Frame Check Sequence: 16- or 32-bit CRC
Flag Field
HDLC frame

Flag Address Control Information FCS Flag


any number of bits

 Frame delineated by flag character


 HDLC uses 01111110 for occurrence
of flag
Control Field Format
Information Frame
1 2-4 5 6-8
0 N(S) P/F N(R)

Supervisory Frame

1 0 S S P/F N(R)

Unnumbered Frame

1 1 M M P/F M M M

• S: Supervisory Function Bits  M: Unnumbered Function Bits


• N(R): Receive Sequence Number  P/F: Poll/final bit used in interaction
between primary and secondary
• N(S): Send Sequence Number
Control Field Diagram

- extended mode
Information frames

Each I-frame contains sequence number N(S)

Positive ACK piggybacked

N(R)=Sequence number of next frame expected
acknowledges all frames up to and including N(R)-1

Poll/Final Bit

NRM: Primary polls station by setting P=1; Secondary
sets F=1 in last I-frame in response

Primaries and secondaries always interact via paired
P/F bits
Error Detection & Loss Recovery

Frames lost due to loss-of-synch or receiver
buffer overflow

Frames may undergo errors in transmission

CRCs detect errors and such frames are
treated as lost

Recovery through ACKs, timeouts &
retransmission

Sequence numbering to identify out-of-
sequence & duplicate frames

HDLC provides for options that implement
several ARQ methods
Supervisory frames
Used for error (ACK, NAK) and flow control

(Don’t Send):

Receive Ready (RR), SS=00

ACKs frames up to N(R)-1 when piggyback not available

REJECT (REJ), SS=01

Negative ACK indicating N(R) is first frame not received
correctly. Transmitter must resend N(R) and later frames

Receive Not Ready (RNR), SS=10

ACKs frame N(R)-1 & requests that no more I-frames be
sent

Selective REJECT (SREJ), SS=11

Negative ACK for N(R) requesting that N(R) be selectively
retransmitted
Unnumbered Frames
Setting of Modes:


SABM: Set Asynchronous Balanced Mode

UA: acknowledges acceptance of mode setting
commands

DISC: terminates logical link connection
Information Transfer between stations


UI: Unnumbered information

Recovery used when normal error/flow control
fails
Unnumbered Frames
FRMR: frame with correct FCS but impossible semantics


Examples of impossible semantics are a frame
shorter than 32 bits, an illegal control frame, and
an acknowledgement of a frame that was outside
the window, etc.

FRMR frames contain a 24-bit data field telling what
was wrong with the frame.

RSET: indicates sending station is resetting sequence
numbers

XID: exchange station id and characteristics
Connection Establishment &
Release
• Set Asynchronous Balanced Mode (SABM)
• Disconnect (DISC)
• Unnumbered Acknowledgment (UA)
A

SABM UA
Data UA
transfer DISC

B
HDLC Flow Control
 Flow control prevents transmitter from
overrunning receiver buffers.
 Receiver can control flow by delaying
acknowledgement messages.
 Receiver can also use supervisory frames to
explicitly control transmitter
 Receive Not Ready (RNR) & Receive Ready (RR)

I3 I4 I5 RNR5 RR6 I6
Example: HDLC using NRM
Address of secondary(polling)
Primary A Secondaries B, C
A polls B B, RR, 0, P N(S) N(R)

B, I, 0, 0
N(R) B sends 3 info
X B, I, 1, 0
frames
B, I, 2, 0,F
A rejects fr1 B, SREJ, 1
A polls C C, RR, 0, P
C, RR, 0, F C nothing to
send
A polls B, B, SREJ, 1,P
requests
selective B, I, 1, 0 B resends fr1
retrans. fr1 B, I, 3, 0 Then fr 3 & 4
B, I, 4, 0, F
A send info fr0 B, I, 0, 5
to B, ACKs up to 4
Time
Examples of Operation (1)
Examples of Operation (2)

You might also like