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

x25swrite X.25 Device Handler Entry Point

Purpose

Provides the means to send data to the X.25 adapter.

Syntax

int x25swrite (devno, uiop, chan, ext)
dev_t devno;
struct uio *uiop;
int chan;
struct x25_write_ext *ext;

Parameters

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 struct x25_write_ext structure. This structure is found in the /usr/include/sys/x25user.h file.

Description

Note: Call-establishment or termination packets cannot be sent using this entry point.

The x25swrite entry point provides the means to send an X.25 data packet to the adapter.

uio Structure

For the x25swrite entry point, the uiop parameter is a pointer to a uio structure. This structure is described in the /usr/include/sys/uio.h file. The uio structure specifies the location and length of the caller's data.

This routine checks the uiop->segflag field to determine whether the data is in user space or kernel space. If the data is in kernel space, the uiop->uio_ iov ->uio_base field points to an mbuf structure chain containing the data for transmission. If the data is in user space, then the uiop->uio_iov field points to an array of iovec structures.

The data is in the form described by the mbuf structure. For a kernel-mode process, the mbuf structure containing the data should be pinned before making this call.

For session types of SESSION_SVC_OUT, SESSION_SVC_IN, or SESSION_PVC, the possible values for the packet_type field are the following:

If the value of the packet_type field is PKT_DATA and the data buffer is larger than the packet size, the data is transmitted as an X.25 packet sequence.

If a previous incoming data packet has been received with the D bit set, the incoming packet must be acknowledged with a PKT_D_BIT_ACK packet type before any further packets can be accepted by the device handler for this session.

x25_write_ext Parameter Block

For the x25swrite entry point, the ext parameter points to the x25_write_ext parameter block. The x25_write_ext structure contains a write_extension (we) structure and a session_id field.

The we.flag field consists of the bitwise OR of one or more of the following values:

CIO_NOFREE_MBUF Setting this bit causes the X.25 device handler to retain the mbuf structure after transmission is complete. If a kernel-mode process sets this bit, it must also do the following:
  1. Determine when the X.25 device handler is finished with the mbuf structure.
  2. Free the mbuf structure.

    For a user-mode process, the device handler always frees the mbuf structure.

CIO_ACK_TX_DONE Setting this bit causes the X.25 device handler to acknowledge completion by building a CIO_TX_DONE status block for the caller when the write is complete.

The we.status field is meaningful only if the return value is EIO.

Execution Environment

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

Return Values

EINVAL Indicates that an invalid parameter was used or a write was made on a listen session.
EIO Indicates an error has occurred. The ext->status field contains one of the following common exception codes:

Otherwise, the field contains one of the following X.25 specific codes:

X25_NO_ACK A data packet with the D-bit set requires acknowledgment. Data packets cannot be sent until the acknowledgment is completed.
X25_NO_ACK_REQ A PKT_D_BIT_ACK was sent and no packets required a D-bit acknowledgment.
X25_PROTOCOL A protocol error occurred.
X25_RESET The session is in reset state. The data packet could not be sent.
X25_CLEAR The session has been cleared.
X25_NO_LINK The X.25 link is not established.
X25_BAD_PKT_TYPE The packet_type field passed in the uiop parameter block is not valid for the session type.
EAGAIN Indicates that the transmit queue is full and the DNDELAY flag is set. The command was not accepted.

Implementation Specifics

The x25swrite 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 x25sread entry point.

Common X.25 Device Handler Structures in AIX Version 4 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 ]