Using the X.25 Library

Introduction
Network Lookup Function Overview
Host Lookup Functions Overview
Packet Reception Status Function Overview
X.25 Functions
Example Program
Error Handling and Codes
Supported Tags
X.25 Library Header File
packetnets Example
x25netent structure


Introduction

The X.25 library is an abstraction layer which allows programmers to focus on their protocol-sensitive application development, without regard for the mechanisms used to communicate with the X.25 infrastructure. Within limits, the library allows the development of applications which (at the source code level) work on Netcom II, Wanware Linux, Wanware/NT, and the SyncServer product lines.

The library is partly based on a concept called 'Tags'; library routines use Tags to obtain parameters for some functions. Tags are almost always passed in pairs: the manifest constant for the tag itself and the value associated with it. (The only exception to this is the last tag in the list, which must ALWAYS be TAG_END!) Whenever a function specifies that it accepts a TAG LIST, a variable length argument list is expected to be passed to it. A variation on this is to pass a pointer to the first element of an array of TAG structures to the ...tags() variant of this function.

An example:


    rc = X25makecall(callt, T_OUTPKTSIZE, 256,
		T_CUD, "\01\00\00\00C",
		T_CUDLEN, 5,
		TAG_END);

Any function capable of accepting tag arguments can be called in either of two ways. The first is to pass a variable number of tag arguments This method allows for great flexibility, especially the ability to use C's conditional operator to create conditional tags. Example:


X25clear(ct, diag_known ? T_DIAG : T_IGNORE, 0x80, TAG_END);

The second way involves passing an array of tags, which must still include a TAG_END. This method results in faster execution in most cases, since the library normally converts variable argument tags into an array form before processing them. You may wish to use this method when you are passing the same tags over and over again. Example:


TAGS mytags[] = { {T_DIAG, 0x80}, {TAG_END, 0} };
X25cleartags(ct, mytags);

Most functions will return 0 for success or -1 for failure.

An error code may be retrieved by calling X25geterror() or X25geterrorct() when processing a CALLT. X25error() may be called to print out an explanation for the error on stdout. X25errormsg() may be called to translate the error code into a message. Please see libx25.h for a list of currently defined error codes.



Network Lookup Functions Overview

The library requires that a netid be used to identify a particular board and link combination. The following group of functions enable access to the database which contains the Netid information.

Before using X25getnetent, the functionX25setnetent must be called which allocates necessary resources and enables the library to access the configuration database. At this point X25getnetent can be used to scan through the list of netids in the system. An optional filter can be specified using X25setfilter to limit or increase the types of Netids returned by X25getnetent. To release the resources allocated by X25setnetent, call X25endnetent.

The functions X25getnetbynetid and X25getnetbyname use the above functions to search through the configuration database to locate the desired Netid. These functions do not require the calling application to use X25setnetent or X25endnetent.


Host File Lookup Overview

The x25hostent structure is defined in libx25.h It contains the name of the host, the DNA (X.121 Address), the network ID, flags specifying special options for the host, and a partially filled call request structure.

All host file access functions will return a pointer to a static area which will be overwritten by the next call to a host file access function.

The functions to enumerate hosts in the x25hosts file are: X25sethostent to initialize file access, X25gethostent to retrieve one host from the file, and X25endhostent to terminate file access. Functions to search for a specific host are: X25gethostbyaddr to retrieve an x25hostent structure associated with a given DNA (X.121 address) and Network ID, and X25gethostbyname to retrieve an x25hostent structure associated with a logical host name.




Packet Reception Status Function Overview

The library has two mechanisms to determine the availability of data packets on one or more circuits.

If only one circuit is to be monitored, then using X25lookatone is the simplest method. However, this approach does not easily scale when 2 or more circuits require monitoring.

Under Unix select() may be employed to investigate file descriptors for readability and writability.

The recommended method for multi-circuit applications under Win32 is to use the X25lookxxxx series of functions. This set of functions is used to manipulate and monitor a list of circuits.X25lookinit initializes the list, X25lookadd and X25lookdel manipulate list entries, X25looksel queries the list for available data packets and X25lookclose frees the list.


X.25 Functions

General Functions

X.25 Operation Functions

X25accept
Process Call Accept after NOWAIT Call Request
X25clear
Clears any type of call
X25close
Close X.25 connection
X25getcall
Accept an X.25 call
X25incall
Receive an X.25 call
_X25getcallinfo
Obtain the parameters of an incoming (not yet accepted) call
X25interrupt
Send an INTERRUPT
X25interruptconf
Send an INTERRUPT Confirm
X25listen
Listen to Specific Events
X25look
Check for an incoming event
X25makecall
Make an X.25 call
X25open
Open X.25 connection
X25pvcattach
Attach to a PVC
X25pvcdetach
Detach from a PVC
X25hdlcattach
Attach to a HDLC/LAPB link
X25hdlcdetach
Detach from a HDLC/LAPB link
X25read
Read data
X25reset
Send a RESET
X25stoplisten
Stop listening to events
X25write
Write data

Host Lookup Functions

These functions are used to access the host file using the x25hostent structure.

X25endhostent
Stop Host file lookup operations
X25gethostbyaddr
Lookup Host by Address
X25gethostbyname
Lookup Host by Name
X25gethostent
Get host entry
X25sethostent
Start Host file lookup operations

Network Lookup Functions

These function are used to access the networks file using the x25netent structure.

X25endnetent
End Network Lookup Operations
X25getnetbyboard
Lookup Network By Board and Link No.
X25getnetbyname
Lookup Network by Name
X25getnetbynetid
Lookup Network by Network ID
X25getnetent
Obtain Network Entry
X25setnetent
Start Network Lookup Operations
X25setfilter
Sets the Network type filter for the Network Lookup Functions.

Miscellaneous Functions

findtag
Find Tag given Tag list
X25error
Prints out text version of current X.25 or system error
X25errorct
Prints out text version of current X.25 or system error for CALLT functions.
X25geterror
Get the library internal error code
X25geterrorct
Get the library internal error code for CALLT functions (Needed for threaded applications)
X25getsyserror
Get the system error code (Unix errno at the time of the problem)
X25getsyserrorct
Get the system error code for CALLT functions (Needed for threaded applications)
X25errormsg
Print X.25 Error Information into buffer
X25getinfo
Obtain Information from connection
X25getinfotags
Obtain Information from connection
X25getopts
Obtain Global Tags
X25initcps
Initialize cps structure
X25initcpstags
Initialize cps structure
X25initpvc
Initialize _pvcdesc structure
X25initpvctags
Initialize _pvcdesc structure
X25setopts
Set Global Tags
X25linkup
Return the status of the X.25 link
X25lookatone
Check readability of one CALLT
X25lookinit
Initialize the selection list
X25looksel
Check for datagrams on multiple VCs
X25lookadd
Add a CALLT to the selection list
X25lookdel
Remove a CALLT to the selection list
X25lookclose
Close/Free the selection list
X25getsyserror
Obtain system error code
X25seterror
Set the library internal error code

Macros

ct is of type CALLT *

