Module 3→ARQ Protocols for
error control
   Dr.S.Sivakumar /Associate
    Professor/ VIT/ Chennai
                       Flow control
• Flow control is a set of procedures that tells the sender how
  much data it can transmit before it must wait for an
  acknowledgment from the receiver.
• The flow of data must not be allowed to overwhelm the
  receiver
• Any receiving device has a limited speed at which it can
  process incoming data and a limited amount of memory in
  which to store incoming data.
                   Flow control
• The receiving device must be able to inform the
  sending device before those limits are reached and to
  request that the transmitting device send fewer frames
  or stop temporarily.
• Incoming data must be checked and processed before
  they can be used. For this reason, each receiving
  device has a block of memory, called a buffer.
• If the buffer begins to fill up, the receiver must be able
  to tell the sender to halt transmission
                      Error control
• In the data link layer, the term error control refers
  primarily to methods of error detection and
  retransmission.
• Error control in the data link layer is often implemented
  simply: Any time an error is detected in an exchange,
  specified frames are retransmitted. This process is called
  automatic repeat request (ARQ).
• Error control in the data link layer is based on automatic
  repeat request, which is the retransmission of data.
 Automatic repeat request (ARQ)
• Three main types of the ARQ (for noisy
  channel in particular) are:
  – Stop-and-wait ARQ
  – Go-Back-N ARQ
  – Selective Repeat ARQ
  Note:- Go-Back-N ARQ and Selective Repeat ARQ
  are sub categories of Sliding Window ARQ
             Stop and wait ARQ
• Sender
  – Sends one data packet at a time.
  – Sends next packet only after       receiving
    acknowledgement for previous.
• Receiver
  – Sends acknowledgement after receiving and
    consuming of data packet.
       Causes for Data retransmission
i) Data lost
ii) Acknowledgement lost
iii) Delayed Acknowledgement or data
  – RTT (restart a time-out timer)
  – Timeout
  – Time To Live (TTL)
          Stop and Wait ARQ
              Sender           Receiver
                           Frame 0
Timer start       Ack 1
  Timeout                  Frame 1
Timer start        Ack 0
  Timeout                  Frame 0
                   Ack 1
          Stop and Wait ARQ (Frame lost)
                Sender           Receiver
                             Frame 0
 Timer start
                    Ack 1
    Timeout                  Frame 1
  Timer start                           Frame 1 lost
    Timeout
                             Frame 1
Resend Frame 1       Ack 0
             Stop and Wait ARQ (ACK lost)
                 Sender           Receiver
                              Frame 0
   Timer start
                     Ack 1
      Timeout                  Frame 1
   Timer start                           Discard
                          Ack 0          Frame 1
      Timeout
                               Frame 1
Ack 0 lost & so       Ack 0
Resend Frame 1
    Stop n Wait Protocol (Numbering Frames)
• We need to assign sequence nos. to data frames and
  acknowledgement nos. to the ACK frames
• Sequence nos. are 0,1,0,1,0,1,…. The sequence numbers are
  based on modulo-2 arithmetic.
• Acknowledgement nos. are 1,0,1,0,1,0,…
• That is, sequence nos. start with 0 and acknowledgement
  nos. start with 1
• An ACK no. also defines the sequence no. of next frame to
  receive
• ACK number always announces in modulo-2 arithmetic the
  sequence number of the next frame expected
Scenario 1: Stop n Wait
Scenario 2: Stop n Wait
          Scenario in Stop-and-Wait ARQ
• Figure 11.11 below shows an example of Stop-and-Wait
  ARQ.
• Frame 0 is sent and acknowledged.
• Frame 1 is lost and resent after the time-out. The resent
  frame 1 is acknowledged and the timer stops.
• Frame 0 is sent and acknowledged, but the acknowledgment
  is lost.
• The sender has no idea if the frame or the acknowledgment
  is lost, so after the time-out, it resends frame 0, which is
  acknowledged.
Flow diagram
            Problem in Stop-and-Wait ARQ
