Framing in Data link layer
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
A frame has the following parts −
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.
Explore our latest online courses and learn new skills at your own pace. Enroll
and become a certified expert to boost your career.
Types of Framing
Framing can be of two types, fixed sized framing and variable sized framing.
Fixed-sized Framing
Here 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
Here, the size of each frame to be transmitted may be different. So 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.
Two ways to define frame delimiters in variable sized framing are −
1. Length field – We can introduce a length field in the frame to indicate
the length of the frame. Used in Ethernet(802.3). The problem with
this is that sometimes the length field might get corrupted.
2. End Delimiter (ED) – We can introduce an ED(pattern) to indicate the
end of the frame. Used in Token Ring. The problem with this is that ED
can occur in the data. This can be solved by:
1. Character/Byte Stuffing: Used when frames consist of characters. If
data contains ED then, a byte is stuffed into data to differentiate it
from ED.
Let ED = “$” –> if data contains ‘$’ anywhere, it can be escaped using ‘\
O’ character.
–> if data contains ‘\O$’ then, use ‘\O\O\O$'($ is escaped using \O
and \O is escaped using \O).
Disadvantage – It is very costly and obsolete method.
2. Bit Stuffing: Let ED = 01111 and if data = 01111
–> Sender stuffs a bit to break the pattern i.e. here appends a 0 in data =
011101.
–> Receiver receives the frame.
–> If data contains 011101, receiver removes the 0 and reads the data.
Examples:
If Data –> 011100011110 and ED –> 0111 then, find data after bit
stuffing.
--> 011010001101100
If Data –> 110001001 and ED –> 1000 then, find data after bit stuffing?
--> 11001010011
framing in the Data Link Layer also presents some challenges, which include: