t_rcvudata(3xti)t_rcvudata(3xti)Namet_rcvudata - receive a data unit
Syntax
#include <xti.h>
int t_rcvudata(fd, unitdata, flags)
int fd;
struct t_unitdata *unitdata;
int *flags:
Arguments
fd Identifies the local transport endpoint through which data is
received.
unitdata Holds information associated with the received data unit. The
unitdata argument points to a t_unitdata structure containing
the following members:
struct netbuf addr;
struct netbuf opt;
struct netbuf udata
On return from this call, the members have the following
meanings:
addr Specifies the protocol address of the sending
unit.
opt Identifies protocol-specific options that were
associated with this data unit.
udata Specifies the user data that was received.
flags Set on return to indicate that the complete data
unit was not received.
Description
This function is used in connectionless mode to receive a data unit
from another transport user.
By default, operates in synchronous mode waits for a data unit to
arrive if none is currently available. However, if O_NONBLOCK is set by
means of or udata executes in asynchronous mode and fails if no data
units are available.
The maxlen field of addr, opt, and udata must be set before issuing
this function to indicate the maximum size of the buffer for each.
If the buffer defined in the udata field of unitdata is not large
enough to hold the current data unit, the buffer fills and T_MORE sets
in flags on return to indicate that another should be issued to
retrieve the rest of the data unit. Subsequent calls return zero for
the length of the address and options until the full data unit has been
received.
──────────────────────────────────────────────────
Parameters Before Call After Call
──────────────────────────────────────────────────
fd x /
unitdata->addr.maxlen x /
unitdata->addr.len / x
unitdata->addr.buf x (x)
unitdata->opt.maxlen x /
unitdata->opt.len / x
unitdata->opt.buf x (x)
unitdata->udata.maxlen x /
unitdata->udata.len / x
unitdata->udata.buf x (x)
flags / x
──────────────────────────────────────────────────
Return Values
Upon successful completion, a value of 0 is returned. On failure, a
value of -1 is returned, and t_errno is set to indicate the error.
Diagnostics
On failure, t_errno is set to one of the following:
[TBADF] The specified file descriptor does not refer to a
transport endpoint.
[TOUTSTATE] The function was issued in the wrong sequence on
the transport endpoint referenced by fd.
[TNODATA] O_NONBLOCK was set, but no data units are currently
available from the transport provider.
[TBUFOVFLW] The number of bytes allocated for the incoming pro‐
tocol address or options is not sufficient to store
the information. The unit data information to be
returned in unitdata is discarded.
[TLOOK] An asynchronous event has occurred on the transport
endpoint and requires immediate attention.
[TNOTSUPPORT] This function is not supported by the underlying
transport provider.
[TSYSERR] A system error has occurred during execution of
this function.
See Alsofcntl(2), t_alloc(3xti), t_open(3xti), t_rcvuderr(3xti), t_sndu‐
data(3xti)t_rcvudata(3xti)