• Assume that, in a Stop-and-Wait ARQ system, the bandwidth of
   the line is 1 Mbps, and 1 bit takes 20 ms to make a round trip.
   What is the bandwidth-delay product? If the system data frames
   are 1000 bits in length, what is the utilization percentage of the
   link?
• Solution:-
The bandwidth-delay product = (1x 106 )(20 x 10-3 )=20,000 bits
The system can send 20,000 bits during the time it takes for the data
to go from the sender to the receiver and then back again. However,
the system sends only 1000 bits. We can say that the link utilization is
only 1000/20,000, or 5 percent.
• For this reason, for a link with a high bandwidth or long delay, the
   use of Stop-and-Wait ARQ wastes the capacity of the link.
           Problem in Stop-and-Wait ARQ
What is the utilization percentage of the link in above question,
if we have a protocol that can send up to 15 frames before
stopping and worrying about the acknowledgments?
The bandwidth-delay product is still 20,000 bits. The system can
send up to 15 frames or 15,000 bits during a round trip. This
means the utilization is 15,000/20,000, or 75 percent. Of
course, if there are damaged frames, the utilization percentage is
much less because frames have to be resent.
Note:-There is no pipelining in Stop-and-Wait ARQ because
we need to wait for a frame to reach the destination and be
acknowledged before the next frame can be sent
                     Go-Back-N ARQ Protocol
• Pipelining improves the efficiency of the transmission if the number
  of bits in transition is large with respect to the bandwidth-delay
  product.
• To improve the efficiency of transmission, multiple frames must be
  in transition while waiting for acknowledgment. The first is called
  Go-Back-N Automatic Repeat Request
• In this protocol, we can send several frames before receiving
  acknowledgments; sender keep a copy of these frames until the
  acknowledgments arrive.
• In the Go-Back-N Protocol, the sequence numbers are modulo 𝟐𝒎 ,
  where m is the size of the sequence number field in bits.
• The sequence numbers range from 0 to 2𝑚 - 1.
• For example, if m is 4, the only sequence numbers are 0 through
  15 inclusive. The sequence numbers are
    0, 1,2,3,4,5,6, 7,8,9, 10, 11, 12, 13, 14, 15,0, 1,2,3,4,5,6,7,8,9,10, 11, ...
→ In other words, the sequence numbers are modulo 𝟐𝒎
                      Go-Back-N Protocol
• In Go-Back-N, the ACK no. is cumulative and defines the seq. no of the
  next packet expected
• Send Window: It is an imaginary box covering the sequence nos of the
  data packets that can be in transit or can be sent.
• In each window position, some of these sequence nos define the packets
  that have been sent. Others define those that can be sent
• The max. size of the window is 2𝑚 - 1
• Let the size be fixed and set to the max. value
Note: Some protocols may have a variable window size
• Let us consider a sliding window of size 7 (m=3) for the Go-Back-N
  protocol
              Go back N ARQ (ACK lost)
Timer start   6   5   4   3    2   1     1
                                         2
                                         3
                                         4
                                   1
   Timeout                         2
              Ack lost 3, 4
                               6   5     5
                                         6   Discarded
                      6   5    4   3
                  Retransmit
     Go_back_N ARQ (Frame Received out of order)
                               Transmitter   Receiver
Timer start   6   5   4   3    2   1             1
                                                 2
                                                 3
                                                 4      Discarded
                                   1
   Timeout                         2
              Ack lost 3, 4
                               6   5             5
                                                 6      Discarded
                      6   5    4   3
                  Retransmit
                  Sliding Window of size 7 (m=3)
                 Send Window for Go-Back-N ARQ
The window itself is an abstraction; three variables define its size and location at any
time. We call these variables Sf (send window, the first outstanding frame),
Sn (send window, the next frame to be sent), and Ssize (send window, size).
The variable Sf defines the sequence number of the first (oldest) outstanding frame.
The variable Sn holds the sequence number that will be assigned to the next frame to
be sent.
Finally, the variable Ssize defines the size of the window, which is fixed in our protocol.
     Sliding Window of size 15 (m=4)
   Send Window before and after sliding
