X.25 API Reference

| Introduction | Function Summary | Function Reference |

Function Summary

X25open Open a X25CALLT on a specified X25MUX
X25close Close an X25CALLT
X25incall Receive a call index for a pending incoming call
X25getcall Accept a call given a call index
X25makecall Make an X.25 call
X25accept Process call acceptance of an X.25 call
X25clear Clear a call
X25pvcattach/X25hdlcattach Attach to a PVC or HDLC/LAPB link.
X25gotreset Handles reception of an incoming RESET packet
X25pvcdetach/X25hdlcdetach Detach from a PVC or HDLC/LAPB link
X25write Write a packet across your X.25 virtual circuit or HDLC link
X25read Receive a packet from your X.25 virtual circuit or HDLC link
X25reset Send a RESET packet
X25resetconf Send a RESET CONFIRM packet
X25interrupt Send an INTERRUPT packet
X25interruptconf Send an INTERRUPT CONFIRM packet
X25listen Start listening on the specific X25CALLT
X25stoplisten Stop listening for incoming calls on the specified X25CALLT
X25look Check for pending events on your VC or listener.
X25findtag Find tag index in tag array
X25setopts Set X.25 library parameters
X25getopts Get X.25 library parameters
X25linkup Obtain link up status
X25getcallinfo Obtain X.25 Incoming call information
X25sense Obtain status of DCD, DSR and CTS for chosen link
X25setdebugfile Sets the library debug output file
X25setdebugfunc Sets the library debug output function
X25debug Enable or disable X.25 library debugging
X25setfilter Sets network type filter for packetnets accesses
X25setnetent Initializes the packetnets file for reading
X25endnetent Ends packetnets file processing
X25getnetent Return next X25netent entry from packetnets file
X25getnetbyname Finds the network ID given the network name
X25getnetbynetid Finds the network entry with the given network ID in packetnets file
X25getnetbyboard Finds the host with the given board and link in packetnets file
X25remotenetidtolocalnetid Map remote netid to local netid
X25sethostent Initializes the x25hosts file for reading
X25endhostent Ends x25hosts file processing
X25gethostent Return next X25hostent entry from x25hosts file
X25gethostbyaddr Finds the host with the given X.25 address in x25hosts file
X25gethostbyname Finds the named host in x25hosts file
X25getinfo Obtain information about an established call
X25initcpstags Initialize a Call Progress Structure
X25initcps Clears a Call Progress Structure
X25initpvctags Initialize a PVC Descriptor Structure
X25initpvc Clears a PVC description Structure
X25lookinit Initialize the file descriptor selection mechanism
X25lookclose Closes the look list handle
X25lookadd Add file descriptor(s) to the look list
X25lookdel Removes the file descriptor(s) from the look list
X25looksel Checks for availability of datagrams on look list
X25lookatone Look at one X25CALLT and wait for activity
X25error Prints the X.25 error message
X25seterror Sets the X.25 error
X25geterror Gets the X.25 error
X25getsyserror Gets the X.25 system error
X25getdiags Gets the X.25 diagnostic and cause codes
X25errormsg Obtain error message based on X.25 error code
X25causemsg Obtain error message based on cause code
X25diagmsg Obtain error message based on diagnostic code



| Introduction | Function Summary | Function Reference |

Function Reference


X25open

Prototypes X25CALLT X25open(int netid, ...)
X25CALLT X25opentags(int netid, TAGS *tags)
Purpose Open a X25CALLT on a specified X25MUX
Description X25open opens a suitable X.25 device. No calls are made or accepted in this function.
You may identify the endpoint in 2 ways:
  • Specify a valid network ID as the first argument
  • Specify a valid network name (T_NETNAME) and an arbitrary netid
You may use the T_FLAGS tag to specify special options for the Unix open() flag for local network IDs only.
Tags
  • All global tags
  • T_NETNAME
  • T_HANDLE
  • T_DEVICE
  • T_BOARD
  • T_LINK
  • T_WATCH
  • T_WATCHEVENT
  • T_WATCHMESSAGE
  • T_FLAGS
  • T_BLOCKING
  • T_SYNCTCP
Parameters
netid network ID to open (ignored depending on tag choices)
tags pointer to TAGS list
Returns
X25CALLT on success
NULL on failure
Errors
  • X25SYSERR
  • X25BADMUX
  • X25BADNETID
  • X25BADPOINTER
  • X25NOMUXSLOTS
  • X25MUXNOTINIT
See Also

| Introduction | Function Summary | Function Reference |


X25close

Prototypes void X25close(X25CALLT ct)
Purpose Close an X25CALLT
Description Closes the file descriptor associated with a specific call.
Frees all internally allocated memory for a specific call.
Calls X25pvcdetach() for PVCs or X25clear() if a call was established.
After this call ct should no longer be considered a valid pointer.
Parameters
ct X25CALLT handle
See Also

| Introduction | Function Summary | Function Reference |


X25incall

Prototypes int X25incall(X25CALLT ct, ...)
int X25incall(X25CALLT ct, TAGS *tags)
Purpose Receive a call index for a pending incoming call
Description Receive a call index for a pending incoming call.
This call index is appropriate to use for a call to X25getcall().
This function should be called with the ct associated with the X25listen() request.
Normally this function is used after establishing that a call has indeed been received using the X25look() function.
The T_PNETID tag allows determining on which netid the call arrived on.
The T_CPSP tag with a pointer to enough storage for a cps structure will copy the cps (Call Progress Structure) into that user supplied buffer.
Tags
  • All global tags
  • T_CPSP
  • T_PNETID
