Download - Bit Byte Stuff 06

Transcript
  • 7/29/2019 Bit Byte Stuff 06

    1/17

    Computer Networks: Bit and Byte Stuffing 1

    Bit and Byte Stuffing

  • 7/29/2019 Bit Byte Stuff 06

    2/17

    Computer Networks: Bit and Byte Stuffing 2

    Synchronous versus AsynchronousTransmissions

    There exists a hierarchy of synchronization

    tasks:

    Bit level: recognizing the start and end of each

    bit

    Character or byte level: recognizing the start

    and end of each character (or small unit of data)

    Block or message level: recognize the start andend of each large unit of data (in networks this

    is a frame).

  • 7/29/2019 Bit Byte Stuff 06

    3/17

    Computer Networks: Bit and Byte Stuffing 3

    Synchronous versus AsynchronousTransmissions [Halsall]

    A fundamental requirement of digital data communicationsis that the receiver knows the starting time and theduration of each bit.

    Asynchronous transmission :: each character (or byte) istreated independently for clock (bit) and character (byte)synchronization purposes and the receiverresynchronizes at the start of each character received.

    Synchronous transmission :: the complete frame istransmitted as a contiguous string of bits and thereceiver endeavors to keep in synchronism with theincoming bit stream for the duration of the frame.

  • 7/29/2019 Bit Byte Stuff 06

    4/17

    Computer Networks: Bit and Byte Stuffing 4

    Start

    bit

    Stop

    bit1 2 3 4 5 6 7 8

    Data bits

    Line

    idle

    3T/2 T T T T T T T

    Receiver samples the bits

    Figure 3.68

    Transmitted at random intervals (e.g., keyboard)

    Direction of transmission

    Copyright 2000 The McGraw Hill Companies Leon-Garcia & Widjaja: Communication Networks

    Synchronizationin Asynchronous Transmissions

  • 7/29/2019 Bit Byte Stuff 06

    5/17

    Computer Networks: Bit and Byte Stuffing 5

    More efficient, i.e., less overhead

    Blocks of characters transmitted without

    start and stop codes The transmitted stream is suitably encoded

    so the receiver can stay in synchby:

    Using a separate clock lineEmbedding clocking information into data (e.g.

    biphase coding).

    Synchronous Transmissions

  • 7/29/2019 Bit Byte Stuff 06

    6/17

    Computer Networks: Bit and Byte Stuffing 6

    1. Byte counts

    2. Starting/ending bytes [byte stuffing]

    3. Starting/ending flags [bit stuffing]

    4. Using physical layer coding

    violations (i.e., invalid physicalcodes)

    Frame Identification Methods

    [Tanenbaum]

  • 7/29/2019 Bit Byte Stuff 06

    7/17

    Computer Networks: Bit and Byte Stuffing 7

    Preamble

    Bit Pattern

    Postamble

    Bit Pattern

    frame

    The contents of each frame are encapsulatedbetween a

    pair of reserved characters or bytes for frame synchronization.

  • 7/29/2019 Bit Byte Stuff 06

    8/17

    Computer Networks: Bit and Byte Stuffing 8

    Header Body

    8 8 8 8 168

    CRC

    BISYNC Frame Format

    Figure 2.9

    P&D slide

  • 7/29/2019 Bit Byte Stuff 06

    9/17

    Computer Networks: Bit and Byte Stuffing 9

    ProtocolControlAddressFlag Pay load

    88 816168

    FlagChecksum

    PPP Frame Format

    Figure 2.10P&D slide

  • 7/29/2019 Bit Byte Stuff 06

    10/17

    Computer Networks: Bit and Byte Stuffing 10

    Figure 2.11

    Header Body

    8 8 4214 168

    CR CCount

    DDCMP Frame Format

    P&D slide

  • 7/29/2019 Bit Byte Stuff 06

    11/17

    Computer Networks: Bit and Byte Stuffing 11

    Figure 2.12

    Header Body

    8 16 16 8

    CRCBeginningsequence

    Endingsequence

    HDLC Frame Format

    P&D slide

  • 7/29/2019 Bit Byte Stuff 06

    12/17

    Computer Networks: Bit and Byte Stuffing 12

    Byte Stuffing[HDLC Example]

    Also referred to as character stuffing. ASCII characters are used as framing delimiters

    (e.g. DLE STX and DLE ETX)

    The problem occurs when these character patternsoccur within the transparent data.

    Solution: sender stuffs an extra DLEinto the datastream just before each occurrence of anaccidentalDLE in the data stream.

    The data link layer on the receiving end unstuffs theDLEbefore giving the data to the network layer.

  • 7/29/2019 Bit Byte Stuff 06

    13/17

    Computer Networks: Bit and Byte Stuffing 13

    DLE STX DLE ETXTransparent Data

    DLE STX DLE ETXA B DLE H W

    DLE STX DLE ETXA B DLE H WDLE

    DLE STX DLE ETXA B DLE H W

    Stuffed

    Unstuffed

    Before

    Byte Stuffing[HDLC Example]

  • 7/29/2019 Bit Byte Stuff 06

    14/17

    Computer Networks: Bit and Byte Stuffing 14

    Bit Stuffing

    Each frame begins and ends with a special bitpattern called a flag byte [01111110].{Note this is7E in hex}

    Whenever sender data link layer encountersfiveconsecutive ones in the data stream, itautomatically stuffs a 0 bit into the outgoingstream.

    When the receiver seesfive consecutive incomingones followed by a 0 bit, it automatically destuffsthe 0 bit before sending the data to the networklayer.

  • 7/29/2019 Bit Byte Stuff 06

    15/17

    Computer Networks: Bit and Byte Stuffing 15

    Input Stream

    Stuffed Stream

    Unstuffed Stream

    0110111111100111110111111111100000

    01101111101100111110011111011111000000

    0110111111100111110111111111100000

    Stuffed bits

    Bit Stuffing

  • 7/29/2019 Bit Byte Stuff 06

    16/17

    Computer Networks: Bit and Byte Stuffing 16

    Flag flagAddress Control Information CRCProtocol01111110 011111101111111 00000011

    Unnumbered

    frameSpecifies what kind of packet is contained in the

    payload, e.g., LCP, NCP, IP, OSI CLNP, IPX

    All stations are to

    accept the frame

    Figure 5.40Copyright 2000 The McGraw Hill Companies Leon-Garcia & Widjaja: Communication Networks

    PPP (Point-to-Point Protocol)Frame Format

  • 7/29/2019 Bit Byte Stuff 06

    17/17

    Computer Networks: Bit and Byte Stuffing 17

    Flag flagAddress Control Information CRCProtocol01111110 1111111 00000011 01111110

    7E7E 7E7D

    5D

    33 42

    7E7E

    7E7E

    7D

    7D 5D 33

    33

    7D 5E 42

    427E

    Input

    Stuffed Stream

    Unstuffed Stream

    Flag01111110

    Flag01111110

    PPP Byte Stuffing