Send window is an abstract concept defining an imaginary box of size 2𝑚 - 1 with
three variables: Sf Sn and Ssize’. Frames 0, I, and 2 are acknowledged, so the
window has slide to the right three slots. Note that the value of Sf is 3 because
frame 3 is now the first outstanding frame.
          Receive window for Go-Back-N ARQ
The sequence numbers to the left of the window belong to the frames already received and
acknowledged; the sequence numbers to the right of this window define the frames that cannot be
received. The receive window also slides, but only one slot at a time.
When a correct frame is received (and a frame is received only one at a time), the window slides.
                     Send Window Size
• We can now show why the size of the send window must be less
  than 2m ?
• As an example, we choose m =2, which means the size of the
  window can be 2m - 1, or 3.
• Fig 11.15 compares a window size of 3 against a window size of 4.
• If the size of the window is 3 (less than 22) and all three
  acknowledgments are lost, the frame timer expires and all three
  frames are resent. The receiver is now expecting frame 3, not
  frame 0, so the duplicate frame is correctly discarded.
• If the size of the window is 4 (equal to 22) and all acknowledgments
  are lost, the sender will send a duplicate of frame 0. However, this
  time the window of the receiver expects to receive frame 0, so it
  accepts frame 0, not as a duplicate, but as the first frame in the
  next cycle. This is an error
                Selective Repeat ARQ
                           Frame 0
0   1   2   3   4   5
                            Frame 1    0   1   2   3   4   5
0   1   2   3   4   5
                           ACK2        0   1   2   3   4   5
0   1   2   3   4   5   Frame 2 lost
                            Frame 3
0   1   2   3   4   5
                                       0   1   2   3   4   5
                            NACK
                            Frame2
0   1   2   3   4   5
                                       0   1   2   3   4   5
               Selective-Repeat (SR) ARQ
• Selective-Repeat ARQ →Advantage in this error-control
  method is that only the frame which is in error is resent.
• SR ARQ is preferable for Noisy channel and Go-Back-N ARQ
  preferred for noiseless channel
• First, the size of the send window is much smaller; it is 2m-1
• Second, the receive window is the same size as the send
  window .
• For example, if m = 4, the sequence numbers go from 0 to
  15, but the size of the window is just 2m-1 = 8 (wheras size of
  send window is 15 in Go-Back-N Protocol since 2m - 1).
Send Window of SR ARQ
                      Receive Window of SR ARQ
• The Selective Repeat Protocol allows as many frames as the size of the receive window to arrive
    out of order and be kept until there is a set of in-order frames to be delivered to the network
    layer.
•   Because the sizes of the send window and receive window are the same, all the frames in the
    send frame can arrive out of order and be stored until they can be delivered.
•   Also note that the receiver never delivers packets out of order to the network layer
    The two well-known implementations of sliding window protocol
    are:-
1. Go back N Protocol
2. Selective Repeat Protocol
  Go back N Protocol
     Go back N protocol is an implementation of a sliding window
    protocol.
    The features and working of this protocol are explained in the
    following points-
    Point-01:
       In Go back N, sender window size is N and receiver window
                           size is always 1.
    In Go back N,
•    Sender window size = N. Example in Go back 10, sender
     window size will be 10.
•    Receiver window size is always 1 for any value of N.
    Point-02:
             Go back N uses cumulative acknowledgements.
    In Go back N,
•    Receiver maintains an acknowledgement timer.
•    Each time the receiver receives a new frame, it starts a new
     acknowledgement timer.
•    After the timer expires, receiver sends the cumulative
     acknowledgement for all the frames that are unacknowledged
     at that moment.
    NOTE
     A new acknowledgement timer does not start after the expiry
    of old acknowledgement timer. It starts after a new frame is
    received.
    Point-03:
    Go back N may use independent acknowledgements too.
•    The above point does not mean that Go back N cannot use
     independent acknowledgements.
•    Go back N may use independent acknowledgements too if
     required.
•    The kind of acknowledgement used depends on the expiry of
     acknowledgement timer.
    Example-
     Consider after the expiry of acknowledgement timer, there is
    only one frame left to be acknowledged.