Parameters
ct X25CALLT handle
Returns
idx call index on success
-1 on failure
Errors
  • X25SYSERR
  • X25CLEAR
  • X25PVCINUSE
  • X25BADCALLT
  • X25BADMSG
  • X25NOVC
See Also

| Introduction | Function Summary | Function Reference |


X25getcall

Prototypes int X25getcall(X25CALLT ct, ...)
int X25getcalltags(X25CALLT ct, TAGS *tags)
Purpose Accept a call given a call index
Description X25getcall() will accept a call given a call index.
The T_CALLINDEX argument MUST be specified and can be obtained by the user program from the x25daemon or x25calld by specifying $index on the x25incalls or x25tab command line or by calling X25incall().
The cps for this call will be updated.
Tags
  • All global tags
  • T_CALLINDEX
  • T_CPSP
Parameters
ct X25CALLT handle
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25CLEAR
  • X25PVCINUSE
  • X25BADCALLT
  • X25NOVC
See Also

| Introduction | Function Summary | Function Reference |


X25makecall

Prototypes int X25makecall(X25CALLT ct, ...)
int X25makecalltags(X25CALLT ct, TAGS *tags)
Purpose Make an X.25 call
Description There are two ways to specify parameters to this function:
The first involves passing in each parameter seperately, however, for the advanced user, a cps structure may be passed in directly using the T_CPSP tag. A copy of the CPS is made (so that the passed in cps storage does not have to stay persistent/in scope.)
The T_HOST tag will use the host names in the x25hosts file to bind default options to a particular host. T_HOSTADDR will try to match a host by its address from the x25hosts file.
T_DNA will default to 9999 if not supplied.
T_CUD will default to 1 0 0 0 if not supplied.
Tags
  • All global tags
  • T_INPKTSIZE
  • T_OUTPKTSIZE
  • T_INWINDOW
  • T_OUTWINDOW
  • T_PRIORITY
  • T_REVERSE
  • T_CUD
  • T_CUDLEN
  • T_DNA
  • T_DNALEN
  • T_NUI
  • T_CPSP
  • T_NUILEN
  • T_INTHRUCLASS
  • T_OUTTHRUCLASS
  • T_DBITSUPPORT
  • T_PKTSIZE
  • T_WINDOW
  • T_THRUCLASS
  • T_HOST
  • T_HOSTADDR
Parameters
ct X25CALLT handle
tags pointer to TAGS list
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25BADHOST
  • X25PVCINUSE
  • X25BADCALLT
  • X25BADMSG
  • X25CLEAR
  • X25CONNECTEDIND
  • X25BADCUD
  • X25BADDNA
  • X25BADNUI

| Introduction | Function Summary | Function Reference |


X25accept

Prototypes int X25accept(X25CALLT ct)
Purpose Process call acceptance of an X.25 call
Description This function will process Call acceptance of a previous X25makecall() with the T_NOWAIT tag set to TRUE. This function assumes that there is a call acceptance packet to be read. (ie. X25look() returns X25CONNECTEDIND).
Parameters
ct X25CALLT handle
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25PVCINUSE
  • X25BADCALLT
  • X25BADMSG
  • X25CLEAR
  • X25CONNECTEDIND

| Introduction | Function Summary | Function Reference |


X25clear

Prototypes int X25clear(X25CALLT ct, ...)
int X25cleartags(X25CALLT ct, tags);
Purpose Clear a call
Description Clears an X.25 call. Not valid on PVCs. There are 3 ways to call this function:
  • No tags (except TAG_END of course!) In this case the driver will use a Diagnostic and XIP cause of XCA_CLOSED, and a Cause value of 0x00
  • You may supply the cps structure (using T_CPSP) in which case all the other tags are not considered. you may use the value NULL for this tag in order to use the cps associated with this call. If you are using this tag then the other tags will have no effect
  • You may supply the Cause value (T_CAUSE) (defaults to 0x00) you may also supply a diagnostic (T_DIAG) (defaults to XCA_CLOSED) you may also supply an XIP Cause code (T_XIPCAUSE) (def. to 0x00)
Tags
  • All global tags
  • T_DIAG
  • T_CAUSE
  • T_XIPCAUSE
  • T_CPSP
  • T_CALLINDEX
  • T_NETID
Parameters
ct X25CALLT handle
tags pointer to TAGS list
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25PVCINUSE
  • X25BADCALLT
  • X25ISAPVC
  • X25USERDATA

| Introduction | Function Summary | Function Reference |


X25pvcattach/X25hdlcattach