X25_CPS(ct)
pointer to call progress structure (CPS) associated with ct
X25_DEVNAME(ct)
device name for this call
X25_FD(ct)
file descriptor for CALLT on which data and exceptions will appear
X25_ISHDLC(ct)
Is it an HDLC/LAPB connection?
X25_ISINIT(ct)
Is the CALLT structure initialized?
X25_ISPVC(ct)
Is it a PVC connection?
X25_LCI(ct)
Logical Channel ID
X25_NETID(ct)
Network ID for this call
X25_PVC(ct)
pointer to _pvcdesc associated with ct


Example Program


/*************************************************************
 *  Module Name: libtest.c
 *
 *  Description:
 *   Sends a string 100 times over an X.25 link
 *************************************************************

#include <stdio.h>
#include <libx25.h>

#define NUMPACKETS     100

int main(int argc, char **argv)
{
    CALLT *ct;
    int i, netid = 0;
    char *string = "This is the string being sent across X.25";
    char buf[80];

    if (argc > 1)
	netid = atoi(argv[1]);

    /*
     * Prior to any X.25 activity, obtain a handle for
     * operating the virtual circuit.
     */
    if (!(ct = X25open(netid, TAG_END)))
    {
	X25error("test");
	exit(1);
    }

    /*
     * Make a call to a remote machine at 123456 by sending
     * out a Call Request Packet.
     */
    if (X25makecall(ct, T_OUTPKTSIZE, 256,
	T_DNA, "123456",
	T_CUD, "\01\00\00\00C",
	T_CUDLEN, 5,
	T_VERBOSE, TRUE,
	TAG_END) < 0)
    {
	X25error("test");
	X25close(ct);
	exit(1);
    }

    /*
     * Send the same string to the machine 100 times
     * prepended by it's sequence number.
     */
    for (i = 0; i < NUMPACKETS; i ++)
    {
	sprintf(buf, "%03d: %s\n", i, string);
	if (X25write(ct, T_BUFFER, buf,
	    T_BUFLEN, strlen(buf),
	    TAG_END) < 0)
	{
	    X25error("test");
	    break;
	}
    }

    /*
     * Now we're done with X.25. Close and exit.
     */
    X25close(ct);
    exit(0);
}


Error Codes

On older versions of the library only the exported variable x25errno may be used to ascertain the current error code. The following is a list of error codes which X25geterror() or X25geterrorct() may return or which x25errno may take on. If the returned code is set to X25SYSERR check the return from X25getsyserror() or X25getsyserrorct() or errno (on Unix) for more details. X25error() or X25errorct() will print out the error message associated with both X.25 library errors and system errors. Output will be written to the file associated with the X25OUTERR tag FILE pointer. This value defaults to stderr.

Error Code

Description

X25CLEAR

Call Cleared. Check x25errbuf->cause and x25errbuf->diag for cause and diagnostic codes respectively.

X25NOADDR

No data network address (DNA) given in call to X25makecall()

X25SYSERR

System Error. Error codes depend on operating system.

X25BADMSG

Bad/Undefined Message

X25BADERRMSG

Unknown Error was detected

X25OUTSTATE

Invalid Protocol State

X25USERDATA

User Data Too Large

X25OPTERR

Invalid Tag was passed to a library function.

X25PVCINUSE

PVC in Use

X25NOTAPVC

Not a PVC

X25ISAPVC

Not a valid function for a PVC

X25NOTLISTENER

Not a listening VC

X25BADPID

Bad Protocol ID specification

X25BADDEFAULT

Bad Default listener

X25RESET

Call Reset. Check x25errbuf->cause and x25errbuf->diag for cause and diagnostic codes respectively.

X25INTRCONF

Interrupt Confirmation

X25INTERRUPT

Interrupt

X25FILEFMT

Bad File Format in x25hosts or packetnets file

X25DATAIND

Data Indication. Incoming data is waiting.

X25DATAACKIND

Data Ack. Indication

X25RESETCOMP

Reset Completed

X25CALLIND

Call Indication use X25getcall() to establish a connection

X25CONNECTEDIND

Call Connected Indication. Connection has been established.

X25BADNUI

Bad NUI Syntax

X25FACLEN

Facility String Too Long

X25PVCSYN

Syntax Error in PVC String

X25BADNULL

Bad Null-protocol Listener

X25HDLCSYN

Syntax Error in HDLC/LAPB String

X25BADCALLT

Bad CALLT contents

X25NOVC

No VC Specified in X25getcall()

X25NOTINIT

Call Not Initialized Properly

X25BADBUFFER

Bad Buffer Specification (ie. NULL pointer or zero sized buffer)

X25BADNETID

Unable to Look up Network ID

X25NOTFOUND

File not found ie. x25hosts or packetnets.

X25BADDNA

Bad Data Network Address (DNA pointer is NULL or the size is greater than CPS_ADDMAX)

X25BADCUD

Bad Call User Data (CUD pointer is NULL or the size is greater than CPS_CCUDMAX)

X25BADHOST