•    Then, Go back N sends the independent acknowledgement
     for that frame.
    Point-04:
       Go back N does not accept the corrupted frames and silently
                            discards them.
    In Go back N,
•    If receiver receives a frame that is corrupted, then it silently
     discards that frame.
•    The correct frame is retransmitted by the sender after the time
     out timer expires.
•    Silently discarding a frame means-“Simply rejecting the frame
     and not taking any action” (like not sending a NACK to the
     sender to send the correct frame)
    Point-05:
       Go back N does not accept out of order frames and silently
                           discards them.
    In Go back N,
•    If receiver receives a frame whose sequence number is not
     what the receiver expects, then it silently discards that frame.
•    All the following frames are also discarded.
•    This is because receiver window size is 1 and therefore
     receiver cannot accept out of order frames.
    Point-06:
      Go back N leads to retransmission of entire window if for any
              frame, no ACK is received by the sender.
    In Go back N,
•  Receiver silently discards the frame if it founds the frame to
   be either corrupted or out of order.
• It does not send any acknowledgement for such frame.
• It silently discards the following frames too.
  Thus, if for any particular frame, sender does not receive any
 acknowledgement, then it understands that along with that
 frame, all the following frames must also have been discarded
 by the receiver.
•    So, sender has to retransmit all the following frames too along
     with that particular frame.
•    Thus, it leads to the retransmission of entire window.
•    That is why, the protocol has been named as “Go back N“.
    Point-07:
      Go back N leads to retransmission of lost frames after expiry of time out
                                      timer.
    In Go back N,
•    Consider a frame being sent to the receiver is lost on the way.
•    Then, it is retransmitted only after time out timer expires for that frame at sender’s
     side.
    Efficiency of Go back N Efficiency of any flow control protocol is given
         Efficiency = Sender Window Size (N) in Protocol / (1 + 2a)
    Problem-01:
    Using stop and wait protocol, the sender wants to transmit
    10 data packets to the receiver. Out of these 10 data packets,
    every 4th data packet is lost. How many packets will the
    sender have to send in total?
    Solution
    1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10
    • The lost packets are- 4, 7 and 10.
    • Thus, sender will have to send 13 data packets in total.
    Problem-02:
    Station A needs to send a message consisting of 9
    packets to station B using a sliding window (window size
    3) and Go Back N error control strategy. All packets are
    ready and immediately available for transmission.
    If every 5th packet that A transmits gets lost (but no ACKs
    from B ever get lost), then what is the number of packets
    that A will transmit for sending the message to B ?
    Solution:
•    Total number of packets to be sent = 9
•    Go back N is used where N = 3
•    Every 5th packet gets lost
    Total 16 packet Transmissions.
    Go back N strategy: Remember these 2 points below
    and try the solution:-
    1. The window should slide ahead as we go on receiving
    ack and we will miss ack only for frame which is lost i.e
    frame 5 according to question
    2. We should go back and send frame starting from
    frame no which was lost till the end of current window
    size.
    Suppose if frame 5th was lost we should resent 5 6 7
    because currently these 3 frames are in window.
    Step-by-step analysis
    Step-01: Since sender window size is 3, so sender sends 3 packets
    (1, 2, 3)
                     Total packets sent till now from sender side = 3
     Step-02: After receiving the acknowledgement for packet-1, sender
    slides its window and sends packet-4.
                     Total packets sent till now from sender side = 4
     Step-03: After receiving the acknowledgement for packet-2, sender
    slides its window and sends packet-5.
                       Total packets sent till now from sender = 5
     Step-04: After receiving the acknowledgement for packet-3, sender
    slides its window and sends packet-6.
                       Total packets sent till now from sender = 6
     Step-05: After receiving the acknowledgement for packet-4, sender
    slides its window and sends packet-7.
                     Total packets sent till now from sender side = 7
    Step-06:
    According to question, every 5th packet gets lost.
•    So, packet-5 gets lost and when time out occurs, sender retransmits
     packet-5.