Prototypes int X25pvcattach(X25CALLT ct, ...)
int X25hdlcattach(X25CALLT ct, ...)
int X25pvcattachtags(X25CALLT ct, TAGS *tags)
int X25hdlcattachtags(X25CALLT ct, TAGS *tags)
Purpose Attach to a PVC or HDLC/LAPB link.
Description This function tries to establish a PVC or HDLC/LAPB connection over the given Logical Channel (defaults to 1.)
When passing a copy of the _pvcdesc using T_PVCP a copy of the _pvcdesc is made (so that the passed in _pvcdesc storage does not have to stay persistent/in scope.)
A reset will normally be generated by the protocol stack in response to this function. In the case of X25pvcattach(), this reset is sent to the application when a reset packet has been exchanged with the remote application on the selected LCI.
In the case of X25hdlcattach(), this reset is sent to the application when the link (layer 2) is up. Usually, these routines wait for the resulting reset before returning to the calling application. This means that the application can start to send and/or receive data upon return from these routines.
If T_NOWAIT, TRUE is passed in then this function will not wait for a RESET (X25RESET event). X25look() may be called upon readability of the associated PVC file descriptor to determine if a X25RESET has been received, at which point X25gotreset() should be called to properly set internal library state.
Tags
  • All global tags
  • T_OUTPKTSIZE
  • T_INPKTSIZE
  • T_INWINDOW
  • T_OUTWINDOW
  • T_PKTSIZE
  • T_WINDOW
  • T_LCI
  • T_PVCP
Parameters
ct X25CALLT handle
tags pointer to TAGS list
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25BADMSG
  • X25BADCALLT
  • X25CONNECTEDIND
  • X25BADCUD
See Also

| Introduction | Function Summary | Function Reference |


X25gotreset

Prototypes int X25gotreset(X25CALLT ct, ...)
int X25gotresettags(X25CALLT ct, TAGS *tags)
Purpose Handles reception of an incoming RESET packet
Description This function has to be called after doing a non-blocking X25pvcattach() ie. T_NOWAIT, TRUE.
If T_VERBOSE is set "Complete" is printed on the console. We obtain PVC information and return 0. It is assumed that the reset was already observed using X25look() or X25read().
Tags
  • None
Parameters
ct X25CALLT handle
tags pointer to TAGS list
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25BADCALLT
See Also

| Introduction | Function Summary | Function Reference |


X25pvcdetach/X25hdlcdetach

Prototypes int X25pvcdetach(X25CALLT ct, ...)
int X25hdlcdetach(X25CALLT ct, ...)
int X25pvcdetachtags(X25CALLT ct, TAGS *tags)
int X25hdlcdetachtags(X25CALLT ct, TAGS *tags)
Purpose Detach from a PVC or HDLC/LAPB link
Description Detaches from PVC or HDLC/LAPB associated with ct.
Tags
  • All global tags
Parameters
ct X25CALLT handle
tags pointer to TAGS list
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25BADMSG
  • X25CONNECTEDIND
  • X25BADCALLT
See Also

| Introduction | Function Summary | Function Reference |


X25write

Prototypes int X25write(X25CALLT ct, ...)
int X25writetags(X25CALLT ct, TAGS *tags);
Purpose Write a packet across your X.25 virtual circuit or HDLC link
Description Sends data over an established X.25 connection.
You may use this function to send data over SVC or PVC connections.
NOTE: the T_BITS tag expects an integer containing some combination of DBIT, MBIT & QBIT Also note that only QBIT may be used by user applications as the other bits are handled in the protocol driver.
If D Bit acknowledgement is active, then for each call to this function an X25read() should be performed which will return an X25DATAACK status code.
Tags
  • All global tags
  • T_BITS
  • T_BUFFER
  • T_BUFLEN
Parameters
ct X25CALLT handle
tags pointer to TAGS list
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25CLEAR
  • X25RESET
  • X25BADBUFFER
  • X25NOTINIT
  • X25BADCALLT

| Introduction | Function Summary | Function Reference |


X25read

Prototypes int X25read(X25CALLT ct, ...)
int X25readtags(X25CALLT ct, TAGS *tags);
Purpose Receive a packet from your X.25 virtual circuit or HDLC link
Description Receive characters from an X.25 connection. You may use this function to receive data from VC or PVC connections.
This function returns the number of bytes read.
It is USUALLY a good idea to check the X.25 error for more information when a -1 is returned.
On Unix, to check for System interrupts ie. EINTR check if X25geterrorct() returns X25SYSERR and errno == EINTR.
NOTE: the T_BITS tag expects a pointer to an integer which is to hold a combination of DBIT, and QBIT. The M Bit should never be set. When receiving a packet with the D Bit set, X25read will send an acknowledgement. The packet level will assemble M-bit-connected packet sequences together before presenting them to the application. This assembly stops when one of the following is true:
  • the M bit is not set on a packet
  • it has collected 4096 bytes worth of data
  • the D bit is set
  • the packet is not full
When receiving a packet with the D Bit set, X25read will send an acknowledgement. The T_BLOCKING and T_TIMEOUT tags available under UNIX are not available under NT. To avoid waiting for data under NT, see the Frame Reception Overview discussion.
Tags
  • All global tags
  • T_BITS
  • T_BUFFER
  • T_BUFLEN
Parameters
ct X25CALLT handle
tags pointer to TAGS list
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25CLEAR
  • X25RESET
  • X25BADBUFFER
  • X25NOTINIT
  • X25BADCALLT

| Introduction | Function Summary | Function Reference |


X25reset

Prototypes int X25reset(X25CALLT ct, ...)
int X25resettags(X25CALLT ct, TAGS *tags)
Purpose Send a RESET packet
Description Send a RESET with given cause and diagnostic values specified by the T_CAUSE and T_DIAG tags respectively.
Tags
  • All global tags
  • T_CAUSE
  • T_DIAG
Parameters
ct X25CALLT handle
tags pointer to TAGS list
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25BADCALLT
See Also

| Introduction | Function Summary | Function Reference |


X25resetconf

