Sei sulla pagina 1di 83

Chapter 11

Data Link Control

Framing
Data link layer needs to pack bits into frames, so that each frame is distinguishable from another Framing: Separate a message from one source to a destination. Fixed-size framing: There is no need for defining the boundaries of the frame. Variable-size framing Need a way to define the end of the frame and the beginning of the next. Two approaches are used: Character-oriented approach and bit-oriented approach

Character-oriented Protocols
In character-oriented protocol, data to be carried are 8 bit-character.

Frame structure

Continued..
The header carries the source and destination address and other control information. The trailer carries the error detection or error redundant bits. Flag: That separate one frame from next and added at the beginning and end of the frame.

Continued..
In byte stuffing a special byte is added to the data section of the frame when there is a character with same pattern as the flag. This byte is called escape character (ESC).

Byte stuffing: process of adding 1 extra byte whenever there is a flag or escape character in the text

Bit- Oriented Protocols


In bit-oriented protocol, the data section of the frame is a sequence of bits to be interpreted by the upper layer. We need a delimiter to separate one frame from the other.

We use a 8 bit pattern flag 01111110 as a


delimiter to define the beginning and the end

Frame structure

Continued..
Bit stuffing: process of adding one extra 0 whenever five consecutive 1s follow a 0 in the data.

Flow and Error Control


The important responsibilities of the data link layer are flow control and error control. Flow control: The amount of data that can be sent before receiving an acknowledgement. Each receiving device has a block of memory called a buffer.
Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgement

Continued..
Error Conrtol: Error control is both error detection and error correction. Error control in the data link layer is based on automatic repeat request (ARQ), which is the retransmission of data Protocols:

Continued..

Noiseless Channels
Simplest Protocol: This has no flow or error control. Design:

Continued..

Algorithm

Sender-site algorithm

Continued..
Receiver-site algorithm

Example:

Stop-and-Wait Protocol
Stop and wait Protocol the sender sends one frame, stops until it receives confirmation from the receiver. Design: In this one data frame in the forward channel or one ACK frame on the reverse channel.

Continued..

Sender-site algorithm

Receiver-site algorithm

Example

Noisy Channels
Stop-and-Wait ARQ:
It adds a simple error control mechanism to stop and wait protocol. Lost frame are more difficult to handle than corrupted ones. The corrupted and lost frame resent in the protocol. Error correction in Stop-and-Wait ARQ is done by keeping a copy of the sent frame and retransmitting of the frame when the timer expires.

Continued..
Sequence Numbers:
A field is added to the data frame to hold the sequence number of that frame. The sequence number start from 0, go to 2m-1. Assume that we used x as sequence number then next should be x+1. In Stop-and-Wait ARQ, we use sequence numbers to number the frames. The sequence numbers are based on modulo-2 arithmetic

Assume that the sender has sent frame numbered x. Three things can happen.

Continued..
Acknowledgment Numbers:
Acknowledgment Numbers always announce the sequence number of the next frame excepted by the receiver. Acknowledgment number always announces in modulo-2 arithmetic the sequence number of the next frame expected.

Design:

Sn points to the slot that matches the sequence number of the frame that has been sent. Rn points to the slots that matches the sequence number of the expected frame.

Algorithms: Sender-site algorithm

Algorithms: Sender-site algorithm( continued)

Algorithm: Receiver Site

Continued..
Efficiency:
The stop and Wait is very inefficient if the channel is thick and long.

Pipelining:
In networking and in other areas, a task is often begun before the previous task has ended. This is known as pipelining.
There is no pipelining in stop and wait protocol

Example

Go-Back-N ARQ
To improve the efficiency of transmission, multiple frames must be in transition while waiting for acknowledgment. We can send several frames before receiving acknowledgements Sequence Numbers: If the header of the frame allows m bits for the sequence number, the sequence number range from 0 to 2m-1. In the Go-Back-N Protocol, the sequence numbers are modulo 2m, where m is the size of the sequence number field in bits

If m is 4, the sequence numbers are 0 through 15 inclusive.

Continued..
Sliding Window:
Sliding Window is an abstract concept that defines the range of sequence numbers that is concern of the sender and receiver. The range which is the concern of the sender is called the send sliding window. The range which is the concern of the receiver is called the receive sliding window. The send window is an imaginary box covering the sequence numbers of the data frames which can be transit. The maximum size of window is 2m-1.

Continued..

Continued..
The send window is an abstract concept defining an imaginary box of size 2m - 1 with three variables: Sf, Sn, and Ssize. Fig(b) shows a send window can slide one or more slots to the right when acknowledgment arrives from the other end.
The send window can slide one or more slots when a valid acknowledgment arrives.

Continued..
The receive window makes sure that the correct data frames are received and that the correct acknowledgments are sent.

Continued..
The receive window is an abstract concept defining an imaginary box of size 1 with one single variable Rn. The window slides when a correct frame has arrived; sliding

occurs one slot at a time.

