|
Description
The getprotaddr() returns the local and remote protocol addresses currently assigned to transport endpoint fd. The boundaddr and peeraddr parameters point to objects of type struct t_bind.
The t_bind structure is declared in <xti.h> as follows:
struct t_bind { struct netbuf addr; unsigned qlen; };
Before calling t_getprotaddr(), the user specifies the maximum size of the address buffer in boundaddr->maxlen and peeraddr->maxlen. The user also specifies with boundaddr->addr.buf and peeraddr->addr.buf pointers to buffers into which t_getprotaddr() is to return the address concerned.
After t_getprotaddr() is executed, boundaddr->addr.buf points to the address assigned to transport endpoint fd (if available). boundaddr->addr.len contains the length of this address.
If transport endpoint fd is in the T_UNBND state, t_getprotaddr() returns the value 0 in the boundaddr->addr.len component.
After t_getprotaddr() is executed, peeraddr->addr.buf points to the address of the communications partner of fd (if available). peeraddr->addr.len contains the length of this address. If transport endpoint fd is not in the T_DATAXFER state, t_getprotaddr() returns the value 0 in the peeraddr->addr.len component.
Return value
0:
If successful.
-1:
If an error occurs. t_ errno is set to indicate the error.
Errors
TBADF
The specified file descriptor does not reference a transport endpoint.
TBUFOVFLW
The number of bytes reserved for a result parameter (with maxlen) is greater than 0 but not large enough to store the value of the parameter concerned.
TPROTO
This error indicates that a communications problem was detected between XTI and the transport system, for which no other suitable error description is available.
TSYSERR
A system error occurred during execution of this function.