0% found this document useful (0 votes)
12 views81 pages

Framing HDLC PPP

Uploaded by

sabarisris.23it
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views81 pages

Framing HDLC PPP

Uploaded by

sabarisris.23it
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 81

Data Link

Control (DLC)
G.Sasikala
AP/IT
KEC
• The data-link layer is divided into two sublayers.
• The upper sublayer, data-link layer (DLC).
• The lower sublayer, multiple access control (MAC)
• The first section discusses the general services provided by the DLC
sublayer. It first describes framing and two types of frames used in
this sublayer.
• The section then discusses flow and error control. Finally, the section
explains that a DLC protocol can be either connectionless or
connection-oriented.
• The second section discusses some simple and common data-link
protocols that are implemented at the DLC sublayer. The section first
describes the Simple Protocol.
• It then explains the Stop-and-Wait Protocol.
• The third section introduces HDLC, a protocol that is the basis of all
common data-link protocols in use today such as PPP and Ethernet.
The section first talks about configurations and transfer modes. It
then describes framing and three different frame formats used in this
protocol.
• The fourth section discusses PPP, a very common protocol for
point-to-point access. It first introduces the services provided by the
protocol. The section also describes the format of the frame in this
protocol. It then describes the transition mode in the protocol using
an FSM. The section finally explains multiplexing in PPP.
11.1.1 Framing
• Definition – Framing is the process used in the data-link layer to group bits
into distinguishable units called frames, making it possible to separate one
message from another.
• Purpose – It adds sender and destination addresses so that the recipient
knows both where the data is going and who sent it.
• Analogy – Similar to how an envelope separates and identifies letters in a
postal system, framing separates and identifies data in a network.
• Error and flow control
• Synchronization vs. Framing – The physical layer moves raw bits and
ensures timing synchronization, while the data-link layer uses framing to
organize those bits into meaningful units.
• Two types:
• Fixed-size frames & Variable-size frames.Fixed-size framing: No need
for explicit boundaries; size acts as delimiter (e.g., ATM uses fixed-size
cells).
• Variable-size framing: Common in LANs; requires a method to mark
frame boundaries.
• Framing Approaches
• Character-Oriented (Byte-Oriented) Framing
• Data, header, and trailer are in multiples of 8 bits (1 byte).
• Uses special 8-bit flag characters to mark start and end of a frame.
• Header contains source/destination addresses & control info.
• Trailer contains error detection bits.
• Example: ASCII coding system.
• Bit-Oriented Framing (mentioned as alternative, but details later)
Character-Oriented Framing
• Originally used when only text was exchanged.
• Flag character marks the start and end of a frame.
• Works well if the flag character never appears in actual data.
Problem with Modern Data
• Now we send text, images, audio, video.
• Flag pattern might appear in the data itself.
• Receiver may mistakenly detect end of frame in the middle of data.
Solution: Byte Stuffing (Character Stuffing)
• Insert a special escape character (ESC) before any occurrence of the
flag pattern in the data.
• ESC has a predefined unique bit pattern.
• Receiver’s role:
• Removes ESC from data.
• Treats the next byte as data, not a flag.
Byte Stuffing – Recap
• Purpose: Allows the presence of flag patterns inside data without
misinterpretation.
• Method: Insert an ESC before any occurrence of the flag pattern in
the data.
New Problem
• If ESC itself appears in the data before a flag pattern, it can still cause
errors.
• Receiver removes the first ESC, and the flag pattern that follows is
wrongly seen as frame end.
Solution
• If ESC is part of the text, double it (insert another ESC before it).
• Receiver: Removes one ESC and treats the second as part of data.
Other Limitation
• Character-oriented protocols use 8-bit characters (ASCII).
• Modern systems use 16-bit or 32-bit characters (e.g., Unicode),
making compatibility harder.
• Bit-Oriented Framing Data section is a sequence of bits (can represent
text, image, audio, video, etc.).Delimiter: Special 8-bit flag pattern
01111110 marks start and end of a frame.

Sender checks data:


•After a 0 followed by five consecutive 1s, insert an extra 0
(stuffed bit).
•Done regardless of the next bit’s value.
•Receiver: Removes stuffed 0s to recover original data.
Example
Original data: 000111111001111101000
Stuffed data: 0001111101001111101000
Receiver removes stuffed bits to get original data.
Advantages
• Works with any type of data (binary-based, not byte-limited).
• Avoids confusion between data patterns and frame flags.
Flow control-Data-Link Layer
• Definition: Mechanism to match the data sending rate of the sender
with the data processing rate of the receiver.
• Purpose: Prevents receiver buffer overflow and loss of frames.
• Exists whenever one entity produces and another consumes data.
• If sender is faster, receiver may be overwhelmed → data loss.
• If sender is slower, receiver may stay idle → low efficiency.
In Networking Context
• Focus on the relationship between data-link layers at sender and
receiver.
• Sender → pushes frames to receiver.
• Receiver → processes frames at its own speed.
• Flow control feedback informs sender to slow down or speed up.
Error Control – Data-Link Layer
• Prevents delivery of corrupted frames to the network layer.
• Needed because physical layer is not fully reliable.
A DLC protocol can be either connectionless or connection-oriented.
1. Connectionless Protocol
• Meaning: Frames are sent independently, with no link between them.
• No numbering → No guarantee of order.
• No setup/teardown → Sender just sends frames right away.
• Use case: Most LAN protocols (like Ethernet).
• Example analogy: Sending separate letters by regular post without
telling the receiver in advance — they may arrive in any order, and
each stands alone.
• 2. Connection-Oriented Protocol
• Meaning: A logical connection is first set up between sender and receiver.
• Frames numbered & ordered → Receiver can reorder if needed.
• Has three phases:
• Setup – Establish connection.
• Transfer – Send ordered frames.
• Teardown – Close connection after transfer.
• Use case: Some point-to-point protocols, certain wireless LANs, and
WANs.
• Example analogy: A phone call — you first connect, talk in sequence, then
hang up.
1. Four Traditional Data-Link Layer Protocols
• These were designed to handle flow control (preventing sender from
overwhelming the receiver) and error control (detecting/correcting errors):
• Simple Protocol – No flow control, no error control. Just send.
• Stop-and-Wait – Sender sends one frame, waits for acknowledgment
before sending the next.
• Go-Back-N – Sender can send multiple frames before waiting for ACKs, but
if an error occurs, it resends from the error frame onward.
• Selective-Repeat – Like Go-Back-N, but only retransmits the frames that
were in error, not the entire sequence.
Current use:
• Simple and Stop-and-Wait are still sometimes used in LANs
(especially in simple or short-distance communications).
• Go-Back-N and Selective-Repeat are rare now at the data-link layer,
but their logic is used in higher layers like TCP.
2. FSM (Finite State Machine) Concept
• A Finite State Machine is a way to model how a protocol behaves.
• States – Different conditions the system can be in.
• Events – Something that happens (input or trigger).
• Actions – What the system does in response to an event.
• State transition – Moving from one state to another after an event.
At any given moment, the machine is in only one state.
• An event triggers:
• An action (e.g., send a frame, start a timer, discard a packet)
• A transition to the next state (which may be the same state).
• One state is the initial state (starting point).
Simple Protocol
• Purpose: The most basic data-link layer protocol.
• Assumptions:
• No flow control → The sender can send frames at any time, without worrying
about overwhelming the receiver.
• No error control → There’s no checking for errors in the frames. If an error
occurs, the frame is just lost or corrupted without retransmission.
• The receiver immediately processes each frame upon arrival.
11.2.2 Stop-and-Wait Protocol
• Provides both flow control (ensuring the sender doesn’t overwhelm the
receiver) and error control (detecting and retransmitting lost or corrupted
frames).
• Send One Frame at a Time
• The sender transmits one frame and waits for an acknowledgment (ACK)
before sending the next frame.
• Error Detection
• Each frame includes a CRC (Cyclic Redundancy Check) for detecting
corruption.
• When a frame arrives at the receiver:
• If the CRC is correct → frame is accepted.
• If the CRC is incorrect → frame is discarded silently.
Acknowledgment Handling
• Receiver sends an ACK for each correctly received frame.
• The silence (no ACK) signals the sender that the frame was either lost
or corrupted.
Timer Mechanism
• Sender starts a timer when sending a frame.
• If ACK arrives before timer expires → sender stops the timer and
sends the next frame.
• If timer expires → sender resends the same frame.
Frame Copying
• The sender must keep a copy of the frame until its ACK is received.
• Once ACK is received, the copy is discarded, and the next frame is
sent.
Stop-and-Wait ensures reliable delivery, but there’s a potential
problem: duplicate frames.
• Example: If a frame is resent due to timeout, the receiver might
receive the same frame twice.
• In real applications (like ordering online), duplicates could mean
ordering the same item twice.

• Solution: Use sequence numbers in data frames and