Timers: The timer is used for all the frames sent. Acknowledgment: The receiver sends a positive acknowledgment if frame has arrived safe. The receiver does not have to acknowledge each frame received. It can send one cumulative acknowledgment for several frames.

Continued..
Resending a frame: When the timer expires, the sender resends all outstanding frames.
Suppose the sender has already sent frame 6, but the timer for frame 3 expires. This means that frame 3 has not been acknowledged, hence the sender goes back and sends frames 3,4,5 and 6 again

Design:

Continued..
Send Window Size:
The size of window must be 2m -1.

Sender Algorithm

Continued..

Receiver Algorithm

Example:

Go-Back-N ARQ Versus Stop- and- Wait ARQ.

There is only two sequence numbers and send window size is 1.

Selective Repeat ARQ


In this N frames are not resent just one frame is damaged & damaged frame is resent. So it is called Selective Repeat ARQ. Windows: This uses two windows: a send window and a receive window. First the size of send window is much smaller; i.e

Continued..
Second the receive window is the same size as the send window. Sender window for selective Repeat ARQ.

Continued..
Receive Window for Selective Repeat ARQ.

Continued..
The slots inside the window i.e., colored define frames that are arrived out of order and are waiting for their neighbors to arrive before delivery to the network layer. Design:

Continued..

Selective Repeat ARQ: Window Size The size of the sender and receiver window must be at most one-half of 2m.

Algorithm Sender-Site:

Receiver-Site Algorithm

Continued..

Continued..
Delivery of data in Selective Repeat ARQ.

Example:

Piggybacking:
To improve the efficiency of the bidirectional protocols Piggybacking in Go-Back-N ARQ

Continued..

HDLC
High-level Data Link Control (HDLC): It is a bit-oriented protocol for communication over point-to-point and multipoint links. Configuration and Transfer Modes: Two common transfer mode: normal response mode (NRM) and asynchronous balanced mode (ABM). Normal Respond Mode:

Continued..

Continued..
Asynchronous Balanced Mode:

Frames
HDLC defines three types of frames: Information frame ( I frame) Supervisory frame ( S frame) Unnumbered frame ( U frame). Each

HDLC Frames

Fields:
Flag Field: The flag field is 8 bit sequence with the bit pattern of 01111110. Address Field: The HDLC contains the address of the secondary station. Control Field: It is 1 or 2 byte segment of the frame used for flow control and error control. Information Field: It contains users data from the network layer. FCS field: The Frame Control Sequence is the HDLC error detection field.

Control Field for different frame types

Continued..

Control field for I frames: I frames is designed to carry user data from the network layer. The single bit between N(S) and N(R) is called the P/F bit. The P/F field is a single bit dual purpose. It has a meaning only when the bit is set to 1 (poll or final)

Continued..
Control Field for S frames: It is used for flow control and error control. S- frames do not have information field. The four types of S- frames: Receive Ready: If the value of the code subfield is 00, it is RR S- frame. Receive not ready (RNR): If the value of the code subfield is 10, it is RNR S- frame.

Continued..
Reject (REJ): If the value of the code subfield is 01, it is REJ S- frame. Selective reject (SREJ) : If the value of the code subfield is 11, it is SREJ S- frame.

Control field for U- frames:


Unnumbered frames are used to exchange session management and control information.

U- frame control command and response

Example: Connection/Disconnection

Example: Piggybacking without error

Example: Piggybacking with error

Point-to-Point Protocol: PPP


PPP Provides several services: the format of the frame to be exchanged between devices how two devices the establish the link and the exchange of data how network layer data are encapsulated in the data link frame how two devices can authenticate each other multiple network layer services connection over multiple links Network address configuration

Continued..
But, several services are missing for simplicity no flow control, simple error control (detection and discard), no sophisticate addressing for multipoint configuration Framing PPP is a byte-oriented protocol.

Frame Format

Flag: A PPP frame starts ends with a 1- byte flag with bit pattern 01111110. Address: The address field of this protocol has a constant value and set to 11111111. Control: The field is set to a constant value 11000000. Protocol: The protocol field defines what is being carried in the data field.

Continued..
Payload field: This field carries either the user data or the information. FCS: The FCS is simply a 2-byte or 4- byte standard CRC. Byte Stuffing: The similarity b/w PPP and HDLC ends at the frame format. PPP is a byte-oriented protocol using byte stuffing with the escape byte 01111101

Continued..
Transition Phases of PPP:

Continued..
Dead: In this phase the link is not being used. Establish: In this phase, options are negotiated b/w the two parties. Authenticate: The two nodes may decide during the establishment phase. Network: In the n/w phase, negotiation for the n/w layer protocols takes place The PPP supports multiple protocols at the n/w layer.

Continued..
Open: In this phase, data transfer takes place The connection remains in this phase until one of the endpoints wants to terminate the connection. Terminate: In this phase the connection is terminated.

End of unit 5

Potrebbero piacerti anche