0% found this document useful (0 votes)
73 views

High Level Data Link

HDLC is a bit-oriented protocol that provides both connection-oriented and connectionless services at the data link layer. It can be used for point-to-multipoint connections but is now mostly used for point-to-point connections between two devices using Asynchronous Balanced Mode. HDLC frames contain flags at the beginning and end for synchronization, optional addresses, control fields, payload data, and a frame check sequence for error detection.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

High Level Data Link

HDLC is a bit-oriented protocol that provides both connection-oriented and connectionless services at the data link layer. It can be used for point-to-multipoint connections but is now mostly used for point-to-point connections between two devices using Asynchronous Balanced Mode. HDLC frames contain flags at the beginning and end for synchronization, optional addresses, control fields, payload data, and a frame check sequence for error detection.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

High-Level Data Link Control

Internet Protocol Suite

Application Layer

BGP · DHCP · DNS · FTP · HTTP · IMAP · IRC ·


LDAP · MGCP · NNTP · NTP · POP · RIP · RPC ·
RTP · SIP · SMTP · SNMP · SSH · Telnet ·
TLS/SSL · XMPP ·

(more)

Transport Layer

TCP · UDP · DCCP · SCTP · RSVP · ECN ·

(more)

Internet Layer

IP (IPv4, IPv6) · ICMP · ICMPv6 · IGMP · IPsec ·

(more)

Link Layer

ARP/InARP · NDP · OSPF · Tunnels (L2TP) ·


PPP · Media Access Control (Ethernet, DSL, ISDN,
FDDI) · (more)

v·d·e

High-Level Data Link Control (HDLC) is a bit-oriented synchronous data link layer protocol
developed by the International Organization for Standardization (ISO). The original ISO
standards for HDLC are:

 ISO 3309 — Frame Structure


 ISO 4335 — Elements of Procedure
 ISO 6159 — Unbalanced Classes of Procedure
 ISO 6256 — Balanced Classes of Procedure
The current standard for HDLC is ISO 13239, which replaces all of those standards.

HDLC provides both connection-oriented and connectionless service.

HDLC can be used for point to multipoint connections, but is now used almost exclusively to
connect one device to another, using what is known as Asynchronous Balanced Mode (ABM).
The original master-slave modes Normal Response Mode (NRM) and Asynchronous Response
Mode (ARM) are rarely used.

History
HDLC is based on IBM's SDLC protocol, which is the layer 2 protocol for IBM's Systems
Network Architecture (SNA). It was extended and standardized by the ITU as LAP, while ANSI
named their essentially identical version ADCCP.

Derivatives have since appeared in innumerable standards. It was adopted into the X.25 protocol
stack as LAPB, into the V.42 protocol as LAPM, into the Frame Relay protocol stack as LAPF
and into the ISDN protocol stack as LAPD. It was the inspiration for the IEEE 802.2 LLC
protocol, and it is the basis for the framing mechanism used with the PPP on synchronous lines,
as used by many servers to connect to a WAN, most commonly the Internet. A mildly different
version is also used as the control channel for E-carrier (E1) and SONET multichannel telephone
lines. Some vendors, such as Cisco, implemented protocols such as Cisco HDLC that used the
low-level HDLC framing techniques but added a protocol field to the standard HDLC header.
More importantly, HDLC is the default encapsulation for serial interfaces on Cisco routers. It has
also been used on Tellabs DXX for destination of Trunk.

Framing
HDLC frames can be transmitted over synchronous or asynchronous links. Those links have no
mechanism to mark the beginning or end of a frame, so the beginning and end of each frame has
to be identified. This is done by using a frame delimiter, or flag, which is a unique sequence of
bits that is guaranteed not to be seen inside a frame. This sequence is '01111110', or, in
hexadecimal notation, 0x7E. Each frame begins and ends with a frame delimiter. A frame
delimiter at the end of a frame may also mark the start of the next frame. A sequence of 7 or
more consecutive 1-bits within a frame will cause the frame to be aborted.

