'\"macro stdmacro
.if n .pH g3n.t_optmgmt @(#)t_optmgmt	40.4 of 10/10/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} t_optmgmt 3N "Networking Support Utilities" "\&"
.if \nX=1 .ds x} t_optmgmt 3N "Networking Support Utilities"
.if \nX=2 .ds x} t_optmgmt 3N "" "\&"
.if \nX=3 .ds x} t_optmgmt "" "" "\&"
.if \nX=4 .ds x} t_optmgmt "NS_LIB" "EXTENSION" " "
.TH \*(x}
.SH NAME
\f4t_optmgmt\f1 \- manage options for a transport endpoint
.SH SYNOPSIS
\f4#include <tiuser.h>\f1
.PP
.nf
\f4int t_optmgmt (int fd, struct t_optmgmt \(**req, struct t_optmgmt \(**ret);\f1
.fi
.SH DESCRIPTION
The \f4t_optmgmt\fP function enables a transport user to retrieve,
verify, or negotiate protocol options with the transport provider.
\f4fd\fP identifies a bound transport endpoint.
.PP
The \f4req\fP and \f4ret\fP
arguments point to a \f4t_optmgmt\fP structure containing the following
members:
.PP
.RS
\f4struct netbuf opt;\fP
.br
\f4long flags;\fP
.RE
.PP
The
\f4opt\fP field identifies protocol options and the \f4flags\fP
field is used to specify the action to take with those options.
.PP
The options are represented by a \f4netbuf\fP
[see \f4intro\fP(3); also for \f4len\f1, \f4buf\f1, and \f4maxlen\f1]
structure in a manner similar to the address in
\f4t_bind\fP.
\f4req\fP
is used to request a specific action of the provider and to
send options to the provider.
\f4len\fP
specifies the number of bytes in the options, \f4buf\fP
points to the options buffer, and \f4maxlen\fP has no meaning for
the \f4req\fP argument.
The transport provider may return options and flag values
to the user through
\f4ret\fP.
For \f4ret\fP, \f4maxlen\fP specifies the maximum size of the options
buffer and \f4buf\fP
points to the buffer where the options are to be placed.
On return,
\f4len\fP
specifies the number of bytes of options returned.
\f4maxlen\fP
has no meaning for the
\f4req\fP
argument, but must be set in the
\f4ret\fP
argument
to specify the maximum number of bytes the options buffer
can hold.
The actual structure and content of the options is imposed by the
transport provider.
.PP
The
\f4flags\fP
field of
\f4req\fP
can specify one of the following actions:
.TP 15
\f4T_NEGOTIATE\fP
This action enables the user to negotiate the values of the options
specified in
\f4req\fP
with the transport provider.
The provider will evaluate the requested options and negotiate the
values, returning the negotiated values through
\f4ret\fP.
.TP
\f4T_CHECK\fP
This action enables the user to verify whether the options
specified in
\f4req\fP
are supported by the transport provider.
On return, the \f4flags\fP field of \f4ret\fP will have either
\f4T_SUCCESS\fP or \f4T_FAILURE\fP
set to indicate to the user whether the options are supported.
These flags are only meaningful for the \f4T_CHECK\fP request.
.TP
\f4T_DEFAULT\fP
This action enables a user to retrieve the default options
supported by the transport provider into the \f4opt\fP field of
\f4ret\fP.
In \f4req\fP, the \f4len\fP field of \f4opt\fP must be zero and
the \f4buf\fP field may be \s-1NULL\s+1.
.PP
If issued as part of the connectionless-mode service, \f4t_optmgmt\fP
may block due to flow control constraints.
The function will not complete until the transport provider
has processed all previously sent data units.
.P
On failure, \f4t_errno\f1 may be set to one of the following:
.TP 20 
\f4[TBADF]\fP
The specified file descriptor does not refer to a transport endpoint.
.TP
\f4[TOUTSTATE]\fP
The function was issued in the wrong sequence.
.TP
\f4[TACCES]\fP
The user does not have permission to negotiate the specified options.
.TP
\f4[TBADOPT]\fP
The specified protocol options were in an incorrect format or
contained illegal information.
.TP
\f4[TBADFLAG]\fP
An invalid flag was specified.
.TP
\f4[TBUFOVFLW]\fP
The number of bytes allowed for an incoming argument is not
sufficient to store the value of that argument.
The information to be returned in \f4ret\fP
will be discarded.
.TP
\f4[TSYSERR]\fP
A system error has occurred during execution of this function.
.SH "SEE ALSO"
\f4intro\fP(3), \f4t_getinfo\fP(3N), \f4t_open\fP(3N).
.sp .2
\f2UNIX System V Network Programmer's Guide\f1.
.SH DIAGNOSTICS
\f4t_optmgmt\fP
returns 0 on success and \-1 on failure and
\f4t_errno\f1 is set to indicate the error.
.Ee
