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

x25_receive Subroutine

Purpose

Receives an incoming packet and indicates the packet type.

Library

X.25 Communications Library (libx25s.a)

C Syntax

int x25_receive(conn_id, cb_msg)
int *conn_id;
struct cb_msg_struct *cb_msg;

Description

The x25_receive subroutine is used to receive incoming calls and messages and monitor data for connected calls. One x25_receive subroutine call receives a complete packet sequence. In the event that an interrupt packet is received, an interrupt confirmation is sent automatically by the system.

Parameters

conn_id Contains a pointer to an integer that contains the listen identifier.
Note: If the call is successfully received, an open file is created in the current process that is used by the API library functions for subsequent communication on this connection. The file is closed when the call is cleared.

To receive a message for any connected call, a pointer to an integer that contains a value of 0.

To receive a message for a specific connected call, a pointer to an integer that contains the connection identifier of the call.

To receive monitoring data for a call, a pointer to an integer that contains the connection identifier returned by the x25_link_monitor subroutine.

On return from this subroutine, in all cases, a pointer to an integer that now contains the actual connection identifier.

cb_msg Specifies a pointer to the message structure, cb_msg_struct, which includes the msg_type field. This structure is allocated by the API; it is the responsibility of the application to free this memory.

Return Values

If successful, the x25_receive subroutine returns a nonnegative value. If an error occurs, the x25_receive 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 values:

X25BADID

X25NOACKREQ

X25NOCARD

X25NODATA

X25NOLINK

X25NOTINIT

X25RESETCLEAR

X25SYSERR

X25TRUNCTX

If the x25_errno global variable is set to a X25SYSERR value, the errno global variable is set to an EINTR value.

Examples

  1. See the example program svcrcv for a code sample that receives an incoming call.
  2. See the example program svcrcv for a code sample that receives data or some other message.
  3. See the example program svcxmit for a code sample that receives an acknowledgment that data has been received.

Implementation Specifics

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

Related Information

The x25_send 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 ]