Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
HDLC PROTOCOL
Michel GARDIE
INT/LOR/RIP October 15, 2007
The version of this document is temporary. There are still several mistakes. I'm sorry for that.
email: [email protected]
© 1985 FRANCE TELECOM INT/DIT/TI© 1992 INT/DSR/TI© 1994 INT/LOR/AIGRI© 2000 GET/INT/LOR/RIP© 2001 GET/INT/LOR/RIP© 2005 GET/INT/LOR/RIP© 2006 GET/INT/LOR/RIP© 2007 GET/INT/LOR/RIP
Generated with OpenOffice.org 2.3 under Fedora 5
Tous droits réservés. Aucune partie de ce document ne peut être reproduite ou transmise sous quelque forme ou par quelque procédé que ce soit (machine électronique ou mécanique, photocopie, enregistrement, photographie ou tout autre) sans le consentement écrit préalable de l’auteur ou de ses ayant-droits.
GET/INT/LOR/RIP 2 of 33 October 15, 2007
HDLC
ISO 3309 Data communication – High-level data link control procedures – Frame structure.
ISO 4335 Data communication – High-level data link control procedures – Elements of procedure.
ISO 6256 Data communication – HDLC unbalanced classes of procedures.
ISO 8885 Information processing systems – Data communication -- High-level data link control procedures – General purpose XID frame information field content and format.
ISO/IEC 13239 Information technology – Telecommunications and information exchange between systems – High-level data link control (HDLC) procedures. 2002. (Revises 3309, 4335, 6256, 8885)
HDLC is used in X.25 networks, has been adapted to create the PPP protocol (Internet), or the LAPDm protocol (data link layer on the GSM radio interface).
GET/INT/LOR/RIP 3 of 33 October 15, 2007
HIGH-LEVEL DATA LINK CONTROL
HDLC
Overview
● Synchronous
● Bit-oriented
● Full-duplex
● Transparent
● Point-to-point or multipoint links
Features
● One frame structure
● Several elements of procedure
GET/INT/LOR/RIP 4 of 33 October 15, 2007
FRAME STRUCTURE
Definition
Data and control information are transmitted within a single structure: the frame
Frame structure
flag: sequence for synchronization and delimitation
address: address of the secondary station
control: controls the protocol behavior
information: user data field
FCS: frame check sequence
GET/INT/LOR/RIP 5 of 33 October 15, 2007
Flag01111110
Flag01111110
Address8 bits
FCS16 bits
Information0 ≤ n < ∞ bits
Control8 bits
FRAME FIELDS
Flag
● delimitation
start of frame
end of frame
● synchronization
● inter-frame filling
Address
● Address of the secondary station
a secondary station receives command frames
Control
● identifies the different frames
● numbers the information frames
● acknowledges the information frames
● supervises the data link
GET/INT/LOR/RIP 6 of 33 October 15, 2007
FRAME FIELDS
Information field
● optional
● sequence of n bits
● user defined
FCS
● allows detection of transmission errors
● cyclic redundancy check
● polynomial: x16 + x12 + x5 + 1
GET/INT/LOR/RIP 7 of 33 October 15, 2007
FRAME CHARACTERISTICS
Transparency
● Allows to transmit any bit pattern
● Principle (between two [non included] flags)
Emission: inserts 1 "zero" after 5 consecutive "ones"
Reception: suppresses every "zero" following 5 consecutive "ones"
Frame inter-filling
● Maintains the synchronization
● Continuous emission of flags
Frame abandon
● Forces the receiver to ignore a frame
● Sequence of M bits: M ≥ 7
GET/INT/LOR/RIP 8 of 33 October 15, 2007
TRANSPARENCY
The aim of transparency is to transmit any bit pattern between two flags.
HDLC uses a special bit pattern (01111110) as a delimiter. This special pattern is called a flag.A receiver enters the reception state (and remains in this state) when it receives any bit pattern different from the delimitation pattern. It quits the reception state when it detects a new flag.However, the delimitation pattern can be found anywhere between two real flags:
● it can be an ASCII character (tilde; "~") whose binary coding is 01111110● it can be the association of two adjacent bytes giving the illusion of a flag.
For instance, let us consider the two following bytes: 10010011 and 11110011. When these byte are put together, we obtain the following binary stream: 1001001111110011 where a "flag" seems to appear.We absolutely must remove these pseudo-flags when sending a frame. On the reception side, we will have to restore the original bit stream.
The principle to do that is simple, and is applied only between two flags.On the sender side, we systematically add one "0" after five consecutive "1"s.On the receiver side, each time we receive five consecutive "1"s, we apply the following algorithm:
1. if the next bit is a "0", this bit is immediately and systematically removed2. if the next bit is a "1", there are two possibilities:
a) the next bit after this "1" is a "0": we are detecting a real flag. This is the end of the frame;
b) the next bit after this "1" is still a "1": we are detecting an abandon sequence. The frame must be discarded.
GET/INT/LOR/RIP 9 of 33 October 15, 2007
FRAME CHARACTERISTICS
Invalid frames
● Frame too short: less than 32 bits
● Frame too Long1
Extensions
● Address field (2 or 3 bytes)
● Control field (2 bytes)
1 Example: the final flag has not been detected by the receiver, and its reception buffer is full.
GET/INT/LOR/RIP 10 of 33 October 15, 2007
ELEMENTS OF PROCEDURE
The elements of procedure define how to use the basic element of the protocol: the
frame.
The rest of this document presents the following points:
● the different types of frame
information
supervision
unnumbered
● the rules of restart
● the transmission controls
● the "command" and "response" frames
GET/INT/LOR/RIP 11 of 33 October 15, 2007
FRAME TYPES
N(S) number of the sent frame
N(R) number of the next expected frame
SS bits defining the supervision functions
UUUUU bits defining the extra functions
P/F P (poll) = request of an explicit response
F (final) = indication of an explicit response
GET/INT/LOR/RIP 12 of 33 October 15, 2007
F A C Info FCS F
8 7 6 5 4 3 2 1
N(R) N(S) 0
1
1
0
1
P/F
P/F
P/F
N(R)
U U U U U
S S
FRAME TYPES
Information
● The information field is not empty and its content is defined by the user.
● The frame numbers are modulo 8 2
N(S) number of the sent frame
N(R) number of the next expected frame
Supervision
● No information field
● Number transmitted by the frame: N(R)
● This type of frame is used to:
acknowledge information frames
reject information frames
specify the state of the receiving station
2 It is possible to use a modulus of 128. This is negotiated when establishing the connection.
GET/INT/LOR/RIP 13 of 33 October 15, 2007
FRAME TYPES
Unnumbered
● No information field
● No frame number
● Basic control of the data link
initialization (connection)
connection reject
disconnection
indication of protocol errors
GET/INT/LOR/RIP 14 of 33 October 15, 2007
SUPERVISION FUNCTIONS
S4, S3 = 0,0 RR Receiver Ready
S4, S3 = 1,0 REJ Reject
S4, S3 = 0,1 RNR Receiver Not Ready
S4, S3 = 1,1 SREJ Selective Reject
GET/INT/LOR/RIP 15 of 33 October 15, 2007
F A C Info FCS F
8 7 6 5 4 3 2 1
N(R) 10P/F S S
SUPERVISION FRAMES
All the frames below acknowledge information frames whose number is less or equal
to N(R) – 1 (modulo n).
RR RECEIVER READY
● The receiver is ready to process new information frames.
● The previous received information frames have been correctly processed and their content has been delivered to the user.
REJ REJECT
● The receiver requests the retransmission of all information frames starting from the number N(R).
GET/INT/LOR/RIP 16 of 33 October 15, 2007
SUPERVISION FRAMES
RNR RECEIVER NOT READY
● The receiver temporarily cannot receive extra information frames.
● The previous frames (up to N(R) - 1) were correctly received but their content could not be delivered to the user.
SREJ SELECTIVE REJECT
● The receiver requests the retransmission of the information frame whose number is N(R).
● The next received frames (after N(R)) have been correctly received, and have been stored; the content of these frames has not been delivered to the user.
● The use of this supervision frame is optional.
GET/INT/LOR/RIP 17 of 33 October 15, 2007
EXTRA FUNCTIONS
FORMAT OF THE CONTROL FIELD OF THE UNNUMBERED FRAMES
The table below only gives the most common frames.
Table 1: Bits of the control field
8 7 6 5 4 3 2 1 Meaning
0 0 0 P/F 1 1 1 1SARM
Set Asynchronous Response Mode
0 0 1 P/F 1 1 1 1SABM
Set Asynchronous Balanced Mode
0 1 0 P/F 0 0 1 1DISC
Disconnect
0 1 1 P/F 0 0 1 1UA
Unnumbered Acknowledgment
0 0 0 P/F 1 1 1 1DM
Disconnected Mode
1 0 0 P/F 0 1 1 1CMDR / FRMR
Command Reject / Frame Reject
The CMDR / FRMR frames contain an information field explaining the reason of the reject.
GET/INT/LOR/RIP 18 of 33 October 15, 2007
EXTRA FUNCTIONS
LAPB (LINK ACCESS PROTOCOL BALANCED)
SABM
● Frame nature: command.
● Select the balanced mode (LAPB).
● The stations can both manage the data link.
● The acceptation of the connection is done with a UA frame.
● The rejection of the connection is done with a DM frame.
DISC
● Frame nature: command.
● Generates the logical disconnection of the data link between two stations.
● The receiving station must answer with a UA.
GET/INT/LOR/RIP 19 of 33 October 15, 2007
EXTRA FUNCTIONS
UA
● Frame nature: response.
● Accepts a command.
FRMR
● Frame nature: response.
● Rejects a command:
after an error;
if the requested command is not implemented.
DM
● Frame nature: response.
● Two functions:
Indicates that a station is not logically connected.
Rejects a command
GET/INT/LOR/RIP 20 of 33 October 15, 2007
RULES OF RESTART
Some error conditions or abnormal behavior may occur. The rules of restart resolve these problems.
OVERFLOW
● A station, which cannot receive any more information frames, sends a RNR frame with N(R) indicating the first unaccepted frame.
● The station sends a RR frame as soon as it is ready again to receive new information frames.
TRANSMISSION ERROR
● Any frame, whose FCS computation indicates a transmission error, must be discarded.
● No other specific action should be undertaken by the receiver.
WRONG N(S) (REJ VERSION)
● Any information frame whose N(S) does not contain the expected value must be discarded; the next frames must be ignored too.
● The station receiving such a frame must then send a REJ frame with N(R) indicating the expected frame number.
GET/INT/LOR/RIP 21 of 33 October 15, 2007
RULES OF RESTART
WRONG N(S) (SREJ VERSION)
● Any information frame whose N(S) does not contain the expected value must be discarded. The eventual next information frames should be stored.
● A station receiving such a frame must then send a SREJ frame with N(R) indicating the expected frame number.
COMMAND REJECT
● After receiving a CMDR / FRMR frame, the data link is supposed to be disconnected.
RESET
● Clears a data link.
● The SABM and UA frames are exchanged without prior disconnection.
● The N(S) and N(R) counters are reset; the pending information frames are discarded.
GET/INT/LOR/RIP 22 of 33 October 15, 2007
RULES OF RESTART
RESTART AFTER TIME-OUT
● A station which does not receive any acknowledgment before T1 seconds, must retransmit the first unacknowledged information frame. The P/F bit of this information frame must be set.
● The station can then resume the transmission after the reception of an acknowledgment with the P/F bit set.
BIT P/F
● A station which receives a command frame with the P/F3 bit set, must send a response frame with the P/F4 bit also set.
3 The P/F bit is called P (Poll) in a command frame (e.g. Information frames)4 The P/F bit is called F (Final) in a response frame (e.g. RR, RNR or REJ frames)
GET/INT/LOR/RIP 23 of 33 October 15, 2007
TRANSMISSION CONTROL
OVERVIEW
Any transmission occurs between a PRIMARY and a SECONDARY.
The primary station controls the data link.
The secondary station is tied to the primary station.
STATION
A station may be composed of:
● a primary
● a secondary
● a primary and a secondary
GET/INT/LOR/RIP 24 of 33 October 15, 2007
ADDRESS FIELD
The address field is used to make a distinction between the command and the
response frames.
CODING OF THE ADDRESS FIELD IN THE X.25 PROTOCOL
There are only two values with the following coding:
AddressBit number
1 2 3 4 5 6 7 8hexadecimal
A 0 0 0 0 0 0 1 1 03
B 0 0 0 0 0 0 0 1 01
The use of these values is explained below:
Sender ►
Frame nature
▼
Network DTE
Command A B
Response B A
GET/INT/LOR/RIP 25 of 33 October 15, 2007
FLOW CONTROL
The flow control is used to regulate the information flow between stations.
✔ The mechanism used is a window.
✔ A station can send up to W information frames before receiving any acknowledgment.
✔ The window is closed if the station has sent W frames and did not receive any acknowledgment.
✔ A station cannot send other information frames if its window is closed.
✔ The receiver can acknowledge one, several, or all the information frames previously received.
✔ When a station acknowledges some informations frames, it opens more or less the window of its peer.
GET/INT/LOR/RIP 26 of 33 October 15, 2007
FLOW CONTROL
W = 3 the window size is 3.
DLDTreq : primitive of service sent by the user of the level 2 (DTE side): DLDTreq = Data Link Data request.
DLDTind : primitive of service sent by the user of the level 2 (network side): DLDTind = Data Link Data indication.
I,0,2 : information frame, N(R)=0, N(S)=2
RR,2 : supervision frame RR, N(R)=2
GET/INT/LOR/RIP 27 of 33 October 15, 2007
NETWORKDTE
DLDTreq
DLDTreq
DLDTreq
DLDTreq
DLDTind
DLDTind
DLDTind
DLDTind
I 0,0
I 0,0
I 0,0
I 0,0
RR 2
RR 2
W = 3
LIST OF SOME PARAMETERS USED AT THE FRAME LEVEL
TIMER T1
● On timeout of this timer, the first unacknowledged information frame must be sent again.
● Standard values:
T1 = 100, 200, 400, 800, 1600, 2500 ms
TIMER T2
● Maximum time that a receiver can wait to acknowledge an information frame.
N2
● Maximum number of retransmission of the same information frame.
● If this value is reached, the link is considered to be out-of-order.
● Standard value: 10
N1
● Maximum size of an information frame.
GET/INT/LOR/RIP 28 of 33 October 15, 2007
EXCHANGE MODES
DEFINITIONS
GET/INT/LOR/RIP 29 of 33 October 15, 2007
SOURCE DESTINATION
INFORMATION
ACKNOWLEDGMENT
PRIMARY SECONDARY
COMMAND
RESPONSE
PRIMARY SECONDARY
SELECTING
ACCEPTANCE
DESTINATIONSOURCE
INFORMATION
ACKNOWLEDGMENT
PRIMARY SECONDARY
POLLING
ACCEPTANCE
DESTINATION SOURCEINFORMATION
ACKNOWLEDGMENT
EXCHANGE MODES
ASYMMETRIC POINT-TO-POINT
This mode is typically intended for multi-point links. Asymmetric point-to-point link
is an adaptation of multi-point links.
The information frames can be either "command" frames, or "response" frames.
This mode is selected with the command frame "SNRM (Set Normal Response
Mode)".
GET/INT/LOR/RIP 30 of 33 October 15, 2007
PRIMARY SECONDARY
DEST.SOURCE
Station A Station B
DEST. SOURCE
SEL I
POLL ACK
ACK
II
I I
I
EXCHANGE MODES
SYMMETRIC POINT-TO-POINT
This mode is selected with the command frame "SARM (Set Asynchronous Response
Mode)".
The information frames are always "command" frames.
The supervisions frames (RR, RNR, REJ...) are generally "response" frames.
GET/INT/LOR/RIP 31 of 33 October 15, 2007
PRIMARY SECONDARY
DEST.SOURCE
Station A Station B
DEST. SOURCE
I
ACK
ACK
II
I I
I
PRIMARYSECONDARY
EXCHANGE MODE
BALANCED POINT-TO-POINT
In this mode, the concepts of "primary" and "secondary" are replaced by the concept
of "combined station".
The command frames (INFO, SABM, DISC...) always carry the address of the remote
station.
The response frames (RR, RNR, UA, DM....) always carry the address of the local
station.
This mode is selected with the command frame "SABM (Set Asynchronous Balanced
Mode)".
GET/INT/LOR/RIP 32 of 33 October 15, 2007
DEST.
Station A Station B
SOURCE
SOURCE
DEST.
Com
bine
d st
atio
n
Com
bine
d st
atio
n
CREDITS
This document was written with OpenOffice.org 2.3 (http://www.openoffice.org).
Different fonts were used:
Font name Web site Sample (12pt)
Calisto MT http://netsourcesfr.free.fr/Polices_C.htm The quick brown fox jumps over the lazy dog
Daniel http://www.dafont.com The quick brown fox jumps over the lazy dog
Goodfish http://www.dafont.com The quick brown fox jumps over the lazy dog
Morpheus http://www.dafont.com The quick brown fox jumps over the lazy dog
Times New Roman http://www.myfonts.com (not free) The quick brown fox jumps over the lazy dog
GET/INT/LOR/RIP 33 of 33 October 15, 2007