0% found this document useful (0 votes)
27 views

Computer Networks UNIT-2 Data Link Layer

The document provides an overview of the Data Link Layer, detailing its design issues, functions, and protocols such as framing, flow control, and error detection. It explains the structure of frames, types of framing techniques, and various elementary data link protocols, including simplex and sliding window protocols. Additionally, it discusses error control mechanisms and redundancy techniques for error detection, including parity checks, checksums, and cyclic redundancy checks.

Uploaded by

parvezsharief38
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Computer Networks UNIT-2 Data Link Layer

The document provides an overview of the Data Link Layer, detailing its design issues, functions, and protocols such as framing, flow control, and error detection. It explains the structure of frames, types of framing techniques, and various elementary data link protocols, including simplex and sliding window protocols. Additionally, it discusses error control mechanisms and redundancy techniques for error detection, including parity checks, checksums, and cyclic redundancy checks.

Uploaded by

parvezsharief38
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 35

UNIT-2

Data link layer: Design issues, Framing: fixed size framing, variable size framing, flow control, error
control, error detection and correction codes, CRC, Checksum: idea, one’s complement internet
checksum, services provided to Network Layer
Elementary Data Link Layer protocols: simplex protocol, Simplex stop and wait, Simplex protocol for
Noisy Channel.
Sliding window protocol: One bit, Go back N, Selective repeat-Stop and wait protocol, Data link layer
in HDLC: configuration and transfer modes, frames, control field, point to point protocol (PPP):
framing transition phase, multiplexing, multi link PPP.

Data Link Layer


 Data Link Layer is the second layer after physical layer. The data link layer is responsible for
maintaining the data link between two hosts or nodes.
 Before going through the design issues in data link layer. Some of its sub-layers and their
functions are as following below.
 The data link layer is divided into two sub-layers :
1. Logical Link Control Sub-layer (LLC)
 Provides the logic for the data link , Thus it controls the synchronization ,
flow control , and error checking functions of the data link layer.
 Functions are –

(i) Error Recovery.

(ii) It performs the flow control operations.

(iii) User addressing.

2. Media Access Control Sub-layer (MAC)


 It is the second sub-layer of data-link layer. It controls the flow and
multiplexing for transmission medium.
 Transmission of data packets is controlled by this layer. This layer is
responsible for sending the data over the network interface card.
 Functions are :

(i) To perform the control of access to media.

(ii) It performs the unique addressing to stations directly connected to LAN.

(iii) Detection of errors.

Data link layer design issues

 The data link layer uses the services of the physical layer to send and receive bits over
communication channels.
 It has a number of functions, including:

1. Providing a well-defined service interface to the network layer.


2. Dealing with transmission errors.

3. Regulating the flow of data so that slow receivers are not swamped by fast senders.

 To accomplish these goals, the data link layer takes the packets it gets from the network
layer and encapsulates them into frames for transmission.
 Each frame contains a frame header, a payload field for holding the packet, and a frame
trailer.

Services provided to the Network layer

 The function of the data link layer is to provide service to the network layer.
 The principal service is transferring data from the network layer on the source machine to
the network layer on the destination machine.
 The network layer hands some bits to the data link layer for transmission to the destination,
the job of the data link layer is to transmit the bits to the destination machine, so they can
be handed over to the network layer on the destination machine.
 The job of the data link layer is to transmit the bits to the destination machine so they can
be handed over to the network layer there

Actual communication

 In this communication, no physical medium is present for Data Link Layer to transmit data.
 It can be only be visualized and imagined that two Data Link Layers are communicating with
each other with the help of or using data link protocol.

Virtual communication

 In this communication, physical medium is present through which Data Link Layer simply
transmits data frames.
 The actual path is Network Layer -> Data link layer -> Physical Layer on sending machine,
then to physical media and after that to Physical Layer -> Data link layer -> Network
Layer on receiving machine.

 The data link layer can be designed to offer various services. The actual services that are
offered vary from protocol to protocol.
 Three reasonable possibilities that we will consider in turn are:

1. Unacknowledged connectionless service.

2. Acknowledged connectionless service.

3. Acknowledged connection-oriented service.

1. Unacknowledged connectionless service

 Here, the data link layer of the sending machine sends independent frames to the data link
