5-7 Data Link Layer
5-7 Data Link Layer
Data Communications & Networking by Behrouz A Forouzan. Copyright © The McGraw-Hill Companies, Inc.
Data can be corrupted
during transmission.
Solution
We first find all the Hamming distances.
Table 10.2
The dmin in this case is 3.
To guarantee the detection of up to s
errors in all cases, the minimum
Hamming distance in a block
code must be dmin = s + 1.
Example
Solution
This code guarantees the detection of up to three errors
(s = 3), but it can correct up to one error. In other words,
if this code is used for error correction, part of its capability
is wasted. Error correction codes need to have an odd
minimum distance (3, 5, 7, . . . ).
LINEAR BLOCK CODES
- The extra bit, called the parity bit, is selected to make the total number of 1s in the
codeword even.
- The minimum Hamming distance for this category is dmin =2, which means that the
code is a single-bit error-detecting code; it cannot correct any error.
Encoder and decoder for simple parity-check code
• 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, signals
the start or end of a frame.
Byte stuffing and unstuffing
Byte Stuffing
• Any pattern used for the flag could also be part of the information.
• If this happens, the receiver, when it encounters this pattern in the
middle of the data, thinks it has reached the end of the frame.
• To fix this problem, a byte-stuffing strategy was added to character-
oriented framing.
• In byte stuffing (or character stuffing), a special byte is added to the
data section of the frame when there is a character with the same
pattern as the flag.
• The data section is stuffed with an extra byte. This byte is usually
called the escape character (ESC), which 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 a
delimiting flag.
Note
• This flag can create the same type of problem we saw in the
byte-oriented protocols.
• If the flag pattern appears in the data, we need to somehow
inform the receiver that this is not the end of the frame.
• We do this by stuffing 1 single bit (instead of 1 byte) to
prevent the pattern from looking like a flag.
Note
• Now let us see how the data link layer 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.
Taxonomy of protocols
NOISELESS CHANNELS
Note
Solution
The address is sent left-to-right, byte by byte; for each
byte, it is sent right-to-left, bit by bit, as shown below:
Ethernet frame structure
type
14.99