HS X.25 C Source Library (+ RFC1613 XOT)


HS X.25 is a software library in C (supplied with full source code) which implements ITU-T recommendation X.25 - 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 and RFC1613 Cisco Systems X.25 over TCP (XOT)

HS X.25 C source library runs on Windows and on Unix (Linux, Solaris, HP-UX, RedHat, CentOS and others)

HS X.25 supports both SVCs and PVCs over XOT

Feature table



 DCE Operation Yes
 DTE Operation Yes
 RFC1613 XOT Yes
 Maximum Number of VCs 4095
 Facilities Support Yes
 Call User Data supported Yes
 SVC Support Yes
 PVC Support Yes
 X.25 Version ITU-T (formerly CCITT) 10/96
 Outgoing Calls Yes
 Incoming Calls Yes
 Incoming Call processing  Configurable between: Match on local DTE address or Accept All Calls
 Packet Format Basic format, modulo 8
 Packet Size Configurable in range 128,256,512,1024 with 128 default
 Window Sizes Configurable from 1 to 7 with default of 2
 A Bit Basic format only (non TOA/NPI) addresses supported
 Q Bit procedure Yes
 M Bit procedure Yes
 D Bit procedure Yes
 Logical Channel Assignment Configurable Outgoing and Incoming range
 Timers and Counters Supported T10
T20 Retry
T23 Retry
 Interrupt packets Yes
 Trace Function Supported Yes
 Flow Control (RNR) Yes
 Per VC statistics Yes
 Per X.25 Link statistics Yes
 XOT outgoing call routing based called NUA Yes

How it works

When user application initlialises Hs X.25 library, it provides interface callbacks for the services used by HS X.25 protocol module: timer management, and event callbacks.

The application then calls HsX25 functions to establish virtual circuits, send and receive data, enforce flow control and clear calls.

HS X.25 internally at a lower layer interfaces to HsDL library. HsDL library is Data Link layer abstraction, which includes RFC1613 Cisco mode XOT (X.25 over TCP) sub-module. When HS X.25 is ported into environment with LAPB or LAPD as data link layer, only HsDL module needs to change.

HsDL links directly to HsSock module (also included in this package) - Winsock interface component that provides reliable TCP transport services similar to LAPB / LAPD / HDLC.

HsX25 as provided to customer may be used immediately in X.25 over TCP (Cisco XOT) solution or it may be used with traditional LAPB or LAPD in which case only HsDL will need to be modified.

RFC1613 XOT and Proprietary XOT

HS X.25 Library supports both Cisco RFC1613 mode XOT and Proprietary XOT.

With RFC1613 the data link layer operates both as a server, always listening on port 1998 and a client making a separate TCP connection for each new outgoing call request, thus a total of 4095 TCP sessions can exits to carry 4095 VCs.

With Proprietary XOT mode, a similar framing protocol is used on top of TCP/IP but the usage concept is different. An X.25 Link equal a single TCP session which can be either a TCP client or a TCP server. Remote IP addresses and port numbers and also the listening port numbers are configurable per X.25 link. There is currently a total of 10 X.25 links supported, meaning 10 TCP sessions. Each X.25 link can carry multiple X.25 VCs - up to 4095.

HS X.25 Evaluation Pack includes demo applications which allow testing both of the above XOT modes of operation

API Summary

  • HsX25Init
  • HsX25Connect
  • HsX25Listen
  • HsX25Clear
  • HsX25Data
  • HsX25DataExp
  • HsX25ShutDown
  • HsX25Rnr
  • HsX25DecodePkt
  • HsX25GetStats
  • HsX25Tick


How do we plan to develop this product further:

  • Integrated PAD (Packet Assembler Dis-assembler) with following modes:
  • X.28 / X.3
  • Transparent mode
  • TPAD / Transactional Packet Assembler Dis-assembler (APACS, IBRO)
  • LAPB protocol module as an option to operate instead of XOT
  • X.25 Call Router module

Release Notes

Version 1.2

  • base tested full release

Version 1.2.1

  • fixed handle leak in socket layer when closing and de-initialising the library

Version 1.2.2

  • changed interface to list library

Version 1.2.3

  • fixed issue with X.25 VC not clearing if remote host terminates abruptly.