layer of the receiving machine.
 The receiving machine does not acknowledge receiving the frame. No logical connection is
set up between the host machines. Error and data loss is not handled in this service.
 This is applicable in Ethernet services and voice communications.

2. Acknowledged connectionless service

 Here, no logical connection is set up between the host machines, but each frame sent by the
source machine is acknowledged by the destination machine on receiving.
 If the source does not receive the acknowledgment within a stipulated time, then it resends
the frame.
 This is used in Wifi (IEEE 802.11) services.

3. Acknowledged connection-oriented service

 This is the best service that the data link layer can offer to the network layer.
 A logical connection is set up between the two machines and the data is transmitted along
this logical path.
 The frames are numbered, that keeps track of loss of frames and also ensures that frames
are received in correct order.
 It is appropriate for satellite communications and long-distance telephone circuits.
 It is appropriate for satellite communications and long-distance telephone circuits.
 The service has three distinct phases –
1. Set up of connection – A logical path is set up between the source and the destination
machines. Buffers and counters are initialised to keep track of frames.
2. Sending frames – The frames are transmitted.
3. Release connection – The connection is released, buffers and other resources are
released.

Framing

 The data link layer needs to pack bits into frames, so that each frame is distinguishable from
another.
 Frames are generally data unit of data link layer that is transmitted or transferred among
various network points.
 It includes complete and full addressing, protocols that are essential, and information under
control.
 Physical layers only just accept and transfer stream of bits without any regard to meaning or
structure.
 Therefore it is up to data link layer to simply develop and recognize frame boundaries. 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 −


1. Frame Header − It contains the source and the destination addresses of the frame.
2. Payload field − It contains the message to be delivered.
3. Trailer − It contains the error detection and error correction bits.
4. Flag − It marks the beginning and end of the frame.

Types of framing

 There are two types of framing techniques are there.

1.Fixed size framing

2.Variable size framing

1. Fixed size framing


o Here the size of the frame is fixed and so the frame length acts as a delimiter of the
frame.
o Consequently, it does not require additional boundary bits to identify the start and
end of the frame.
2. Variable size framing-
 Here the size of each frame to be transmitted may be different
 So additional mechanism are kept to mark the end of the frame and the beginning of
the frame

Various framing approaches

1. Bit-oriented approach

2.Byte oriented approach


Bit-oriented approach

 It simply views the frame as collection of bits


 In bit-oriented framing data is transmitted as a sequence of bits that can be interpreted in
the upper layers both as text as well as multimedia data.
 Bit-oriented protocol is HDLC.

HDLC (High Level Data Link Control)

 HDLC (High Level Data Link Control) is a bit oriented protocol.


 The Synchronous Data Link Control(SDLC) protocol developed by IBM is an example of bit
oriented protocol.
 SDLC was later standardized by the ISO as the High Level Data Link Control(HDLC) protocol.

HDLC-Frame format

8 16 16 8

Beginning Payload CRC Ending


sequence Header sequence

Protocol :Beginning and ending sequence-01111110


Bit Stuffing Mechanism

 In a data link frame, the delimiting flag sequence generally contains six or more consecutive
1s. In order to differentiate the message from the flag in case of the same sequence, a single
bit is stuffed in the message.
 Whenever a 0 bit is followed by five consecutive 1bits in the message, an extra 0 bit is
stuffed at the end of the five 1s.
 When the receiver receives the message, it removes the stuffed 0s after each sequence of
five 1s. The un-stuffed message is then sent to the upper layers.
Byte oriented approach

 This is one of the oldest approaches to framing.


 Here each frame is viewed as a collection of bytes(character) rather than bits.
 Protocols of byte oriented approach

1. BISYNC-Binary Synchronous Communication Protocol.

2. DDCMP-Digital Data Communication Message Protocol.

3. PPP-Point to Point Protocol.

1. BISYNC-Binary Synchronous Communication Protocol.


 Introduced in the mid-1960s, IBM’s BISYNC protocol was designed to provide a general-
purpose data link protocol for point-to-point and multipoint connections.
 Although the protocol itself is very old and rarely used today, the concepts introduced with
BISYNC have carried over into many protocols currently in use
 BISYNC (or BSC) is a half duplex protocol—data may be transmitted in both directions but