When no frames are being transmitted on a simplex or full-duplex synchronous link, a frame
delimiter is continuously transmitted on the link. Using the standard NRZI encoding from bits to
line levels (0 bit = transition, 1 bit = no transition), this generates one of two continuous
waveforms, depending on the initial state:
This is used by modems to train and synchronize their clocks via phase-locked loops. Some
protocols allow the 0-bit at the end of a frame delimiter to be shared with the start of the next
frame delimiter, i.e. '011111101111110'.

For half-duplex or multi-drop communication, where several transmitters share a line, a receiver
on the line will see continuous idling 1-bits in the inter-frame period when no transmitter is
active.

Since the flag sequence could appear in user data, such sequences must be modified during
transmission to keep the receiver from detecting a false frame delimiter. The receiver must also
detect when this has occurred so that the original data stream can be restored before it is passed
to higher layer protocols. This can be done using bit stuffing, in which a "0" is added before the
occurrence of every "11111" in the data. The receiver, when detects these "11111" in the data,
removes a "0" added by the transmitter.

Synchronous framing

On synchronous links, this is done with bit stuffing. Any time that 5 consecutive 1-bits appear in
the transmitted data, the data is paused and a 0-bit is transmitted. This ensures that no more than
5 consecutive 1-bits will be sent. The receiving device knows this is being done, and after seeing
5 1-bits in a row, a following 0-bit is stripped out of the received data. If the following bit is a 1-
bit, the receiver has found a flag.

This also (assuming NRZI with transition for 0 encoding of the output) provides a minimum of
one transition per 6 bit times during transmission of data, and one transition per 7 bit times
during transmission of flag, so the receiver can stay in sync with the transmitter. Note however,
that for this purpose encodings such as 8b/10b encoding are better suited.

HDLC transmits bytes of data with the least significant bit first (little-endian order).

Asynchronous framing

When using asynchronous serial communication such as standard RS-232 serial ports, bits are
sent in groups of 8, and bit-stuffing is inconvenient. Instead they use "control-octet
transparency", also called "byte stuffing" or "octet stuffing". The frame boundary octet is
01111110, (7E in hexadecimal notation). A "control escape octet", has the bit sequence
'01111101', (7D hexadecimal). If either of these two octets appears in the transmitted data, an
escape octet is sent, followed by the original data octet with bit 5 inverted. For example, the data
sequence "01111110" (7E hex) would be transmitted as "01111101 01011110" ("7D 5E" hex).
Other reserved octet values (such as XON or XOFF) can be escaped in the same way if
necessary.
Structure
The contents of an HDLC frame are shown in the following table:

Flag Address Control Information FCS Flag


8 bits 8 or more bits 8 or 16 bits Variable length, 0 or more bits 16 or 32 bits 8 bits

Note that the end flag of one frame may be (but does not have to be) the beginning (start) flag of
the next frame.

Data is usually sent in multiples of 8 bits, but only some variants require this; others theoretically
permit data alignments on other than 8-bit boundaries.

The frame check sequence (FCS) is a 16-bit CRC-CCITT or a 32-bit CRC-32 computed over the
Address, Control, and Information fields. It provides a means by which the receiver can detect
errors that may have been induced during the transmission of the frame, such as lost bits, flipped
bits, and extraneous bits. However, given that the algorithms used to calculate the FCS are such
that the probability of certain types of transmission errors going undetected increases with the
length of the data being checked for errors, the FCS can implicitly limit the practical size of the
frame.

If the receiver's calculation of the FCS does not match that of the sender's, indicating that the
frame contains errors, the receiver can either send a negative acknowledge packet to the sender,
or send nothing. After either receiving a negative acknowledge packet or timing out waiting for a
positive acknowledge packet, the sender can retransmit the failed frame.

The FCS was implemented because many early communication links had a relatively high bit
error rate, and the FCS could readily be computed by simple, fast circuitry or software. More
effective forward error correction schemes are now widely used by other protocols.

