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

x25sread X.25 Device Handler Entry Point


Provides the means to receive data from the X.25 adapter.


int x25sread (devno, uiop, chan, ext)
dev_t devno;
struct uio *uiop;
int chan;
struct x25_read_ext *ext;


devno Specifies major and minor device numbers.
uiop Points to a uio structure.
chan Identifies the channel number assigned by the x25smpx routine.
ext Points to the x25_read_ext structure. This structure is found in the /usr/include/sys/x25user.h file and it contains a call_id field and a re.status field. The call_id field is only valid on sessions of type SESSION_SVC_LISTEN. The re.status field is meaningful only if the return value is EIO.


Note: This entry point can only be called by user-mode processes. Data received for a kernel-mode process is passed to the rx_fn kernel procedure specified by the x25sopen entry point.

The x25sread entry point provides the means to receive incoming data on the session specified by session_id field. If the session_id field is 0 (zero) and the device was opened in normal mode, data for any session started by this channel is returned, and the session_id field is filled in accordingly. The X.25 device handler copies the data to the user buffer and decrements the uiop->resid field by the number of bytes moved.

X.25 data is made up of an M-bit sequence. This sequence is consolidated before it is made available for read operations. The exception are sessions of type X25_SESSION_YBTS. For these sessions, each packet is available as a separate data block.

  1. The order of incoming data is preserved for each session, but is not guaranteed across sessions.
  2. The x25_packet_data common data structure describes the buffering of incoming X.25 packet sequences. This structure is found in the /usr/include/sys/x25user.h file.

The x25sread entry point can be a blocking or nonblocking read. The type of read is determined by flags specified by the x25sopen entry point when the channel is opened. If the read is blocking, and no data is available, the x25sread entry point blocks until data is received. If the read is nonblocking and no data is available, the entry point returns an error code.

If the current session was initialized for listening, the only data that can be read on the session is an incoming call. The user process should respond by issuing a X25_REJECT operation on the current session or by starting a new session with a Start Session CIO_START operation to accept the call.

When a PKT_CLEAR_IND packet is received, the user must respond with a CIO_HALT operation. As a result, no further x25swrite entry points are accepted. If the session is a SESSION_MONITOR type, then the data buffer contains monitor control sequences.

Parameter Block

For the x25sread entry point, the arg parameter returns a pointer to the uio structure. This structure specifies the location and length of the caller's data area to transfer information. The uio structure is defined in the /usr/include/sys/uio.h file.

The data is in the form described in the mbuf structure. The value for the packet_type field for SESSION_SVC_LISTEN sessions is PKT_INCOMING_CALL. For other sessions, the possible packet types are the following:

Execution Environment

The x25sread entry point can be called from the process environment only.

Return Values

EFAULT Indicates a buffer area was not valid.
EINVAL Indicates a parameter was not valid.
EIO Indicates an error has occurred. The ext->status field in the x25_read_ext structure contains one of the following values:
EMSGSIZE Indicates that the buffer was not large enough to receive the packet data. The receiver data is preserved within the device driver until a read is issued with a large enough buffer.
EAGAIN Indicates that there were no packets to be read and the device was opened with the DNDELAY flag set.

Implementation Specifics

The x25sread entry point functions with an X.25 Interface Co-Processor/2 that has been correctly configured for use on a qualified network. Consult adapter specifications for more information on configuring the adapter and network qualifications.

Related Information

The x25smpx entry point, x25sopen entry point, x25swrite entry point.

The CIO_HALT x25sioctl X.25 Device Handler Operation, CIO_START x25sioctl X.25 Device Handler Operation, X25_REJECT x25sioctl X.25 Device Handler Operation.

The mbuf structure in AIX Kernel Extensions and Device Support Programming Concepts.

Data Transmission and Reception for the X.25 Device Handler in AIX Kernel Extensions and Device Support Programming Concepts.

Sessions with the X.25 Device Handler in AIX Kernel Extensions and Device Support Programming Concepts.

[ Previous | Next | Contents | Search ]