not at the same time.
 Stated another way, it is a stop-and-wait protocol, in that one side sends a message, then
stops and waits for a reply.
 BISYNC is also called a character-oriented protocol. The messages or packets transmitted
between primary and secondary are collections of individual characters, many of which are
special control characters that drive the dialog.
 For example, if the primary wishes to poll the first of multiple secondaries, the following
packet is transmitted:
Frame format of BISYNC

8 8 8 8 8 16

SYN SYN SOH HEADER STX PAYLOAD ETX CRC

1. SYN Character-It establishes synchronization of the incoming message with the receiver and
precedes all message packets. It can also be inserted into the middle of longer messages to
maintain synchronization
2. SOH–It indicates the Start Of Header
3. STX character –It signals the Start of TeXt
4. ETX character – It signals the End of TeXt
5. Payload-This is the actual message received from the Network layer.

2.PPP-Point to Point Protocol

 PPP is a data link layer protocol.


 PPP is a WAN protocol and which is commonly run over internet links.
 It is widely used in broadband communications having heavy loads and high speeds.
 It is used to transmit multiprotocol data between two directly connected(point to point)
computers

Frame format

8 8 8 16 16

Flag Address Control Protocol Payload Checksum

Fields

 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 endpoint of
communications

3.DDCMP-Digital Data Communication Message Protocol.

 Devised by digital equipment corporation.


 It is a byte counting approach.
 Count field in the frame format.
 Count- How many bytes are contained in the frame body.
Danger with the count field

The danger is that if transmission error could corrupt the count field then the end of the frame
would not be correctly detected by the receiver.

Character stuffing

 Byte stuffing or character stuffing is the process of adding one extra byte whenever there is
a flag sequence appear in the payload

Elementary Data Link Protocols

 Protocols in the data link layer are designed so that this layer can perform its basic functions:
1. Framing- Framing is the process of dividing bit - streams from physical layer into data
frames whose size ranges from a few hundred to a few thousand bytes
2. Error control- Error control mechanisms deals with transmission errors and
retransmission of corrupted and lost frames
3. Flow control-Flow control regulates speed of delivery and so that a fast sender does not
drown a slow receiver.

Error control

 Error control is basically process in data link layer of detecting or identifying and re-
transmitting data frames that might be lost or corrupted during transmission.
 In both of these cases, receiver or destination does not receive correct data-frame and
sender or source does not even know anything about any such loss regarding data frames.
 Therefore, in such type of cases, both sender and receiver are provided with some essential
protocols that are required to detect or identify such type of errors like loss of data frames.
 The Data-link layer follows technique known as re-transmission of frames to detect or
identify transit errors and also to take necessary actions that are required to reduce or
remove such errors. Each and every time an effort is detected during transmission,
particulardata frames retransmitted and this process is known as ARQ (Automatic Repeat
Request).

Error Detection :

 Error detection, as name suggests, simply means detection or identification of errors.


 These errors may cause due to noise or any other impairments during transmission from
transmitter to the receiver, in communication system.
 It is class of technique for detecting garbled i.e. unclear and distorted data or message.

Types of errors

There are 2 types of errors are there.

1.Bit error

2.Burst error

1. Bit error- It is also known as single bit error.


2.Burst error-In burst error,2 or more bits in the data unit have changed

How to detect the errors?

• Error detection means to decide whether the received data is correct or not without having
a copy of the original message.

• To detect or correct errors, we need to send some extra bits with the data.

• The extra bits are called redundancy bits.

Error detection techniques

• There are 3 types of redundancy techniques are used in data communication

1. Vertical redundancy check(VRC)

2. Checksum

3. Cyclic redundancy check(CRC)


1. Vertical redundancy check(VRC)/Parity Checking

 It is also called as parity check.


 Parity bit means nothing but an additional bit added to the data at the transmitter
before transmitting the data.
 Before adding the parity bit, number of 1’s or zeros is calculated in the data. Based
on this calculation of data an extra bit is added to the actual information / data.
 The addition of parity bit to the data will result in the change of data string size.
 This means if we have an 8 bit data, then after adding a parity bit to the data binary
string it will become a 9 bit binary data string.
 There is two types of parity bits in error detection, they are