Bad Host Name or Address (unable to look up host or address in x25hosts

X25BADPOINTER Bad Pointer was provided to a function
X25ISAPVC API call is not valid for a PVC
X25PVCDISC Phone line disconnected for dialup PVC
X25INVHANDLE A handle was found to be invalid.

Supported Tags

This is a list of currently supported tags and an explanation of their meanings. Global tags can be used by any function expecting tag arguments, while specialized tags can only be used by specific functions.

Note that the expected data type of the tag argument (the next argument passed to a library function) differs from tag to tag; it may even differ for a given type of tag, depending on which library function the tag is passed to. In general, when passing a tag to X25getinfo() to obtain an X.25 setting, the tag argument must be a pointer to the memory location where you would like to store the data. So if the data is an integer, the tag argument will be a pointer to an integer (int *); if the data is already a pointer, the tag argument will be a pointer to a pointer, etc.

Special tags

TAG_IGNORE

Ignore this tag and its argument

TAG_END

End of Tag List

TAG_DONE

Synonym for TAG_END

T_END

Another Synonym for TAG_END

Global Tags

T_OUTERR

A file stream where X.25 error messages will be sent by X25error() and other library functions if verbose mode is turned on. The present error output stream is stored in the global variable x25outerr, and is stdoutby default. Pass a value of type (FILE *) when setting the error output stream; pass a value of type (FILE **) when obtaining it.

T_VERBOSE

A boolean telling the library whether to comment on the progress of X.25 functions by printing out status messages to the error output stream. The present verbose mode is stored in the global variable x25verbose, and is FALSE by default. Pass a value of type (int), where zero indicates FALSE and non-zero TRUE, when setting the verbose mode; pass a value of type (int *) when obtaining it.

T_BLOCKING

A boolean that determines whether to block (wait) on library calls or not. For example, when X25read() is used with blocking on, the library will wait until a packet is read or a predetermined length of time has elapsed; otherwise it will fail immediately if no packet is ready. The blocking mode is stored in the global variable x25blocking, and is TRUE by default. Pass a value of type (int), where zero indicates FALSE and non-zero TRUE, when setting the blocking mode; pass a value of type (int *) when obtaining it.

T_TIMEOUT

The number of seconds to block before returning unsuccessfully. The present timeout delay is stored in the global variable x25timeout, and is 60 by default. Pass a value of type (int) when setting the timeout delay; pass pass a value of type (int *) when obtaining it.

Specialized Tags

T_DEVICE

Device name string from the packetnets file. Pass a value of type (char *) when specifying the device name.

T_BOARD

Board number of the X.25 card to use, starting at zero for the first card installed in the system. Pass a value of type (int) when specifying the board number.

T_LINK

Link number to use, starting at zero for the first link on the X.25 card. Pass a value of type (int) when specifying the link number.

T_OUTPKTSIZE

Maximum data packet size for outgoing packets, in bytes. Pass a value of type (int) when setting the outgoing packet size; pass a value of type (int *) when obtaining it.

T_INPKTSIZE

Maximum data packet size for incoming packets, in bytes. Pass a value of type (int) when setting the incoming packet size; pass a value of type (int *) when obtaining it.

T_PKTSIZE

Used to set both incoming and outgoing packet sizes to the same value. If these sizes are to be different, you must use T_OUTPKTSIZE and T_INPKTSIZE separately.

T_DNA

Pointer to called Data Network Address buffer, used in conjunction with the T_DNALEN tag. Pass a value of type (char *).

T_DNALEN

Length of called Data Network Address string (in bytes), used in conjunction with the T_DNA tag. Pass a value of type (int) when specifying the DNA length; pass a value of type (int *) when obtaining it.

T_CUD

Pointer to Call User Data buffer, used in conjunction with the T_CUDLEN tag. This buffer contains any data the caller wishes to pass when making a call. Pass a value of type (char *).

T_CUDLEN

Length of Call User Data buffer, used in conjunction with the T_CUD tag. Pass a value of type (int) when specifying the length of the CUD buffer; pass a value of type (int *) when obtaining it.

T_BUFFER

Pointer to a user-allocated buffer, used in conjunction with the T_BUFLEN tag. Pass a value of type (char *) when providing a buffer to any library function.

T_BUFLEN

Size of a user-allocated buffer, used in conjunction with the T_BUFFER tag. Pass a value of type (int) when specifying the buffer size.

T_PRIORITYCALL

Priority service flag (Datapac). Pass a value of type (int), where zero is FALSE and non-zero is TRUE, when setting the priority flag; pass a value of type (int *) when obtaining it.

T_REVERSE

Reverse Charge flag, used to indicate that the end accepting an X.25 call will be charged for its cost, rather than the end making the call. Pass a value of type (int), where zero is FALSE and non-zero is TRUE, when setting the reverse charge flag; pass a value of type (int *) when obtaining it.

T_BITS

Bitfield comprised of some combination of QBIT, DBIT, and MBIT 'or'ed together. Pass a value of type (int) when setting the bitfield for an outgoing packet; pass a value of type (int *) when obtaining it for an incoming packet.

T_OUTWINDOW

Outgoing window size, the number of outgoing frames that can be queued before flow control occurs. Pass a value of type (int) when setting the outgoing window size; pass a value of type (int *) when obtaining it.

T_INWINDOW

Incoming window size, the number of incoming frames that can be queued before flow control occurs. Pass a value of type (int) when setting the incoming window size; pass a value of type (int *) when obtaining it.

T_WINDOW

Used to set both incoming and outgoing window sizes to the same value. If these sizes are to be different, you must use T_OUTWINDOW and T_INWINDOW separately.

T_OUTTHRUCLASS

Outgoing throughput class, a number from 3 to 12 representing bits per second. Pass a value of type (int) when specifying the throughput class; pass a value of type (int *) when obtaining it.

T_INTHRUCLASS

Incoming throughput class, a number from 3 to 12 representing bits per second. Pass a value of type (int) when specifying the throughput class; pass a value of type (int *) when obtaining it.

T_THRUCLASS

Used to set both incoming and outgoing throughput classes to the same value. If these classes are to be different, you must use T_OUTTHRUCLASS and T_INTHRUCLASS separately.

T_LCI

Used to specify the Logical Channel Identifier number when establishing a PVC connection. Pass a value of type (int) when setting the LCI.

T_CALLINDEX

Used to specify the call index of an incoming call. Pass a value of type (int) when specifying the call index.

T_CPSP

Pointer to a fully qualified CPS structure, which contains connection parameters for SVCs. This tag is useful for setting or obtaining many parameters at once. Pass a value of type (cps *).

T_PVCP

Pointer to a fully qualified _pvcdesc structure, which contains connection parameters for PVCs. This tag is useful for setting or obtaining many parameters at once. Pass a value of type (_pvcdesc *).

T_CAUSE

Cause code for a clear or reset. See the Administrator's Guide for a complete list of cause codes. Pass a value of type (int) when setting the cause code.

T_XIPCAUSE

XIP cause code for a clear or reset. See the Administrator's Guide for a complete list of XIP cause codes. Pass a value of type (int) when setting the XIP cause code.

T_DIAG

Diagnostic code for a clear or reset. See the X.25 Administrator's Guide for a complete list of diagnostic codes. Pass a value of type (int) when setting the diagnostic code.

T_NETNAME

Network name string from the packetnets file. Pass a value of type (char *) when specifying the network name.

T_LISTENTYPE

Type of listen to perform; see X25listen() for details. Pass a value of type (int) when specifying the listen type.

T_NUMLISTEN

Number of elements in an array protocol identifiers, used in conjunction with the T_LISTENPIDS tag. Pass a value of type (int) when specifying the array size.

T_LISTENPIDS

Pointer to an array of protocol identifiers, which each correspond to the first character in a CUD string. Pass a value of type (int *) when specifying the array of protocol IDs.

T_NUI

Network user ID string, used only when making or accepting a call. Pass a value of type (char *).

T_NUILEN

Length of network user ID buffer, used in conjunction with the T_CUD tag. Pass a value of type (int) when specifying the length of the CUD buffer; pass a value of type (int *) when obtaining it.

T_FLAGS

Flags to pass to an open() system call when first calling X25open(). Pass a value of type (int) when specifying the flags.

T_DBITSUPPORT

DBIT flag, used to request that end-to-end Data Ack packets be transmitted. Pass a value of type (int), a boolean where zero is FALSE and non-zero is TRUE.

T_HOST

Remote host name string from the x25hosts file. Pass a value of type (int *) when specifying the host name.

T_HOSTADDR

Remote host address string from the x25hosts file. Pass a value of type (int *) when specifying the host name.

T_NOWAIT

No-wait flag. If FALSE (zero), wait to receive a Call Accept message when making a call; if TRUE (non-zero), do not wait. Pass a value of type (int) when specifying the no-wait flag.

T_PNETID

A pointer to an integer which is to contain the Network ID.

[ Functions | Contents | Tags | Errors ]


X.25 Library Header File

This header file contains constants and function prototypes needed for proper compilation. Please see libx25.h located under your X.25 development directory for details.

[ Functions | Contents | Tags | Errors ]


X.25 Functions (alphabetical list)

findtag
X25accept
X25clear
X25close
X25error
X25errorct
X25errormsg
X25getcall
X25getinfo
X25getopts
X25hdlcattach
X25hdlcdetach

X25incall
X25initcps
X25initcpstags
X25initpvc
X25initpvctags
X25interrupt
X25interruptconf
X25linkup
X25listen
X25look

X25makecall
X25open
X25pvcattach/X25hdlcattach
X25pvcdetach/X25hdlcdetach
X25read
X25setopts
X25stoplisten
X25write
_X25getcallinfo


X25accept

Function Prototype:

X25accept(CALLT *ct)

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).

Arguments:

ct - pointer to CALLT structure

Returns:

0 on success
-1 on failure

See Also:

X25makecall
X25look

Possible Error Codes

X25CLEAR

X.25 call not connected. Check x25errbuf for clearing code

X25SYSERR

operating system error; check errno

X25BADMSG

Internal Error: unrecognizable message from Driver

X25PVCINUSE

CALLT already in use for PVC

X25CONNECTEDIND

No error: call connected successfully

X25BADCALLT

*ct passed addresses an invalid CALL, or one already in use

[ Functions | Contents | Tags | Errors ]


X25clear

Function Prototype:

X25clear(CALLT *ct, TAG LIST)
X25cleartags(CALLT *ct, tags);

Description:

Clears an X.25 call. Not valid on PVCs. There are 3 ways to call this function:
Tags recognized:

All global tags
T_DIAG
T_CAUSE
T_XIPCAUSE
T_CPSP

Arguments:

ct - pointer to CALLT structure
tags - pointer to TAGS list

Returns:

0 for success
-1 for failure

Possible Error Code

X25SYSERR

operating system error; check errno

X25PVCINUSE

CALLT already in use for PVC

X25BADCALLT

*ct passed addresses an invalid CALLT, or one already in use

X25ISAPVC

A PVC was passed to a library functions that is not valid for a PVC

X25USERDATA

User data too large in call

[ Functions | Contents | Tags | Errors ]


X25close

Function Prototype:

X25close(CALLT *ct)

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 and X25_FD() will no longer return a valid file descriptor.

Arguments:

ct - pointer to CALLT structure

Returns:

None

See Also:

X25open
X25clear
X25pvcdetach

Possible Error Codes

X25SYSERR

operating system error; check errno

X25PVCINUSE

CALLT already in use for PVC

X25BADCALLT

*ct passed addresses an invalid CALLT, or one already in use

[ Functions | Contents | Tags | Errors ]


X25error

Function Prototype:

X25error(char *string)

Description:

Prints the error message associated with X.25 library error codes as in 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.

Arguments:

string - pointer to message to print

Returns:

none

See Also:

X25errorct
X25errormsg
X25geterror
X25geterrorct

[ Functions | Contents | Tags | Errors ]


X25errorct

Function Prototype:

X25errorct(CALLT *ct, char *string)

Description:

Prints the error message associated with X.25 library error codes as in 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.

Arguments:

ct - pointer to CALLT structure

string - pointer to message to print

Returns:

none

See Also:

X25error
X25errormsg
X25geterror
X25geterrorct

[ Functions | Contents | Tags | Errors ]


X25errormsg

Function Prototype:

X25errormsg(int xerrno, char *buf, int buflen)

Description:

Prints the error message associated with X.25 library error codes into the buffer pointed to by buf. It returns the number of characters copied into buf or the number of characters needed to copy the resulting string if buflen is too small.

Arguments:

xerrno - X.25 Error Number
buf - buffer to copy into
buflen - length of buffer

Returns:

number of characters copied or needed

See Also:

X25error
X25geterror
X25geterrorct

[ Functions | Contents | Tags | Errors ]


X25getinfo

Function Prototype:

X25getinfo(CALLT *ct, TAG LIST)
X25getinfotags(CALLT *ct, TAGS *tags)

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; CALLT *ct;
rc = X25getinfo(ct, T_OUTPKTSIZE, &size, TAG_END);

Tags recognized:

All global tags
T_INPKTSIZE
T_OUTPKTSIZE
T_INWINDOW
T_OUTWINDOW
T_PRIORITYCALL
T_REVERSE
T_CUD
T_CUDLEN
T_DNA
T_DNALEN
T_LCI
T_NUI
T_NUILEN
T_INTHRUCLASS
T_OUTTHRUCLASS
T_CPSP
T_PVCP
T_DBITSUPPORT

Arguments:

CALLT *ct - pointer to callt structure to initialize
TAGS *tags - pointer to tag list containing options

Returns:

0 For success
-1 For error

See Also:

X25makecall

Possible Error Codes

X25SYSERR

operating system error; check errno

X25BADCALLT

*ct passed addresses an invalid CALLT, or one already in use

X25BADBUFFER

Bad buffer specification

[ Functions | Contents | Tags | Errors ]


X25getcall

Function Prototype:

X25getcall(CALLT *ct, TAG LIST)
X25getcalltags(CALLT *ct, TAGS *tags)

Description:

X25getcall() will accept a call. The cps for this call will be updated. The T_CALLINDEX argument MUST be specified and can be obtained by the user program from the x25daemon by specifying $index on the x25incalls or x25tab command line or by calling X25incall().

Tags recognized:

All global tags, T_CALLINDEX, T_CPSP

Arguments:

ct - pointer to CALLT structure
tags - pointer to TAGS list

Returns:

0 on success
-1 on failure

See Also:

X25incall
_X25getcallinfo

Possible Error Codes

X25SYSERR

operating system error; check errno

X25CLEAR

X.25 call not connected. Check x25errbuf for clearing codes

X25PVCINUSE

CALLT already in use for PVC

X25CONNECTEDIND

Not an error message, just a connection indication

X25BADDCALLT

*ct passed addresses an invalid CALLT, or one already in use

X25NOVC

No call index specified

[ Functions | Contents | Tags | Errors ]


X25getopts

Function Prototype:

X25getopts(0, TAG LIST)
X25getoptstags(TAGS *tags)

Description:

Obtains the value of global X.25 library parameters

Arguments:

tags - pointer to TAGS list containing pointer to variables to hold information requested.

Tags recognized:

T_OUTERR
T_TIMEOUT
T_VERBOSE

Returns:

None

See Also:

X25setopts

[ Functions | Contents | Tags | Errors ]


X25hdlcattach

See X25pvcattach

[ Functions | Contents | Tags | Errors ]


X25hdlcdetach

See X25pvcdetach

[ Functions | Contents | Tags | Errors ]


X25incall

Function Prototype:
X25incall(CALLT *ct, TAG LIST)
X25incalltags(CALLT *ct, TAGS *tags)
Description:
X25incall() will 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 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 recognized:
T_PNETID
T_CPSP
All global tags
Arguments:
ct - pointer to CALLT structure
tags - pointer to TAGS list
Returns:
call index on success
-1 on failure
See Also:
X25incall
X25getcall
_X25getcallinfo

Possible Error Codes

X25CALLIND

Not an error: Processed an Incoming Call

X25SYSERR

operating system error; check errno

X25PVCINUSE

CALLT already in use for PVC

X25BADCALLT

*ct passed addresses an invalid CALLT, or one already in use

X25BADMSG

Internal Error: unrecognizable message from Driver

X25CLEAR

X.25 call not connected. Check x25errbuf for clearing codes

[ Functions | Contents | Tags | Errors ]


_X25getcallinfo

Function Prototype:
int _X25getcallinfo(int fd, unsigned short index, cps *callinfo)
Description:
This function is used by an application to obtain the parameters of an incoming (not yet accepted) call. This function is only required if the application wishes to use the call parameters to determine if the call should be accepted (using X25getcall())or rejected (using X25clear()). If all calls are to be accepted, simply use X25getcall().
Tags recognised:
None
Arguments:
fd - The file descriptor underlying the callt used for listening. This may be obtained using X25_FD(listenct).
index - The call index returned by X25incall()
callinfo - A pointer to a call progress structure which is to be filled in with information about the incoming call (see callprog.h). This includes the calling address and call facilities.
Returns:
0 on success
-1 on failure
See Also:
X25incall
X25getcall