Types of Stations (Computers), and Data Transfer Modes


Synchronous Data Link Control (SDLC) was originally designed to connect one computer with
multiple peripherals. The original "normal response mode" is a master-slave mode where the
computer (or primary terminal) gives each peripheral (secondary terminal) permission to
speak in turn. Because all communication is either to or from the primary terminal, frames
include only one address, that of the secondary terminal; the primary terminal is not assigned an
address. There is also a strong distinction between commands sent by the primary to a
secondary, and responses sent by a secondary to the primary. Commands and responses are in
fact indistinguishable; the only difference is the direction in which they are transmitted.

Normal response mode allows operation over half-duplex communication links, as long as the
primary is aware that it may not transmit when it has given permission to a secondary.
Asynchronous response mode is an HDLC addition[1] for use over full-duplex links. While
retaining the primary/secondary distinction, it allows the secondary to transmit at any time.

Asynchronous balanced mode added the concept of a combined terminal which can act as both
a primary and a secondary. There are some subtleties about this mode of operation; while many
features of the protocol do not care whether they are in a command or response frame, some do,
and the address field of a received frame must be examined to determine whether it contains a
command (the address received is ours) or a response (the address received is that of the other
terminal).

Some HDLC variants extend the address field to include both source and destination addresses,
or an explicit command/response bit.

HDLC Operations, and Frame Types


There are three fundamental types of HDLC frames.

 Information frames, or I-frames, transport user data from the network layer. In addition
they can also include flow and error control information piggybacked on data.
 Supervisory Frames, or S-frames, are used for flow and error control whenever
piggybacking is impossible or inappropriate, such as when a station does not have data to
send. S-frames do not have information fields.
 Unnumbered frames, or U-frames, are used for various miscellaneous purposes,
including link management. Some U-frames contain an information field, depending on
the type.

The general format of the control field is:

HDLC control fields


7 6 5 4 3 2 1 0
N(R) N(S)
P/F 0 I-frame
Receive sequence no. Send sequence no.
N(R)
P/F type 0 1 S-frame
Receive sequence no.
type P/F type 1 1 U-frame

There are also extended (2-byte) forms of I and S frames. Again, the least significant bit
(rightmost in this table) is sent first.

Extended HDLC control fields


15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
N(R) N(S)
P/F 0 Extended I-frame
Receive sequence no. Send sequence no.
N(R)
P/F 0 0 0 0 type 0 1 Extended S-frame
Receive sequence no.
The P/F bit

Poll/Final is a single bit with two names. It is called Poll when set by the primary station to
obtain a response from a secondary station, and Final when set by the secondary station to
indicate a response or the end of transmission. In all other cases, the bit is clear.

The bit is used as a token that is passed back and forth between the stations. Only one token
should exist at a time. The secondary only sends a Final when it has received a Poll from the
primary. The primary only sends a Poll when it has received a Final back from the secondary, or
after a timeout indicating that the bit has been lost.

 In NRM, possession of the poll token also grants the addressed secondary permission to
transmit. The secondary sets the F-bit in its last response frame to give up permission to
transmit. (It is equivalent to the word "Over" in radio voice procedure.)
 In ARM and ABM, the P bit forces a response. In these modes, the secondary need not
wait for a poll to transmit, so need not wait to respond with a final bit.
 If no response is received to a P bit in a reasonable period of time, the primary station
times out and sends P again.
 The P/F bit is at the heart of the basic checkpoint retransmission scheme that is required
to implement HDLC; all other variants (such as the REJ S-frame) are optional and only
serve to increase efficiency. Whenever a station receives a P/F bit, it may assume that any
frames that it sent before it last transmitted the P/F bit and not yet acknowledged will
never arrive, and so should be retransmitted.

When operating as a combined station, it is important to maintain the distinction between P and
F bits, because there may be two checkpoint cycles operating simultaneously. A P bit arriving in
a command from the remote station is not in response to our P bit; only an F bit arriving in a
response is.