1. Even parity
2. Odd parity
1. Even Parity
 If the data has even number of 1’s, the parity bit is 0.
Ex: data is 10000001 -> parity bit 0
 Odd number of 1’s, the parity bit is 1.
Ex: data is 10010001 -> parity bit 1
2. Odd Parity
 If the data has odd number of 1’s, the parity bit is 0.
Ex: data is 10011101 -> parity bit 0
 Even number of 1’s, the parity bit is 1.
 Ex: data is 10010101 -> parity bit 1

The circuit which adds a parity bit to the data at transmitter is called “Parity generator”. The parity
bits are transmitted and they are checked at the receiver. If the parity bits sent at the transmitter
and the parity bits received at receiver are not equal then an error is detected. The circuit which
checks the parity at receiver is called “Parity checker”.

Messages with even parity and odd parity


Performance of the VRC

 It can detect single bit errors.


 It can detect burst error only if the number of errors are odd.

2.Checksum

 Checksums are similar to parity bits except, the number of bits in the sums is larger than
parity and the result is always constrained to be zero. That means if the checksum is zero,
error is detected. A checksum of a message is an arithmetic sum of code words of certain
length. The sum is stated by means of 1’s compliment and stored or transferred as a code
extension of actual code word. At receiver a new checksum is calculated by receiving the bit
sequence from transmitter.
 The checksum method includes parity bits, check digits and longitudinal redundancy check
(LRC). For example, if we have to transfer and detect errors for a long data sequence (also
called as Data string) then we divide that into shorter words and we can store the data with
a word of same width. For each another incoming bit we will add them to the already stored
data. At every instance, the newly added word is called “Checksum”.
 At receiver side, the received bits checksum is same as that of transmitter’s, there is no error
found.

Checksum-Operation at sender side

1.Break the original message into ‘k’ number of blocks with ‘n’ bits in each block.

2.Sum all the ‘k’ data blocks.

3.Add the carry to the sum, if any.

4.Do 1’s complement to the sum=checksum


Checksum-Operation at Receiver side

1.Collect all the data blocks including the checksum

2.Sum all the data blocks and checksum.

3.If the result is all 1’s accepts; else reject

Example

1. Solve this with checksum 10011001111000100010010010000100

Solution

Checksum-Operation at Receiver side

Step 1: Break the original message into ‘k’ number of blocks with ‘n’ bits in each block.

10011001 11100010 00100100 10000100

Step 2: Sum all the ‘k’ data blocks.


Step 3:Add the carry to the sum, if any.

Step 4:Do 1’s complement to the sum=checksum

At receiver side

Step 1: Collect all the data blocks including the checksum

11011010 10011001 11100010 00100100 10000100

Step 2: Sum all the data blocks and checksum.


Step 3: If the result is all 1’s accepts:else reject

* Here the data is accepted by the receiver.

3.Cyclic redundancy check(CRC)

 In CRC, a sequence of redundant bits, called cyclic redundancy check bits, are appended to
the end of data unit so that the resulting data unit becomes exactly divisible by a second,
predetermined binary number.
 At the destination, the incoming data unit is divided by the same number. If at this step
there is no remainder, the data unit is assumed to be correct and is therefore accepted.
 A remainder indicates that the data unit has been damaged in transit and therefore must be
rejected.

CRC generation at sender side

1.Find the length of the divisor ‘L’.

2.Append L-1 bits to the original message

3.Perform binary division operation.

4.Remainder of the division=CRC


CRC validation at receiver side

1. At the receiver side, we divide the received code word with the same divisor to get the
actual code word.
2. For an error free reception of data, the reminder is 0. If the reminder is a non – zero,
that means there is an error in the received code / data sequence.

Example

Find the CRC for the data blocks 100100 with the divisor 1101?

At sender side

At receiver side

 The data received by the receiver:100100001


Error Correction:

 Error correction, as name suggests, simply means correction or solving or fixing of errors.
 It simply means reconstruction and rehabilitation of original data that is error-free. But error
correction method is very costly and is very hard.
 The techniques that we have discussed o far can detect errors, but do not correct them.
Error correction can be handled in 2 ways
1. One I when error is discovered, the receiver can have the sender retransmit the entire
data unit
2. The receiver can use an error correcting code which automatically corrects certain errors.