X25initcps

Function Prototype:

X25initcps(cps *cpsp)

Description:

Clear cps structure, thereby allowing the drivers to use their default values.

Arguments:

cpsp - pointer to cps structure to initialize

Returns:

None

See Also:

X25initcpstags

[ Functions | Contents | Tags | Errors ]


X25initcpstags

Function Prototype:

X25initcpstags(cps *cpsp, TAGS *tags)

Description:

Initializes cps with the information contained in tags This function is usually not required to be called directly unless you are using your own cps structure.
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. The tags T_PKTSIZE, T_WINDOW, T_THRUCLASS may be used to specify both incoming and outgoing values. If T_INx is specified and T_OUTx is not specified, the value for T_OUTx is set to the same as specified for T_INx. If T_OUTx is specified and T_INx is not specified, the value for T_INx is set to the same as specified for T_OUTx.

Tags recognized:

All global tags
T_PKTSIZE
T_INPKTSIZE
T_OUTPKTSIZE
T_WINDOW
T_INWINDOW
T_OUTWINDOW
T_PRIORITYCALL
T_REVERSE
T_CUD
T_CUDLEN
T_DNA
T_DNALEN
T_NUI
T_NUILEN
T_THRUCLASS
T_INTHRUCLASS
T_OUTTHRUCLASS
T_CPSP
T_PVCP
T_DBITSUPPORT

Arguments:

cps *cpsp - pointer to cps structure to initialize
TAGS *tags - pointer to tag list containing options

Returns:

0 on Success
-1 on Error

See Also:

X25initcps

[ Functions | Contents | Tags | Errors ]


X25initpvc

Function Prototype:

X25initpvc(_pvcdesc *pvcp)

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 still set to 1.

Arguments:

pvcp - pointer to _pvcdesc structure to initialize

Returns:

None

See Also:

X25initpvctags

[ Functions | Contents | Tags | Errors ]


X25initpvctags

Function Prototype:

X25initpvctags(_pvcdesc *pvcp, TAGS *tags)

Description:

Initializes pvc with the information contained in tags

Tags recognized:

All global tags
T_PKTSIZE
T_INPKTSIZE
T_OUTPKTSIZE
T_WINDOW
T_INWINDOW
T_OUTWINDOW
T_LCI

Arguments:

pvcp - pointer to _pvcdesc structure to initialize
tags - pointer to TAGS list

Returns:

0 on Success
-1 on Error

See Also:

X25initpvc

[ Functions | Contents | Tags | Errors ]


X25interrupt

Function Prototype:

X25interrupt(CALLT *ct, TAG LIST)
X25interrupttags(CALLT *ct, TAGS *tags)

Description:

Send an INTERRUPT with given buffer specified by T_BUFFER and T_BUFLEN.

Tags recognized:

All global tags
T_BUFFER
T_BUFLEN

Arguments:

ct - pointer to CALLT structure
tags - pointer to TAGS list

Returns:

0 on success
-1 on failure

See Also:

X25interruptconf

Possible Error Codes

X25SYSERR

operating system error; check errno

X25BADBUFFER

0 length buffer, or buffer pointer invalid or not supplied

X25NOTINIT

Call not established: attempt to use CALLT out of state

X25BADCALLT

*ct passed addresses an invalid CALLT, or one already in use

X25USERDATA

Value supplied for interrupt data length (T_BUFLEN) too large

[ Functions | Contents | Tags | Errors ]


X25interruptconf

Function Prototype:

X25interruptconf(CALLT *ct)

Description:

Send an INTERRUPT CONFIRM.

Arguments:

ct - pointer to CALLT structure

Returns:

0 on success
-1 on failure

See Also:

X25interrupt

Possible Error Codes

X25SYSERR

operating system error; check errno

X25BADCALLT

*ct passed addresses an invalid CALLT, or one already in use

X25NOTINIT

Call not established: attempt to use CALLT out of state

[ Functions | Contents | Tags | Errors ]


X25listen

Function Prototype:

X25listen(CALLT *ct, TAG LIST);
X25listentags(CALLT *ct, TAGS *tags)

Description:

This function will initiate a listen request for the specified protocol identifier which is the first byte of Call User Data. The number of protocol IDs and the list of the IDs are indicated with the tags T_NUMLISTEN and T_LISTENPIDS respectively.

Alternatively, special types of listens may be performed using the tag T_LISTENTYPE. Valid values for the T_LISTENTYPE tag are:

X25_LISTEN_DEF
default listener
Note: Only one default listener is allowed per machine.If your program is to be the listener, you must configure x25daemon to not listen for incoming calls. See x25daemon
X25_LISTEN_NULL
Null listener
X25_LISTEN_ACC
Accounting information

Tags recognized:

All global tags
T_LISTENTYPE
T_NUMLISTEN
T_LISTENPIDS

Arguments:

ct - pointer to CALLT structure
tags - pointer to TAGS list

Returns:

0 on success
-1 on failure

See Also:

X25getcall
X25stoplisten

Possible Error Codes

X25SYSERR

operating system error; check errno

X25BADPID

No protocol ID supplied, or attempted to listen to too many PIDs at once

X25BADCALLT

*ct passed addresses an invalid CALLT, or one already in use

[ Functions | Contents | Tags | Errors ]


X25look

Function Prototype:

X25look(CALLT *ct)

Description:

This function should be used to see if there are any events ready to be read.
This function is not available under Windows NT. Please see X25looksel()
X25look() returns the event codes listed under Returns:
Arguments:

ct - pointer to CALLT

Returns:

0 if nothing unusual occurred.
Error Code or -1 (Error code also set in x25errno)

See Also:

X25looksel

Possible Error Codes

X25CLEAR

X.25 call not connected. Check x25errbuf for clearing codes

X25SYSERR

operating system error; check errno

X25BADMSG

Internal Error: unrecognizable message from Driver

X25BADERRMSG

Unrecognized Error Message from X.25 hardware

X25OUTSTATE

Message Received Out of State

X25RESET

Reset Indication received from the remote. Data possibly lost

X25INTRCONF

Received indication of Interrupt Confirmation

X25INTERRUPT

Received indication of Interrupt Indication

X25DATAIND

Data received

X25DATAACKIND

Indication of D bit acknowledgement received

X25RESETCOMP

Received indication of Reset sequence complete

X25CALLIND

Received Call Indication

X25CONNECTEDIND

Received Call Connected

X25BADCALLT

*ct passed addresses an invalid CALLT, or one already in use

[ Functions | Contents | Tags | Errors ]


X25makecall

Function Prototype:

X25makecall(CALLT *ct, TAG LIST)
X25makecalltags(CALLT *ct, TAGS *tags)

Description:

Makes an X.25 call and waits for call acceptance. There are two ways to specify parameters to this function. The first involves passing in each parameter separately, however, for the advanced user, a cps may be passed in directly using the T_CPSP tag. 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 it's 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 recognized:

All global tags
T_INPKTSIZE
T_OUTPKTSIZE
T_INWINDOW
T_OUTWINDOW
T_PRIORITYCALL
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
T_NOWAIT

Arguments:

