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

x25_ctr_test Subroutine

Purpose

Returns the current value of a counter.

Library

X.25 Communications Library (libx25s.a)

C Syntax

int x25_ctr_test(ctr_id)
int ctr_id;

Description

The x25_ctr_test subroutine returns the current value of an active counter for testing.

Parameters

ctr_id Contains the Counter identifier allocated by a previous x25_ctr_get subroutine.

Return Values

If successful, the x25_ctr_test subroutine returns the current value of the counter. If an error occurs, the x25_ctr_test 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:

X25INVCTR

X25NOTINIT

X25SYSERR

Examples

The following code structure determines how many messages for a call are waiting to be received, assuming an array of calls information is available:

ctr_id = calls[i].counter_id;
number_of_messages = x25_ctr_test(ctr_id);
if (number_of_messages == 0)
    (void)printf("There are no messages waiting\n");
else if (number_of_messages > 0)
    (void)printf("The number of messages waiting is %d\n",
                 number_of_messages);
Note: The array used here is not part of the X.25 API.

Implementation Specifics

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

Related Information

The x25_ctr_get subroutine, x25_ctr_remove subroutine, x25_ctr_wait subroutine.

Processing Calls with the X.25 API, X.25 Overview for Programming in AIX Version 4.3 Communications Programming Concepts.


[ Previous | Next | Contents | Search ]