N(R), the receive sequence number

Both I and S frames contain a receive sequence number N(R). N(R) provides a positive
acknowledgement for the receipt of I-frames from the other side of the link. Its value is always
the first frame not received; it acknowledges that all frames with N(S) values up to N(R)-1
(modulo 8 or modulo 128) have been received and indicates the N(S) of the next frame it expects
to receive.

N(R) operates the same way whether it is part of a command or response. A combined station
only has one sequence number space.

N(S), the sequence number of the sent frame

This is incremented for successive I-frames, modulo 8 or modulo 128. Depending on the number
of bits in the sequence number, up to 7 or 127 I-frames may be awaiting acknowledgment at any
time.
I-Frames (user data)

Information frames, or I-frames, transport user data from the network layer. In addition they
also include flow and error control information piggybacked on data. The sub-fields in the
control field define these functions.

The least significant bit (first transmitted) defines the frame type. 0 means an I-frame. Except for
the interpretation of the P/F field, there is no difference between a command I frame and a
response I frame; when P/F is 0, the two forms are exactly equivalent.

S-Frames (control)

Supervisory Frames, or S-frames, are used for flow and error control whenever piggybacking is
impossible or inappropriate, such as when a station does not have data to send. S-frames do not
have information fields.

The S-frame control field includes a leading "10" indicating that it is an S-frame. This is
followed by a 2-bit type, a poll/final bit, and a sequence number. If 7-bit sequence numbers are
used, there is also a 4-bit padding field.

The first 2 bits mean it is an S-frame. All S frames include a P/F bit and a receive sequence
number as described above. Except for the interpretation of the P/F field, there is no difference
between a command S frame and a response S frame; when P/F is 0, the two forms are exactly
equivalent.

The 2-bit type field encodes the type of S frame.

Receive Ready (RR)

 Indicate that the sender is ready to receive more data (cancels the effect of a previous
RNR).
 Send this packet if you need to send a packet but have no I frame to send.
 A primary station can send this with the P-bit set to solicit data from a secondary station.
 A secondary terminal can use this with the F-bit set to respond to a poll if it has no data to
send.

Receive Not Ready (RNR)

 Acknowledge some packets and request no more be sent until further notice.
 Can be used like RR with P bit set to solicit the status of a secondary station.
 Can be used like RR with F bit set to respond to a poll if the station is busy.

Reject (REJ)

 Requests immediate retransmission starting with N(R).


 Sent in response to an observed sequence number gap. After seeing I1/I2/I3/I5, send
REJ4.
 Optional to generate; a working implementation can use only RR.

Selective Reject (SREJ)

 Requests retransmission of only the frame N(r).


 Not supported by all HDLC variants.
 Optional to generate; a working implementation can use only RR, or only RR and REJ.

U-Frames

Unnumbered frames, or U-frames, are used for link management, and can also be used to
transfer user data. They exchange session management and control information between
connected devices, and some U-frames contain an information field, used for system
management information or user data. The first 2 bits (11) mean it is a U-frame. The 5 type bits
(2 before P/F bit and 3 bit after P/F bit) can create 32 different types of U-frame

 Mode settings (SNRM, SNRME, SARM, SARME, SABM, SABME, UA, DM, RIM,
SIM, RD, DISC)
 Information Transfer (UP, UI)
 Recovery (FRMR, RSET)
o Invalid Control Field
o Data Field Too Long
o Data field not allowed with received Frame Type
o Invalid Receive Count
 Miscellaneous (XID, TEST)

