The document provides an overview of the data link layer. It discusses the functions of the data link layer including framing, flow control, and error detection. It describes various data link protocols like HDLC, PPP, Ethernet, and wireless LAN standards. It also covers topics like framing, MAC addressing, LLC, flow control mechanisms like stop-and-wait, and error detection techniques like CRC codes.
Introduction to Unit 3 covering Data Link Layer presented by Chandan Gupta Bhagat.
Details functions including Framing, Flow Control, Error Detection, HDLC, PPP, and access methods.
Explanation of DLL functions: service interface, error control, and flow regulation.
Focus on framing, flow, and error control; discussing Logical Link Layer and Media Access Control.
Details about frame structures; header, payload, trailer, and how data is framed for transport.
Discussion on fixed-size and variable size framing methods with examples.
Byte and bit stuffing techniques to define frame delimiters; examples included.
Overview of Flow Control protocols; addressing issues when sender and receiver differ in speed.
Explanations of Simple, Stop-and-Wait, and Sliding Window flow control protocols.Understanding error detection requirements and various ACK types for error handling.
Review of Stop and Wait ARQ, Go-Back-N ARQ, and Selective Repeat ARQ methods.
Details on various Error Detection techniques including Single Parity, Two-Dimensional Parity, and Checksum.
Explanation of CRC error detection method and its working with examples.
Difference between backward and forward error correction with illustrative examples.
Detailed explanation of Hamming code for error detection and correction and its algorithm.
Introduction to HDLC as a communication protocol and its various operational modes.
Discussion on the structure and types of frames in HDLC, including I, S, and U frames.
Overview of PPP protocol for multi-protocol data transmission across point-to-point links.
Description of PPP components, including encapsulation, LCP, AP, and various NCP functionalities.
Unit 3 :Data Link Layer
Chandan Gupta Bhagat
https://chandanbhagat.com.np/me
2.
Data Link Layer
ïŽFunction of Data Link Layer (DLL)
ïŽ Data Link Control: Framing, Flow and Error Control
ïŽ Error Detection and Correction
ïŽ High Level Data Link Control (HDLC) & Point-to-Point Protocol (PPP)
ïŽ Channel Allocation Problem
ïŽ Multiple Access:
ïŽ Random Access (ALOHA, CSMA, CSMA/CD, CSMA/CA)
ïŽ Controlled Access (Reservation, Polling, Token Passing)
ïŽ Channelization (FDMA, TDMA, CDMA)
ïŽ Wired LAN: Ethernet Standards and FDDI
ïŽ Wireless LAN: IEEE 802.11x and Bluetooth Standards
ïŽ Token Bus, Token Ring and Virtual LAN
Functions of DataLink Layer
ïŽ Providing a well-defined service interface to the network layer (framing)
ïŽ Dealing with transmission errors (error control)
ïŽ Regulating the flow of data so that slow receivers are not swamped by
fast senders (flow control)
Framing
ïŽ It needsto pack the bits into frames, so that each frame is distinguishable from one another
ïŽ Prepares a packet for the transport across the local media by encapsulating with a header and trailer to create
frames
ïŽ Data Link Layer frame includes
ïŽ Data: Packet from Network
ïŽ Header: Contains control information, such as Addressing and it is located at the beginning of the Packet Data Unit
ïŽ Trailer: Contains control information added to the end of PDU
Header Payload Trailer
Packet
Sending Machine
Header Payload Trailer
Packet
Receiving Machine
Frames
7.
Parts of frames
ïŽFrame Header: Contains the source and the destination addresses of the frame
ïŽ Payload Field: Contains the message to be delivered
ïŽ Trailer: Contains the error detection and error correction bits
ïŽ Flag: Marks the beginning and end of the frame
Flag Header Trailer Flag
Payload Field
8.
MAC and LLC
ïŽLogical Link Layer (LLC)
ïŽ Upper Sublayer of the DLL of OSI Model
ïŽ Acts as interface between the network layer and the MAC sublayer of DLL
ïŽ main purpose is to multiplex the protocols that may concurrently use the MAC layer (like IPv4, IPv6,...).
ïŽ It may also be used to retransmit error frames detected by MAC.
ïŽ Media Access Control
ïŽ On a network, the Network Interface Card (NIC) has an unique hardware address which identifies a computer or device.
ïŽ The physical address is utilized for the MAC sublayer addressing.
ïŽ Main purpose is framing and to direct those data frames across the network using some kind of addressing
ïŽ Handles Error Correction
9.
MAC and LLC
LLC
Layer3 protocol
Multiplexer / De-multiplexer
Logical Link Services
(Connectionless,
Connection-oriented)
MAC
Broadcast Media
Collision Resolution
Framing/De-framing
Frame header / frame trailer processing
Checksum computation/ Checksum
Verification
LLC
MAC
Physical Layer
LLC
MAC
Physical Layer
Network Layer Packets Network Layer Packets
Data Link Layer
Wired / Wireless Link
10.
LLC
ïŽ Destination ServiceAccess Point (DSAP):
ïŽ IEEE 802.2 header begins with 1 byte, which identifies the upper-layer processing
ïŽ Source Service Access Point (SSAP):
ïŽ Following the DSAP Address is the 1 byte address. which identifies the sending upper layer process
ïŽ Control:
ïŽ It employs 3 different formats depending on the type of LLC used
ïŽ Information (I) Frame: Carries upper-layer information and some control information.
ïŽ Supervisory (S) Frame: Provides control information. An S frame can request and suspend transmission, reports on status, and
acknowledge receipt of I frames.
ïŽ Unnumbered (U) Frame: Used for control purposes and is not sequenced. A U frame can be used to initialize secondaries.
Depending on the function of the U frame, its Control field is 1 or 2 bytes. Some U frames have an Information field.
ïŽ Data:
ïŽ Variable-length field bounded by the MAC format implemented.
DSAP SSAP Control Data
Figure: LLC Frame Format
11.
MAC
ïŽ An error-detectiontechnique used widely in todayâs computer networks is based on cyclic redundancy check
(CRC) codes.
ïŽ CRC codes are also known as polynomial codes.
Control Header Source Address LLC Data CRC
Figure: MAC Frame Format
Destination Address
12.
Framing
ïŽ In thephysical layer, data transmission involves synchronised transmission of bits from the source to the destination. The data link
layer packs these bits into frames.
ïŽ Data-link layer takes the packets from the Network Layer and encapsulates them into frames. If the frame size becomes too large,
then the packet may be divided into small sized frames. Smaller sized frames makes flow control and error control more efficient.
ïŽ Then, it sends each frame bit-by-bit on the hardware. At receiverâs end, data link layer picks up signals from hardware and
assembles them into frames.
ïŽ Parts of a Frame
ïŽ Frame Header: It contains the source and the destination addresses of the frame.
ïŽ Payload field: It contains the message to be delivered.
ïŽ Trailer: It contains the error detection and error correction bits.
ïŽ Flag: It marks the beginning and end of the frame.
13.
Types of Framing
ïŽFixed-sized Framing
ïŽ The size of the frame is fixed and so the frame length acts as delimiter of the frame.
ïŽ Consequently, it does not require additional boundary bits to identify the start and end of the frame.
ïŽ Example â ATM cells.
ïŽ Variable â Sized Framing
ïŽ The size of each frame to be transmitted may be different.
ïŽ Additional mechanisms are kept to mark the end of one frame and the beginning of the next frame.
ïŽ It is used in local area networks.
14.
Variable Size Frame
Twoways to define frame delimiters in variable sized framing
ïŽ Length Field
ïŽ A length field is used that determines the size of the frame.
ïŽ It is used in Ethernet.
ïŽ End Delimiter:
ïŽ A pattern is used as a delimiter to determine the size of frame.
ïŽ If the pattern occurs in the message, then two approaches are used to avoid the situation
ïŽ Byte-Stuffing:
ïŽ A byte is stuffed in the message to differentiate from the delimiter.
ïŽ This is also called character-oriented framing.
ïŽ Bit-Stuffing:
ïŽ A pattern of bits of arbitrary length is stuffed in the message to differentiate from the delimiter.
ïŽ This is also called bit-oriented framing.
15.
Byte Stuffing
Flag HeaderâŠ.. Flag
Trailer
Data from Upper layer
Variable Number of Characters
Byte Stuffing: process of adding 1 byte whenever there is a flag or escape characters in the text
Flag ESC
Flag Header ESC Flag ESC ESC Trailer Flag
Byte Stuffing
Sending Machine
Data Link Frame Sent
Flag ESC
Flag Header ESC Flag ESC ESC Trailer Flag
Byte Un-stuffing
Receiving Machine
Data Link Frame Received
Data From Network Layer
Data to Network Layer
In byte stuffing, a special byte called the escape character (ESC) is stuffed
before every byte in the message with the same pattern as the flag byte. If
the ESC sequence is found in the message byte, then another ESC byte is
stuffed before it.
16.
Byte Stuffing
Flag HeaderPayload Field Flag
Trailer
A frame delimited by flag bytes
Flag
A B Flag
A B
ESC
Original Characters After Stuffing
ESC
A B ESC
A B
ESC
Flag
A B Flag
A B
ESC ESC ESC
ESC
ESC
A B ESC
A B
ESC ESC ESC
ESC
Four Examples of byte sequences before and after byte stuffing
17.
Bit Stuffing
00011111111010100011111001
Flag Header00111110111010100111110001 Trailer Flag
Bit Stuffing
Frame Sent
Bit Un-stuffing
Receiving Machine
Data Link Frame Received
Data From Network Layer
Data to Network Layer
In bit stuffing, we add one extra 0 whenever 5 consecutive 1âs follow a 0 in the
data
Flag Header 00111110111010100111110001 Trailer Flag
00011111111010100011111001
Receiving Machine
Flow Control
ïŽ Flowcontrol coordinates the amount of the data that can be sent before receiving acknowledgement
ïŽ In most protocols, flow control is a set of procedures that tells the sender how much data it can transmit
before it must wait for an acknowledgement from the receiver
ïŽ When a data frame (Layer-2 data) is sent from one host to another over a single medium, it is required that the
sender and receiver should work at the same speed.
ïŽ Sender sends at a speed on which the receiver can process and accept the data.
ïŽ What if the speed (hardware/software) of the sender or receiver differs?
ïŽ If sender is sending too fast the receiver may be overloaded, (swamped) and data may be lost.
Flow Control
ïŽ Simplest
ïŽSimplest Protocol is one that has no flow or error control
ïŽ It is a unidirectional protocol in which data frames are traveling in only one direction-from the sender to receiver.
ïŽ Can be assumed that the receiver can immediately handle any frame it receives with a processing time that is small
enough to be negligible.
ïŽ The data link layer of the receiver immediately removes the header from the frame and hands the data packet to its
network layer, which can also accept the packet immediately.
Flow Control
ïŽ Flowcontrol restricts the number of frames the sender can send before it waits for an acknowledgment from the receiver.
ïŽ Data link layer uses feedback-based flow control mechanisms. There are two main techniques
ïŽ Stop and wait:
ïŽ Send one frame at a time
ïŽ Sends a frame and waits for acknowledgement
ïŽ After the receiver receives the frame, it sends acknowledgement frame back to sender
ïŽ On receiving the acknowledgment frame, the sender understands that the receiver is ready to accept the next frame. So it sender
the next frame in queue.
ïŽ Sliding window:
ïŽ Send Several frame at a time
ïŽ Improves the efficiency of stop and wait protocol by allowing multiple frames to be transmitted before receiving acknowledgement
24.
Flow Control: Stopand Wait
Sender
Network
Data Link
Physical
Get Data
Send Frame
Receiver
Network
Data Link
Physical
Deliver Data
Receive Frame
Data Frames
Request from network Layer
Algorithm for sender site
Event:
Repeat Forever
Notification from physical
layer
Algorithm for receiver site
Event:
Repeat Forever
25.
Flow Control
Frame
Frame
ACK
ACK
Propagation
Delay
Transmission
Delay
Start TransmitEnd Transmit
Receiver
Sender
End of transmit of
ACK
Last Bit
Received
Last Bit of ACK
Received
âą Advantages
âą Simple and each frame is checked and
acknowledged
âą Disadvantages
âą Only one frame can be in transmission
at a time
âą Inefficient, if the distance is long
between devices
âą Reason is propagation delay is much
longer than the transmission delay
26.
Flow Control: SlidingWindow
ïŽ This protocol improves the efficiency of stop and wait protocol by allowing multiple frames to be transmitted
before receiving an acknowledgment.
ïŽ The working principle of this protocol can be described as follows
ïŽ Both the sender and the receiver has finite sized buffers called windows. The sender and the receiver agrees upon the
number of frames to be sent based upon the buffer size.
ïŽ The sender sends multiple frames in a sequence, without waiting for acknowledgment. When its sending window is
filled, it waits for acknowledgment. On receiving acknowledgment, it advances the window and transmits the next
frames, according to the number of acknowledgments received.
ïŽ Each frame has to be numbered in relation to the sliding window. For a window of size n, frames get a number
from 0 to n - 1.
27.
Flow Control: SlidingWindow
ïŽ For example, if n = 8, the frames are numbered 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1...so on. The size of
the window is (n -1) = 7.
ïŽ When the receiver sends an ACK containing the number 5, it means all frames upto number 4 have been
received.
ïŽ If the window size is sufficiently large the sender can continuously transmit packets:
ïŽ If W >= (2a+1), sender can transmit continuously. (Efficiency =1)
ïŽ If W < (2a+1), sender can transmit W frames every (2a+1) time units. (Efficiency = W/(1+2a) )
28.
Error Control
ïŽ Dataframe may be lost or may be corrupted
ïŽ Sender might be unaware of the loss of the data frame
ïŽ Both sender and receiver are quipped with some protocols which helps them to detect error
ïŽ Sender might retransmit or receiver may send request to resend the data-frame
29.
Error Control
ïŽ Requirementsfor the error control mechanism
ïŽ Error detection: The sender and receiver, either both or any, must ascertain that there is some error in the transit.
ïŽ Positive ACK: When the receiver receives a correct frame, it should acknowledge it.
ïŽ Negative ACK: When the receiver receives a damaged frame or a duplicate frame, it sends a NACK back to the sender
and the sender must retransmit the correct frame.
ïŽ Retransmission: The sender maintains a clock and sets a timeout period. If an acknowledgement of a data-frame
previously transmitted does not arrive before the timeout, the sender retransmits the frame, thinking that the frame or
its acknowledgement is lost in transit.
30.
Error Control
ïŽ 3types of technique to control the errors by Automatic Repeat Requests
ïŽ Stop and Wait ARQ
ïŽ Go-Back-N ARQ
ïŽ Selective Repeat ARQ
31.
Stop and WaitARQ
ïŽ The sender maintains a timeout counter.
ïŽ When a frame is sent, the sender starts the timeout counter.
ïŽ If acknowledgement of frame comes in time, the sender transmits the next frame in queue.
ïŽ If acknowledgement does not come in time, the sender assumes that either the frame or its
acknowledgement is lost in transit. Sender retransmits the frame and starts the timeout counter.
ïŽ If a negative acknowledgement is received, the sender retransmits the frame.
32.
Stop and WaitARQ
Sender
Timeout
Timeout
Timeout
Receiver
33.
Go-Back-N ARQ
ïŽ Stopand wait ARQ mechanism does not utilize the resources at their best. When the acknowledgement is
received, the sender sits idle and does nothing. In Go-Back-N ARQ method, both sender and receiver maintain
a window
ïŽ The sending-window size enables the sender to send multiple frames without receiving the acknowledgement
of the previous ones. The receiving-window enables the receiver to receive multiple frames and acknowledge
them. The receiver keeps track of incoming frameâs sequence number.
ïŽ When the sender sends all the frames in window, it checks up to what sequence number it has received
positive acknowledgement. If all frames are positively acknowledged, the sender sends next set of frames. If
sender finds that it has received NACK or has not receive any ACK for a particular frame, it retransmits all the
frames after which it does not receive any positive ACK..
34.
Go-Back-N ARQ
Sender
Set timerfor 0
Receiver
ACK 0
X
Set timer for 1
Set timer for 2
Close timer for 0 and send 3
Close timer for 1 and send 4
Send all frames again
35.
Selective Repeat ARQ
ïŽIn Go-back-N ARQ, it is assumed that the receiver does not have any buffer space for its window size and has
to process each frame as it comes. This enforces the sender to retransmit all the frames which are not
acknowledged
ïŽ In Selective-Repeat ARQ, the receiver while keeping track of sequence numbers, buffers the frames in memory
and sends NACK for only frame which is missing or damaged.The sender in this case, sends only packet for
which NACK is received
36.
Selective Repeat ARQ
Sender
Settimer for 0
Receiver
ACK 0
X
Set timer for 1
Set timer for 2
Close timer for 0 and send 3
Close timer for 1 and send 4
Send frame 2 again
Error Detection
Many factorsincluding line noise can alter
or wipe out one or more bits of a given
data unit. Reliable systems must have
mechanism for detecting and correcting
such errors. Error detection and correction
are implemented either at the data link
layer or the transport layer of the OSI
model.
Types of Errors
Single Bit
(Only one bit in the data
unit has changed)
Burst
(2 or more bit in the data
unit has changed) 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0
O changed to 1
Single Bit Error
0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0
Burst Error
0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 0
Corrupted Bits
Length of Burst Error
is 5
Sent
Received
When data is transmitted from one device to another device, the
system does not guarantee whether the data received by the
device is identical to the data transmitted by another device.
An Error is a situation when the message received at the receiver
end is not identical to the message transmitted.
39.
Single Bit Error
ïŽIn the above figure, the message which is sent is corrupted as single-bit, i.e., 0 bit is changed to 1.
ïŽ The only one bit of a given data unit is changed from 1 to 0 or from 0 to 1.
ïŽ Single-Bit Error does not appear more likely in Serial Data Transmission. For example, Sender
sends the data at 10 Mbps, this means that the bit lasts only for 1âs and for a single-bit error to
occurred, a noise must be more than 1âs.
ïŽ Single-Bit Error mainly occurs in Parallel Data Transmission. For example, if eight wires are used to
send the eight bits of a byte, if one of the wire is noisy, then single-bit is corrupted per byte.
0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0
O changed to 1
Single Bit Error
40.
Burst
ïŽ The twoor more bits are changed from 0 to 1 or from 1 to 0 is known as Burst Error. The Burst
Error is determined from the first corrupted bit to the last corrupted bit.
ïŽ The duration of noise in Burst Error is more than the duration of noise in Single- Bit.
ïŽ Burst Errors are most likely to occur in Serial Data Transmission.
ïŽ The number of affected bits depends on the duration of the noise and data rate.
0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0
Burst Error
0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 0
Corrupted Bits
Length of Burst Error
is 5
Sent
Received
Single Parity Check
ïŽSingle Parity checking is the simple mechanism and inexpensive to detect the errors.
ïŽ In this technique, a redundant bit is also known as a parity bit which is appended at the end
of the data unit so that the number of 1s becomes even.
ïŽ If the number of 1s bits is odd, then parity bit 1 is appended and if the number of 1s bits is even,
then parity bit 0 is appended at the end of the data unit.
ïŽ At the receiving end, the parity bit is calculated from the received data bits and compared with the
received parity bit.
ïŽ This technique generates the total number of 1s even, so it is known as even- parity checking.
âą 1 is added to the block if it contains odd number of 1âs, and
âą 0 is added if it contains even number of 1âs
43.
Single Parity Check
âą1 is added to the block if it contains odd number of 1âs, and
âą 0 is added if it contains even number of 1âs
Sender Receiver
Transmission Media
1011011
Compute Parity bit
1011011
Compute Parity bit
Good?
1 1011011 1
Yes
No
Accept Data
Reject Data
44.
Single Parity Check
DrawbacksOf Single Parity Checking
ïŽ It can only detect single-bit errors which are very rare.
ïŽ If two bits are interchanged, then it cannot detect the errors.
âą 1 is added to the block if it contains odd number of 1âs, and
âą 0 is added if it contains even number of 1âs
0 0 0 0 1 0 1 0 0 0 1 0 0 0 1 0
Unable to Detect
Single Bit Error
45.
Two-Dimensional Parity Check
ïŽPerformance can be improved by using Two-Dimensional Parity Check which organizes
the data in the form of a table.
ïŽ Parity check bits are computed for each row, which is equivalent to the single-parity check.
ïŽ In Two-Dimensional Parity check, a block of bits is divided into rows, and the redundant row of
bits is added to the whole block.
ïŽ At the receiving end, the parity bits are compared with the parity bits computed
from the received data.
46.
Two-Dimensional Parity Check
Paritycheck bits are calculated for each
row, which is equivalent to a simple parity
check bit. Parity check bits are also
calculated for all columns, then both are
sent along with the data. At the receiving
end these are compared with the parity
bits calculated on the received data.
1 0 0 0 0 1 0 0 1 1 1 0 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 0
1 0 0 0 0 1 0 0
1 1 1 0 0 0 1 0
0 0 1 0 0 1 0 0
1 0 0 0 0 1 0 0
1 1 0 0 0 1 1 0
0
0
0
0
1 0 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 1 1 0 0 0 1 1 0 0
0
Row Parities
Column Parities
Original Data
Data to be sent
âą If two bits in one data unit are corrupted
and two bits exactly the same position in
another data unit are also corrupted, then
2D Parity checker will not be able to detect
the error.
âą This technique cannot be used to detect
the 4-bit errors or more in some cases.
Drawbacks
Checksum
ïŽ In checksumerror detection scheme, the data is divided into k segments each of m bits.
ïŽ In the senderâs end the segments are added using 1âs complement arithmetic to get the sum.
The sum is complemented to get the checksum.
ïŽ The checksum segment is sent along with the data segments.
ïŽ At the receiverâs end, all received segments are added using 1âs complement arithmetic to get the
sum. The sum is complemented.
ïŽ If the result is zero, the received data is accepted; otherwise discarded.
49.
Checksum
.
.
Section1 n bits
Section2 n bits
Checksum All 0s
Section K n bits
Sum n bits
Complement n bits
Sender
Checksum
.
.
Section1 n bits
Section 2 n bits
Checksum All 0s
Section K n bits
Sum n bits
Complement n bits
Receiver
Result
Data + Checksum
Packet
n bits
If result = 0; Keep
Else Discard
Cyclic Redundancy Check(CRC)
ïŽ CRC is a redundancy error technique used to determine the error.
ïŽ Following are the steps used in CRC for error detection:
ïŽ In CRC technique, a string of n 0s is appended to the data unit, and this n number is less than the number of bits in a
predetermined number, known as division which is n-1 bits.
ïŽ Secondly, the newly extended data is divided by a divisor using a process is known as binary division. The remainder
generated from this division is known as CRC remainder.
ïŽ Thirdly, the CRC remainder replaces the appended 0s at the end of the original data. This newly generated unit is sent to
the receiver.
ïŽ The receiver receives the data followed by the CRC remainder. The receiver will treat this whole unit as a single unit, and
it is divided by the same divisor that was used to find the CRC remainder.
ïŽ If the resultant of this division is zero which means that it has no error, and the data is accepted.
ïŽ If the resultant of this division is not zero which means that the data consists of an error. Therefore, the data is
discarded.
Error Correction Techniques
ïŽError Correction Techniques
ïŽ Error Correction codes are used to detect and correct the errors when data is transmitted from the sender to
the receiver.
ïŽ Error Correction can be handled in two ways:
ïŽ Backward error correction: Once the error is discovered, the receiver requests the sender to retransmit the entire data
unit.
ïŽ Forward error correction: In this case, the receiver uses the error-correcting code which automatically corrects the
errors.
ïŽ A single additional bit can detect the error, but cannot correct it.
ïŽ For correcting the errors, one has to know the exact position of the error. For example, If we want to calculate a single-
bit error, the error correction code will determine which one of seven bits is in error. To achieve this, we have to add
some additional redundant bits.
55.
Error Correcting Codes
ïŽAlong with detecting code, we have to pass the some data to figure out the original message from the corrupt
message that we received.
ïŽ Error correcting codes also deploys the same strategy as error-detecting codes but such codes also detect the
exact location of corrupt bits
ïŽ parity check has a simple way to detect errors along with a sophisticated mechanism to determine the corrupt
bit location. Once the corrupt bit is located, its value is reverted (from 0 to 1 or 1 to 0) to get the original
message
56.
How to Detectand Correct the Errors?
ïŽ To detect and correct the errors, additional bits are added to the data bits at the time of transmission.
ïŽ The additional bits are called parity bits. They allow detection or correction of the errors.
ïŽ The data bits along with the parity bits form a code word.
57.
Hamming Code
ïŽ Paritybits: The bit which is appended to the original data of binary bits so that the total number of 1s is even
or odd.
ïŽ Even parity: To check for even parity, if the total number of 1s is even, then the value of the parity bit is 0. If the
total number of 1s occurrences is odd, then the value of the parity bit is 1.
ïŽ Odd Parity: To check for odd parity, if the total number of 1s is even, then the value of parity bit is 1. If the total
number of 1s is odd, then the value of parity bit is 0.
58.
Hamming Code :Algorithm (General)
ïŽ Write the bit positions starting from 1 in binary form (1, 10, 11, 100, etc).
ïŽ All the bit positions that are a power of 2 are marked as parity bits (1, 2, 4, 8, etc).
ïŽ All the other bit positions are marked as data bits.
ïŽ Each data bit is included in a unique set of parity bits, as determined its bit position in binary form.
ïŽ Parity bit 1 covers all the bits positions whose binary representation includes a 1 in the least significant position (1, 3, 5, 7, 9, 11, etc).
ïŽ Parity bit 2 covers all the bits positions whose binary representation includes a 1 in the second position from the least significant bit (2, 3, 6, 7, 10, 11, etc).
ïŽ Parity bit 4 covers all the bits positions whose binary representation includes a 1 in the third position from the least significant bit (4â7, 12â15, 20â23, etc).
ïŽ Parity bit 8 covers all the bits positions whose binary representation includes a 1 in the fourth position from the least significant bit bits (8â15, 24â31, 40â47, etc).
ïŽ In general, each parity bit covers all bits where the bitwise AND of the parity position and the bit position is non-zero.
ïŽ Since we check for even parity set a parity bit to 1 if the total number of ones in the positions it checks is odd.
ïŽ Set a parity bit to 0 if the total number of ones in the positions it checks is even. Determining the position of redundant bits, These
redundancy bits are placed at the positions which correspond to the power of 2
59.
Hamming Code :Example
ïŽ Suppose the original data is 1010 which is to be sent.
ïŽ Total number of data bits 'd' = 4
ïŽ Number of redundant bits r :
ïŽ 2r >= d+r+1
ïŽ 2r>= 4+r+1
ïŽ Therefore, the value of r is 3 that satisfies the above relation.
ïŽ Total number of bits = d+r = 4+3 = 7;
60.
Hamming Code :Example
ïŽ Determining the position of the redundant bits:
ïŽ The number of redundant bits is 3. The three bits are represented by r1, r2, r4. The position of the redundant
bits is calculated with corresponds to the raised power of 2. Therefore, their corresponding positions are 1, 21,
22.
ïŽ The position of r1 = 1 The position of r2 = 2 The position of r4 = 4
ïŽ Representation of Data on the addition of parity bits:
1 0 1 r4 0 r2 r1
7 6 5 4 3 2 1
61.
Hamming Code :Example
ïŽ Determining r1 bit : The r1 bit is calculated by performing a parity check on the bit positions whose binary
representation includes 1 in the first position.
ïŽ We observe from the above figure that the bit positions that includes 1 in the first position are 1, 3, 5, 7. Now,
we perform the even-parity check at these bit positions. The total number of 1 at these bit positions
corresponding to r1 is even, therefore, the value of the r1 bit is 0.
1 0 1 r4 0 r2 r1
7 6 5 4 3 2 1
r1
62.
Hamming Code :Example
ïŽ Determining r2 bit : The r2 bit is calculated by performing a parity check on the bit positions whose binary
representation includes 1 in the second position.
ïŽ We observe from the above figure that the bit positions that includes 1 in the second position are 2, 3, 6, 7.
Now, we perform the even-parity check at these bit positions. The total number of 1 at these bit positions
corresponding to r2 is odd, therefore, the value of the r2 bit is 1.
1 0 1 r4 0 r2 0
7 6 5 4 3 2 1
r2
63.
Hamming Code :Example
ïŽ Determining r4 bit : The r4 bit is calculated by performing a parity check on the bit positions whose binary
representation includes 1 in the third position.
ïŽ We observe from the above figure that the bit positions that includes 1 in the third position are 4, 5, 6, 7. Now,
we perform the even-parity check at these bit positions. The total number of 1 at these bit positions
corresponding to r4 is even, therefore, the value of the r4 bit is 0.
1 0 1 r4 0 1 0
7 6 5 4 3 2 1
r4
1 0 1 0 0 1 0
7 6 5 4 3 2 1
64.
Hamming Code :Example
ïŽ Suppose the 4th bit is changed from 0 to
1 at the receiving end, then parity bits
are recalculated.
ïŽ R1 bit
ïŽ The bit positions of the r1 bit are 1,3,5,7
ïŽ We observe from the above figure that the binary
representation of r1 is 1100. Now, we perform the even-
parity check, the total number of 1s appearing in the r1 bit
is an even number. Therefore, the value of r1 is 0.
1 0 1 0 0 1 0
7 6 5 4 3 2 1
1 0 1 1 0 1 0
7 6 5 4 3 2 1
r1
65.
Hamming Code :Example
ïŽ R2 bit
ïŽ The bit positions of r2 bit are 2,3,6,7.
ïŽ We observe from the above figure that the binary
representation of r2 is 1001. Now, we perform the even-
parity check, the total number of 1s appearing in the r2 bit
is an even number. Therefore, the value of r2 is 0.
1 0 1 0 0 1 0
7 6 5 4 3 2 1
1 0 1 0 0 1 0
7 6 5 4 3 2 1
r2
66.
Hamming Code :Example
ïŽ R4 bit
ïŽ The bit positions of r4 bit are 4,5,6,7.
ïŽ We observe from the above figure that the binary
representation of r4 is 1011. Now, we perform the even-parity
check, the total number of 1s appearing in the r4 bit is an
odd number. Therefore, the value of r4 is 1.
ïŽ The binary representation of redundant bits, i.e., r4r2r1 is 100,
and its corresponding decimal value is 4. Therefore, the error
occurs in a 4th bit position. The bit value must be changed
from 1 to 0 to correct the error.
1 0 1 0 0 1 0
7 6 5 4 3 2 1
1 0 1 1 0 1 0
7 6 5 4 3 2 1
r4
67.
High Level DataLink Control (HDLC) & Point-to-Point
Protocol (PPP)
68.
High-Level Data LinkControl (HDLC)
ïŽ High-level Data Link Control (HDLC) is a group of communication protocols of the data link layer for
transmitting data between network points or nodes. Since it is a data link protocol, data is
organized into frames. A frame is transmitted via the network to the destination that verifies its
successful arrival.
ïŽ High-level Data Link Control (HDLC) is a bit-oriented protocol for communication over point-to-
point and multipoint links. It implements the ARQ mechanisms.
ïŽ HDLC provides two common transfer modes that can be used in different configurations:
ïŽ Normal Response Mode (NRM)
ïŽ Asynchronous Balanced Mode (ABM).
69.
Normal Response Mode(NRM)
ïŽ Here, two types of stations are there, a primary station that send commands and secondary station
that can respond to received commands.
Command
Response
Primary
Secondary
Command
Response
Primary
Secondary Secondary
Response
a. Point-to-point
b. Multipoint
70.
Asynchronous Balanced Mode(ABM)
ïŽ Here, the configuration is balanced, i.e. each station can both send commands and respond to
commands. It is used for only point - to - point communications
Command/Response
Command/Response
Stattion
Stattion
Point-to-point
71.
HDLC Frame
Fields ofa HDLC Frame
ïŽ Flag : It is an 8-bit sequence that marks the beginning and the end of the frame. The bit pattern of the
flag is 01111110.
ïŽ Address : It contains the address of the receiver. If the frame is sent by the primary station, it contains the
address(es) of the secondary station(s). If it is sent by the secondary station, it contains the address of the
primary station. The address field may be from 1 byte to several bytes.
ïŽ Control : It is 1 /2 bytes containing flow and error control information.
ïŽ Payload : This carries the data from the network layer. Its length may vary from one network to another.
ïŽ FCS : It is a 2 byte or 4 bytes frame check sequence for error detection. The standard code used is CRC
(cyclic redundancy code)
Flag Address Control Payload FCS Flag
1 byte 1 byte 1/2 byte variable 2 / 4 byte 1 byte
72.
Types of HDLCFrame
ïŽ I â Frame
ïŽ S â Frame
ïŽ U â Frame
Flag Address Control User Information FCS Flag
Flag Address Control FCS Flag
Flag Address Control Management Information FCS Flag
73.
I â Frame
ïŽI-frames or Information frames carry user data from the network layer. They also include flow and
error control information that is piggybacked on user data. The first bit of control field of Iframe is
0.
Flag Address Control User Information FCS Flag
0 P/F
N(S) N(R)
Control Field (1 byte)
N(S) = sequence number of the frame
N(R) = sequence number of the frame expected in return in
two-way communication P/F= Poll/Final
When P/F =1 , it follow two case:
Poll when Frame is sent by a primary station to secondary (
address of receiver) Final when frame is send by secondary to
primary (address of sender)
74.
S - Frame
ïŽâ S-frames or Supervisory frames do not contain information field. They are used for flow and error
control when piggybacking is not required. The first two bits of control field of S-frame is 10.
Flag Address Control FCS Flag
1 0 P/F
Code
N(R)
75.
U - Frame
ïŽU-frames or Un-numbered frames are used for myriad miscellaneous functions, like link
management. It may contain an information field, if required. The first two bits of control field of
Uframe is 11.
Flag Address Control Information FCS Flag
1 1 P/F
Code Code
Control Field (1 byte)
Code Command
00 RR Receive Ready
01 REJ Reject
10 RNR Receive Not Ready
11 SREJ Selective Reject
76.
Point-to-Point Protocol
ïŽ Point- to - Point Protocol (PPP) is a communication protocol of the data link layer that is used to transmit
multiprotocol data between two directly connected (point-to-point) computers.
ïŽ It is a byte - oriented protocol that i s widely use d i n broadband communications having heavy loads and high
speeds.
ïŽ Since it is a data link layer protocol, data is transmitted in frames. It is also known as RFC 1661.
ïŽ One of the most common protocols for point-to-point access
ïŽ Many Internet users who need to connect their home computer to the server of an Internet service provider use
PPP
ïŽ A point-to-point link protocol is required to control and manage the transfer of data
77.
Point-to-Point Protocol
ïŽ Itdefines / provides
ïŽ the format of the frame to be exchanged between devices
ïŽ how two devices negotiate the establishment of the link and the exchange of data
ïŽ how network layer data are encapsulated in the data link frame
ïŽ how two devices can authenticate each other
ïŽ multiple network layer services
ïŽ connection over multiple links
ïŽ Network address configuration
ïŽ But, several services are missing for simplicity
ïŽ no flow control, simple error control (detection and discard), no sophisticate addressing for multipoint
configuration
78.
Point-to-Point Frame
ïŽ Flagâ marks the beginning and the end of the frame. The bit pattern of the flag is 01111110.
ïŽ Address â it is set to 11111111 in case of broadcast.
ïŽ Control â set to a constant value of 11000000.( No need because PPP has no flow control and limited
error control)
ïŽ Protocol â 1 or 2 bytes that define the type of data contained in the payload field.
ïŽ Payload â This carries the data from the network layer. The maximum length of the payload field is 1500
bytes. However, this may be negotiated between the endpoints of communication.
ïŽ FCS â It is a 2 byte or 4 bytes frame check sequence for error detection. The standard code used is CRC
(cyclic redundancy code)
** PPP is a byte-oriented protocol using byte stuffing with the escape byte 01111101**
Flag Address Control Protocol FCS Flag
1 byte 1 byte 1/2 byte variable 2 / 4 byte 1 byte
Payload
1/2 bytes
79.
Point-to-Point Transition State
DeadEstablish
Terminate Authenticate
Open Network
Failed
Carrier Detected
Failed
Network Layer
Configuration
Done
Carrier Dropped
Options agreed
By both sides
Authentication
Successful
If authentication
Not needed
80.
Components of PPP
Point- to - Point Protocol is a layered protocol having three components â
ïŽ Encapsulation Component : It encapsulates the datagram so that it can be transmitted over the specified
physical layer.
ïŽ Link Control Protocol (LCP) : It is responsible for establishing, configuring, testing, maintaining and
terminating l inks for t ransmission. I t also i mparts negotiation for set up of options and use of features
by the two endpoints of the links.
ïŽ Authentication Protocols (AP) : These protocols authenticate endpoints for use of services.
ïŽ The two authentication protocols of PPP are:
ïŽ Password Authentication Protocol (PAP)
ïŽ Challenge Handshake Authentication Protocol (CHAP)
Flag Address Control Protocol FCS Flag
1 byte 1 byte 1/2 byte variable 2 / 4 byte 1 byte
Payload
1/2 bytes
81.
Network Control Protocols(NCPs)
ïŽ These protocols are used for negotiating the parameters and facilities for the network layer. For every
higher-layer protocol supported by PPP, one NCP is there. Some of the NCPs of PPP are:
ïŽ Internet Protocol Control Protocol (IPCP)
ïŽ OSI Network Layer Control Protocol (OSINLCP)
ïŽ Internetwork Packet Exchange Control Protocol (IPXCP)
ïŽ DECnet Phase IV Control Protocol (DNCP)
ïŽ NetBIOS Frames Control Protocol (NBFCP)
ïŽ IPv6 Control Protocol (IPV6CP)
82.
Network Control Protocols(NCPs)
Data From Networking Protocols
NCP
IPCP
OSINLCP
IPXCP
âŠâŠâŠ
AP
PAP
CHAP
LCP
Physical Layer Protocols
Network Layer
Data Link Layer
Physical Layer
#23Â The following figure shows an example of communication using this protocol. It is very simple. The sender sends a sequence of frames without even thinking about the receiver. To send three frames, three events occur at the sender site and three events at the receiver site. Note that the data frames are shown by tilted boxes; the height of the box defines the transmission time difference between the first bit and the last bit in the frame.
#29Â When data-frame is transmitted, there is a probability that data-frame may be lost in the transit, or it is received corrupted. In both cases, the receiver does not receive the correct data-frame and sender does not know anything about any loss. In such case, both sender and receiver are equipped with some protocols which helps them to detect transit errors such as loss of data-frame. Hence, either the sender retransmits the data-frame or the receiver may request to resend the previous data-frame.
#30Â When data-frame is transmitted, there is a probability that data-frame may be lost in the transit, or it is received corrupted. In both cases, the receiver does not receive the correct data-frame and sender does not know anything about any loss. In such case, both sender and receiver are equipped with some protocols which helps them to detect transit errors such as loss of data-frame. Hence, either the sender retransmits the data-frame or the receiver may request to resend the previous data-frame.
#31Â When data-frame is transmitted, there is a probability that data-frame may be lost in the transit, or it is received corrupted. In both cases, the receiver does not receive the correct data-frame and sender does not know anything about any loss. In such case, both sender and receiver are equipped with some protocols which helps them to detect transit errors such as loss of data-frame. Hence, either the sender retransmits the data-frame or the receiver may request to resend the previous data-frame.
#32Â When data-frame is transmitted, there is a probability that data-frame may be lost in the transit, or it is received corrupted. In both cases, the receiver does not receive the correct data-frame and sender does not know anything about any loss. In such case, both sender and receiver are equipped with some protocols which helps them to detect transit errors such as loss of data-frame. Hence, either the sender retransmits the data-frame or the receiver may request to resend the previous data-frame.
#35Â When data-frame is transmitted, there is a probability that data-frame may be lost in the transit, or it is received corrupted. In both cases, the receiver does not receive the correct data-frame and sender does not know anything about any loss. In such case, both sender and receiver are equipped with some protocols which helps them to detect transit errors such as loss of data-frame. Hence, either the sender retransmits the data-frame or the receiver may request to resend the previous data-frame.