Bind an address to a transport endpoint.
X/Open Transport Interface Library (libxti.a)
#include <xti.h> int t_bind (fd, req, ret) int fd; const struct t_bind *req; struct t_bind *ret;
The t_bind subroutine associates a protocol address with the transport endpoint specified by the fd parameter and activates that transport endpoint. In connection mode, the transport provider may begin enqueuing incoming connect indications or servicing a connection request on the transport endpoint. In connectionless mode, the transport user may send or receive data units through the transport endpoint.
The req and ret parameters point to a t_bind structure containing the following members:
struct netbuf addr; unsigned qlen;
Within this structure, the fields have the following meaning:
addr | Specifies a protocol address. |
qlen | Indicates the maximum number of outstanding connect indications. |
If the requested address is not available, the t_bind subroutine returns -1 with t_errno set as appropriate. If no address is specified in the req parameter, (that is, the len field of the addr field in the req parameter is zero or the req parameter is NULL), the transport provider assigns an appropriate address to be bound, and returns that address in the addr field of the ret parameter. If the transport provider could not allocate an address, the t_bind subroutine fails with t_errno set to TNOADDR.
The qlen field has meaning only when initializing a connection-mode service. This field specifies the number of outstanding connect indications that the transport provider should support for the given transport endpoint. An outstanding connect indication is one that has been passed to the transport user by the transport provider but which has not been accepted or rejected. A qlen field value of greater than zero is only meaningful when issued by a passive transport user that expects other users to call it. The value of the qlen field is negotiated by the transport provider and may be changed if the transport provider cannot support the specified number of outstanding connect indications. However, this value of the qlen field is never negotiated from a requested value greater than zero to zero. This is a requirement on transport providers. See "Implementation Specifics" for more information. On return, the qlen field in the ret parameter contains the negotiated value.
0 | Successful completion. |
-1 | t_errno is set to indicate an error. |
On failure, t_errno is set to one of the following:
TACCES | The user does not have permission to use the specified address. |
TADDRBUSY | The requested address is in use. |
TBADADDR | The specified protocol address was in an incorrect format or contained illegal information. |
TBADF | The specified file descriptor does not refer to a transport endpoint. |
TBUFOVLW | The number of bytes allowed for an incoming argument (maxlen) is greater than 0 but not sufficient to store the value of that argument. The provider's state will change to T_IDLE and the information to be returned in ret will be discarded. |
TNOADDR | The transport provider could not allocate an address. |
TOUTSTATE | The function was issued in the wrong sequence. |
TPROTO | This error indicates that a communication problem has been detected between the X/Open Transport Interface and the transport provider for which there is no other suitable X/Open Transport Interface (t_errno). |
TSYSERR | A system error has occurred during execution of this function. |
The requirement that the value of the qlen field never be negotiated from a requested value greater than zero to zero implies that transport providers, rather than the X/Open Transport Interface implementation itself, accept this restriction.
A transport provider may not allow an explicit binding of more than one transport endpoint to the same protocol address, although it allows more than one connection to be accepted for the same protocol address. To ensure portability, it is, therefore, recommended not to bind transport endpoints that are used as responding endpoints, (those specified in the resfd parameter), in a call to the t_accept subroutine, if the responding address is to be the same as the called address.
The t_alloc subroutine, t_close subroutine, t_open subroutine, t_optmgmt subroutine, t_unbind subroutine.