p2p protocol (2)

Upload: madhana3

Post on 05-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 p2p Protocol (2)

    1/69

    Peer-to-Peer Protocols

    Peer-to-Peer Protocols and Service ModelsFlow ControlARQ Protocols

    Data Link Control

    UNIT-II

  • 8/2/2019 p2p Protocol (2)

    2/69

    Peer-to-Peer protocols: many protocolsinvolve the interaction between two peers Service Models

    Detailed discussion of ARQ provides example ofdevelopment of peer-to-peer protocols

    Data Link Control Framing

    PPP

    HDLC

  • 8/2/2019 p2p Protocol (2)

    3/69

    n 1 peer process n 1 peer process

    n peer process n peer process

    n + 1 peer process n + 1 peer process

    Peer-to-Peer Protocols

    Peer-to-Peer processesexecute layer-n protocolto provide service tolayer-(n+1)

    Layer-(n+1) peer callslayer-n and passesService Data Units(SDUs) for transfer

    Layer-n peers exchangeProtocol Data Units(PDUs) to effect transfer

    Layer-n delivers SDUs todestination layer-(n+1)

    peer

    SDU SDU

    PDU

  • 8/2/2019 p2p Protocol (2)

    4/69

    Service Models

    Theservice model specifies the information transferservice layer-n provides to layer-(n+1)

    The most important distinction is whether the serviceis:

    Connection-oriented Connectionless

    Service model possible features: Arbitrary message size or structure

    Sequencing and Reliability

    Timing and Flow control

    Multiplexing

    Privacy, integrity, and authentication

  • 8/2/2019 p2p Protocol (2)

    5/69

    Message Size and Structure

    What message size and structure will a service

    model accept?

    Different services impose restrictions on size &

    structure of data it will transfer

    Single bit? Block of bytes? Byte stream?

    Ex: Transfer of voice mail = 1 long message

    Ex: Transfer of voice call = byte stream1 voice mail= 1 message = entire sequence of speech samples

    (a)

    1 call = sequence of 1-byte messages

    (b)

  • 8/2/2019 p2p Protocol (2)

    6/69

    1 long message

    2 or more blocks

    2 or more short messages

    1 block

    Segmentation & Blocking

    To accommodate arbitrary message size, a layer mayhave to deal with messages that are too long or too shortfor its protocol

    Segmentation & Reassembly: a layer breaks long

    messages into smaller blocks and reassembles these atthe destination

    Blocking & Unblocking: a layer combines smallmessages into bigger blocks prior to transfer

  • 8/2/2019 p2p Protocol (2)

    7/69

    Reliability & Sequencing

    Reliability: Are messages or information

    stream delivered error-free and without loss or

    duplication?

    Sequencing: Are messages or information

    stream delivered in order?

    ARQ protocols combine error detection,

    retransmission, and sequence numbering to

    provide reliability & sequencing

    Examples: TCP and HDLC

  • 8/2/2019 p2p Protocol (2)

    8/69

    Flow Control

    Messages can be lost if receiving system does nothave sufficient buffering to store arriving messages

    If destination layer-(n+1) does not retrieve its

    information fast enough, destination layer-n buffersmay overflow

    Flow Control provide backpressure mechanisms thatcontrol transfer according to availability of buffers at

    the destination Examples: TCP and HDLC

  • 8/2/2019 p2p Protocol (2)

    9/69

    Timing

    Applications involving voice and video generate units

    of information that are related temporally

    Destination application must reconstruct temporal

    relation in voice/video units Network transfer introduces delay & jitter

    Timing Recovery protocols use timestamps &

    sequence numbering to control the delay & jitter indelivered information

    Examples: RTP & associated protocols in Voice over

    IP

  • 8/2/2019 p2p Protocol (2)

    10/69

    Multiplexing

    Multiplexing enables multiple layer-(n+1)

    users to share a layer-n service

    A multiplexing tag is required to identify

    specific users at the destination

    Examples: UDP, IP

  • 8/2/2019 p2p Protocol (2)

    11/69

    Privacy, Integrity & Authentication

    Privacy: ensuring that information transferred cannot

    be read by others

    Integrity: ensuring that information is not altered

    during transfer Authentication: verifying that sender and/or receiver

    are who they claim to be

    Security protocols provide these services Examples:IPSec, SSL

  • 8/2/2019 p2p Protocol (2)

    12/69

    End-to-End vs. Hop-by-Hop

    A service feature can be provided by implementing a protocol

    end-to-end across the network

    across every hop in the network

    Example: Perform error control at every hop in the network or only

    between the source and destination?

    Perform flow control between every hop in the network or

    only between source & destination? We next consider the tradeoffs between the two

    approaches

  • 8/2/2019 p2p Protocol (2)

    13/69

    End-to-End Approach Preferred

    1 2 5

    Data

    ACK/NAK

    End-to-end

    More scalable if

    complexity at

    the edge

    Simple

    inside the

    network

    Hop-by-hop

    cannot ensure E2E

    correctness

    1 2 5

    Data

    ACK/

    NAK

    Hop-by-hop

    3

    Data

    ACK/

    NAK

    4

    Data

    ACK/

    NAK

    Data

    ACK/

    NAK

    3

    Data

    4

    Data Data

    Faster recovery

  • 8/2/2019 p2p Protocol (2)

    14/69

    Flow Control: Initial Assumptions

    Simplex Channel

    Infinite buffer capacity with the receiver

    Error free transmission Network layer at the senders end is always

    ready with data

    10/06/11 14Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    15/69

    10/06/11 15Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    16/69

    Stop and Wait

    10/06/11 16Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    17/69

    Sliding Window

    10/06/11 17Computer Networks and Protocols

    Sliding Window Protocols are a feature of packet-based datatransmission protocols. They are used where reliable in-order delivery

    of packets is required, such as in the data link layer (OSI model) as well

    as in TCP (transport layer of the OSI model).

    Conceptually, each portion of the transmission (packets in most data

    link layers, but bytes in TCP) is assigned a unique consecutivesequence number, and the receiver uses the numbers to place received

    packets in the correct order, discarding duplicate packets and

    identifying missing ones. The problem with this is that there is no limit

    of the size of the sequence numbers that can be required.

  • 8/2/2019 p2p Protocol (2)

    18/69

    Sender Sliding Window

    10/06/11 18Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    19/69

    Receiver Sliding Window

    10/06/11 19Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    20/69

    Sliding Window Example

    10/06/11 20Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    21/69

    Sender

  • 8/2/2019 p2p Protocol (2)

    22/69

    Receiver

    10/06/11 22Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    23/69

    Automatic Repeat Request (ARQ)

    Purpose: to ensure a sequence of information packetsis delivered in order and without errors or duplicationsdespite transmission errors & losses

    We will look at:

    Stop-and-Wait ARQ Go-Back N ARQ

    Selective Repeat ARQ

    Basic elements of ARQ:

    Error-detecting code with high error coverage ACKs (positive acknowledgments)

    NAKs (negative acknowlegments)

    Timeout mechanism

    10/06/11 23Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    24/69

    10/06/11 24Computer Networks and Protocols

    ERROR CONTROL

  • 8/2/2019 p2p Protocol (2)

    25/69

    Stop-and-Wait ARQ

    Transmitter

    Ready state Await request from higher layer for

    packet transfer

    When request arrives, transmit framewith updated S and CRC

    Go to Wait StateWait state Wait for ACK or timer to expire; block

    requests from higher layer

    If timeout expires retransmit frame and reset timer

    If ACK received: If sequence number is incorrect or iferrors detected: ignore ACK

    If sequence number is EQUAL acceptframe, go to Ready state

    Receiver

    Always in Ready State Wait for arrival of new frame When frame arrives, check for errors If no errors detected and sequence

    number is correct (S=R), then

    accept frame, update Rnext,

    send ACK frame with Rnext,

    deliver packet to higher layer

    If no errors detected and wrongsequence number

    discard frame

    send ACK frame with Rnext

    If errors detected discard frame

    10/06/11 25Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    26/69

    Applications of Stop-and-Wait ARQ

    IBM Binary Synchronous Communications

    protocol (Bisync): character-oriented data link

    control

    Xmodem: modem file transfer protocol

    Trivial File Transfer Protocol (RFC 1350):

    simple protocol for file transfer over UDP

    10/06/11 26Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    27/69

    CRCInformation

    packet

    Header

    Information frame Control frame: ACKs

    CRCHeader

    PacketError-free

    packet

    Information frame

    Control frame

    Transmitter

    (Process A)

    Receiver

    (Process B)

    Stop-and-Wait ARQ

    Timer set after each

    frame transmission

    Transmit a frame, wait for ACK

    10/06/11 27Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    28/69

    Damaged Frame

    10/06/11 28Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    29/69

  • 8/2/2019 p2p Protocol (2)

    30/69

    Stop-and-Wait ARQ, lost ACK frame

    10/06/11 30Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    31/69

    Go-Back-N

    Improve Stop-and-Wait by not waiting!

    Keep channel busy by continuing to send frames

    Allow a window of up to Ws outstanding frames

    Use m-bit sequence numbering

    If ACK for oldest frame arrives before window is

    exhausted, we can continue transmitting

    If window is exhausted, pull back and retransmit alloutstanding frames

    Alternative: Use timeout

    10/06/11 31Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    32/69

    Go-Back-N ARQ

    Frame transmission arepipelinedto keep the channel busy Frame with errors and subsequent out-of-sequence frames are ignored Transmitter is forced to go back when window of 4 is exhausted

    A

    B

    fr

    0Timefr

    1

    fr

    2fr

    3

    fr

    4

    fr

    5fr

    6

    fr

    3

    A

    C

    K

    1

    out of sequence

    frames

    Go-Back-4: 4 frames are outstanding; so go back 4

    fr

    5fr

    6

    fr

    4fr

    7

    fr

    8

    fr

    9

    A

    C

    K

    2

    A

    C

    K

    3

    A

    C

    K

    4

    A

    C

    K

    5

    A

    C

    K

    6

    A

    C

    K

    7

    A

    C

    K

    8

    A

    C

    K

    9

    Rnext 0 1 2 3 3 4 5 6 7 8 9

    10/06/11 32Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    33/69

    Damaged Frame

    10/06/11 33Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    34/69

    Lost Frame

    10/06/11 34Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    35/69

    Lost ACK

    10/06/11 35Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    36/69

    Applications of Go-Back-N ARQ

    HDLC(High-Level Data Link Control): bit-

    oriented data link control

    V.42 modem: error control over telephone

    modem links

    10/06/11 36Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    37/69

    Selective Repeat ARQ

    Go-Back-N ARQ inefficient because multiple frames areresent when errors or losses occur

    Selective Repeat retransmits only an individual frame

    Timeout causes individual corresponding frame to be resent

    NAK causes retransmission of oldest un-acked frame

    Receiver maintains a receive window of sequence numbers

    that can be accepted

    Error-free, but out-of-sequence frames with sequence numbers

    within the receive window are buffered

    Arrival of frame with R causes window to slide forward by 1 or

    more

    10/06/11 37Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    38/69

    Selective Reject

    10/06/11 38Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    39/69

    Applications of Selective Repeat ARQ

    TCP (Transmission Control Protocol):

    transport layer protocol uses variation of

    selective repeat to provide reliable stream

    service

    Service Specific Connection Oriented

    Protocol: error control for signaling messages

    in ATM networks

    10/06/11 39Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    40/69

  • 8/2/2019 p2p Protocol (2)

    41/69

    Point-to-Point

    ProtocolPPP

    10/06/11 41Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    42/69

    PPP provides router-to-router and host-to-

    network connections over synchronous andasynchronous circuits, which can be either

    dialup or leased lines.

    PPP is the protocol of choice when

    configuring serial links in a multivendor

    environment.

    10/06/11 42Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    43/69

    PPP actually uses HDLC as a basis for

    encapsulating datagrams.

    PPP's frame format is based on the HDLC

    frame format.

    PPP defines the Link Control Protocol(LCP). The job of LCP is to establish,

    configure, and testthe data-link connection.

    10/06/11 43Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    44/69

    Point-to-Point Link

    10/06/11 44Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    45/69

    Transition States

    10/06/11 45Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    46/69

    PPP Layers

    10/06/11 46Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    47/69

    PPP Frames

    10/06/11 47Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    48/69

    LCP Packet Encapsulated in a Frame

    10/06/11 48Computer Networks and Protocols

    PAP

  • 8/2/2019 p2p Protocol (2)

    49/69

    PAP

    10/06/11 49Computer Networks and Protocols

    Password Authentication Protocol-

    provides a simple method for the peer to establish its

    identity using a 2-way handshake. This is done only upon

    initial link establishment.After the Link Establishment phase is complete, an

    Id/Password pair is repeatedly sent by the peer to the

    authenticator until authentication is acknowledged or the

    connection is terminated

  • 8/2/2019 p2p Protocol (2)

    50/69

    PAP Packets

    10/06/11 50Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    51/69

    IPCP Packet Encapsulated in PPP Frame

    10/06/11 51Computer Networks and Protocols

    Internet Protocol Control Protocol

    - Is responsible for configuring, enabling, and disablingthe IP protocol modules on both ends of the point-to-point

    link.

  • 8/2/2019 p2p Protocol (2)

    52/69

    HDLC

    High Level Data Link Control

    Early Link Layer Protocol.

    Used in many LAN and WAN Protocols.

    Support Broad range of Application.

    10/06/11 52Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    53/69

    HDLC Basis

    Why do we use it ?

    Framing

    Frame Protection

    Error Recovery

    Three types of StationsPrimary Station.

    Secondary Station.

    Combined Station.

    Three Modes

    Normal Response Mode[NRM]Asynchronous Response Mode[ARM]

    Asynchronous Balance Mode[ABM]

    10/06/11 53Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    54/69

    HDLC Configuration

    10/06/11 54Computer Networks and Protocols

    C C fi i

  • 8/2/2019 p2p Protocol (2)

    55/69

    HDLC Configuration

    10/06/11 55Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    56/69

    HDLC Configuration

    10/06/11 56Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    57/69

    HDLC Modes

    10/06/11 57Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    58/69

    HDLC Frame Types

    10/06/11 58Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    59/69

    HDLC Frame Types

    10/06/11 59Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    60/69

    HDLC Frame Types

    10/06/11 60Computer Networks and Protocols

  • 8/2/2019 p2p Protocol (2)

    61/69

    HDLC Flag Field

    10/06/11 61Computer Networks and Protocols

    Bit St ffi g

  • 8/2/2019 p2p Protocol (2)

    62/69

    Bit Stuffing

    10/06/11 62Computer Networks and Protocols

    HDLC Address Field

  • 8/2/2019 p2p Protocol (2)

    63/69

    HDLC Address Field

    10/06/11 63Computer Networks and Protocols

    HDLC C l Fi ld

  • 8/2/2019 p2p Protocol (2)

    64/69

    HDLC Control Field

    10/06/11 64Computer Networks and Protocols

    P ll/Fi l

  • 8/2/2019 p2p Protocol (2)

    65/69

    Poll/Final

    10/06/11 65Computer Networks and Protocols

    HDLC I f i Fi ld

  • 8/2/2019 p2p Protocol (2)

    66/69

    HDLC Information Field

    10/06/11 66Computer Networks and Protocols

    HDLC FCS Fi ld

  • 8/2/2019 p2p Protocol (2)

    67/69

    HDLC FCS Field

    10/06/11 67Computer Networks and Protocols

    Peer-to-Peer Example

  • 8/2/2019 p2p Protocol (2)

    68/69

    p

    10/06/11 68Computer Networks and Protocols

    Peer-to-Peer Example

  • 8/2/2019 p2p Protocol (2)

    69/69

    p