Prototypes int X25resetconf(X25CALLT ct)
Purpose Send a RESET CONFIRM packet
Description Send a RESET Confirm.
A reset confirm should be sent on reception of an X25RESET event when returned as an error or from X25look().
Parameters
ct X25CALLT handle
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25BADCALLT
See Also

| Introduction | Function Summary | Function Reference |


X25interrupt

Prototypes int X25interrupt(X25CALLT ct, ...)
int X25interrupttags(X25CALLT ct, TAGS *tags)
Purpose Send an INTERRUPT packet
Description Send an INTERRUPT with given buffer specified by T_BUFFER and T_BUFLEN.
Tags
  • All global tags
  • T_BUFFER
  • T_BUFLEN
Parameters
ct X25CALLT handle
tags pointer to TAGS list
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25BADCALLT
  • X25BADBUFFER
  • X25NOTINIT
  • X25USERDATA
See Also

| Introduction | Function Summary | Function Reference |


X25interruptconf

Prototypes int X25interruptconf(X25CALLT ct)
Purpose Send an INTERRUPT CONFIRM packet
Description Send an INTERRUPT CONFIRM packet.
Parameters
ct X25CALLT handle
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25BADCALLT
  • X25NOTINIT
See Also

| Introduction | Function Summary | Function Reference |


X25listen

Prototypes int X25listen(X25CALLT ct, ...);
int X25listentags(X25CALLT ct, TAGS *tags)
Purpose Start listening on the specific X25CALLT
Description This function will initiate a listen request for the specified protocol identifier. Traditionally, this is the first byte of Call User Data. For example, Hex 01 identifies CCITT X.29 calls. The tag T_LISTENTYPE defines the type of listen and the corresponding meaning of the array presented with T_LISTENPIDS. Valid values for the T_LISTENTYPE tag are:
none
If a T_LISTENTYPE is not specified, each entry in the T_LISTENPIDS array corresponds to the first character in a call user data (CUD) string. That is, a call request which has the first byte of CUD equal to any one of the values in the array will be directed to this listener.
X25_LISTEN_CUDSTR
The T_LISTENPIDS array contains several bytes of one call user data. In this case, the entire CUD field of a call request is compared with the bytes in the array. The wildcard character * may be used. For example, listening for the CUD 1 0 0 * specifies that all calls with the digits 1 0 0 followed by any others should be directed to the application.
X25_LISTEN_CALLED
The T_LISTENPIDS array contains the numeric ASCII digits of a called address. Incoming calls with their called address matching the digits in the array will be directed to this listener. The wildcard character * may be used as described above. Ensure that called_length in the link configuration is set at least as large as the number of digits you are using for listening.
X25_LISTEN_CALLING
The T_LISTENPIDS array contains the numeric ASCII digits of a calling address. Incoming calls with their calling address matching the digits in the array will be directed to this listener. The wildcard character * may be used as described above.
X25_LISTEN_DEF
The application is the default listener. All calls not matching a specific listen (based on CUD, called or calling address) will be directed to this listener. Note that only one default listener is allowed per machine. No T_LISTENPIDS array should be included with this type of listen.
X25_LISTEN_NULL
Null listener. Calls without any call user data will be directed to this listener. No T_LISTENPIDS array should be included with this type of listen.
X25_LISTEN_ACC
Call accounting information is directed to the application.
T_NUMLISTEN specifies the size of the array identified by T_LISTENPIDS. A given call may match more than one listen request but will be directed to only one listener. A listener will be found first by inspecting the CUD, then the called address and then the calling address. Use X25stoplisten() to stop listening for incoming calls.
Tags
  • All global tags
  • T_LISTENTYPE
  • T_NUMLISTEN
  • T_LISTENPIDS
Parameters
ct X25CALLT handle
tags pointer to TAGS list
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25BADPID
  • X25BADCALLT
See Also

| Introduction | Function Summary | Function Reference |


X25stoplisten

Prototypes int X25stoplisten(X25CALLT ct);
Purpose Stop listening for incoming calls on the specified X25CALLT
Description This function will stop a listen request previously enabled. with a call to X25listen().
Parameters
ct X25CALLT handle
Returns
0 on success
-1 on failure
Errors
  • X25SYSERR
  • X25BADCALLT
See Also

| Introduction | Function Summary | Function Reference |


X25look

Prototypes int X25look(X25CALLT ct);
Purpose Check for pending events on your VC or listener.
Description This function should be used to see if there are any events ready to be read. It returns one of the following event codes:
X25CLEAR
The call got cleared
X25SYSERR
System Error Message
X25BADMSG
Unexpected Message from Driver
X25BADERRMSG
Unknown Error Message
X25OUTSTATE
Message Received Out of State
X25RESET
Received Reset
X25INTRCONF
Received Interrupt Confirm
X25INTERRUPT
Received Interrupt
X25DATAIND
Received Data
X25DATAACKIND
Received Data Ack
X25RESETCOMP
Received Reset Complete
X25CALLIND
Received Call Indication
X25CONNECTEDIND
Received Call Connected Indication
Parameters
ct X25CALLT handle
Returns
X.25 error on success
0 no events pending
-1 on failure
See Also

| Introduction | Function Summary | Function Reference |


X25findtag

Prototypes int X25findtag(TAGS *tags, unsigned long item);
Purpose Find tag index in tag array
Description Finds the tag item in the tags array pointed to by tags and returns the index of the tag item in the array.
Parameters
tags pointer to TAGS list
item item to find in tags
Returns
index on success
-1 if not found