Hamming Code

 This error detecting and correcting code technique is developed by R.W.Hamming . This
code not only identifies the error bit, in the whole data sequence and it also corrects it.
 This code uses a number of parity bits located at certain positions in the codeword. The
number of parity bits depends upon the number of information bits.
 The hamming code uses the relation between redundancy bits and the data bits and this
code can be applied to any number of data bits.

What is a Redundancy Bit?

 Redundancy means “The difference between number of bits of the actual data sequence and
the transmitted bits”. These redundancy bits are used in communication system to detect
and correct the errors, if any.
How the Hamming code actually corrects the errors?

 In Hamming code, the redundancy bits are placed at certain calculated positions in order to
eliminate errors. The distance between the two redundancy bits is called “Hamming
distance”.
 To understand the working and the data error correction and detection mechanism of the
hamming code, let’s see to the following stages.

Parity bits

• A parity bit is a bit appended to a data of binary bits to ensure that the total number of 1’s in
the data is even or odd. Parity bits are used for error detection. There are two types of parity
bits:

Even parity bit


• In the case of even parity, for a given set of bits, the number of 1’s are counted. If
that count is odd, the parity bit value is set to 1, making the total count of
occurrences of 1’s an even number. If the total number of 1’s in a given set of bits is
already even, the parity bit’s value is 0.

Odd Parity bit

• In the case of odd parity, for a given set of bits, the number of 1’s are
counted. If that count is even, the parity bit value is set to 1, making the
total count of occurrences of 1’s an odd number. If the total number of 1’s in
a given set of bits is already odd, the parity bit’s value is 0.

Hamming code structure

• We uses 7 bit hamming code structure in most of the cases.

• All bit positions that are power of 2 marked as parity bits(1,2,4,8…) and the remaining bits
are marked as data bits.

Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1

D7 D6 D5 P4 D3 P2 P1

 D-data bit
 P-parity bit

Determine the value of parity bits

 The value of the parity bit determined by the sequence of bit that is alternatively check and
skips.
P1 –check 1 bit,skip 1 bit, check 1 bit,skip 1 bit,
 P1=1,3,5,7,9,11………….
P2 –check 2 bits,skip 2 bits, check 2 bits,skip 2 bit,
 P2=2,3,6,7,10,11………….
P4 –check 4 bits,skip 4 bits, check 4 bits,skip 4 bits
 P4=4,5,6,7,12,13,14,15………….

Finding parity bit positions

 The value of P1=1,3,5,7

P1 D3 D5 D7

P1 1 0 1

P1=1

 The value of P2=2,3,6,7

P2 D3 D6 D7

P2 1 1 1

P2=0

 The value of P4=4,5,6,7

P4 D5 D6 D7

P4 0 1 1

P4=1

Detecting errors

o At receiver end ,bits P1(1,3,5,7),P2(2,3,6,7),P4(4,5,6,7) are checked for the odd


parity.
o If all parity bits consisting zero(o) then there are no errors found in the message.
o In this example P1 and P4 are not equal to zero. So received code is wrong

P1=1, P2=0, P3=1 -> No errors.

So we need to correct this error.

Correcting of errors

• An error is located by forming a 3 bit number out of 3 parity checks.

• After we found the error word we find its decimal value

• Then we invert the incorrect bit to obtain the correct code.

Error word E=101

1 0 1
The decimal value for E=5(101) which shows that 5th bit is in error.

So we write the correct word by simply inverting the 5th bit.

Correct word = 1001011

Flow control

 Flow control is a technique that allows two stations working at different speeds to
communicate with each other.
 It is a set of measures taken to regulate the amount of data that a sender sends so that a
fast sender does not overwhelm a slow receiver.
 In data link layer, flow control restricts the number of frames the sender can send before it
waits for an acknowledgment from the receiver.

Simplex protocol

 The Simplex protocol is data link layer protocol for transmission of frames over computer
network.
 It is hypothetical protocol designed for unidirectional data transmission over an ideal
channel, i.e. a channel through which transmission can never go wrong.
 It is assumed that both the sender and the receiver are always ready for data processing and
both of them have infinite buffer.
 The sender simply sends all its data available onto the channel as soon as they are available
its buffer.
 The receiver is assumed to process all incoming data instantly. It is does not handle flow
