HP X.25/9000 Programmer's Guide
82 Chapter5
Receiving and Transmitting Out-of-band Information
Transmitting Out-of-band Events
ioctl(X25_RD_USER_DATA) call sequence to read the call user data until
ioctl(X25_NEXT_MSG_STAT) says there is no longer call user data
available, then issue an additional ioctl(X25_RD_USER_DATA) call
sequence to read the clear user data.
The ioctl(X25_RD_USER_DATA) call can read a maximum of 126 bytes of
call or clear user data (one byte must contain the length) per ioctl()
call. If more than 126 bytes of call or clear user data is received, the
ioctl(X25_RD_USER_DATA) must be called, until the returned buffer
length is 0.
Syntax for ioctl(X25_RD_USER_DATA)
The syntax for the ioctl(X25_RD_USER_DATA) call and its parameters
are described below.
#include <x25/x25ioctls.h>
#include <x25/x25str.h>
/* struct x25_userdata {
* u_char x25_cud_len;
* u_char x25_cud_data[X25_MAX_CU_LEN];
*/ }
int err;
int sd;
struct x25_userdata udata;
err = ioctl(sd, X25_RD_USER_DATA, &udata);
sd Socket descriptor for an VC socket over which a CLEAR INDICATION
packet, CALL INDICATION packet, or CALL CONNECTED packet has
been received.
X25_RD_USER_D
ATA
Definition for the request.
udata Contains the length (
x25_cud_len
) and data (
x25_cud_data
) for the
user data field, where the maximum length is 126 bytes. If there is more
than 126 bytes of call or clear user data, ioctl() must be called until
udata.x25_cud_len
is 0.
err On successful completion,
err
is set to 0. Otherwise, a value of –1 is
returned and
errno
is set to indicate the error.
The code example below shows how to use the
ioctl(X25_RD_USER_DATA) call to get the data from a CALL or CLEAR
packet.
36960-90061.bk Page 82 Friday, November 10, 2000 3:42 PM










