t_getprotaddr(3xti)


t_getprotaddr -- get protocol addresses

Synopsis

cc [options] file -lnsl
#include <xti.h>

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

Description

This function is an TLI/XTI local management function used to get protocol addresses for both the local and remote endpoints. t_getprotaddr returns, for the transport endpoint specified by fd, the local address of the transport endpoint (pointed to by boundaddr) and the remote address of the peer (pointed to by peeraddr).

The local address is available if the endpoint is bound (not in the T_UNBND state) and the peer address is available if the endpoint is in the T_DATAXFER state.

Parameters


fd
File descriptor for the transport endpoint associated with the protocol address.

boundaddr
Points to the bound address of the local transport endpoint.

peeraddr
Points to the peer address.

Structure definitions

boundaddr and peeraddr point to a t_bind structure containing the following members:
   struct netbuf addr;	/* address */
   unsigned qlen;		/* connect indications */
The netbuf addr members (len, maxlen and buf) are described in intro(3xti). len specifies the number of bytes in the address, buf points to the address buffer, and maxlen is the maximum size of the address buffer. qlen, in connection mode only, is used to indicate the maximum number of outstanding connect indications.

In boundaddr and peeraddr, maxlen is the maximum size of the address buffer, specified by the user, and buf points to the buffer where the address will be placed.

On return, if the endpoint specified by fd is currently bound, the buf field of boundaddr points to the address of the transport endpoint and len indicates the length of the address. If the endpoint is not bound, the len member of boundaddr returns a value of 0.

If the transport user is in the T_DATAXFER state, the buf member of peeraddr points to the address of the peer (currently connected to fd and the len member indicates the length of that address. If the endpoint is not connected, the len member of peeraddr returns a value of 0.

State transitions

t_getprotaddr may be issued from any valid state except T_UNINIT and has no effect on the state.

Files


/usr/lib/libxti.so
X/Open® Transport Interface Library (shared object)

/usr/lib/libnsl.so
Network Services Library (shared object)

Usage

This function is applicable for both connection-mode and connectionless transport services. However, since the remote endpoint is never in the TDATAXFER state if the service is connectionless, only the address of the bound endpoint will be returned.

Return values

t_getprotaddr returns a value of 0 on successful completion and -1 on failure and t_errno is set to indicate the error.

Errors

On failure, t_errno may be set to one of the following:

TBADF
The specified file descriptor does not refer to a transport endpoint.

TBUFOVFLW
The number of bytes (maxlen) allocated for an incoming argument is greater than zero but not sufficient to store the value of that argument.

TSYSERR
A system error has occurred during execution of this function.

TPROTO
A communication problem has been detected with the transport provider and there is no other value of t_errno to describe the error condition.

References

intro(3xti), t_accept(3xti), t_bind(3xti), t_connect(3xti)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004