You are on page 1of 35

Data link control

Some specific responsibilities of data link layer: Framing: Fixed size v Variable size, Byte oriented v Bit oriented, Physical Addressing, Flow control, Access control, Error control.

Framing: character-oriented protocol


A frame in a character-oriented protocol

Byte stuffing and unstuffing

Framing: bit-oriented protocol


A frame in a bit-oriented protocol

Bit stuffing and unstuffing

Data Link Control Protocols


Need layer of logic above Physical to manage exchange of data over a link
Data link control: Frame synchronization; Line discipline; Flow control; Error control; Addressing. Line discipline: Who should send now? Error control in the data link layer is based on automatic repeat request, which is the retransmission of data. Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment.

Line discipline categories: ENQ/ACK : peer-to-peer communication, Poll/Select : primary-secondary communication.


4

Line Discipline: ENQ/ACK

How it works

Line Discipline: Poll/Select

Polling : If the primary wants to receive data, it asks the secondaries if they have anything to send. Selecting : If primary wants to send data, it tells the target secondary to get ready to receive. Therefore, the primary is always the initiator of a session.
6

Line Discipline: Poll/Select

Select: is used whenever the primary device has something to send.

Poll: is used by the primary device to solicit transmissions from the secondary devices. The secondaries are not allowed to transmit data unless asked.
7

Flow control
Refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment

Stop-and-Wait: The sender sends one frame and waits for an acknowledgment before sending the next frame.

Advantage: simplicity Disadvantage: inefficiency.


8

Flow control: Sliding window


The word window in the term sliding window refers to an extra buffer, created by both the sender and the receiver.

Allows multiple numbered frames to be in transit. Receiver has buffer W frames. Transmitter may send up to W frames without ACK ACK includes number of next frame expected Sequence number is bounded by size of field (k) frames are numbered modulo 2k max window size up to 2k - 1
9

Sliding Window Diagram

10

Sliding Window Example

11

Error control
Refers primarily to methods of error detection and retransmission ARQ (Automatic Repeat Request): means retransmission of data in three cases: damaged frame, lost frame, and lost acknowledgment

Categories of error control:

12

Error control
Stop-and-Wait ARQ

Sequence numbers For retransmission to work, four features are added to the basic flow control mechanism.
0

Sending device keeps a copy of the last frame transmitted, Data frame and ACK frame are numbered alternately 0 and 1, NAK frame (not numbered), Timer (sending device).

13

Error control
Stop-and-Wait ARQ

Lost Data Frame


0

Lost Acknowledgment
0

14

Error control
Sliding Window ARQ: Go-Back-n ARQ Damaged Frame Three features are added to the basic flow control mechanism (sliding window): Sending device keeps copies of all transmitted frame until they have been acknowledged, ACK (carry the number of the next frame expected), NAK (carry the number of the damaged frame itself), Equipped with a timer to enable it to handle lost acknowledgments. If one frame is lost or damaged, all frames sent since the lost frame acknowledged are retransmitted.
15

Error control
Sliding Window ARQ: Go-Back-n ARQ

Lost Data Frame

Lost Acknowledgment

16

Error control
Sliding Window ARQ: Selective-Reject ARQ Only the specific damaged or lost frame is retransmitted.

17

HDLC protocol
An important data link control protocol. High-level Data Link Control (HDLC) is a bit-oriented protocol for communication over point-to-point and multipoint links. It implements the ARQ mechanisms.

Normal Response Mode (NMR)

Asynchronous Balanced Mode (ABM)


18

HDLC protocol
HDLC protocol defines three types of frames: - the Information frame (I-frame), - the Supervisory frame (S-frame), - the Unnumbered frame (U-frame).

19

HDLC protocol
Fields Flag field: 8-bit sequence with the bit pattern 01111110. Address field: Contains the address of the secondary station, an address field can be one byte or several bytes. Control field: 1 or 2 bytes long. Information field: Contains the users data from the network layer. FCS field: The frame check sequence (FCS) is the HDLC error detection field, can contain either 2 or 4 byte CRC.

20

HDLC protocol
Control field I-Frame: N(S): Frame sequence number, N(R): Ack number, P/F: Poll/Final. S-Frame: Code: Frame type. 00 Receive Ready (RR): N(R) is Ack number, 10 Receive not Ready (RNR): N(R) is Ack number + Receiver is busy, 01 Reject (Rej): NAK frame, 11 Selective Reject (SRej): N(R) is negative Ack number U-Frame: Control command and response.
21

Control field format for the different frame types.

HDLC protocol
U-frame control command and response

22

HDLC protocol
Example of data transfer (Piggybacking) without error

Example of connection and disconnection

23

HDLC protocol
Example of piggybacking with error

Node B sends three data frames (0, 1, and 2), but frame 1 is lost. When node A receives frame 2, it discards it and sends a REJ frame for frame 1. Note that the protocol being used is Go-Back-N with the special use of an REJ frame as a NAK frame. The NAK frame does two things here: It confirms the receipt of frame 0 and declares that frame 1 and any following frames must be resent. Node B, after receiving the REJ frame, resends frames 1 and 2. Node A acknowledges the receipt by sending an RR frame (ACK) with acknowledgment number 3.

24

HDLC Operation Example

25

HDLC Operation Example

26

Point-to-Point Protocol

Point-to-Point Protocol (PPP) is one of the most common protocols for point-to-point access. PPP: Is a byte-oriented protocol using byte stuffing with the escape byte 01111101. Defines: the format of the frame, how the two devices negotiate the establishment of the link and the exchange of data, how two devices can authenticate each other. Provides: IP address at connection time. Does not provide flow control. Has a very simple mechanism for error control.

27

Point-to-Point Protocol
Frame Format

Flag: The bit pattern is 01111110. Address: is set to a constant value 11111111 (Broadcast address). Control: is set to a constant value 11000000. Protocol: 1 or 2 bytes long. Defines what is being carried in the data field. Payload field: carries the user data or other information with the default of a maximum of 1500 bytes. FCS: The frame check sequence is a 2 or 4 bytes CRC.
28

Point-to-Point Protocol
Transition phases

29

Point-to-Point Protocol
Multiplexing in PPP

30

Point-to-Point Protocol
LCP packet encapsulated in a frame.

LCP is responsible for: establishing, maintaining, configuring, and terminating links. providing negotiation mechanisms to set options between the two endpoints. Both endpoints must reach an agreement about the options before the link can be established. Code field defines the type of LCP packet. ID field holds a value that matches a request with a reply.
31

Point-to-Point Protocol
LCP packets

Common options
32

PPP: Authentication protocol


Two protocols for authentication: Password Authentication Protocol (PAP), Challenge Handshake Authentication Protocol (CHAP). PAP packets encapsulated in a PPP frame.

33

PPP: Authentication protocol


CHAP: The password is never sent online. CHAP packets encapsulated in a PPP frame.

34

PPP: Network Control Protocols


PPP is a multiplenetwork layer protocol. PPP specifies a specific Network Control Protocol for each network protocol. For example: IPCP (Internet Protocol Control Protocol) configures the link for carrying IP data packets.

IPCP packet encapsulated in PPP frame.

IP datagram encapsulated in a PPP frame.


35

You might also like