In the data link layer, framing is essential to divide the continuous stream of bits from the physical layer into discrete units called frames, allowing for error control and flow control. Several methods are used to determine the start and end of each frame.
Common Framing Methods
The data link layer employs various techniques to delineate frame boundaries. According to the provided reference, the common framing methods include:
- Character Count
- Starting & Ending Characters With Character Stuffing
- Starting & ending Flags With Bit Stuffing
- Physical Layer Coding Violation
Let's explore each method briefly.
Character Count
This method relies on a field in the frame header that explicitly specifies the number of characters (or bytes) within the frame.
- Principle: The header of the frame contains a field indicating the total length of the frame's data payload in characters.
- Reference Detail: "This Method Specifies The Number Of Characters That Are Present In particular Frame."
- Mechanism: The receiver reads the character count, then reads that many characters following the count field to determine the end of the frame.
- Potential Issue: If the character count field is corrupted during transmission, the receiver will likely lose synchronization and be unable to correctly identify the subsequent frames.
Starting & Ending Characters With Character Stuffing
This method uses specific characters to mark the beginning and end of a frame.
- Principle: Frames begin and end with predefined start and end characters.
- Mechanism: To prevent the start or end character from appearing within the data payload itself (and being misinterpreted as a frame boundary), a technique called character stuffing (also known as byte stuffing) is used. If the start or end character appears in the data, an escape character is inserted before it. The receiver removes the escape character upon receiving the data. If the escape character itself appears in the data, it is also stuffed by preceding it with another escape character.
Starting & Ending Flags With Bit Stuffing
Similar to character-based framing, this method uses unique bit patterns as flags to indicate frame boundaries.
- Principle: Frames start and end with a specific bit pattern, often
01111110
. - Mechanism: To ensure the flag pattern doesn't occur within the frame's data, bit stuffing is employed. Whenever the sender encounters five consecutive
1
s in the data stream, it automatically inserts a0
bit. The receiver removes any0
bit that follows five consecutive1
s. This prevents the data from accidentally creating the flag pattern.
Physical Layer Coding Violation
This method utilizes properties of the physical layer encoding scheme to indicate frame boundaries.
- Principle: Some physical layer encoding methods use more signal levels than strictly necessary for representing data bits (e.g., Manchester or differential Manchester coding where voltage transitions occur on every bit or in the middle of a bit). A violation of the standard coding rule (e.g., a lack of expected transition) can be used as a signal to mark the start or end of a frame.
- Mechanism: By intentionally creating a sequence of bits that violates the physical layer's encoding rules, the data link layer can signal frame boundaries without using control characters or bit patterns that might conflict with the data.
Summary Table of Framing Methods
Method | Boundary Indicator | Stufing Mechanism | Vulnerability Example |
---|---|---|---|
Character Count | Frame length specified in header | None | Corrupted count field |
Starting & Ending Characters | Specific Start/End Characters | Character Stuffing | Incorrect stuffing/destuffing |
Starting & Ending Flags | Specific Bit Pattern (Flag) | Bit Stuffing | Incorrect stuffing/destuffing |
Physical Layer Coding Violation | Intentional violation of encoding | None (uses physical property) | Physical layer issues |
Understanding these methods is crucial for comprehending how data is segmented and reliably transmitted across a link before being passed up to higher network layers.