Dat Link Layer
Dat Link Layer
Data Link
Error Framing
Layer
Control
Flow Physical
Control Addressing
Functions of the Data Link Layer (2)
• Error-Detecting Codes
• Error-Correcting Codes
Error-Detecting Codes
a) Single-Bit Error
b) The term single-bit error means that only one bit of a given data
unit (such as a byte, character, data unit, or packet) is changed from
1 to 0 or from 0 to 1.
c) In figure below shows, 00000010 (ASCII STX) was sent, meaning
start of text, but 00001010 (ASCII LF) was received, meaning line
feed.
Single Bit Error
Burst Error
a) A burst error means that two or more bits in the data unit
have changed.
b) In figure below shows, 0100010001000011 was sent, but
0101110101000011 was received. The length of the burst
is measured from the first corrupted bit to the last
corrupted bit.
c) Burst error is most likely to happen in a serial
transmission. The duration of noise is normally longer
than the duration of bit, which means that when noise
affects data, it affects a set of bits. The number of bits
affected depends on the data rate and duration of noise.
Burst Error
Error Detection Techniques
(Redundancy)
Data Data Redundant
Bits
Generator
Redundancy Checker
Parity Bit or
VRC
Even parity Generator Parity Checker (Count 1’s in
1
(Count 1’s in data) data + VRC)
1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1
Vertical Redundancy Check
(VRC)/Parity Check
Receiver
Sender
Data Accept Data Reject Data
1 1 0 0 1 1 1
Parity Bit or
VRC
Even parity Generator Parity Checker (Count 1’s in
1
(Count 1’s in data) data + VRC)
1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 1
0 1 0 1 1 1 1 1
Longitudinal Redundancy Check
(LRC).
Contd..
However, if two bits in one data unit are damaged and two bits in
exactly the same positions in another data unit are also damaged,
the LRC checker will not detect an error.
Cyclic Redundancy Check (CRC)
Requirements of CRC :
1011 .
Contd..
Polynomial codes
CRC generator using polynomials
Checksum
– The sender follows these steps:
• The unit is divided into k sections, each of n bits.
• All sections are added using one’s complement to get the
sum.
• The sum is complemented and becomes the checksum.
• The checksum is sent with the data.
– The receiver follows these steps:
• The unit is divided into k sections, each of n bits.
• All sections are added using one’s complement to get the
sum.
• The sum is complemented.
• If the result is zero, the data are accepted: otherwise, rejected.
Example Part 1
a) Suppose the following block of 16 bits is to be sent using a
checksum of 8 bits.
b) 10101001 00111001
c) The numbers are added using one’s complement
d) 10101001
e) 00111001
------------
Sum 11100010
f) Checksum 00011101
g) The pattern sent is 10101001 00111001 00011101
Example part 2
a) Now suppose the receiver receives the pattern sent in Example 7
and there is no error.
b) 10101001 00111001 00011101
c) When the receiver adds the three sections, it will get all 1s, which,
after complementing, is all 0s and shows that there is no error.
d) 10101001
e) 00111001
f) 00011101
g) Sum 11111111
h) Complement 00000000 means that the pattern is OK.
Error-Correcting Codes
Continued
Some definitions
needed in the
protocols to follow.
These are located in
the file protocol.h.
Unrestricted
Simplex
Protocol
Simplex
Stop-and-
Wait
Protocol
A Simplex Protocol for a Noisy Channel
A positive
acknowledgement
with retransmission
protocol.
Continued
A Simplex Protocol for a Noisy Channel (ctd.)
Continued
A One-Bit Sliding Window Protocol (ctd.)
A One-Bit Sliding Window Protocol (2)
Continued
Sliding Window Protocol Using Go Back N
Continued
Sliding Window Protocol Using Go Back N
Continued
Sliding Window Protocol Using Go Back N
Sliding Window Protocol Using Go Back N (2)
Continued
A Sliding Window Protocol Using Selective Repeat (2)
Continued
A Sliding Window Protocol Using Selective Repeat (3)
Continued
A Sliding Window Protocol Using Selective Repeat (4)
A Sliding Window Protocol Using Selective Repeat (5)
Control field of
(a) An information frame.
(b) A supervisory frame.
(c) An unnumbered frame.
The Data Link Layer in the Internet