| Introduction | Function Summary | Function Reference |


X25setopts

Prototypes void X25setopts(int dummy, ...);
void X25setoptstags(TAGS *tags);
void X25setoptsct(X25CALLT ct, ...);
void X25setoptsct(X25CALLT ct, TAGS *tags);
Purpose Set X.25 library parameters
Description Sets X.25 library parameters.
Tags
  • These global tags
  • T_OUTERR
  • T_TIMEOUT
  • T_VERBOSE
Parameters
dummy Any value will do
ct X25CALLT handle
tags pointer to TAGS list

| Introduction | Function Summary | Function Reference |


X25getopts

Prototypes void X25getopts(int dummy, ...);
void X25getoptstags(TAGS *tags);
void X25getoptsct(X25CALLT ct, ...);
void X25getoptsct(X25CALLT ct, TAGS *tags);
Purpose Get X.25 library parameters
Description Gets X.25 library parameters. The provided tag arguments must be of the following types:
T_OUTERR
FILE **
T_TIMEOUT
int *
T_VERBOSE
int *
Tags
  • These global tags
  • T_OUTERR
  • T_TIMEOUT
  • T_VERBOSE
Parameters
dummy Any value will do
ct X25CALLT handle
tags pointer to TAGS list

| Introduction | Function Summary | Function Reference |


X25linkup

Prototypes void X25linkup(X25CALLT ct);
Purpose Obtain link up status
Description Return the status of an X.25 link being run by the streams stack
Parameters
ct X25CALLT handle
Returns
1 if link is up
0 if link is down
-1 an error occured

| Introduction | Function Summary | Function Reference |


X25getcallinfo

Prototypes void X25getcallinfo(X25CALLT ct, unsigned short indx, cps *callinfo);
Purpose Obtain X.25 Incoming call information
Description Obtain X.25 call information about an incoming call which has not yet been accepted. Ie. a call indicated to have arrived on a listener channel.
Parameters
ct X25CALLT handle
indx Call Index
callinfo cps *
Returns
0 on success
-1 on failure
See Also

| Introduction | Function Summary | Function Reference |


X25sense

Prototypes void X25sense(int netid, int *dcd, int *dsr, int *cts);
void X25sensect(X25CALLT ct, int *dcd, int *dsr, int *cts);
Purpose Obtain status of DCD, DSR and CTS for chosen link
Description Returns the status of the DCD, DSR and CTS lines for the specified netid or X25CALLT.
When this function returns 0 the locations to which the dcd, dsr, cts pointers point to will be filled in as 1 if the line is high and 0 if the line is low.
When the X25sense() function is called internally a new X25CALLT is created and destroyed during this function call.
Parameters
netid Network ID of link
ct X25CALLT handle
dcd pointer to integer to hold DCD status
dsr pointer to integer to hold DSR status
cts pointer to integer to hold CTS status
Returns
0 0 on success
-1 an error occured

| Introduction | Function Summary | Function Reference |


X25setdebugfile

Prototypes int X25setdebugfile(char *file);
Purpose Sets the library debug output file
Description Sets file name of library debug output when debug type is set to X25DEBUG_FILE. The file is opened in write mode. Any previous file with that name will be truncated. This function should be called before calling X25debug(X25DEBUG_FILE). Calling this function after has no effect unless a call to X25debug(X25DEBUG_NONE) is performed first.
Parameters
file File name to write to
Returns
0 0 on success
-1 an error occured

| Introduction | Function Summary | Function Reference |


X25setdebugfunc

Prototypes int X25setdebugfunc(X25DBGFUNC func);
Purpose Sets the library debug output function
Description Sets the call back debug output function. You may call this function at any time unless multiple threads are using the library. In this case you should make sure that other threads are not accessing the library before calling this function. Alternatively a call to X25debug(X25DEBUG_NONE) may be made before setting a different function. This function must be called before calling X25debug(X25DEBUG_FUNCTION)
Parameters
function X25DBGFUNC declared function
Returns
0 0 on success
-1 an error occured

| Introduction | Function Summary | Function Reference |


X25debug

Prototypes void X25debug(int debugtype);
Purpose Enable or disable X.25 library debugging
Description Sets library debugging mode.
One of the following values (defined in libx25.h) can be passed in:
  • X25DEBUG_NONE - turn off debugging
  • X25DEBUG_CONSOLE - Linux: output to stderr
  • X25DEBUG_MONITOR - Windows: output to system debug monitor
  • X25DEBUG_FILE - output to file specified through X25setdebugfile()
  • X25DEBUG_FUNCTION - call to function specified through X25setdebugfunc()
If X25DEBUG_FILE is enabled then a subsequent call to X25debug(X25DEBUG_NONE) will close the file.
Parameters
debugtype One of the above values

| Introduction | Function Summary | Function Reference |


X25setfilter

Prototypes void X25setfilter(int type)
Purpose Sets network type filter for packetnets accesses
Description Sets a network type filter for all accesses to the packetnets file so that the functions X25getnetent(), X25getnetby...() will return only the specified network types.
Default type is NETX25E_TYPE | NETX25_TYPE selecting both Streams based links and intelligent card links.
NETALL_TYPE will retrieve all network types.
Parameters
type type of network mask
See Also

| Introduction | Function Summary | Function Reference |


X25setnetent

