t_getprotaddr() — Get the protocol addresses

Standards

Standards / Extensions C or C++ Dependencies
XPG4.2 both  

Format

#define _XOPEN_SOURCE_EXTENDED 1
#include <xti.h>

int t_getprotaddr(int fd, struct t_bind *boundaddr,
                  struct t_bind *peeraddr);

General description

Returns local and remote protocol addresses currently associated with the transport endpoint specified by fd. In boundaddr and peeraddr the user specifies maxlen, which is the maximum size of the address buffer, and buf which points to the buffer where the address is to be placed. On return, the buf field of boundaddr points to the address, if any, currently bound to fd, and the len field specifies the length of the address. If the transport endpoint is in the T_UNBND state, zero is returned in the len field of boundaddr. The buf field of peeraddr points to the address, if any, currently connected to fd, and the len field specifies the length of the address. If the transport endpoint is not in the T_DATAXFER state, zero is returned in the len field of peeraddr.

Valid states: All - except for T_UNINIT

Returned value

If successful, t_getprotaddr() returns 0.

If unsuccessful, t_getprotaddr() returns -1 and sets errno to one of the following values:
Error Code
Description
TBADF
The specified file descriptor does not refer to a transport endpoint.
TBUFOVFLW
The number of bytes allocated for an incoming argument (maxlen) is greater than 0 but not sufficient to store the value of that argument.
TPROTO
This error indicates that a communication problem has been detected between XTI and the transport provider for which there is no other suitable XTI (t_errno).
TSYSERR
A system error has occurred during execution of this function.

Related information