•    In Go back N, all the following packets are also discarded by the
     receiver.
•    So, packet-6 and packet-7 are discarded by the receiver and they
     are also retransmitted.
•    Thus, the entire window (5, 6, and 7) is retransmitted.
     So, we have                     Total packets sent till now from
    sender side = 10
     Now, the next 5th packet that will be lost will be packet-7. (6, 7, 5, 6,
    7)
     Step-07: After receiving the acknowledgement for packet-5, sender
    slides its window and sends packet-8.
                     Total packets sent till now from sender side = 11
     Step-08: After receiving the acknowledgement for packet-6, sender
    slides its window and sends packet-9.
                    Total packets sent till now from sender side = 12
    Step-09: According to question, every 5th packet gets lost.
•    So, packet-7 gets lost and when time out occurs, sender
     retransmits packet-7 and the following packets namely packets 8
     & 9.
•    Thus, the entire window (7, 8 and 9) is retransmitted.
     So, we have                    Total packets sent till now from sender
    side = 15
     Now, the next 5th packet that will be lost will be packet-9. (8, 9, 7, 8,
    9)
     Step-10: After receiving the acknowledgement for packet-7, sender
    slides its window.
                     Total packets sent till now from sender side = 15
    Step-11: After receiving the acknowledgement for packet-8, sender
    slides its window.
                     Total packets sent till now from sender side = 15
    Step-12:
     According to question, every 5th packet gets lost. So, packet-9 gets
    lost and When time out occurs, sender retransmits packet-9.
    So, we have
                     Total packets sent till now from sender side = 16
    Finally, all the 9 packets got transmitted which took total 16 number of
    transmissions.
    Problem-03:
    In Go back 4, if every 6th packet that is being transmitted is lost
    and if total number of packets to be sent is 10, then how many
    transmissions will be required?
    Solution
•    Solve in the same way as we have solved Problem-02.
•    Total number of transmissions required will be 17.
    SELECTIVE REPEAT (SR) ARQ
    Problem-04
    Answer is: 3405126
    Problem-0 5:
     A 1 Mbps satellite link connects two ground stations. The
    altitude of the satellite is 36,504 km and speed of the signal is 3
    x 108 m/sec. What should be the packet size for a channel
    utilization of 25% for a satellite link using go-back-127 sliding
    window protocol?
    Solution
    Given
•    Bandwidth = 1 Mbps
•    Distance = 2 x 36504 km = 73008 km
•    Propagation speed = 3 x 108 m/sec
•    Efficiency = 25% = 1/4
•    Go back N is used where N = 127
    Let the packet size be L bits.
    Calculating Transmission Delay(Tt)
    Transmission delay (Tt)
    = Packet size / Bandwidth
    = L bits / 1 Mbps
    = L μsec
    Calculating Propagation Delay(Tp)
    Propagation delay (Tp)
    = Distance / Speed
    = (73008 x 103 m) / (3 x 108 m/sec)
    = 24336 x 10-5 sec
    = 2,43,360 μsec
    Calculating Value of ‘a’
    a= Propagation Delay / Transmission Delay
    a = Tp / Tt
    a = 243360 μsec / L μsec
    a = 243360 / L
    Calculating Packet Size
    Efficiency (η) = N / (1+2a)
    Substituting the values, we get-
    1/4 = 127 / (1 + 2 x 243360 / L)
1/4 = 127 x L / (L + 486720)
L + 486720 = 508 x L
507 x L = 486720
L = 960 bits = 960/8 bytes
That is the packet size = 960 bits or 120 bytes.
Module 3 Framing: Byte Stuffing
        & Bit Stuffing
       Dr.S.Sivakumar
   Associate Professor Senior
    SENSE - VIT Chennai
                        FRAMING
• Data transmission in the physical layer means moving bits in the
  form of a signal from the source to the destination
• The physical layer provides bit synchronization to ensure that the
  sender and receiver use the same bit durations and timing
• The data link layer, on the other hand, needs to pack bits into
  frames, so that each frame is distinguishable from another. Our
  postal system practices a type of framing.