Prototypes void X25setnetent()
Purpose Initializes the packetnets file for reading
Description Initializes the packetnets file for reading.
The first X25getnetent() will return the first network entry in the file. Subsequent calls to this function will rewind the file pointer to the beginning of the file. The function X25endnetent() should be called to terminate network file processing.
See Also

| Introduction | Function Summary | Function Reference |


X25endnetent

Prototypes void X25endnetent()
Purpose Ends packetnets file processing
Description Ends packetnets file processing.
See Also

| Introduction | Function Summary | Function Reference |


X25getnetent

Prototypes X25netent *X25getnetent()
Purpose Return next X25netent entry from packetnets file
Description Return next X25netent entry from packetnets file.
Each call to this function will retrieve the next network entry in this file in the form of an X25netent structure.
This function only returns X.25 entries by default. See X25setfilter() to change.
Example

        X25netent *ne;
        X25setnetent();
        // shows all hosts defined in packetnets
        while ((ne = X25getnetent()) != NULL)
        {
    	    printf("Name: %s, Network ID: %d\n", ne->name, ne->netid);
        }
        X25endnetent();
    
Returns
X25netent * on success
NULL on failure or no more entries
See Also

| Introduction | Function Summary | Function Reference |


X25getnetbyname

Prototypes X25netent *X25getnetbyname(char *name)
Purpose Finds the network ID given the network name
Description Attempts to look up a network entry given a name.
This function only returns an X.25 entry by default. See X25setfilter() to change.
There is no need to call X25setnetent() or X25endnetent() before and after calling this function.
Parameters
addr X.25 address
Returns
X25netent * on success
NULL on failure or entry not found
See Also

| Introduction | Function Summary | Function Reference |


X25getnetbynetid

Prototypes X25netent *X25getnetbynetid(char *name)
Purpose Finds the network entry with the given network ID in packetnets file
Description Attempts to look up a network entry given a netid.
This function only returns an X.25 entry by default. See X25setfilter() to change.
There is no need to call X25setnetent() or X25endnetent() before and after calling this function.
Parameters
netid Network ID to find
Returns
X25netent * on success
NULL on failure or entry not found
See Also

| Introduction | Function Summary | Function Reference |


X25getnetbyboard

Prototypes X25netent *X25getnetbyboard(int board, int link)
Purpose Finds the host with the given board and link in packetnets file
Description Attempts to look up a network entry given board and link number.
NOTE: only old style intelligent boards have a board and link number and as such use of this function should be considered deprecated.
There is no need to call X25setnetent() or X25endnetent() before and after calling this function.
Parameters
board Board #
link Link #
Returns
X25netent * on success
NULL on failure or entry not found
See Also

| Introduction | Function Summary | Function Reference |


X25remotenetidtolocalnetid

Prototypes int X25remotenetidtolocalnetid(char *host, int remotenetid)
Purpose Map remote netid to local netid
Description Attempts to map the remote netid # on a specified host to the local network ID as specified in packetnets.
Parameters
host TCPSERVER host in packetnets
remotenetid TCPNETID in packetnets
Returns
netid on success
-1 on failure
See Also

| Introduction | Function Summary | Function Reference |


X25sethostent

Prototypes void X25sethostent()
Purpose Initializes the x25hosts file for reading
Description Initializes the x25hosts file for reading. The first X25gethostent() will return the first host entry in the file. Subsequent calls to this function will rewind the file pointer to the beginning of the file. The function X25endhostent() should be called to terminate x25hosts file processing.
See Also

| Introduction | Function Summary | Function Reference |


X25endhostent

Prototypes void X25endhostent()
Purpose Ends x25hosts file processing
Description Ends x25hosts file processing, closing the file.
See Also

| Introduction | Function Summary | Function Reference |


X25gethostent

Prototypes X25hostent *X25gethostent()
Purpose Return next X25hostent entry from x25hosts file
Description Returns next X25hostent entry from x25hosts file.
Example

        X25hostent *he;
        X25sethostent();
        // shows all hosts defined in x25hosts
        while ((he = X25gethostent()) != NULL)
        {
    	    printf("Host name: %s on Network ID: %d\n", he->host, he->netid);
        }
        X25endhostent();
    
Returns
X25hostent * on success
NULL on failure or no more entries
See Also

| Introduction | Function Summary | Function Reference |


X25gethostbyaddr

Prototypes X25hostent *X25gethostbyaddr(char *name)
Purpose Finds the host with the given X.25 address in x25hosts file
Description Finds the host with the given X.25 address in the x25hosts file.
There is no need to call X25sethostent() or X25endhostent() before and after calling this function.
Parameters
addr X.25 address
Returns
X25hostent * on success
NULL on failure or entry not found
See Also

| Introduction | Function Summary | Function Reference |


X25gethostbyname

Prototypes X25hostent *X25gethostbyname(char *name)
Purpose Finds the named host in x25hosts file
Description Finds the named host in x25hosts file.
There is no need to call X25sethostent() or X25endhostent() before and after calling this function.
Parameters
name Host name
Returns
X25hostent * on success
NULL on failure or entry not found
See Also

| Introduction | Function Summary | Function Reference |


X25getinfo

Prototypes int X25getinfo(X25CALLT ct, ...)
int X25getinfo(X25CALLT ct, TAGS *tags)
Purpose Obtain information about an established call
Description Obtains information from an established call for both PVCs and SVCs. NOTE: Tags expect pointers to valid areas of memory as arguments
Example

        int size;
        X25CALLT ct;
        rc = X25getinfo(ct, T_OUTPKTSIZE, &size, TAG_END);
    