ct - pointer to CALLT structure
tags - pointer to TAGS list

Returns:

0 on success
-1 on failure

See Also:

x25hosts

Possible Error Codes

X25SYSERR

operating system error; check errno

X25PVCINUSE

CALLT already in use as a PVC

X25BADCALLT

*ct passed addresses an invalid CALLT, or one already in use

X25BADMSG

Internal Error: unrecognizable message from Driver

X25CLEAR

X.25 call not connected. Check x25errbuf for clearing codes.

X25CONNECTEDIND

Not an error: Call connected

X25BADCUD

Call user Data Length of 0 not allowed

X25BADDNA

Data network address either 0 or too large

X25BADHOST

Unable to look up host name or address in x25hosts file

X25BADNUI

Bad NUI syntax

[ Functions | Contents | Tags | Errors ]


X25open

Function Prototype:

X25open(int netid, TAG LIST)
X25opentags(int netid, TAGS *tags)

Description:

X25open opens a suitable X.25 device and sets up the user's context. No calls are made or accepted. You may use the T_FLAGS tag to specify special options for the open() flag.
The macro X25_FD() is valid after a call to this function. The T_BLOCKING tag set to FALSE, will set non-blocking mode on the associated file descriptor.
You may call this function in 4 ways:
Tags recognized:

All global tags
T_DEVICE
T_NETNAME
T_FLAGS
T_BOARD
T_LINK
T_BLOCKING
T_SYNCTCP

Arguments:

netid - network ID to open (ignored depending on tag choices)
tags - pointer to TAGS list

Returns:

pointer to a CALLT structure on success
NULL on failure

See Also:

X25close

Possible Error Codes

X25SYSERR

Failure to allocate memory for the CALLT structure

X25BADNETID

Invalid netid passed as a parameter.

[ Functions | Contents | Tags | Errors ]


X25pvcattach/X25hdlcattach

Function Prototype:

X25pvcattach(CALLT *ct, TAG LIST)
X25hdlcattach(CALLT *ct, TAG LIST)
X25pvcattachtags(CALLT *ct, TAGS *tags)
X25hdlcattachtags(CALLT *ct, TAGS *tags)

Description:

This function tries to establish a PVC or HDLC/LAPB connection over the given Logical Channel (defaults to 1).

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.

The exception is when the application has used the T_NOWAIT tag with X25open(). In this case, the application must use X25look() to wait for an X25RESET indication.

Tags recognized:

All global tags
T_OUTPKTSIZE
T_INPKTSIZE
T_INWINDOW
T_OUTWINDOW
T_PKTSIZE
T_WINDOW
T_LCI
T_PVCP

Arguments:

ct - pointer to CALLT structure
tags - pointer to TAGS list

Returns:

0 on success
-1 on failure

See Also:

X25pvcdetach

Possible Error Codes

X25SYSERR

Unable to allocate memory for internal operations, or NETCOM II refused attachment request, or attachment request timed out

X25BADMSG

Internal Error: unrecognizable message from Driver

X25BADCALLT

*ct passed addresses an invalid CALLT, or one already in use

X25CONNECTEDIND

No error: Permanent Virtual Circuit or HDLC link attached successfully

X25BADCUD

0 values passed for packet window size parameters

[ Functions | Contents | Tags | Errors ]


X25pvcdetach/X25hdlcdetach

Function Prototype:

X25pvcdetach(CALLT *ct, TAG LIST)
X25hdlcdetach(CALLT *ct, TAG LIST)
X25pvcdetachtags(CALLT *ct, TAGS *tags)
X25hdlcdetachtags(CALLT *ct, TAGS *tags)

Description:

Detaches from PVC or HDLC/LAPB associated with ct.

Tags recognized:

None

Arguments:

ct - pointer to CALLT structure
tags - pointer to tags list

Returns:

0 on success
-1 on failure

See Also:

X25pvcattach

Possible Error Codes

X25BADCALLT

*ct passed addresses an invalid CALLT, or one already in use

X25BADMSG

Internal Error; unrecognizable message from Driver

X25CONNECTEDIND

No error: call connected successfully

X25SYSERR

operating system error; check errno

[ Functions | Contents | Tags | Errors ]


X25read

Function Prototype:

X25read(CALLT *ct, TAG LIST);
X25readtags(CALLT *ct, TAGS *tags)

Description:

Receive characters from an X.25 connection. You may use this function to receive data from SVC or PVC connections. This function returns the number of bytes read. The function expects a buffer big enough to hold the largest packet. If the packet is larger than the buffer, this buffer is returned full, and the next X25read will return the next bytes of the packet. It is a good idea to check for errors when a -1 is returned.

On Unix, to check for System interrupts ie. EINTR check if the returned error code == X25SYSERR and errno == EINTR.

NOTE: the T_BITS tag expects a pointer to an integer which is to hold a combination of DBIT, MBIT and QBIT.

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:
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 recognized:

All global tags
T_BUFFER
T_BUFLEN
T_BITS

Arguments:

ct - pointer to CALLT structure
tags - pointer to TAGS list

Returns:

The number of characters read on success
-1 on failure

Possible Error Codes:

X25SYSERR
X25CLEAR
X25RESET
X25BADBUFFER
X25NOTINIT
X25BADCALLT

See Also:

X25write

Possible Error Codes

X25SYSERR

operating system error; check errno

X25CLEAR

X.25 call not connected. Check x25errbuf for clearing codes

[ Functions | Contents | Tags | Errors ]


X25write

Function Prototype:

X25write(CALLT *ct, TAG LIST)
X25writetags(CALLT *ct, TAGS *tags);

Description:

Send data over an established X.25 connection. You may use this function to send data over SVC or PVC connections. This function returns the number of bytes written and it is the user's responsibility to handle the condition in which this count does not equal the buffer length. A good way to accomplish this would be to look at the returned error code and decide on a proper action.
NOTE: the T_BITS tag expects an integer containing some combination of DBIT, MBIT & QBIT
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 recognized:

All global tags
T_BITS
T_BUFFER
T_BUFLEN

Arguments:

ct - pointer to CALLT structure
tags - pointer to TAGS list

Returns:

Number of bytes written when successful.
-1 on failure

Possible Error Codes:

X25SYSERR
X25CLEAR
X25RESET
X25BADBUFFER
X25NOTINIT
X25BADCALLT

See Also:

X25read

[ Functions | Contents | Tags | Errors ]


X25linkup

Function Prototype:

X25linkup(CALLT *ct)

Description:

Check if the X.25 link is up.
This function returns the status of the X.25 link associated with ct.

Arguments:

ct - pointer to CALLT structure

Returns:

0 - if the link is down
1 - if the link is up
-1 on failure

Possible Error Codes:

X25SYSERR
X25BADCALLT

See Also:

X25open

[ Functions | Contents | Tags | Errors ]


X25reset

Function Prototype:

X25reset(CALLT *ct, TAG LIST)
X25resettags(CALLT *ct, TAGS *tags)

Description:

Send a RESET with given cause and diagnostic values specified by the T_CAUSE and T_DIAG tags respectively.

Tags recognized:

All global tags
T_CAUSE
T_DIAG

Arguments:

ct - pointer to CALLT structure
tags - pointer to TAGS list

Returns:

0 on success
-1 on failure

Possible Error Codes:

X25SYSERR
X25BADCALLT

