t_look() — Look at the current event on a transport endpoint

Standards

Standards / Extensions C or C++ Dependencies
XPG4.2 both  

Format

#define _XOPEN_SOURCE_EXTENDED 1
#include <xti.h>

int t_look(int fd);

General description

Returns the current event on the transport endpoint specified by fd. This function enables a transport provider to notify a transport user of an asynchronous event when the user is calling functions in synchronous mode. Certain events require immediate notification of the user and are indicated by a specific error, TLOOK, on the current or next function to be executed. This function also enables a transport user to poll a transport endpoint periodically for asynchronous events.

Additional functionality for handling events is provided through select and poll.

Valid states: All - except for T_UNINIT

The following list describes the asynchronous events which cause an XTI call to return with a TLOOK error:
t_accept()
T_DISCONNECT, T_LISTEN
t_connect()
T_DISCONNECT, T_LISTEN

This occurs only when a t_connect is done on an endpoint which has been bound with a qlen > 0 and for which a connect indication is pending.

t_listen()
T_DISCONNECT

This event indicates a disconnect on an outstanding connect indication.

t_rcv()
T_DISCONNECT

This occurs only when all pending data has been read.

t_rcvconnect()
T_DISCONNECT
t_rcvudata()
T_UDERR
t_snd()
T_DISCONNECT
t_sndudata()
T_UDERR
t_unbind()
T_LISTEN, T_DATA

T_DATA may only occur for the connectionless mode.

t_snddis()
T_DISCONNECT
Once a TLOOK error has been received on a transport endpoint using an XTI function, subsequent calls to that and other XTI functions, to which the same TLOOK error applies, will continue to return TLOOK until the event is consumed. An event causing the TLOOK error can be determined by calling t_look() and then can be consumed by calling the corresponding consuming XTI function as defined in Table 1.
Table 1. Events and t_look()
Event Cleared on t_look()? Consuming XTI functions
T_LISTEN No t_listen()
T_CONNECT No t_{rcv}connect()

In the case of the t_connect() function the T_CONNECT event is both generated and consumed by the execution of the function and is therefore not visible to the application.

T_DATA No t_rcv()
T_EXDATA No t_rcv()
T_DISCONNECT No t_rcvdis()
T_GODATA Yes t_snd()
T_GOEXDATA Yes t_snd()

Returned value

If successful, t_look() returns a value that indicates which of the allowable events has occurred, or returns 0 if no event exists. One of the following events is returned:
T_CONNECT
Connect confirmation received.
T_DATA
Normal data received.
T_DISCONNECT
Disconnect received.
T_EXDATA
Expedited data received.
T_GODATA
Flow control restrictions on normal data flow that led to a TFLOW error have been lifted. Normal data may be sent again.
T_GOEXDATA
Flow control restrictions on expedited data flow that led to a TFLOW error have been lifted. Expedited data may be sent again.
T_LISTEN
Connection indication received.
If unsuccessful, t_look() returns -1 and sets errno to one of the following values:
Error Code
Description
TBADF
The specified file descriptor does not refer to a transport endpoint.
TPROTO
This error indicates that a communication problem has been detected between XTI and the transport provider for which there is no other suitable XTI (t_errno).
TSYSERR
A system error has occurred during execution of this function.

Related information