Tags
  • T_INPKTSIZE
  • T_OUTPKTSIZE
  • T_INWINDOW
  • T_OUTWINDOW
  • T_PRIORITY
  • T_REVERSE
  • T_CUD
  • T_CUDLEN
  • T_DNA
  • T_DNALEN
  • T_NUI
  • T_CPSP
  • T_PVCP
  • T_NUILEN
  • T_INTHRUCLASS
  • T_OUTTHRUCLASS
  • T_DBITSUPPORT
  • T_PKTSIZE
  • T_WINDOW
  • T_THRUCLASS
Parameters
ct X25CALLT handle
tags pointer to TAGS list
Returns
0 on success
-1 on failure
Errors
  • X25BADCALLT

| Introduction | Function Summary | Function Reference |


X25initcpstags

Prototypes int X25initcpstags(cps *cpsp, ...)
int X25initcpstags(cps *cpsp, TAGS *tags)
Purpose Initialize a Call Progress Structure
Description Initializes cps with the information contained in tags.
Note:
To specify the DNA you need not provide the T_DNALEN tag. If this T_DNALEN is not provided it will assume to take the length of the string passed to T_DNA. The T_CUD and T_NUI tags, however, require the presence of T_CUDLEN and T_NUILEN respectively.
Example

          cps C;
          X25initcps(&C);
          rc = X25initcpstags(&C, T_WINDOW, 7, T_OUTPKTSIZE, 128, TAG_END);
    
Tags
  • T_INPKTSIZE
  • T_OUTPKTSIZE
  • T_INWINDOW
  • T_OUTWINDOW
  • T_PRIORITY
  • T_REVERSE
  • T_CUD
  • T_CUDLEN
  • T_DNA
  • T_DNALEN
  • T_NUI
  • T_NUILEN
  • T_INTHRUCLASS
  • T_OUTTHRUCLASS
  • T_DBITSUPPORT
  • T_PKTSIZE
  • T_WINDOW
  • T_THRUCLASS
Parameters
cpsp pointer to cps
tags pointer to TAGS list
Returns
0 on success
-X.25 Error on failure
Errors
  • X25BADCUD
  • X25BADNUI
  • X25BADDNA
See Also

| Introduction | Function Summary | Function Reference |


X25initcps

Prototypes int X25initcps(cps *cpsp)
Purpose Clears a Call Progress Structure
Description Clear cps struct, thereby allowing the drivers to use their default values.
Parameters
cpsp pointer to cps
See Also

| Introduction | Function Summary | Function Reference |


X25initpvctags

Prototypes int X25initpvctags(_pvcdesc *pvcp, ...)
int X25initpvctags(_pvcdesc *pvcp, TAGS *tags)
Purpose Initialize a PVC Descriptor Structure
Description Initializes pvc structure with the information contained in tags.
Example

          _pvcdesc P;
          rc = X25initpvctags(&P, T_WINDOW, 7, T_OUTPKTSIZE, 128, TAG_END);
    
Tags
  • T_INPKTSIZE
  • T_OUTPKTSIZE
  • T_PKTSIZE
  • T_INWINDOW
  • T_OUTWINDOW
  • T_WINDOW
  • T_LCI
Parameters
pvcp pointer to _pvcdesc structure
tags pointer to TAGS list
Returns
0 on success
See Also

| Introduction | Function Summary | Function Reference |


X25initpvc

Prototypes int X25initpvc(_pvcdesc *pvcp)
Purpose Clears a PVC description Structure
Description Initialize _pvcdesc structure to default values of all zeroes, which implies that the Packet Level or SPI drivers will use the configured defaults. However, the default LCI number is set to 1.
Parameters
pvcp pointer to _pvcdesc
See Also

| Introduction | Function Summary | Function Reference |


X25lookinit

Prototypes X25_lookent *X25lookinit(int maxlcis)
Purpose Initialize the file descriptor selection mechanism
Description Initializes the selection mechanism for file descriptors.
MAXLOOKFDS is 512 for non SyncServer and 256 for SyncServer client.
Currently the limit for the number of file descriptors to listen on is imposed by the operating system to be MAXLOOKFDS. If maxlcis is specfied to be more than MAXLOOKFDS the call will succeed, but still only MAXLOOKFDS file descriptors are allowed. The pointer returned by this function must be used in all the other "look" functions expecting a X25_lookent.
Parameters
maxlcis maximum number of lcis
Returns
X25_lookent * on success
NULL on failure
See Also

| Introduction | Function Summary | Function Reference |


X25lookclose

Prototypes void X25lookclose(X25_lookent *xlook)
Purpose Closes the look list handle
Description Closes the selection mechanism for xlook.
Parameters
xlook Pointer to X25_lookent structure
See Also

| Introduction | Function Summary | Function Reference |


X25lookadd

Prototypes int X25lookadd(X25_lookent *xlook, X25CALLT ct)
Purpose Add file descriptor(s) to the look list
Description Add the file descriptor(s) associated with ct to the selection list contained in look if possible.
Parameters
xlook Pointer to X25_lookent structure
ct X25CALLT handle
Returns
0 on success
-1 on failure
See Also

| Introduction | Function Summary | Function Reference |


X25lookdel