[ Functions | Contents | Tags | Errors ]


X25stoplisten

Function Prototype:

X25stoplisten(CALLT *ct);

Description:

This function will stop a listen request

Arguments:

ct - pointer to CALLT structure

Returns:

0 on success
-1 on failure

Possible Error Codes:

X25SYSERR
X25BADCALLT

See Also:

X25listen

[ Functions | Contents | Tags | Errors ]


findtag

Function Prototype:

findtag(TAGS *tags, unsigned long item)

Description:

Finds the tag item in the tags array pointed to by tags.

Arguments:

tags - pointer to TAGS list
item - item to find in tags

Returns:

Index of the required tag item in the tags list
-1 if not found.

[ Functions | Contents | Tags | Errors ]


X25setopts

Function Prototype:

X25setopts(0, TAG LIST)
X25setoptstags(TAGS *tags)

Description:

Sets global X.25 library parameters

Tags recognized:

T_OUTERR
T_TIMEOUT
T_VERBOSE

Arguments:

tags - pointer to TAGS list

Returns:

None

See Also:

X25getopts

[ Functions | Contents | Tags | Errors ]


packetnets Example

Example:

 
#############################################################
#
#   General format for this file
#   NETID x
#       <one or more of the following tags>
#       <action list>
#   END
#
#       Tag       Description
#       =======   =============
#       TYPE      Network type (ie. X25, FREL, etc.)
#       BOARD     Board number
#       LINK      Link number
#       NAME      Network Name (ie. link0)
#       NETWORK   Network Layer 
#       BRDTYPE   BOARD TYPE (SGX, SGE, etc)
#       PPA       Physical Point of Attachment (per Boardtype)
#       MODULE    Name of downloadable module or NONE
#       CONFIG    Name of configuration file
#
#       Actions   Description
#       =======   =============
#       OPEN      Open device /dev/x25hpx
#       ATTACH    Send dl_attach with a given PPA
#       PUSH      Push a module
#       LINK      Open and link
#       SETNID    Set Network ID
#       SETCONF   Set Configuration (N/A)
#       DLPI      DLPI conversion module pushed
#       ENABLERX  Enable Receiver
#       PDK       PDK stack
#
###########################################################
NETID   0
    NAME    link0
    TYPE    X25
    CONFIG  link0
    BRDTYPE SGP
    NETWORK /dev/x25pkt
    PPA     0
    MODULE  NONE
    # Stack Building Actions:
    OPEN    /dev/sgp
    ATTACH  0
    # comment out the following two lines to disable tracing
    PUSH    x25trc
    SETNID
    #
    ILINK   /dev/x25frm
    ILINK   /dev/x25pkt
    SETNID
    SETCONF
END

NETID   1
    NAME    link1
    TYPE    X25
    CONFIG  link1
    BRDTYPE SGP
    NETWORK /dev/x25pkt
    PPA     1
    MODULE  NONE
    # Stack Building Actions:
    OPEN    /dev/sgp
    ATTACH  1
    # comment out the following two lines to disable tracing
    PUSH    x25trc
    SETNID
    #
    ILINK   /dev/x25frm
    ILINK   /dev/x25pkt
    SETNID
    SETCONF
END

[ Functions | Contents | Tags | Errors ]


x25netent structure

The x25netent structure contains information on the attached links which are usable for synchronous communications. Each entry specifies the network ID by which this link is known by, its network name, as well as board mappings used by some applications. The device name used to access this device is also available.

All network file access functions will return a pointer to a static area which will be overwritten by the next call to a network file access function.

See libx25.h for the full definition of the x25netent structure.

[ Functions | Contents | Tags | Errors ]


Management Functions (alphabetical list)

X25endhostent
X25gethostbyaddr
X25gethostbyname
X25gethostent
X25sethostent

X25getnetbyboard
X25getnetbyname
X25getnetbynetid
X25endnetent
X25getnetent
X25setfilter
X25setnetent

X25geterror
X25geterrorct
X25getsyserror
X25getsyserrorct
X25lookadd
X25lookatone
X25lookclose
X25lookdel
X25lookinit
X25looksel
X25seterror


X25setnetent

Function Prototype:

X25setnetent(void)

Description:

Initializes the X.25 networks file for reading. The first X25getnetent() will return the first network 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.

Arguments:

None

Returns:

None

See Also:

X25endnetent
X25getnetent
X25setfilter

[ Functions | Contents | Tags | Errors ]


X25endnetent

Function Prototype:

X25endnetent(void)

Description:

Ends network file operations.

Arguments:

None

Returns:

none

See Also:

X25setnetent
X25getnetent
X25setfilter

[ Functions | Contents | Tags | Errors ]


X25getnetent

Function Prototype:

X25getnetent(void)

Description:

Obtains one struct x25netent entry from the networks file Each call to this function will retrieve the next network entry in this file in the form of an x25netent structure.

Arguments:

None

Returns:

pointer to struct x25netent on success
NULL on failure

See Also:

X25setnetent
X25endnetent
X25setfilter

[ Functions | Contents | Tags | Errors ]


X25getnetbyname

Function Prototype:

X25getnetbyname(char *name)

Description:

Looks up a network entry given a network name from the networks file. There is no need to call X25setnetent() or X25endnetent() before and after calling this function. This function will return a pointer to an x25netent structure.

Arguments:

name - Network name to find

Returns:

pointer to struct x25netent on success
NULL on failure

See Also:

X25getnetbynetid
X25setfilter

[ Functions | Contents | Tags | Errors ]


X25getnetbynetid

Function Prototype:

X25getnetbynetid(int netid)

Description:

Looks up a network entry given a network ID from the networks file. There is no need to call X25setnetent() or X25endnetent() before and after calling this function. This function will return a pointer to an x25netent structure.

Arguments:

netid - Network ID to find

Returns:

pointer to struct x25netent on success
NULL on failure

See Also:

X25getnetbyname
X25setfilter

[ Functions | Contents | Tags | Errors ]


X25getnetbyboard

Function Prototype:

X25getnetbyboard(int board, int link)

Description:

Looks up a network entry given a board and link number from the networks file. This function is provided to ease migration to the network ID scheme of naming eligible links. If at all possible use the Network ID or Name to resolve links. There is no need to call X25setnetent() or X25endnetent() before and after calling this function. This function will return a pointer to an x25netent structure.

Arguments:

board - Board number
link - Link number

Returns:

pointer to struct x25netent on success
NULL on failure

See Also:

X25getnetbyname
X25getnetbynetid
X25setfilter

[ Functions | Contents | Tags | Errors ]


X25setfilter

Function Prototype:

void X25setfilter(int typemask)

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. The default type for the X25getnet..() functions is NETX25_TYPE.X25open resets the default type to NETX25_TYPE.

Arguments:

typemask - Mask for Network types. i.e. NETFREL_TYPE | NETX25_TYPE
NETALL_TYPE will select all network types.

Returns:

NONE

See Also:

X25getnetent
X25getnetbyname
X25getnetbynetid

[ Functions | Contents | Tags | Errors ]


X25sethostent

Function Prototype:

X25sethostent(void)

Description:

Initializes the X.25 hosts file for reading. The first X25gethostent() will return the first host in the file. Subsequent calls to this function will rewind the file pointer to the beginning of the file. Host file processing should be terminated by a call to X25endhostent().