HDLC has three operational modes:

 Normal Response Mode (NRM - Normal Response Mode is used in unbalanced


configurations. In this mode, slave stations (or secondary) can only transmit when
specially instructed by the master (primary station). The link may be point-to-point or
multipoint. In the latter case only one primary station is allowed.
 Asynchronous Response Mode (ARM - Asynchronous Response Mode: This mode is
used in unbalanced configurations. [unbalanced configurations]. It allows a secondary
station to initiate a transmission without receiving permission from the primary station .
This mode is normally used with point-to-point configurations and full duplex links and
allows the secondary station to send frames asynchronously with respect to the primary
station)
 Asynchronous Balanced Mode (ABM - The Asynchronous Balanced Mode (ABM), is
used mainly on full duplex point-to-point links for computer to computer communications
and for connections between a computer and a packed switched data network, in this
case each station has an equal status and performs the role of both primary and
secondary functions. This mode is used in the protocol set known as X.25.)

Link Configurations
Link configurations can be categorized as being either:

 Unbalanced, which consists of one primary terminal, and one or more secondary
terminals.
 Balanced, which consists of two peer terminals.

The three link configurations are:

 Normal Response Mode (NRM) is an unbalanced configuration in which only the primary
terminal may initiate data transfer. The secondary terminal transmits data only in
response to commands from the primary terminal. The primary terminal polls the
secondary terminal(s) to determine whether they have data to transmit, and then selects
one to transmit.
 Asynchronous Response Mode (ARM) is an unbalanced configuration in which secondary
terminals may transmit without permission from the primary terminal. However, the
primary terminal still retains responsibility for line initialization, error recovery, and
logical disconnect.
 Asynchronous Balanced Mode (ABM) is a balanced configuration in which either station
may initiate the transmission.

An additional link configuration is Disconnected mode. This is the mode that a secondary station
is in before it is initialized by the primary, or when it is explicitly disconnected. In this mode, the
secondary responds to almost every frame other than a mode set command with a "Disconnected
mode" response. The purpose of this mode is to allow the primary to reliably detect a secondary
being powered off or otherwise reset..

. Priorto any kind of transmission (either between two stations connected by a point to point link
or between a primary and secondary station a multidrop link) a logical connection (A logical
connection between the two communication parties is accomplished by the exchange of two
unnumbered frames. The procedure for setting a logical connection (In a multidrop link) is given
below:The SNRM is first sent by the primary station with the poll bit set to 1 and the address of
the appropriate secondary in the address field. The secondary responds with a UA frame with
the final bit set and its own address in the address field. After all the data has been transferred,
the link is clears by the primary sending a DISC frame and the secondary responding with a UA)
between the two communication parties must be established.
HDLC Command and response repertoire
 Commands (BALA, I, RR, RNR, (SNRM or SARM or SABM) DISC
 Responses (I, RR, RNR, UA, DM, FRMR)

Basic Operations

 Initialization can be requested by either side. When the six-mode set-command is issued.
This command:
o Signals the other side that initialization is requested
o Specifies the mode, NRM, ABM, ARM
o Specifies whether 3 or 7 bit sequence numbers are in use.

The HDLC module on the other end transmits (UA) frame when the request is accepted. And if
the request is rejected it sends (DM) disconnect mode frame.

Functional Extensions (Options)

 For Switched Circuits


o Commands: ADD - XID
o Responses: ADD - XID, RD
 For 2-way Simultaneous commands & responses are ADD - REJ
 For Single Frame Retransmission commands & responses: ADD - SREJ
 For Information Commands & Responses: ADD - Ul
 For Initialization
o Commands: ADD - SIM
o Responses: ADD - RIM
 For Group Polling
o Commands: ADD - UP
 Extended Addressing
 Delete Response I Frames
 Delete Command I Frames
 Extended Numbering
 For Mode Reset (ABM only) Commands are: ADD - RSET
 Data Link Test Commands & Responses are: ADD - TEST
 Request Disconnect. Responses are ADD - RD
 32-bit FCS

HDLC Command/Response Repertoire


Type Of Command/ C-Field Format
Name Description Info
Frame Response 765 4 3210
Information(I) C/R User exchange data N(R) P/F N(S) 0
Ready to
Supervisory Receive Positive
C/R receive I-frame N(R) P/F 0 0 0 1
(S) Ready (RR) Acknowledgement
N(R)
Receive Not Positive Not ready to
C/R N(R) P/F 0 1 0 1
Ready (RNR) Acknowledgement receive
Retransmit
Negative
Reject (REJ) C/R starting with N(R) P/F 1 0 0 1
Acknowledgement
N(R)
Selective
Negative Retransmit only
Reject C/R N(R) P/F 1 1 0 1
Acknowledgement N(R)
(SREJ)

Unnumbered Frames

Unnumbered frames are identified by the low two bits being 1. With the P/F flag, that leaves 5
bits as a frame type. Even though fewer than 32 values are in use, some types have different
meanings depending on the direction they are sent: as a request or as a response. The relationship
between the DISC (disconnect) command and the RD (request disconnect) response seems clear
enough, but the reason for making SARM command numerically equal to the DM response is
obscure.

Command/ C-Field Format


Name Description Info
Response 765 4 3210
Set normal response Use 3 bit
C Set mode 100 P 0011
SNRM sequence number
Set normal response Use 7 bit
C Set mode; extended 110 P 1111
extended mode SNRME sequence number
Set asynchronous response Use 3 bit
C Set mode 000 P 1111
SARM sequence number
Set asynchronous response Use 7 bit
C Set mode; extended 010 P 1111
extended mode SARME sequence number
Set asynchronous balanced Use 3 bit
C Set mode 001 P 1111
mode SABM sequence number
Set asynchronous balanced Use 7 bit
C Set mode; extended 011 P 1111
extended mode SABME sequence number
Set initialization mode Initialize link control function in the
C 000 P 0111
SIM addressed station
Future I and S
Terminate logical link
Disconnect DISC C frames return 010 P 0011
connection
DM
Unnumbered Acknowledge acceptance of one of the
R 011 F 0011
Acknowledgment UA set-mode commands.
Responder in mode set
Disconnect Mode DM R 000 F 1111
Disconnect Mode required
Solicitation for DISC
Request Disconnect RD R 010 F 0011
Command
Request Initialization Request for SIM
R Initialization needed 000 F 0111
Mode RIM command
Unnumbered Information
C/R Unacknowledged data has a payload 0 0 0 P/F 0 0 1 1
UI
Unnumbered Poll UP C Used to solicit control information 001 P 0011
Resets N(R) but
Reset RSET C Used for recovery 100 P 1111
not N(S)
Exchange Identification
C/R Used to Request/Report capabilities 1 0 1 P/F 1 1 1 1
XID
Exchange identical information fields
Test TEST C/R 1 1 1 P/F 0 0 1 1
for testing
Frame Reject FRMR R Report receipt of unacceptable frame 100 F 0111
For application
Nonreserved 0 NR0 C/R Not standardized 0 0 0 P/F 1 0 1 1
use
For application
Nonreserved 1 NR1 C/R Not standardized 1 0 0 P/F 1 0 1 1
use
For application
Nonreserved 2 NR2 C/R Not standardized 0 1 0 P/F 1 0 1 1
use
For application
Nonreserved 3 NR3 C/R Not standardized 1 1 0 P/F 1 0 1 1
use
Was part of
Configure for test CFGR C/R Not part of HDLC 1 1 0 P/F 0 1 1 1
SDLC
Was part of
Beacon BCN R Not part of HDLC 111 F 1111
SDLC

The UI, XID and TEST frames contain a payload, and can be used as both commands and
responses.
 A UI frame contains user information, but unlike an I frame it is not acknowledged or
retransmitted if lost.
 The XID frame is used to exchange terminal capabilities. IBM Systems Network
Architecture defined one format, but the variant defined in ISO 8885 is more commonly
used. A primary advertisies its capabilities with an XID command, and a secondary
returns an XID response.
 The TEST frame is simply a ping command for debugging purposes. The payload of the
TEST command is returned in the TEST response.

You might also like