Version 1.3.0

  • SVC / XOT outbound routing table to allow making X.25 calls over XOT (RFC1613) to multiple different IP hosts.
  • HsSock - socket interface module re-designed to use windows asynchronous sockets notifications processed in the main application message loop instead of thread based socket polling. As a result improved overall stack reliability and reduced CPU utilization for large number of connections
  • Improved operation in Proprietary XOT mode, support for running up to 10 independent X.25 links either TCP servers or clients in any combinations.
  • Fixed an issue in Proprietary XOT mode: DIAG packet not recognized as valid packet.
  • X.25 Link level statistics.

Version 1.3.6

  • PVC Support
  • Fixed an issue on Solaris related to the timer code
  • PVC setup fix: Handle reception of PVC status 0x12 (connected) same as if status 0x00 (success) was received
  • Fix the isssues related to GUI dialig boxes sizing with Win7 DPI
  • Fixes to Incoming PVC setup processing
  • Change PVC reset cause to 0xf (network operational)
  • In PVC listening state, respond with PVC setup status 0x12 (connected) in response to PVC setup (previously was 0x00 - waiting to connect)

Version 1.3.7

  • Fixed PVC disconnection issue both in Win32 code and in Unix code. When X.25 PVC client disconnects abnormally (without sending PVC disconnect), the HS X.25 library when clearing allVCs was incorrectly sending X.25 clear request on a PVC before closing the underlying TCP connection
  • Fixed GUI main window sizing issue when used with different DPI settings on Windows 7

Version 1.3.8

  • Added capability for HS X.25 / XOT endpoint to use a specified local IP address when XOT binds to local port 1998. It proved useful in some customer usage scenarios to be able to bind XOT to one of local IP interfaces present on the same computer

Version 1.3.9

  • Usage scenarios of HS X.25 Library with some customers have shown that the library may be used in a multi-threaded environment. This release adds support for multithreading by protecting HS X.25 VC transmit queue variables by using synchronization locks. This change has been applied to both Windows and Unix code base

Version 1.3.10

  • Fixed pthread mutex lock (unix) and Enter / Leave Critical Section (Windows) in the wrong place in the code protecting transmit method. The fix is applicable to multi-threaded usage scenarios

Version 1.3.11

  • Fixed an issue in socket layer HsSock for Unix / Linux version potentially causing SIGPIPE after continuous failing connect attempts
  • Fixed "leaking" of socket file descriptor handles in some situations where connections are being shutdown in Unix / Linux version
  • Fixed a potential issue in socket layer HsSock for Unix / Linux where socket descriptors may be added in to a set exceeding the maximum size of FD_SET array

Version 1.3.12

  • Removed unused code (in linux sockets library)
  • Generic functions for safely starting and stopping threads and managing locks (Linux)
  • Safe closing of the socket handles (Linux)
  • Changes to the build system - improved makefile (Linux)
  • Fixed an issue in socket layer HsSock for Unix / Linux version when socket listen on XOT port fails

Version 1.3.13

  • Fixed an issue in the windows version of the socket library: if outgoing TCP connection failed,(such as for example connection refused by remote), the socket close event was sent up to the application twice.

Version 1.3.14

  • Code optimization of HS X.25 Library of both Windows and Linux code base

Version 1.3.15

  • Added capability to reset an X.25 VC in data state via HS X.25 API function HsX25Reset
  • Remember previously used X.25 called and X.25 calling DTE addresses in the GUI call dialog

    Version 1.3.16

    • Added a return code - HS_X25_RC_DL_LIS_QFULL that is different from HS_X25_RC_DL_LIS_FAIL. HS_X25_RC_DL_LIS_QFULL is now returned by HsX25Listen() when the listen queue is full. This allows to differenciate real data link failure from queue full situation - that is not a failure

      Version 1.3.17

      • Changed HsSock socket interface library for Linux to introduce signal mechanism between main API code - HsSockTcpConnect, HsSockClose and the I/O thread to avoid 20 ms polling in the select()

        Version 1.3.18

        • Support for the use of TCP keepalives to detect broken (abruptly terminated) XOT sessions. This release adds TCP keepalive support to Linux version only