control or error control. Since this protocol is totally unrealistic, it is often called Utopian
Simplex protocol.
Design

Sender Site:

1. The data link layer in the sender site waits for the network layer to send a data packet.
2. On receiving the packet, it immediately processes it and sends it to the physical layer for
transmission.

Receiver Site:

1. The data link layer in the receiver site waits for a frame to be available.
2. When it is available, it immediately processes it and sends it to the network layer.

Stop-and-Wait Protocol

 It is a data link layer protocol for transmission of frames over noiseless channels.
 It provides unidirectional data transmission with flow control facilities but without error
control facilities.
 After transmitting one frame ,the sender waits for an acknowledgement before transmitting
the next frame.

Design

Sender side

Rule 1-send one data packet at a time

Rule 2-Send the next packet only after receiving acknowledgement for the previous.

Receiver side

Rule 1-Receive and consume data packet.


Rule 2-After consuimgn packet acknowledgement need to be sent.

Problems due to Stop and Wait protocol

1.Problems due to lost data

 Sender waits for acknowledgement for longer period of time.


 Receiver waits for data for longer period of time

2. Problems due to lost Acknowledgement.

o Sender waits for longer period of for Acknowledgement.

3.Problems due to delayed ACK/data

 After timeout on sender side, a delayed AK might be wrongly considered as ACK of some
other data packet.
3. Stop-and-Wait ARQ

 The idea of stop-and-wait protocol is straight forward.


 After transmitting one frame the sender waits for an ACK before transmitting the next frame.
 If the ACK does not arrive after a certain period of time, the sender times out and
retransmits the original frame.
 Stop-and-Wait ARQ=Stop and wait + timeout timer + sequence number.

Drawbacks
1. It sends One frame at a time
2. Poor utilization of bandwidth
3. Poor performance.

Sliding Window

 This protocol improves the efficiency of stop and waits protocol by allowing multiple frames
to be transmitted before receiving an acknowledgment.
 The working principle of this protocol can be described as follows –
 Both the sender and the receiver has finite sized buffers called windows. The sender and the
receiver agrees upon the number of frames to be sent based upon the buffer size.
 The sender sends multiple frames in a sequence, without waiting for acknowledgment.
 When its sending window is filled, it waits for acknowledgment.
 On receiving acknowledgment, it advances the window and transmits the next frames,
according to the number of acknowledgments received.

Go-back-N-ARQ

 Go-back-N-ARQ uses the concept of protocol pipelining i.e., the sender can send multiple
frames before receiving the ACK for the first frame.
 There are finite number of frame and the frames are numbered in a sequence manner.
 The number of frames that can be sent depends on the window size of the sender.
 If the ACK of a frame I not received within an agreed upon time period,all frames in the
current window are transmitted.

Working Principle
 Go – Back – N ARQ provides for sending multiple frames before receiving the
acknowledgment for the first frame.
 The frames are sequentially numbered and a finite number of frames. The maximum
number of frames that can be sent depends upon the size of the sending window.
 If the acknowledgment of a frame is not received within an agreed upon time period, all
frames starting from that frame are retransmitted.
 The size of the sending window determines the sequence number of the outbound frames. If
the sequence number of the frames is an n-bit field, then the range of sequence numbers
that can be assigned is 0 to 2n−1.
 Consequently, the size of the sending window is 2n−1. Thus in order to accommodate a
sending window size of 2n−1, a n-bit sequence number is chosen.
 The sequence numbers are numbered as modulo-n. For example, if the sending window size
is 4, then the sequence numbers will be 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, and so on.
 The number of bits in the sequence number is 2 to generate the binary sequence 00, 01, 10,
11.

Selective Repeat ARQ

 Selective repeat protocol, also called Selective Repeat ARQ (Automatic Repeat reQuest), is a
data link layer protocol that uses sliding window method for reliable delivery of data frames.
 Here, only the erroneous or lost frames are retransmitted, while the good frames are
received and buffered.
 The receiver while keeping track of sequence numbers ,buffers the frames in memory and
sends NACK(negative acknowledgement) for only frame which is missing or damaged.
 The sender will send/retransmit packet for which NACK(negative acknowledgement) is
received
 It uses two windows of equal size: a sending window that stores the frames to be sent and a