Prototypes int X25lookdel(X25_lookent *xlook, X25CALLT ct)
Purpose Removes the file descriptor(s) from the look list
Description Removes the file descriptor(s) associated with ct from the selection list contained in xlook.
Parameters
xlook Pointer to X25_lookent structure
ct X25CALLT handle
Returns
0 on success
-1 on failure
See Also

| Introduction | Function Summary | Function Reference |


X25looksel

Prototypes X25CALLT X25looksel(X25_lookent *xlook, int tmout)
Purpose Checks for availability of datagrams on look list
Description Checks for availability of datagrams for the LCIs in the selection list specified through X25lookadds.
Parameters
xlook Pointer to X25_lookent structure
tmout milliseconds to wait (-1 to block indefinitely, 0 for non blocking)
Returns
ct X25CALLT handle where a datagram can be read
NULL nothing to be read
See Also

| Introduction | Function Summary | Function Reference |


X25lookatone

Prototypes int X25lookatone(X25CALLT ct, int tmout)
Purpose Look at one X25CALLT and wait for activity
Description Checks for availability of datagrams for the LCI associated with ct.
Parameters
ct X25CALLT handle
tmout milliseconds to wait (-1 to block indefinitely, 0 for non blocking)
Returns
1 something to read
0 nothing to read
-1 on failure
See Also

| Introduction | Function Summary | Function Reference |


X25error

Prototypes void X25error(char *string);
void X25errorct(X25CALLT ct, char *string);
Purpose Prints the X.25 error message
Description Prints the error message associated with X.25 library error codes as in unix's perror(S). If a system error was encountered it will also be printed. The resulting output will be of the form:
    	string: error message
        
In the case of a Clear or Reset, the cause and diagnostic codes are also printed. This function will reset the library error codes.
Parameters
ct X25CALLT handle
string string to be printed
See Also

| Introduction | Function Summary | Function Reference |


X25seterror

Prototypes void X25seterror(int xerr);
void X25seterrorct(X25CALLT ct, int xerr);
Purpose Sets the X.25 error
Description Sets the current X.25 error.
Parameters
ct X25CALLT handle
xerr Error number
See Also

| Introduction | Function Summary | Function Reference |


X25geterror

Prototypes int X25geterror();
int X25geterrorct(X25CALLT ct);
Purpose Gets the X.25 error
Description Gets the current X.25 error.
Parameters
ct X25CALLT handle
See Also

| Introduction | Function Summary | Function Reference |


X25getsyserror

Prototypes int X25getsyserror();
int X25getsyserrorct(X25CALLT ct);
Purpose Gets the X.25 system error
Description Gets the current X.25 system error when the X.25 error is X25SYSERR.
Parameters
ct X25CALLT handle
See Also

| Introduction | Function Summary | Function Reference |


X25getdiags

Prototypes int X25getdiags(X25diags *diag, int szdiags);
int X25getdiagsct(X25CALLT ct, X25diags *diag, int szdiags);
Purpose Gets the X.25 diagnostic and cause codes
Description Gets the current X.25 cause and diagnostic data into a X25diag structure defined in the library header file.
Example

        X25diags diag;
        X25getdiagsct(ct, &diag, sizeof(diag));
    
Parameters
ct X25CALLT handle
diag pointer to X25diags structure
szdiags sizeof X25diags structure
See Also

| Introduction | Function Summary | Function Reference |


X25errormsg

Prototypes int X25errormsg(int xerrno, char *buf, int buflen);
Purpose Obtain error message based on X.25 error code
Description Copies the error message associated with X.25 library error code into a buffer.
In the case of a Clear or Reset, the cause and diagnostic codes can be interpreted by calling X25causemsg() and X25diagmsg() respectively.
If buflen is smaller than the size required in buf, then buf remains unmodified and the return value indicates the number of bytes needed.
If buf is NULL then this function will return the size required for the string (minus the terminating 0)
Parameters
xerrno X.25 error number
buf pointer to buffer to write error to
buflen max size of buffer to copy to
Returns
#bytes (# of bytes copied to buffer) - 1
See Also

| Introduction | Function Summary | Function Reference |


X25causemsg

Prototypes int X25causemsg(int cause, int xcause, char *buf, int buflen);
Purpose Obtain error message based on cause code
Description Copies the error message associated with X.25 Cause and XIP cause code into a buffer.
If buflen is smaller than the size required in buf, then buf remains unmodified and the return value indicates the number of bytes needed.
If buf is NULL then this function will return the size required for the string (minus the terminating 0)
Parameters
cause Cause Code
xcause XIP Cause Code
buf pointer to buffer to write error to
buflen max size of buffer to copy to
Returns
#bytes (# of bytes copied to buffer) - 1
See Also

| Introduction | Function Summary | Function Reference |


X25diagmsg

Prototypes int X25diagmsg(int diag, char *buf, int buflen);
Purpose Obtain error message based on diagnostic code
Description Copies the error message associated with X.25 diagnostic code into a buffer.
If buflen is smaller than the size required in buf, then buf remains unmodified and the return value indicates the number of bytes needed.
If buf is NULL then this function will return the size required for the string (minus the terminating 0)
Parameters
diag Diagnostic Code
buf pointer to buffer to write error to
buflen max size of buffer to copy to
Returns
#bytes (# of bytes copied to buffer) - 1
See Also

| Introduction | Function Summary | Function Reference |




Mon Dec 13 11:56:35 2004 by xtractxml.pl$Revision: 1.2 $
Copyright (C) 2003 The Software Group Limited. All Rights Reserved.