acknowledgment numbers in ACK frames.
11.2.3 Piggybacking
• The Simple Protocol and Stop-and-Wait Protocol discussed so far
work for unidirectional communication:
• Data flows only one way (e.g., A → B).
• Acknowledgments (ACKs) go the other way (B → A), but no actual
data is sent in that reverse path
• Bidirectional Communication
• In reality, two devices often both have data to send to each other.
• One approach: Piggybacking
• Instead of sending an acknowledgment as a separate frame, the
acknowledgment is combined (piggybacked) with outgoing data in the
opposite direction.
• Example: If A is sending data to B and also needs to acknowledge data
received from B, A can put the ACK inside its next data frame rather than
sending an empty ACK frame.
HDLC(High Level Data Link Control Protocol)
• Type: Bit-oriented data link layer protocol.
• Use: Works over point-to-point and multipoint links.
• Protocol style: Implements the Stop-and-Wait protocol for reliable
delivery.
• Nature: Mostly theoretical today, but its design concepts influenced
many modern protocols.
Even though HDLC itself is not widely deployed now, its principles are
found in:
• PPP (Point-to-Point Protocol) – still used in WAN links.
• Ethernet (Chapter 13) – wired LAN standard.
• Wireless LAN protocols
Key Features of HDLC
• Bit-oriented: Data is sent as a sequence of bits, not bytes or
characters. Uses special bit patterns for frame boundaries and
control.
• Framing: Uses a flag sequence (01111110) to mark start and end of a
frame.
• Flow/Error Control: Built on Stop-and-Wait ARQ (Automatic Repeat
reQuest).
• Modes: Can support unidirectional or bidirectional communication.
• Operation: Suitable for reliable transfer over noisy links.
Two Transfer Modes
• Normal Response Mode (NRM): Unbalanced configuration — one
primary station (can send commands) and multiple secondary
stations (can only respond). Works for point-to-point and multipoint
links.
• Asynchronous Balanced Mode (ABM): Balanced configuration —
point-to-point link where both stations act as peers (can send and
respond). Most common today.
HDLC Frame Structure – 6 Possible Fields:
• Flag field – Marks start/end of frame (01111110).
• Address field – Identifies sender/receiver station.
• Control field – Indicates frame type & sequence numbers.
• Information field – Contains user data (in I-frames).
• Frame Check Sequence (FCS) field – Error detection (CRC).
• Flag field – Marks end of frame (may be shared with next frame’s
start).
Frame Types in HDLC
• I-frames (Information frames): Carry user data + control info (e.g.,
piggybacked ACKs).
• S-frames (Supervisory frames): Carry only control information (no
user data).
• U-frames (Unnumbered frames): Carry management information for
link setup, maintenance, or termination.
Flag Reuse in Continuous Transmission
• The ending flag of one frame can also act as the beginning flag of the
next frame, improving efficiency.
Bit-Oriented Protocol
• HDLC treats frames as a stream of bits, not characters; uses
bit-stuffing to avoid flag pattern confusion.
Practical Relevance
• While HDLC itself is mostly theoretical today, its concepts are used in
modern protocols like PPP, Ethernet, and wireless LAN protocols.
I-Frame Control Field
• First bit 0 → indicates an I-frame.
• N(S) (3 bits) → sequence number of the frame (0–7).
• P/F bit → dual purpose: Poll (primary→secondary) or Final
(secondary→primary).
• N(R) (3 bits) → Acknowledgment number when piggybacking is used.
S-Frame Identification & Structure
• First two bits 10 → indicates an S-frame.
• No information field (only control data).
• Contains N(R) (ACK or NAK number) and a 2-bit code specifying
S-frame type.
S-Frame Types
• RR (Receive Ready) – Code 00; ACKs frames and indicates readiness to
receive more.
• RNR (Receive Not Ready) – Code 10; ACKs frames but tells sender the
receiver is busy (flow control).
• REJ (Reject) – Code 01; NAK used in Go-Back-N ARQ to request
retransmission from a specific frame.
• SREJ (Selective Reject) – Code 11; NAK used in Selective Repeat ARQ
for a specific lost/damaged frame.
U-Frame Purpose
• Used for session management and control information between devices.
Can carry an information field, but only for management data, not user
data.
U-Frame Control Field Structure
• Divided into 2-bit prefix (before P/F bit) and 3-bit suffix (after P/F bit).
• Combined, these 5 bits can define up to 32 different U-frame types.
• P/F Bit Role Across All Frame Types
• In all frames, the P/F bit signals Poll (primary asking for response) or Final
(secondary indicating last frame in response).Only meaningful when set to
1.
Point-to-Point(PPP) Protocol
Introduction to PPP
•Common protocol for point-to-point connections over serial links.
•Widely used by ISPs for dial-up Internet access.
•Works over physical links like telephone lines, ISDN, fiber, and direct connections.
•Operates at the Data Link Layer in the OSI model.
•Supports encapsulation of multiple network layer protocols (IP, IPv6, IPX, etc.).
Services Provided by PPP
• Frame Formatting – Defines structure for transmitting data.
• Link Establishment & Negotiation – Manages connection setup.
• Multi-Protocol Support – Can carry payloads from various network
protocols.
• Optional Authentication – Supports PAP (Password Authentication
Protocol), CHAP (Challenge Handshake Authentication Protocol) for
secure access.
• Dynamic Address Assignment – Temporary IP address configuration
for clients.
Services Not Provided by PPP
•No Flow Control – Sender can send multiple frames without waiting.
•Error Detection Only – Uses CRC to detect errors, no correction.
•No Error Recovery – Corrupted frames are discarded silently.
•No Sequence Numbers – Packets may arrive out of order.
•No Advanced Addressing – Not suited for multipoint networks.
PPP Frame Format
• Flag – 1 byte, 01111110, marks start and end of frame.
• Address – 1 byte, constant 11111111 (broadcast).
• Control – 1 byte, constant 00000011 (unnumbered frame).
• Protocol – Identifies payload type (default 2 bytes).
• Payload – User data or control info (default max 1500 bytes).
• FCS – 2 or 4-byte CRC for error detection.
Byte Stuffing in PPP
Purpose – Prevents confusion between data and control flag.
Escape Byte – 01111101 used to indicate next byte is data, not a flag.
Stuffing Rule – Flag byte inside data is preceded by escape byte.
Escape Byte Stuffing – Escape byte is doubled if it appears in data.
Unstuffing – Receiver removes extra escape bytes to restore original
data.
Dead State
•Meaning: No active physical link; line is quiet.
•Entry: Start state or after carrier signal is dropped.
•Next:
•If carrier detected → go to Establish.
•If carrier detection fails → stay here.
Establish State
•Purpose: Negotiate link parameters (using LCP – Link Control Protocol packets).
•Next:
•If authentication required → go to Authenticate.
•If no authentication → go directly to Network phase.
Authenticate State (Optional)
•Purpose: Verify the identity of the other party.
•Next:
•If authentication successful → go to Network phase.
•If authentication fails → go to Terminate.

