HP X.25/9000 Programmer's Guide

106 Chapter6
Extended Features
Getting Programmatic Diagnostics and Status Information
int sd, lci;
err = ioctl(sd, X25_RD_LCI, &lci);
sd Socket descriptor for a connected VC socket.
X25_RD_LCI Definition for the request.
lci Contains the logical channel indicator for the socket.
err Set to 0 if the call was successful. Otherwise, contains –1 and
errno
contains the cause of the error. If EINVAL is returned, the circuit is not
connected or the socket is no longer bound to a circuit.
A programming example is shown below.
int error, s, lci;
/*
* Assume at this point that s is a socket
*/
error = ioctl (s, X25_RD_LCI, &lci);
if (error < 0) {
perror(”X25_RD_LCI”);
exit(1);
}
/* Use the lci as the logical circuit indicator. */
The ioctl (X25_RD_HOSTADR) Call
The ioctl(X25_RD_HOSTADR) call returns the X.121 address of the
interface. This is the X.121 address of the interface (NOT the address
inserted in the call packet)
Syntax for ioctl (X25_RD_HOSTADR)
The ioctl(X25_RD_HOSTADR) and its parameters are described below.
#include <x25/x25ioctls.h>
#include <x25/x25addrstr.h>
int error;
int sd;
struct x25addrstr addr;
error = ioctl(sd, X25_RD_HOSTADR, &addr);
sd Socket descriptor for an X.25 socket. Note that this can be a completely
new socket, a connected socket, or a connected socket that has been shut
36960-90061.bk Page 106 Friday, November 10, 2000 3:42 PM