Receives a data unit.
Transport Layer Interface Library (libtli.a)
The t_rcvudata subroutine is used in connectionless mode to receive a data unit from another transport user.
Item | Description |
---|---|
fd | Identifies the local transport end point through which data will be received. |
unitdata | Holds information associated with the received data unit.
The unitdata parameter points to a t_unitdata structure containing the following members:
On return from this call:
Note: The maxlen field of the addr, opt,
and udata fields must be set before issuing this function
to indicate the maximum size of the buffer for each.
|
flags | Indicates that the complete data unit was not received. |
By default, the t_rcvudata subroutine operates in synchronous mode and will wait for a data unit to arrive if none is currently available. However, if the O_NDELAY or O_NONBLOCK flag is set (using the t_open subroutine or fcntl command), the t_rcvudata subroutine will run in asynchronous mode and will stop if no data units are available.
If the buffer defined in the udata field of unitdata is not large enough to hold the current data unit, the buffer will be filled and the T_MORE flag will be set in flags on return to indicate that another t_rcvudata subroutine should be issued to retrieve the rest of the data unit. Subsequent t_rcvudata subroutine calls will return 0 for the length of the address and options until the full data unit has been received.
On successful completion, the t_rcvudata subroutine returns a value of 0. Otherwise, it returns a value of -1 and sets the t_errno variable to indicate the error.
If unsuccessful, the t_errno variable is set to one of the following:
Value | Description |
---|---|
TBADF | The specified file descriptor does not refer to a transport end point. |
TBUFOVFLW | The number of bytes allocated for the incoming protocol address of options is not sufficient to store the information. (The unit data information to be returned in the unitdata parameter will be discarded.) |
TLOOK | An asynchronous event has occurred on this transport endpoint and requires immediate attention. |
TNODATA | The O_DELAY or O_NONBLOCK flag was set, but no data units are currently available from the transport provider. |
TNOTSUPPORT | This subroutine is not supported by the underlying transport provider. |
TOUTSTATE | The subroutine was issued in the wrong sequence. |
TSYSERR | A system error has occurred during operation of this subroutine. |