receiving window that stores the frames receive by the receiver.
 The size is half the maximum sequence number of the frame. For example, if the sequence
number is from 0 – 15, the window size will be 8.

Working Principle

 Selective Repeat protocol provides for sending multiple frames depending upon the
availability of frames in the sending window, even if it does not receive acknowledgement
for any frame in the interim.
 The maximum number of frames that can be sent depends upon the size of the sending
window.
 The receiver records the sequence number of the earliest incorrect or un-received frame. It
then fills the receiving window with the subsequent frames that it has received.
 It sends the sequence number of the missing frame along with every acknowledgement
frame.
 The sender continues to send frames that are in its sending window. Once, it has sent all the
frames in the window, it retransmits the frame whose sequence number is given by the
acknowledgements. It then continues sending the other frames.
High-level Data Link Control (HDLC)

High-level Data Link Control (HDLC) is a group of communication protocols of the data link layer for
transmitting data between network points or nodes. Since it is a data link protocol, data is organized
into frames. A frame is transmitted via the network to the destination that verifies its successful arrival.
It is a bit - oriented protocol that is applicable for both point - to - point and multipoint communications.

Transfer Modes
HDLC supports two types of transfer modes, normal response mode and asynchronous balanced mode.

 Normal Response Mode (NRM) − Here, two types of stations are there, a primary station that send
commands and secondary station that can respond to received commands. It is used for both point - to -
point and multipoint communications.
Asynchronous Balanced Mode

In asynchronous balanced mode (ABM), the configuration is balanced. The link is point-to-point, and
each station can function as a primary and a secondary (acting as peers), as shown in below Figure.
This is the common mode today.

HDLC Frame
HDLC is a bit - oriented protocol where each frame contains up to six fields. The structure varies
according to the type of frame. The fields of a HDLC frame are −

 Flag − It is an 8-bit sequence that marks the beginning and the end of the frame. The bit pattern of the
flag is 01111110.
 Address − It contains the address of the receiver. If the frame is sent by the primary station, it contains
the address(es) of the secondary station(s). If it is sent by the secondary station, it contains the address
of the primary station. The address field may be from 1 byte to several bytes.
 Control − It is 1 or 2 bytes containing flow and error control information.
 Payload − This carries the data from the network layer. Its length may vary from one network to
another.
 FCS − It is a 2 byte or 4 bytes frame check sequence for error detection. The standard code used is CRC
(cyclic redundancy code)
Types of HDLC Frames
There are three types of HDLC frames. The type of frame is determined by the control field of the frame

 I-frame − I-frames or Information frames carry user data from the network layer. They also include flow
and error control information that is piggybacked on user data. The first bit of control field of I-frame is 0.
 S-frame − S-frames or Supervisory frames do not contain information field. They are used for flow and
error control when piggybacking is not required. The first two bits of control field of S-frame is 10.
 U-frame − U-frames or Un-numbered frames are used for myriad miscellaneous functions, like link
management. It may contain an information field, if required. The first two bits of control field of U-frame
is 11.
POINT-TO-POINT PROTOCOL:

Although HDLC is a general protocol that can be used for both point-to-point and multipoint
configurations, one of the most common protocols for point-to-point access is the Point-to-Point
Protocol (PPP). Today, millions of Internet users who need to connect their home computers to the
server of an Internet service provider use PPP. The majority of these users have a traditional
modem; they are connected to the Internet through a telephone line, which provides the services of
the physical layer. But to control and manage the transfer of data, there is a need for a point-to-
point protocol at the data link layer. PPP is by far the most common.

PPP provides several services:

1. PPP defines the format of the frame to be exchanged between devices.

2. PPP defines how two devices can negotiate the establishment of the link and the exchange of
data.

3. PPP defines how network layer data are encapsulated in the data link frame.

4. PPP defines how two devices can authenticate each other.

5. PPP provides multiple network layer services supporting a variety of network layer protocols.
6. PPP provides connections over multiple links.

7. PPP provides network address configuration. This is particularly useful when a home user needs a
temporary network address to connect to the Internet.

On the other hand, to keep PPP simple, several services are missing:

I. PPP does not provide flow control. A sender can send several frames one after another with no
concern about overwhelming the receiver.