• The simple act of inserting a letter into an envelope separates one
  piece of information from another; the envelope serves as the
  delimiter.
• Also each envelope defines the sender and receiver addresses
  since the postal system is a many-to-many carrier facility
                      FRAMING
• Framing in the data link layer separates a message from one
  source to a destination, or from other messages to other
  destinations, by adding a sender address and a destination
  address.
• The destination address defines where the frame is to go; the
  sender address helps the recipient acknowledge the receipt.
• When a message is carried in one very large frame, even a
  single-bit error would require the retransmission of the whole
  message
• When a message is divided into smaller frames, a single-bit
  error affects only that small frame.
 Fixed-Size and Variable-Size Framing
Frames can be of fixed size or variable size.
• In fixed-size framing, there is no need for defining the
   boundaries of the frames; the size itself can be used as a
   delimiter. An example of this type of framing is the ATM WAN,
   which uses frames of fixed size called cells
• Variable-Size Framing is prevalent in LANs. In variable-size
   framing, we need a way to define the end of the frame and
   the beginning of the next.
• Historically, two approaches were used for this purpose: a
   character-oriented approach and a bit-oriented approach.
     Character-Oriented Protocols
• In a character-oriented protocol, data to be carried are 8-bit
  characters from a coding system such as ASCII
• The header, which normally carries the source and destination
  addresses and other control information, and the trailer, which
  carries error detection or error correction redundant bits, are also
  multiples of 8 bits.
• To separate one frame from the next, an 8-bit (I-byte) flag is added
  at the beginning and the end of a frame. The flag, composed of
  protocol-dependent special characters, signals the start or end of a
  frame.
• Character-oriented framing was popular when only text was
  exchanged by the data link layers. The flag could be selected to be
  any character not used for text communication.
     Character-Oriented Protocols
• we send other types of information such as graphs, audio, and
  video. Any pattern used for the flag could also be part of the
  information. If this happens, the receiver, when it encounters this
  pattern in the middle of the data, thinks it has reached the end of
  the frame.
• To fix this problem, a byte-stuffing strategy was added to
  character-oriented framing. In byte stuffing (or character stuffing),
  a special byte is added to the data section of the frame when there
  is a character with the same pattern as the flag. The data section is
  stuffed with an extra byte
• This byte is usually called the escape character (ESC), which has a
  predefined bit pattern. Whenever the receiver encounters the ESC
  character, it removes it from the data section and treats the next
  character as data, not a delimiting flag
                    Byte stuffing
• Byte stuffing by the escape character allows the presence of
  the flag in the data section of the frame, but it creates
  another problem.
• What happens if the text contains one or more escape
  characters followed by a flag? The receiver removes the
  escape character, but keeps the flag, which is incorrectly
  interpreted as the end of the frame.
• To solve this problem, the escape characters that are part of
  the text must also be marked by another escape character.
  In other words, if the escape character is part of the text, an
  extra one is added to show that the second one is part of the
  text.
                                  FF
Process of wrapping data with certain info before
sending out
A frame typically consists of
▪ Flag: indication for start and end of a frame
▪ Header: source/destination addresses, as well as other control
  information
▪ Data from the upper layer
▪ Trailer: error detection/correction code
       CHARACTER / BYTE ORIENTED FRAMING
Flag – Special character that not used for text communication
•   When we send other information like graph, audio or video
    – special character can also be the part of the information
      ▪ Byte stuffing strategy
                          BYTE STUFFING
Process of adding an extra byte whenever there is an escape or a flag character
in the data
              Bit-Oriented Protocols
                     Problem with byte oriented framing
  Conflict with 16-bit & 32-bit coding have conflict with 8-bit characters
• In a bit-oriented protocol, the data section of a frame is a sequence of bits
  to be interpreted by the upper layer as text, graphic, audio, video, and so
  on.
• However, in addition to headers (and possible trailers), we still need a
  delimiter to separate one frame from the other.
• Most protocols use a special 8-bit pattern flag 01111110 as the delimiter
  to define the beginning and the end of the frame
                  BIT ORIENTED FRAMING
