Framing
Addressing
Access control
Dealing with transmission errors
Framing:
Break bit stream into frames. Check if frames arrived correctly. If not: Discards frame. In some cases also request retransmission.
Methods of framing:
Character count. Starting and ending characters , with character stuffing. Starting and ending flags , with bit stuffing.
(a) Without errors. (b) With one error. Count can be garbled by a transmission error, which will loose synchronization, will not know where is next frame starting.
Character Stuffing:
Each frame start with ascii character sequence DLE STX (data link escape start of text) and end with DLE ETX (end of text). Character stuffing is used when binary data ,object program or floating point numbers are being transmitted. A STX DLE A
DLE
DLE
DLE
DLE ETX
DLE
Stuffed DLE(ASCII)
Bit Stuffing:
Each frames begins and ends with special pattern. Example: 01111110. When senders DLL finds 5 consecutive 1s in data stream, stuffs 0. When receiver sees 5 1s followed by 0, de-stuffs
(a) Original data. (b) Data as they appear on the line. (c) Data after de-stuffing.
Error Control:
Data can be corrupted during transmission. For reliable communication, errors must be detected and corrected.
Definition:
Error detection is the ability to detect the presence of errors caused by noise or other impairments during transmission. Error correction is the additional ability to reconstruct the original error free data.
Types of Error:
Single-Bit Error: In a single-bit error, only one bit in the data unit has changed.
Burst Error:
A burst error means that 2 or more bits in the data unit have changed. Burst error of length 5
Detection:
Redundancy Parity Check (VRC)& LRC Cyclic Redundancy Check (CRC) Checksum Correcting or detecting errors is called redundancy. Error detection uses the concept of redundancy, which means adding extra bits with data for detecting errors.
Even-parity concept
In parity check, a parity bit is added to every data unit so that the total number of 1s is even (or odd for odd-parity).
Example 1
Suppose the sender wants to send the word world. In ASCII the five characters are coded as 1110111 1101111 1110010 1101100 1100100 The following shows the actual bits sent 11101110 11011110 11100100 11011000 11001001
Example 2
Now suppose the word world in Example 1 is received by the receiver without being corrupted in transmission. 11101110 11011110 11100100 11011000 11001001 The receiver counts the 1s in each character and comes up with even numbers (6, 6, 4, 4, 4). The data are accepted.
Example 3
Now suppose the word world in Example 1 is corrupted during transmission. 11111110 11011110 11101100 11011000 11001001 The receiver counts the 1s in each character and comes up with even and odd numbers (7, 6, 5, 4, 4). The receiver knows that the data are corrupted, discards them, and asks for retransmission
In LRC, a block of bits is divided into rows and a redundant row of bits is added to the whole block.
Example 4
Suppose the following block is sent:
Steps:
1. A string of n 0s is appended to the data unit.The number n is one less than the number of bits in the predetermined divisor,which is n+1 bits. 2. The newly elongated data unit is divided by the divisor using binary division(modulo-2),The remainder resulting from this division is the CRC. 3. The CRC in step 2 replaces the appended 0s at the end of the data unit. 4. The data is then transmitted and arrives at the receiver,receiver treats the whole string as a unit and divides it by the same divisor. 5. If the string arrives without error,the CRC checker yields a remainder of zero and the data unit passes.and if it is non-zero the data unit does not pass.
Example 5
Checksum:
The sender follows these steps: a. The unit is divided into k sections, each of n bits. b. All sections are added using ones complement to get the sum. c. The sum is complemented and becomes the checksum. d. The checksum is sent with the data. The receiver follows these steps: a. The unit is divided into k sections, each of n bits. b. All sections are added using ones complement to get the sum. c. The sum is complemented. d. If the result is zero, the data are accepted: otherwise, rejected
Example 8
Suppose the following block of 16 bits is to be sent using a checksum of 8 bits. 10101001 00111001 The numbers are added using ones complement 10101001 00111001 -----------Sum 11100010 Checksum 00011101 The pattern sent is 10101001 00111001 00011101
Now suppose the receiver receives the pattern sent in Example 8 and there is no error. 10101001 00111001 00011101 When the receiver adds the three sections, it will get all 1s, which, after complementing, is all 0s and shows that there is no error. 10101001 00111001
00011101
Sum Complement 11111111 00000000 means that the pattern is OK.
Flow control:
Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment. The flow of data must not be allowed to over whelm the receiver. Two Categories of Flow control Stop-and-wait Sliding window
Stop-and-Wait
In this the sender sends one frame and wait for an acknowledgement before sending the next frame.
Advantage: It is simple. Each frame is checked and acknowledged before next frame is sent. Disadvantage: poor link utilization. It is slow. Long propagation delay
Example: if receiver receives frames 2,3, and 4, it sends an ACK with sequence number 5, which acks receipt of 2, 3, and 4.
Transmission window shrinks each time frame is sent, and grows each time an ACK is received. The receiver window shrinks when data are received and expands when ACK are sent. Example-1:If the sequence of transmission for 7 bit frame is as follow : window size 7 ->data0 ->data1 <-ack2 ->data2 <-ack3 ->data3 ->data4 ->data5 <-ack6
Example-2:If the sequence of transmission for 7 bit frame is as follow: ->data0 ->data1 ->data2<-ack3 ->data3 <-ack4 ->data4 ->data5 ->data6
A (Sender) 0 1 2 3 4 5 6 7 0 1 2 3 4 0123456701234
B (Receiver)
0 1 2
ACK 3 3 ACK 4
0123456701234 0123456701234
0123456701234
0123456701234
0123456701234
0123456701234
0123456701234
0123456701234
0123456701234
4 5 0123456701234 6
Error control in the data link layer is based on automatic repeat request, which is the retransmission of data.
In three cases:
Normal Operation
Go Back n ARQ
In this method if one frame is lost or damaged, all frames sent since the last frame ackd are retransmitted. For damaged frame: As soon as receiver discover an error it stops accepting subsequent frame until damaged frame is replaced.
Selective-Repeat ARQ
In this method only specific damaged or lost frame is retransmitted. If the frame is corrupted or lost, a NAK is returned and the frame is resent out of sequence. In this the receiving device must contain sorting logic to enable to reorder frame received out of sequence. A buffer in the receiver must keep previously received frames on hold until all retransmission have been sorted.
HDLC Protocol
Frames:
HDLC has three types of frames:
Information frames(I-frame): used to transport user data and control information related to user (sequence and ack num).
Supervisory frames(s-frame): are used only to transport control information (ack num). Unnumbered frames(u-frame): are reserved for system management (information relating to managing a link).
HDLC frame
Frame in HDLC may contain upto six fields: A beginning Flag field.
An address field
A control field An information field A frame check sequence (checksum)
END
OF DATALINK LAYER