X.25 Switched Virtual Circuits (SVCs) use call setup packets to establish and clear calls. These packets may contain encoded address data, optional facilities, user data and diagnostic and cause codes. The LayGO X.25 call library provides encoding and decoding services for these packets.
Access to basic encoding services is provided by the utility program edcall. Encoded packets can be created and stored to disk with edcall and read into the application at run-time using call_LoadCallData(). (See Using edcall in the LayGO Configuration Manual for details on using the edcall utility.) This level of functionality is sufficient for many applications. However, the encoding and decoding routines used by edcall are also available to applications via the X.25 Call Setup API.
LayGO's X.25 Call Setup API is exported by call.h with support from address.h, diag.h and facility.h. In particular, diag.h provides C language defined constants for X.25 cause and diagnostic codes and functions to convert these codes into human-readable strings. This appendix contains details on using the functions in the X.25 Call Setup API:
Decoding functions that return a diagnostic code return dg_FAILURE if the parameters passed to the function are illegal, dg_NONE if the decoding was successful. Otherwise, they return a diagnostic code indicating the reason the packet was found to be defective. This diagnostic code should be included in any packet clearing an incoming call or call accept.
The functions for retrieving human-readable strings for cause and diagnostic codes are listed below. These are self-explanatory and are fully documented in diag.h.