If a 0 and five consecutive 1s are encountered, an extra bit 0 will
    be added regardless of the value of the next bit. This flag can
    create the same type of problem we saw in the byte-oriented
    protocols.
That is, if the flag pattern appears in the data, we need to somehow inform
   the receiver that this is not the end of the frame. We do this by stuffing
   1 single bit (instead of I byte) to prevent the pattern from looking like a
   flag. The strategy is called bit stuffing
                      Bit stuffing
• In bit stuffing, if a 0 and five consecutive I bits are
  encountered, an extra 0 is added. This extra stuffed bit is
  eventually removed from the data by the receiver.
• Note that the extra bit is added after one 0 followed by five 1s
  regardless of the value of the next bit.
• This guarantees that the flag field sequence does not
  inadvertently appear in the frame.
• Bit stuffing is the process of adding one extra 0 whenever
  five consecutive 1s follow a 0 in the data, so that the
  receiver does not mistake the pattern 0111110 for a flag
• Note that even if we have a 0 after five 1s, we still stuff a O.
  The 0 will be removed by the receiver
           BIT STUFFING
01111110
      Module 3
HDLC Protocol and PPP
                   HDLC
• High-level Data Link Control (HDLC) is a bit-
  oriented protocol for communication over
  point-to-point and multipoint links.
  – Normal Response Mode (NRM)
  – Asynchronous Balanced Mode (ABM)
• Normal Response Mode
     • A primary station can send commands; a
        secondary station can only respond.
• Asynchronous Balanced Mode
       The link is point-to-point, and each station can function as
  a primary and a secondary.
HDLC defines three types of frames:
                      HDLC FRAMES
               Information frames (I-frames)
Flag Address Control            User        FCS Flag
                                Information
Supervisory frames (S-frames)
Flag Address Control         FCS Flag
Unnumbered frames (U-frames)
Flag Address       Control       Management FCS Flag
                                 Information
•   Flag field
     – It is an 8-bit sequence with the bit pattern 01111110 that identifies both the
        beginning and the end of a frame and serves as a synchronization pattern for
        the receiver.
•   Address field
     – The second field of an HDLC frame contains the address of the secondary
        station. If a primary station created the frame, it contains a to address. If a
        secondary creates the frame, it contains a from address.
•   Control field
     – The control field is a 1- or 2-byte segment of the frame used for flow and error
        control.
•   Information field
     – The information field contains the user's data from the network layer or
        management information
•   FCS field
     – The frame check sequence (FCS) is the HDLC error detection field. It is
        usually a 2 byte or 4 byte standard CRC
        Control Field for I-Frames
• I-frames are designed to carry user data from the network
  layer.
• In addition, they can include flow & error control information
  (piggybacking)
        Control Field for I-Frames
• I-frames are designed to carry user data from the network
  layer.
• The first bit defines the type. If the first bit of the control
  field is 0, this means the frame is an I-frame.
• The next 3 bits, called N(S), define the sequence number
  of the frame.
• The last 3 bits, called N(R), correspond to the
  acknowledgment number when piggybacking is used.
• The P/F field is a single bit with a dual purpose.
• when it is set (bit = 1) and can mean poll or final. It means
  poll when the frame is sent by a primary station to a
  secondary. It means final when the frame is sent by a
  secondary to a primary.
       Control Field for S-Frames
• S-frames do not have information fields. If the first 2
bits of the control field is 10, this means the frame is an S-
frame. The last 3 bits, called N(R), corresponds to the
acknowledgment number (ACK)
• ACK or negative acknowledgment number (NAK)
depending on the type of S-frame.
• The 2 bits called code is used to define the type of
S-frame itself.
➢ Receive ready (RR)→The value of the code subfield is 00,
• This kind of frame acknowledges the receipt of a safe and sound
  frame or group of frames. In this case, the value N(R) field defines the
  acknowledgment number.
➢ Receive not ready (RNR)→ the value of the code subfield is 10.
• It acknowledges the receipt of a frame or group of frames, and it
  announces that the receiver is busy and cannot receive more frames. It
  acts as a kind of congestion control mechanism by asking the sender
  to slow down.
