Introduction
X.25 is an ITU (International Telecommunication Union) protocol standard for WAN communications. X.25 protocol standard defines interface between Data Terminal Equipment (DTE) and Data Circuit-terminating Equipment (DCE) for terminals operating in the packet mode and connected to public data networks by dedicated circuit. Hillstone Software's HS X.25 C Source Library fully implements ITU-T X.25 protocol.
X.25 Network Topology
X.25 network consists of DTEs (data terminal equipment: terminals, personal computers, networked hosts, bank ATM machines, payment terminals) communicating across X.25 network, via X.25 DCEs (data circuit-terminating equipment: modems, PADs (packet assembler disassembler) packet switches). DCEs are connected to or integrated within PSE (packet switching exchange typically based on carrier premises. X.25 switches transfer (switch) packets between DTEs in the core of X.25 PSN (public switching network). HS X25 implementation can be used in any part of X.25 network component.
X.25 PAD (Packet Assember Disassember)
Some of X.25 DCEs are either connected to or are a one device with X.25 PAD - Packet Assembler Disassembler. An X.25 PAD is used to connect an Asynchronous character mode terminal to X.25 network. There are several types of PADs: Triple X PAD which operate according to X.28, X.29 and X.3 ITU-T protocol standards; there is also a TPAD - Transactional Packet Assembler Disassember which is often used to connect payment terminals to X.25 network.
X.25 Virtual Circuits
X.25 protocol supports 2 types of virtual circuits (connections): switched virtual circuits (SVC) where calls are established on demand for a desired period of time (similar to telephone (PSTN) calls) and permanent virtual circuits (PVC), where a circuit is permanently connected by agreement between X.25 network operator and X.25 subscriber. HS X.25 supports SVC and PVC operation.
X.25 Protocol Layers
With reference to OSI protocol layer model, X.25 physical layer fits in OSI physical layer, X.25 data link layer fits in OSI data link layer and X.25 packet layer fits in OSI network layer.
- Physical layer: This layer specifies the physical, electrical, functional and procedural characteristics to control the physical link between a DTE and a DCE. Common implementations use X.21, EIA-232, EIA-449 or other serial protocols. X.25 protocol can be run over ISDN (integrated services digital network) D channel or B Channel. In this case physical layer is an ISDN channel driver. X.25 can also be run over XOT (X.25 over TCP /IP). In this case physical layer is LAN (Ethernet) packet driver or serial packet driver such as PPP or SLIP. HS X25 includes full implementation of XOT protocol stack for X.25 operating over TCP IP.
- Data link layer: The data link layer consists of the link access procedure for data interchange on the link between a DTE and a DCE. In its implementation, the Link Access Procedure, Balanced (LAPB) is a data link protocol that manages a communication session and controls the packet framing. It is a bit-oriented protocol that provides error correction and orderly delivery. A variation on LAPB is LAPD which is used on ISDN as opposed to serial synchronous links.
- Packet layer: This layer defined a packet-layer protocol for exchanging control and user data packets to form a packet-switching network based on virtual circuits.
X.25 Packet Layer
Channels and Addressing
VC may be established using X.121. The X.121 address consists of a three-digit Data Country Code (DCC) plus a network digit, together forming the four-digit Data Network Identification Code (DNIC), followed by the National Terminal Number (NTN) of at most ten digits. Note the use of a single network digit, seemingly allowing for only 10 network carriers per country, but some countries are assigned more than one DCC to avoid this limitation. Networks often used fewer than the full NTN digits for routing, and made the spare digits available to the subscriber (sometimes called the sub-address) where they could be used to identify applications or for further routing on the subscribers networks.
NSAP addressing facility is supported from 1984 X.25 revision and this enabled X.25 to better meet the requirements of OSI Connection Oriented Network Service (CONS). Later revisions of X.25 allow multiple addresses in addition to X.121 addresses to be carried on the same DTE-DCE interface: Telex addressing (F.69), PSTN addressing (E.163), ISDN addressing (E.164), Internet Protocol addresses (IANA ICP), and local IEEE 802.2 MAC addresses.
PVCs are permanently established in the network and therefore do not require the use of addresses for call setup. PVCs are identified at the subscriber interface by their logical channel identifier.
One DTE-DCE interface to an X.25 network has a maximum of 4095 logical channels on which it is allowed to establish virtual calls and permanent virtual circuits, although networks are not expected to support a full 4095 virtual circuits. For identifying the channel to which a packet is associated, each packet contains a 12 bit logical channel identifier made up of an 8-bit Logical Channel Number and a 4-bit Logical Channel Group Number. Logical channel identifiers remain assigned to a virtual circuit for the duration of the connection. Logical channel identifiers identify a specific logical channel between the DTE (subscriber appliance) and the DCE (network), and only has local significance on the link between the subscriber and the network. The other end of the connection at the remote DTE is likely to have assigned a different logical channel identifier. The range of possible logical channels is split into 4 groups: channels assigned to permanent virtual circuits, assigned to incoming virtual calls, two-way (incoming or outgoing) virtual calls, and outgoing virtual calls. (Directions refer to the direction of virtual call initiation as viewed by the DTE - they all carry data in both directions.) The ranges allowed a subscriber to be configured to handle significantly differing numbers of calls in each direction while reserving some channels for calls in one direction. All International networks are required to implement support for permanent virtual circuits, two-way logical channels and one-way logical channels outgoing; one-way logical channels incoming is an additional optional facility. DTE-DCE interfaces are not required to support more than one logical channel. Logical channel identifier zero will not be assigned to a permanent virtual circuit or virtual call. The logical channel identifier of zero is used for packets which don't relate to a specific virtual circuit (e.g. packet layer restart, registration, and diagnostic packets).
Packet Layer Initialization
X.25 packet layer is initialized or re-initialized using X.25 restart procedure which simultaneously clears all virtual calls or permanent virtual circuits
Connection Setup for Switched Virtual Circuits (SVC)
A virtual call is established by transferring call request packet over DTE DCE interface and receiving call confirmation packet.
Call request and optionally call confirmation packet contains address block which carries calling and called X.25 DTE addresses.
Connection Clearing for Switched Virtual Circuits (SVC)
A virtual call is disconnected by transferring clear request packet over DTE DCE interface and receiving clear confirmation packet.
Permanent Virtual Circuits
Permanent virtual circuits require no call setup. X.25 reset and reset confirmation packets are transferred across DTE DCE interface to transition PVC endpoints into data state.
Data Transfer and Flow Control
Data is transferred across DTE DCE interface in DATA packets.
For the purpose of flow-control, a sliding window protocol is used with the default window size of 2. The acknowledgements may have either local or end to end significance. A D bit (Data Delivery bit) in each data packet indicates if the sender requires end to end acknowledgement. When D=1, it means that the acknowledgement has end to end significance and must take place only after the remote DTE has acknowledged receipt of the data. When D=0, the network is permitted (but not required) to acknowledge before the remote DTE has acknowledged or even received the data.
DATA packets are sequentially numbered modulo 8 or modulo 128. The sequence number is carried in Ps field of DATA packets. The sequence number cycles from 0 to 8 or 128. Each DATA packet is acknowledged by an RR, RNR or DATA packet in the reverse direction. DATA packets carry both Ps and Pr fields, meaning Send and Receive sequence numbers. RR and RNR packets carry Pr (receive sequence) number only. Pr - receive sequence number acknowledges all DATA packets numbered received up to Pr -1. Maximum number of packets so acknowledged is the window size which is either pre-agreed or negotiated during call setup. For modulo 8 the maximum window size is 7. For example in a windows size is 7 is configured, a DTE or DCE is allowed to send a maximum of 7 packets without waiting for acknowledgement which comes with RR, RNR or DATA packet from remote DTE or DCE.
RR packet is used to acknowledge reception of data packets and to open or re-open remote transmit window. RNR packet is used to acknowledge reception of data packets and to tell the remote side to stop transmitting more data. REJ packet is used to request retransmission of DATA packets which are detected to be lost by analyzing sequence numbers and using timeouts. HS X.25 currently supports modulo 8 only operation.
Some X.25 networks support data packet re-transmissions via special facility to which user may subscribe.
Data Segmentation and Re-assembly
An X.25 protocol is responsible for segmenting the data submitted by application layer for transmission into data packets according to agreed maximum packet size and transmitting fragmented data sequence. All DATA packets except last in sequence has the M (more) bit set. The remote X.25 re-assembles the DATA packets into complete data sequence before passing it up to application layer.
Error Correction
Error recovery procedures at the packet layer assume that the data link layer is responsible for retransmitting data received in error. Packet layer error handling focuses on resynchronizing the information flow in calls, as well as clearing calls that have gone into unrecoverable states.
Basic Packet Format
All X.25 packets have the following fields:
- GFI: general format identifier
- LCN+LCGN: logical channel group number and logical channel number
- Packet type identifier
Further depending on packet type, call setup and clearing packets contain or may contain an address block, clearing cause and diagnostic, facilities and call user data
X.25 Packet Types:
| Packet Type | DCE -> DTE | DTE -> DCE | Service | VC | PVC |
|---|---|---|---|---|---|
| Call setup and Clearing | Incoming Call | Call Request | X | ||
| Call Connected | Call Accepted | X | |||
| Clear Indication | Clear Request | X | |||
| Clear Confirmation | Clear Confirmation | X | |||
| Data and Interrupt | Data | Data | X | X | |
| Interrupt | Interrupt | X | X | ||
| Interrupt Confirmation | Interrupt Confirmation | X | X | ||
| Flow Control and Reset | RR | RR | X | X | |
| RNR | RNR | X | X | ||
| REJ | REJ | X | X | ||
| Reset Indication | Reset Request | X | X | ||
| Reset Confirmation | Reset Confirmation | X | X | ||
| Restart | Restart Indication | Restart Request | X | ||
| Restart Confirmation | Restart Confirmation | X | |||
| Diagnostic | Diagnostic | X | |||
| Registration | Registration Confirmation | Registration Request | X |
X.25 Facilities
X.25 allows users to subscribe to facilities defined and described in ITU-T Recommendation X.2. The categories of X.2 facilities are:
- essential facilities
- additional facilities
- conditional facilities
- mandatory facilities
- optional facilities
X.25 also provides X.25 and ITU-T DTE optional user facilities defined in Recommendation X.7. The X.7 optional user facilities fall into four categories of user facilities that require:
- subscription only
- subscription followed by dynamic invocation
- subscription or dynamic invocation and dynamic invocation only.
X.25 Diagnostic error codes
| Description | Decimal code |
|
No additional information |
0 |
|
Invalid P(S) |
1 |
|
Invalid P(R) |
2 |
|
Packet type invalid |
16 |
|
For state r1 |
17 |
|
For state r2 |
18 |
|
For state r3 |
19 |
|
For state p1 |
20 |
|
For state p2 |
21 |
|
For state p3 |
22 |
|
For state p4 |
23 |
|
For state p5 |
24 |
|
For state p6 |
25 |
|
For state p7 |
26 |
|
For state d1 |
27 |
|
For state d2 |
28 |
|
For state d3 |
29 |
|
Packet not allowed |
32 |
|
Unidentifiable packet |
33 |
|
Call on one-way logical channel |
34 |
|
Invalid packet type on a permanent virtual circuit |
35 |
|
Packet on unassigned logical channel |
36 |
|
Reject not subscribed to |
37 |
|
Packet too short |
38 |
|
Packet too long |
39 |
|
Invalid general format identifier |
40 |
|
Restart packet with non-zero in bits 1 to 4 of octet 1, or bits 1 to 8 of octet 2 |
41 |
|
Packet type not compatible with facility |
42 |
|
Unauthorized interrupt confirmation |
43 |
|
Unauthorized interrupt |
44 |
|
Unauthorized reject |
45 |
|
TOA/NPI address subscription facility not subscribed to |
46 |
|
Time expired |
48 |
|
For incoming call |
49 |
|
For clear indication |
50 |
|
For reset indication |
51 |
|
For restart indication |
52 |
|
For call deflection |
53 |
|
Call set-up or call clearing problem |
64 |
|
Facility code not allowed |
65 |
|
Facility parameter not allowed |
66 |
|
Invalid called DTE address |
67 |
|
Invalid calling DTE address |
68 |
|
Invalid facility length |
69 |
|
Incoming call barred |
70 |
|
No logical channel available |
71 |
|
Call collision |
72 |
|
Duplicate facility requested |
73 |
|
Non-zero address length |
74 |
|
Non-zero facility length |
75 |
|
Facility not provided when expected |
76 |
|
Invalid ITU-T specified DTE facility |
77 |
|
Maximum number of call redirections or call deflections exceeded |
78 |
|
Miscellaneous |
80 |
|
Improper cause code from DTE |
81 |
|
Not aligned octet |
82 |
|
Inconsistent Q-bit setting |
83 |
|
NUI problem |
84 |
|
ICRD problem |
85 |
|
Not assigned |
96 |
|
International problem |
112 |
|
Remote network problem |
113 |
|
International protocol problem |
114 |
|
International link out of order |
115 |
|
International link busy |
116 |
|
Transit network facility problem |
117 |
|
Remote network facility problem |
118 |
|
International routing problem |
119 |
|
Temporary routing problem |
120 |
|
Unknown called DNIC |
121 |
|
Maintenance action |
122 |
|
|
|
|
Reserved for network specific diagnostic information 128 – 255 |
|
X.25 Data link layer - LAPB
LAPB is a data link layer protocol that manages communication and packet framing between DTE and DCE devices. LAPB is a bit-oriented protocol that ensures that frames are correctly ordered and error-free.
Three types of LAPB frames exist: information, supervisory, and unnumbered. The information frame (I-frame) carries upper-layer information and some control information. I-frame functions include sequencing, flow control, and error detection and recovery. I-frames carry send- and receive-sequence numbers. The supervisory frame (S-frame) carries control information. S-frame functions include requesting and suspending transmissions, reporting on status, and acknowledging the receipt of I-frames. S-frames carry only receive-sequence numbers. The unnumbered frame (U frame) carries control information. U-frame functions include link setup and disconnection, as well as error reporting. U frames carry no sequence numbers.
