CCN Unit 2
CCN Unit 2
SYLLABUS
Framing
Flow and error control
Protocols
Noiseless channels and noisy channels
HDLC-high level data link control
The two main functions of the data link layer are data link control and
media access control.
Data link control functions include framing, flow and error control.
To implement data link control, we need protocols.
Each protocol is a set of rules that need to be implemented in software
and run by the two nodes involved in data exchange at the data link layer.
Well discuss five protocols: two for noiseless channels and three for
noisy channels.
FRAMING
Postal system.
The simple act of inserting a letter into an envelope
separates one piece of information from another.
The envelope serves as the delimiter.
Each envelope defines the sender and receiver addresses
as the postal system is a many-to-many carrier facility.
Framing in the data link layer sends a message from one source to a
destination by adding a sender address and a destination address.
Although the whole message could be packed in one frame, that is not
normally done.
One reason is that a frame can be very large, making flow and error control
very inefficient.
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.
Character-Oriented Approach
The header carries the source and destination addresses
and other control information,
The trailer carries error detection or error correction bits.
To separate one frame from the next, an 8-bit (1-byte)
flag is added at the beginning and the end of a frame.
The flag, composed of protocol-dependent special
characters i.e. 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.
Now we send other types of information such as 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
Bit-Oriented Approach
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 1 byte) to prevent the
pattern from looking like a flag.
The strategy is called bit stuffing.
In bit stuffing, if a 0 and five consecutive 1 bits are encountered, an extra
0 is added.
This extra stuffed bit is eventually removed from the data by the receiver.
Bit stuffing is the process of adding one extra 0 whenever five consecutive 1
follow a 0 in the data, so that the receiver does not mistake the pattern
0111110 for a flag.
Flow control
Flow control coordinates the amount of data that can be sent before
receiving an acknowledgment.
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.
Error Control
Error control is both error detection and error correction.
It allows the receiver to inform the sender if any frames lost or
damaged in transmission
it coordinates the retransmission of those frames by the sender.
Any time an error is detected in an exchange, specified frames
are retransmitted.
This process is called automatic repeat request (ARQ).
Protocols
Noiseless channel
Let us first assume we have an ideal channel in
which no frames are lost, duplicated, or corrupted.
We introduce two protocols for this type of channel.
The first is a protocol that does not use flow
control; the second is the one that does.
Of course, neither has error control because we
have assumed that the channel is a perfect
noiseless channel.
Simplest Protocol
It is a unidirectional protocol in which data frames are traveling in
only one direction-from the sender to receiver.
We assume that the receiver can immediately handle any frame it
receives.
The data link layer of the receiver immediately receives frame and
hands the data packet to its network layer, which can also accept the
packet immediately.
In other words, the receiver can never be overwhelmed with
incoming frames.
Stop-and-Wait Protocol
If data frames arrive at the receiver site faster than they can be processed, the frames must be
stored until their use.
Normally, the receiver does not have enough storage space, especially if it is receiving data
from many sources.
To prevent the receiver from becoming overwhelmed with frames, somehow the sender should
be informed to slow down.
The protocol we discuss now is called the Stop-and-Wait Protocol because the sender sends
one frame, stops until it receives confirmation from the receiver and then sends the next frame.
Noisy channel
The received frame could be the correct one, or a duplicate, or a frame out
of order.
Sequence Numbers
In Stop-and-Wait ARQ we use
sequence numbers to number the
frames.
The sequence numbers are based on
modulo-2 arithmetic.
In modulo-N arithmetic, we use only
the integers in the range 0 to N - 1,
inclusive.
In this arithmetic, the modulus N is 2.
We can use only 0 and 1
Acknowledgment Numbers
The acknowledgment numbers always announce the
sequence number of the next frame expected by the
receiver.
For example, if frame 0 has arrived safely, the
receiver sends an ACK frame with acknowledgment 1
(meaning
frame 1 is expected next).
If frame 1 has arrived safely, the receiver sends an
ACK frame with acknowledgment 0 (meaning frame 0
is expected).
Pipelining
A new task is begun before the previous task
has ended.
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.
However, pipelining is applied to next two
protocols- Go-Back-N Automatic Repeat Request
Piggybacking
The three protocols discussed are all unidirectional:
Data frames flow in only one direction although control information such as ACK
and NAK frames can travel in the other direction.
In real life, data frames are normally flowing in both directions:
from node A to node B and from node B to node A.
This means that the control information also needs to flow in both directions.
A technique called piggybacking is used to improve the efficiency of the
bidirectional protocols.
When a frame is carrying data from A to B, it can also carry control information
about arrived (or lost) frames from B; when a frame is carrying data from B to A,
it can also carry control information about the arrived (or lost) frames from A.
HDLC
High-level Data Link Control (HDLC)
is a bit-oriented protocol for
communication over point-to-point
and multipoint links.
HDLC provides two common transfer
modes
1. Normal response mode (NRM)
2. Asynchronous balanced mode
(ABM).
Frames
HDLC defines three types of frames
1. Information frames (I-frames)
2. Supervisory frames (S-frames)
3. Unnumbered frames (U-frames).
. Each type of frame serves as an envelope for the transmission of
a different type of message.
. I-frames are used to transport user data and control information
relating to user data (piggybacking).
. S-frames are used only to transport control information.
. U-frames are reserved for system management.
Frame Format
Each frame in HDLC may contain up to six fields.
At beginning flag field, an address field, a control
field, an information field, a frame check sequence
(FCS) field, and an ending flag field.
In multiple-frame
transmissions, the ending
flag of one frame can
serve as the beginning
flag of the next frame.
Fields
Flag field: It is an 8-bit sequence with the bit pattern 01111110 that identifies
both the beginning and the end of a frame.
Address field: It contains the address of the secondary station.
An address field can be 1 byte or several bytes long, depending on the needs of
the network.
One byte can identify up to 128 stations
If the address field is only 1 byte, the last bit is always a 1.
If the address is more than 1 byte, all bytes but the last one will end with 0; only
the last will end with 1.
Ending each intermediate byte with 0 indicates to the receiver that there are
more address bytes to come.
Control Field
Control Field for I-Frames
. If the first bit of the control field is 0, this means the frame
is an I-frame.
If the first 2 bits of the control field is 10, this means the frame is
an S-frame.
The 2 bits called code is used to define the type of S-frame itself.