COMPUTER NETWORK AND SECURITY

Framing:

Framing in the Data Link Layer involves the encapsulation of network layer packets into frames. Frames are the basic units of data at the Data Link Layer, and they serve several important purposes in data communication. The framing process is crucial for the transmission of data over a physical medium, such as a cable or wireless channel. 

Frame Structure:

A frame typically consists of several fields, each serving a specific purpose. Common fields in a frame include:

Preamble: A sequence of bits that helps synchronize the receiver's clock with the incoming bitstream.

Start Frame Delimiter (SFD): Marks the beginning of the frame and helps the receiver identify the start of the frame.

Addressing Information: Contains the source and destination MAC (Media Access Control) addresses, allowing devices on the same network to recognize the intended recipients.

Frame Control: Includes control information, such as frame type, sequence number, and error-checking information.

Payload: Carries the actual data from the higher-layer protocols (e.g., IP packets).

Frame Check Sequence (FCS): Contains error-checking information (e.g., CRC) to detect transmission errors.

Framing Techniques:

Framing techniques in the context of networking refer to the methods used to encapsulate data into frames at the Data Link Layer. The framing process is essential for transmitting data over a physical medium, such as cables or wireless channels. 

Character Count:

  • In this simple framing technique, the frame contains a field indicating the number of characters (bytes) in the frame. The receiver uses this count to identify the boundaries of the frame.
  •  
  • Start-Stop Delimiters:
    • Start-stop delimiters involve using special bit sequences to mark the beginning and end of a frame. The start delimiter indicates the start of the frame, and the stop delimiter signifies the end. One example is the HDLC (High-Level Data Link Control) protocol.
  •  
  • Byte Stuffing:
    • Byte stuffing is a technique used to prevent the flag byte from being interpreted as the end of the frame within the data. When the sender encounters a predefined pattern (e.g., 01111110), it inserts an extra byte to differentiate it from the flag. The receiver removes the extra byte during frame processing.
  •  
  • Bit Stuffing:
    • Bit stuffing is similar to byte stuffing but operates at the bit level. It involves inserting extra bits into the data stream to avoid long sequences of identical bits that might be confused with flag sequences. The receiver removes the stuffed bits during frame processing.