Network Phase
•Purpose: Configure network-layer protocols (e.g., assign IP addresses).
•Next: → Move to Open state for data transfer.

Open State (Data Transfer State)


•Purpose: Actual exchange of user data packets.
•Stay here until one side requests termination.

Terminate State
•Purpose: Gracefully close the link.
•Next: Wait until carrier is dropped, then return to Dead.
11.4.4 Multiplexing
Three Sets of Protocols in PPP:
• Link Control Protocol (LCP)
• Purpose:
• Establish, configure, maintain, and terminate the link.
• Negotiate link parameters between endpoints.
• Role in Transition Phases: Used in the Establish phase.
• Both sides must agree on the options before data transfer starts.
• Authentication Protocols (APs)
• Two types are defined (e.g., PAP, CHAP).
• Purpose: Authenticate the identity of the two communicating parties before
allowing data transfer.
• Network Control Protocols (NCPs)
• Multiple NCPs exist — one for each network-layer protocol being carried (e.g., IPCP
for IP, IPXCP for IPX).
• Purpose: Configure and enable the network-layer protocols over the PPP link.
At any given moment, the data field of a PPP frame can carry:
• LCP packets (for link setup/configuration)AP packets (for
authentication)
• NCP packets (for network-layer configuration)Actual network-layer
data packets (once the link is open)
• PPP identifies what type of data is inside the frame using a Protocol
field.
• LCP Packet Encapsulation in PPP Frame
• Purpose:
The Link Control Protocol (LCP) packets are used to establish,
configure, and maintain a PPP link.
These packets are encapsulated inside PPP frames for transmission.
• LCP Packets – PPP uses Link Control Protocol (LCP) packets for configuration,
termination, and link monitoring/debugging. The ID matches requests to replies;
options can be negotiated in configuration packets.
• PAP Authentication – Password Authentication Protocol sends username and
password in plain text (Authenticate-Request → Authenticate-Ack/Nak). Less
secure because credentials travel over the link.
• CHAP Authentication – Challenge Handshake Authentication Protocol uses a
3-way handshake with a challenge value and hashed response; password is never
sent directly. More secure than PAP.
• NCP Protocols – Network Control Protocols configure the link for specific
network-layer protocols (e.g., IPCP for IP, Xerox CP for Xerox). They don’t carry
actual data—only configuration.
• Data Transfer – Once configured, PPP carries network-layer packets. Protocol field
values indicate the type of network-layer protocol (e.g., 0x0021 for IP).
• Multilink PPP – Splits one logical PPP frame across multiple physical channels.
Uses sequence numbers and protocol value 0x003D to identify frame fragments.

You might also like