[ Previous | Next | Contents | Search ]
AIXLink/X.25 1.1 for AIX: Guide and Reference

x25_link_query Subroutine

Purpose

Returns information about the current status of an X.25 port.

Library

X.25 Communications Library (libx25s.a)

C Syntax

int x25_link_query(link_name)
struct cb_link_name_struct *link_name;

Description

The x25_link_query subroutine returns the status of the X.25 port as an integer.

Parameters

link_name Contains a pointer to the cb_link_name_struct structure, which gives the name of the X.25 port.

Return Values

If successful, the x25_link_query subroutine returns an integer that indicates a status of X25_LINK_CONNECTED, X25_LINK_DISCONNECTED, or X25_LINK_CONNECTING. If an error occurs, the x25_link_query subroutine returns a value of -1 and sets the x25_errno global variable to one of the error codes shown below.

Error Codes

On failure, the x25_errno global variable is set to one of the following:

X25NOCARD

X25NOTINIT

X25SYSERR

If the x25_errno global variable is set to the X25SYSERR value, the errno global variable is set to one of the following values:

EINTR

EIO

Examples

To find out whether port x25s1 is connected, disconnected, or connecting, use this code sample:

struct cb_link_name_struct link_name;
link_name.flags = X25FLG_LINK_NAME;
link_name.link_name = "x25s1";
rc = x25_link_query(&link_name);
switch (rc)
{
  case X25_LINK_CONNECTED:
    (void)printf("Link is connected\n");
    break;
  case X25_LINK_DISCONNECTED:
    (void)printf("Link is disconnected\n");
    break;
  case X25_LINK_CONNECTING:
    (void)printf("Link is connecting\n");
    break;
    case -1;
      switch (x25_errno);
      {
        case X25SYSERR:
          (void)printf("System error : errno = %d\n",errno);
           perror();
           break;
        case X25NOCARD:
          (void)printf("The X.25 adapter is either not\n");
          (void)printf("installed or not functioning:");
          (void)printf("Call your system administrator.\n");
           break;
        case X25NOTINIT:
          (void)printf("The application has not initialized\n",
          (void)printf("X.25 communications:");
          (void)printf("Call your system administrator.\n");
           break;
        }
    break;
}

Implementation Specifics

This subroutine is part of X.25 Application in Base Operating System (BOS) Extensions 2.

Related Information

The x25_circuit_query subroutine, x25_device_query subroutine.

Processing Calls with the X.25 API, Using the X.25 Structures and Flags, in AIX Version 4.3 Communications Programming Concepts.


[ Previous | Next | Contents | Search ]