Arguments:

None

Returns:

None

See Also:

X25endhostent

[ Functions | Contents | Tags | Errors ]


X25endhostent

Function Prototype:

X25endhostent(void)

Description:

Ends hosts file processing, closing the file.

Arguments:

None

Returns:

None

See Also:

X25sethostent

[ Functions | Contents | Tags | Errors ]


X25gethostent

Function Prototype:

X25gethostent(void)

Description:

Returns next x25hostent structure in the hosts file.
 

Arguments:

None

Returns:

pointer to struct x25hostent if found
NULL if not found

See Also:

X25sethostent
X25endhostent

[ Functions | Contents | Tags | Errors ]


X25gethostbyaddr

Function Prototype:

X25gethostbyaddr(char *addr)

Description:

Finds host based on X.25 address specified in the hosts file. There is no need to call X25sethostent() or X25endhostent() before and after calling this function. The function returns a pointer to an x25hostent structure.

Arguments:

addr - pointer to DNA address string

Returns:

struct x25hostent pointer if found
NULL if not found

See Also:

X25gethostbyname

[ Functions | Contents | Tags | Errors ]


X25gethostbyname

Function Prototype:

X25gethostbyname(char *name)

Description:

Finds a host in the hosts file based on its name. There is no need to call X25sethostent() or X25endhostent() before and after calling this function. The function returns a pointer to an x25hostent structure.

Arguments:

name - pointer to name string

Returns:

struct x25hostent pointer if found
NULL if not found

See Also:

X25gethostbyaddr

[ Functions | Contents | Tags | Errors ]


X25lookatone

Function Prototype:

int X25lookatone(CALLT *ct, int tmout);

Description:

Checks if there is a datagram to be read from ct.

Arguments:

ct - CALLT to check
tmout - timeout in millisecs, (0 for non blocking, -1 to block indefinitely)

Returns:

1 - if there something to be read
0 - if there is nothing

See Also:

X25lookinit
X25lookadd
X25lookdel
X25looksel
X25lookclose

[ Functions | Contents | Tags | Errors ]


X25lookinit

Function Prototype:

X25_lookent *X25lookinit(int maxcallt);

Limited Availability:

Windows Only

Description:

Initializes the selection mechanism for file descriptors. Currently the limit for the number of file descriptors to listen on is imposed by the operating system to be X25MAXLOOKFDS (as defined in libx25.h). If maxcallt is specified to be more than X25MAXLOOKFDS the function call will succeed, but still only X25MAXLOOKFDS file descriptors are allowed. The pointer returned by this function must be used in all the other "look" functions expecting a X25_lookent.

Arguments:

maxcallt - maximum number of CALLTs (< X25MAXLOOKFDS)

Returns:

X25_lookent pointer on success
NULL - on failure (out of memory)

See Also:

X25lookadd
X25lookdel
X25looksel
X25lookclose

[ Functions | Contents | Tags | Errors ]


X25lookadd

Function Prototype:

int X25lookadd(X25_lookent *look, CALLT *ct);

Limited Availability:

Windows Only

Description:

Add the file descriptor associated with ct to the selection list contained in look.

Arguments:

look - pointer to X25_lookent structure
ct - pointer to CALLT to add

Returns:

0 - on success
-1 - on failure

See Also:

X25lookinit
X25lookdel
X25look
X25looksel
X25lookclose

[ Functions | Contents | Tags | Errors ]


X25lookdel

Function Prototype:

int X25lookdel(X25_lookent *look, CALLT *ct);

Limited Availability:

Windows Only

Description:

Remove the file descriptor associated with ct from the selection list contained in look.

Arguments:

look - pointer to X25_lookent structure
ct - pointer to CALLT to delete

Returns:

0 - on success
-1 - on failure

See Also:

X25lookinit
X25lookadd
X25look
X25looksel
X25lookclose

[ Functions | Contents | Tags | Errors ]


X25looksel

Function Prototype:

CALLT *X25looksel(X25_lookent *look, int tmout);

Limited Availability:

Windows Only

Description:

Checks for availability of datagrams for the LCIs in the selection list specified through X25lookadd

Arguments:

look - pointer to X25lookent structure
tmout - millisecs to wait (use -1 for infinity, 0 for no wait)

Returns:

ct - pointer to CALLT if there is a datagram to be read on the file descriptor associated with this CALLT
NULL - nothing to read, or timeout

See Also:

X25lookadd
X25lookdel
X25lookclose

[ Functions | Contents | Tags | Errors ]


X25lookclose

Function Prototype:

CALLT *X25lookclose(X25_lookent *look);

Limited Availability:

Windows Only

Description:

Closes the selection mechanism for the "look" functions.

Arguments:

look - pointer to X25_lookent structure

Returns:

NONE

See Also:

X25lookinit
X25lookadd
X25lookdel
X25looksel

[ Functions | Contents | Tags | Errors ]


X25seterror

Function Prototype:

void X25seterror(int err);

Description:

Set the internal X.25 error variable. x25errno is not available under NT and thus this function can be used.

Arguments:

err - X.25 Error

Returns:

NONE

See Also:

X25geterror
X25geterrorct
X25getsyserrorct
X25error
X25errormsg

[ Functions | Contents | Tags | Errors ]


X25geterror

Function Prototype:

int X25geterror(void);

Description:

Get the internal X.25 error code. x25errno is not available under NT and thus this function should be used.
If a specific CALLT is currently in use please use the more specific X25geterrorct() function especially when dealing with multiple threads of execution.
Older versions of this library may not have a X25geterror() function in which case x25errno should be used.

Arguments:

NONE

Returns:

the X.25 library internal error code defined in libx25.h

See Also:

X25seterror
X25geterrorct
X25getsyserror
X25getsyserrorct
X25error
X25errormsg

[ Functions | Contents | Tags | Errors ]


X25geterrorct

Function Prototype:

int X25geterrorct(CALLT ct);

Description:

Get the internal X.25 error code related to processing a CALLT. Call this function anytime you an error occurs with a function which takes a CALLT *ct as the first argument. (such as X25write()) x25errno is not available under NT and thus this function should be used.

Arguments:

CALLT *ct - pointer to CALLT

Returns:

the X.25 library internal error code defined in libx25.h

See Also:

X25seterror
X25geterror
X25getsyserror
X25getsyserrorct
X25error
X25errormsg

[ Functions | Contents | Tags | Errors ]


X25getsyserror

Function Prototype:

int X25getsyserror(void)

Description:

Retrieves the current system error code from the library.

Arguments:

NONE

Returns:

0 - no error
error from errno.h

See Also:

X25geterror
X25error
X25errormsg

[ Functions | Contents | Tags | Errors ]

X25getsyserrorct

Function Prototype:

int X25getsyserrorct(CALLT *ct)

Description:

Retrieves the current system error code from the library specific to the provided CALLT.

Arguments:

CALLT *ct - pointer to CALLT

Returns:

0 - no error
error from errno.h

See Also:

X25geterror
X25geterrorct
X25getsyserror
X25error
X25errorct
X25errormsg

[ Functions | Contents | Tags | Errors ]


Revision 6.1.0 (February 2003)

Copyright © 1997-2003 The Software Group Limited. All Rights Reserved.
® Netcom is a registered trademark of The Software Group Limited.