t_getprotaddr(3N) t_getprotaddr(3N)
NAME
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);
Parameters
fd the 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.
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.
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 fields (len, maxlen and buf) are described in
intro(3). 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. The qlen field, in connection
mode only, is used to indicate the maximum number of
outstanding connect indications.
Copyright 1994 Novell, Inc. Page 1
t_getprotaddr(3N) t_getprotaddr(3N)
In boundaddr and peeraddr, the maxlen field 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 the len field indicates the length of
the address. If the endpoint is not bound, the len field of
boundaddr returns a value of 0.
If the transport user is in the T_DATAXFER state, the buf
field of peeraddr points to the address of the peer (currently
connected to fd and the len field indicates the length of that
address. If the endpoint is not connected, the len field of
peeraddr returns a value of 0.
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.
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)
Copyright 1994 Novell, Inc. Page 2
t_getprotaddr(3N) t_getprotaddr(3N)
/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.
REFERENCES
intro(3), t_accept(3N), t_bind(3N), t_connect(3N)
Copyright 1994 Novell, Inc. Page 3