➢ Reject (REJ) →If the value of the code subfield is 01, it is a REJ
  S-frame. This is a NAK frame, but not like the one used for Selective
  Repeat ARQ.
➢ Selective reject (SREJ) →If the value of the code subfield is 11, it is
  an SREJ S-frame.
• This is a NAK frame used in Selective Repeat ARQ.
• The HDLC Protocol uses the term selective reject instead of
  selective repeat
         Control Field for U-Frames
➢ Unnumbered frames are used to exchange session management
  and control information between connected devices.
➢ U-frames contain an information field, but one used for system
  management information, not user data.
➢ U-frame codes are divided into two sections: a 2-bit prefix
  before the P/F bit and a 3-bit suffix after the P/F bit.
➢ Together these 2 segments (5 bits) can be used to create up to
  32 different types of U-frames
      Point to Point Protocol (PPP)
• Today, millions of internet users who need to connect their
  home computers to the server of an ISP use PPP
• Point - to - Point Protocol (PPP) is a communication protocol
  of the data link layer that is used to transmit multiprotocol
  data between two directly connected (point-to-point)
  computers.
• It is a byte - oriented protocol that is widely used in
  broadband communications having heavy loads and high
  speeds.
               Components of PPP
• Point - to - Point Protocol is a layered protocol having three sets of
  protocols (LCP, AP & NCP) defined to make PPP powerful
• Encapsulation Component − It encapsulates the datagram so that it
  can be transmitted over the specified physical layer.
• Link Control Protocol (LCP) − It is responsible for establishing,
  configuring, testing, maintaining and terminating links for
  transmission. It also imparts negotiation for set up of options and
  use of features by the two endpoints of the links.
• Authentication Protocols (APs) − These protocols authenticate
  endpoints for use of services.
• Network Control Protocols (NCPs) − These protocols are used for
  negotiating the parameters and facilities for the network layer.
                       PPP Frame
• PPP is a character-oriented or byte - oriented protocol
  where each field of the frame is composed of one or more
  bytes.
Flag Address Control Protocol Payload FCS Flag
• In the above PPP frame format, the Flag, Address, Control are
  1 byte fields, Protocol is 1-2 bytes, Payload is variable field &
  FCS is 2-4 bytes
• Note: The Flag in PPP is a byte that needs to be escaped
  whenever it appears in the data section of the frame.
• The escape byte is 01111101, which means that whenever flag
  like pattern appears in data, this extra byte is stuffed (byte
  stuffing done) to tell the receiver that next byte is not a flag
• The fields of a PPP frame are −
• Flag − 1 byte that marks the beginning and the end of the
  frame. The bit pattern of the flag is 01111110.
• Address − 1 byte which is set to 11111111 in case of
  broadcast.
• Control − 1 byte set to a constant value of 11000000.
• Protocol − 1 or 2 bytes that define the type of data
  contained in the payload field.
• Payload − This carries the data from the network layer. The
  maximum length of the payload field is 1500 bytes.
  However, this may be negotiated between the endpoints of
  communication.
• FCS − It is a 2 byte or 4 bytes frame check sequence for
  error detection. The standard code used is CRC (cyclic
  redundancy code)
       Services not provided by PPP
• PPP does not provide flow control
• A sender can send several frames one after another with no
  concern about overwhelming the receiver
• PPP uses a simple mechanism for error control. A CRC field is
  used to detect errors
• If a frame is corrupted it is silently discarded
• Lack of error control & sequence numbering may cause a
  packet to be received out of order
• PPP does not provide sophisticated address mechanism to
  handle frames in a multi-point configuration
   Muticast and Broadcast protocol
• Data is transported over a network by three simple methods.
   – Unicast
       • from one source to one destination i.e. One-to-One
   – Broadcast
       • from one source to all possible destinations i.e. One-to-
         All
   – Multicast
       • from one source to multiple destinations (group of
         members) stating an interest in receiving the traffic i.e.
         One-to-Many