#include <xti.h>int t_optmgmt (int fd, struct t_optmgmt req, struct t_optmgmt ret);
UnixWare 2.0 transport providers do not support XPG4 options management. Some features of t_optmgmt may also not be supported by third-party transport providers. Limited transport-independent options management is provided by netdir_options(3N).
struct netbuf opt; /* protocol options */ long flags; /* actions */The
opt
field identifies protocol options and the flags
field is used to specify the action to take with those options.
The members of the netbuf structure are described in
intro(3xti).
The req argument
is used to request a specific action of the provider and to
send options to the provider.
The maxlen
field of the netbuf structure
has no meaning for req.
The len
field specifies the number of bytes in the options.
The buf
field points to the list of options and their headers.
The ret argument
is used to return options and flag values
from the transport provider.
The maxlen
field of the netbuf structure must
be set to specify the maximum number of bytes that
the options buffer can hold.
The buf
field points to the
buffer where the options are to be placed.
On return, len
specifies the number of bytes of options returned.
Each option in the options buffer consists of a struct t_opthdr
option header which may be followed by an option value.
The level
member identifies the XTI level or the
transport provider protocol.
The name
member identifies the option within
the level, and the len
member stores its total length
(length of t_opthdr plus option value).
If t_optmgmt is called with the action T_NEGOTIATE
set, the status
member of the returned options indicates whether
the negotiation succeeded or failed.
You can use the macro
OPT_NEXTHDR(pbuf,buflen,poption)
to help in reading from or writing to an option buffer.
This macro also automatically aligns each option in an input or
output option buffer on a long-word boundary. pbuf points to an
option buffer (opt.buf
), buflen is its length, and
poption points to the current option in the buffer.
The macro returns a pointer to the position of the next option
or returns a null pointer if the end of the buffer is reached.
The actual structure and content of the options is imposed by the transport provider (for example, see if(7tcp)).
All options specified on input must address the same level.
The flags
field of req can specify one of the
following actions:
->opt.buf
and
req->opt.len
with the transport provider.
The provider will evaluate the requested options and negotiate the
values, returning the negotiated values
through ret->opt.buf
.
The status
member of each returned option indicates the
result of negotiation:
status
is T_SUCCESS, T_FAILURE,
T_NOTSUPPORT or T_READONLY, the returned option value
is the same as that requested.
The overall result of the negotiation is returned in
ret->flags
.
This member contains the worst result in the list:
T_NOTSUPPORT (worst),
T_READONLY, T_FAILURE, T_PARTSUCCESS,
and T_SUCCESS (best).
If the option T_ALLOPT is requested,
all supported options of this level are
requested to be negotiated to their default values.
On output, ret->opt.buf
contains the result, option
by option.
If an option consists only of a t_opthdr option header,
the status
member of the returned option indicates the
following:
status
is returned with the same value as if the option value were negotiated using
T_NEGOTIATE. If status
is T_SUCCESS,
T_FAILURE, T_NOTSUPPORT, or T_READONLY,
the returned option value is the same as the requested value.
On return, ret->flags
will be set to the worst value
as for T_NEGOTIATE. All currently effective option values remain
unchanged.
->opt.buf
.
Only the t_opthdr option header need be specified.
The returned status
member indicates the
following:
->flags
will be set to the worst value
as for T_NEGOTIATE.
If the option T_ALLOPT is requested,
all supported options of this level with their default values are returned.
On input, ret->opt.maxlen
must have at least the value info->options
.
->opt.buf
. Only the
t_opthdr option header need be specified. On return,
req->opt.buf
will contain the currently effective
values.
The returned status
member indicates the
following:
->flags
will be set to the worst value
as for T_NEGOTIATE.
If the option T_ALLOPT is requested, all supported options of this level are returned with their currently effective values.
t_optmgmt may block if data previously sent across the transport endpoint has not yet been fully processed. If interrupted by a signal, option negotiations that are yet to be processed remain valid. t_optmgmt is also unaffected by the setting of O_NONBLOCK.
struct t_linger { long l_onoff; /* switch option on (T_ON) or off (T_OFF) */ long l_linger; /* linger period in seconds */ }Legal values for
l_linger
are
T_UNSPEC (default), T_INFINITE,
or a non-negative integer.
The system will attempt to send pending data within the linger period before closing the endpoint. Data that is then still remaining to be sent is discarded.
maxlen
) allocated for an incoming argument
is greater than zero but not sufficient to store the value of that argument.
The information to be returned in ret
will be discarded.