2. PPP has a very simple mechanism for error control. A CRC field is used to detect errors. If the
frame is corrupted, it is silently discarded; the upper-layer protocol needs to take care of the
problem. Lack of error control and sequence numbering may cause a packet to be received out of
order.

3. PPP does not provide a sophisticated addressing mechanism to handle frames in a multipoint
configuration.

Framing:

PPP is a byte-oriented protocol. Framing is done according to the discussion of byte oriented
protocols.

Frame Format

Below Figure shows the format of a PPP frame. The description of each field follows:

Flag-A PPP frame starts and ends with a I-byte flag with the bit pattern 01111110. Although this
pattern is the same as that used in HDLC, there is a big difference. PPP is a byte-oriented protocol;
HDLC is a bit-oriented protocol. The flag is treated as a byte, as we will explain later.

Address-The address field in this protocol is a constant value and set to 11111111(broadcast
address). During negotiation (discussed later), the two parties may agree to omit this byte.

Control- This field is set to the constant value 11000000 (imitating unnumbered frames in HDLC). As
we will discuss later, PPP does not provide any flow control. Error control is also limited to error
detection. This means that this field is not needed at all, and again, the two parties can agree, during
negotiation, to omit this byte.

Protocol-The protocol field defines what is being carried in the data field: either user data or other
information. We discuss this field in detail shortly. This field is by default 2 bytes long, but the two
parties can agree to use only 1 byte.
Payload field-This field carries either the user data or other information that we will discuss shortly.
The data field is a sequence of bytes with the default of a maximum of 1500 bytes; but this can be
changed during negotiation. The data field is byte stuffed if the flag byte pattern appears in this field.
Because there is no field defining the size of the data field, padding is needed if the size is less than
the maximum default value or the maximum negotiated value.

FCS-The frame check sequence (FCS) is simply a 2-byte or 4-byte standard CRC.

Transition Phases

A PPP connection goes through phases which can be shown in a transition phase diagram.

Dead-In the dead phase the link is not being used. There is no active carrier (at the physical layer)
and the line is quiet.

Establish- When one of the nodes starts the communication, the connection goes into this phase. In
this phase, options are negotiated between the two parties. If the negotiation is successful, the
system goes to the authentication phase (if authentication is required) or directly to the networking
phase. The link control protocol packets, discussed shortly, are used for this purpose. Several
packets may be exchanged here.

Authenticate-The authentication phase is optional; the two nodes may decide, during the
establishment phase, not to skip this phase. However, if they decide to proceed with authentication,
they send several authentication packets, discussed later. If the result is successful, the connection
goes to the networking phase; otherwise, it goes to the termination phase.

Network- In the network phase, negotiation for the network layer protocols takes place. PPP
specifies that two nodes establish a network layer agreement before data at the network layer can
be exchanged. The reason is that PPP supports multiple protocols at the network layer. If a node is
running multiple protocols simultaneously at the network layer, the receiving node needs to know
which protocol will receive the data.

Open- In the open phase, data transfer takes place. When a connection reaches this phase, the
exchange of data packets can be started. The connection remains in this phase until one of the
endpoints wants to terminate the connection.

Terminate- In the termination phase the connection is terminated. Several packets are exchanged
between the two ends for house cleaning and closing the link.

Multilink PPP

PPP was originally designed for a single-channel point-to-point physical link. The availability of
multiple channels in a single point-to-point link motivated the development of Multilink PPP. In this
case, a logical PPP frame is divided into several actual PPP frames. A segment of the logical frame is
carried in the payload of an actual PPP frame, as shown in below Figure. To show that the actual PPP
frame is carrying a fragment of a logical PPP frame, the protocol field is set to Ox003d. This new
development adds complexity. For example, a sequence number needs to be added to the actual
PPP frame to show a fragment's position in the logical frame.

Example Let us go through the phases followed by a network layer packet as it is transmitted
through a PPP connection. Below Figure shows the steps. For simplicity, we assume unidirectional
movement of data from the user site to the system site (such as sending an e-mail through an ISP).
The first two frames show link establishment. We have chosen two options (not shown in the
figure): using PAP for authentication and suppressing the address control fields. Frames 3 and 4 are
for authentication. Frames 5 and 6 establish the network layer connection using IPCP

You might also like