1t_listen(3NSL)       Networking Services Library Functions      t_listen(3NSL)
2
3
4

NAME

6       t_listen - listen for a connection indication
7

SYNOPSIS

9       #include <xti.h>
10
11
12
13       int t_listen(int fd, struct t_call *call);
14
15

DESCRIPTION

17       This  routine  is part of the XTI interfaces which evolved from the TLI
18       interfaces. XTI represents the future evolution  of  these  interfaces.
19       However,  TLI  interfaces are supported for compatibility. When using a
20       TLI routine that has the same name as an  XTI  routine,  the   tiuser.h
21       header  file must be used.  Refer to the  TLI COMPATIBILITY section for
22       a description of differences between the two interfaces.
23
24
25       This function listens for a connection indication from a calling trans‐
26       port  user.  The  argument  fd  identifies the local transport endpoint
27       where connection indications  arrive,  and  on  return,  call  contains
28       information  describing  the  connection indication. The parameter call
29       points to a t_call structure which contains the following members:
30
31         struct netbuf addr;
32         struct netbuf opt;
33         struct netbuf udata;
34         int sequence;
35
36
37
38       In call, addr returns the protocol address  of  the  calling  transport
39       user.  This  address  is  in  a format usable in future calls to t_con‐
40       nect(3NSL). Note, however that t_connect(3NSL) may fail for other  rea‐
41       sons,  for  example  TADDRBUSY. opt returns options associated with the
42       connection indication, udata returns any user data sent by  the  caller
43       on the connection request, and sequence is a number that uniquely iden‐
44       tifies the  returned  connection  indication.  The  value  of  sequence
45       enables  the  user to listen for multiple connection indications before
46       responding to any of them.
47
48
49       Since this function returns values for the addr, opt and  udata  fields
50       of call, the maxlen field of each must be set before issuing the t_lis‐
51       ten() to indicate the maximum size of  the  buffer  for  each.  If  the
52       maxlen  field of  call→addr, call→opt or  call→udata is set to zero, no
53       information is returned for this parameter.
54
55
56       By default, t_listen() executes in synchronous mode  and  waits  for  a
57       connection  indication to arrive before returning to the user. However,
58       if  O_NONBLOCK is set via t_open(3NSL) or fcntl(2), t_listen() executes
59       asynchronously, reducing to a poll for existing connection indications.
60       If none are available, it returns  -1 and sets t_errno to TNODATA.
61

RETURN VALUES

63       Upon successful completion, a value of 0  is  returned.   Otherwise,  a
64       value of −1 is returned and t_errno is set to indicate an error.
65

VALID STATES

67       T_IDLE, T_INCON
68

ERRORS

70       On failure, t_errno is set to one of the following:
71
72       TBADF          The specified file descriptor does not refer to a trans‐
73                      port endpoint.
74
75
76       TBADQLEN       The argument qlen of the endpoint referenced  by  fd  is
77                      zero.
78
79
80       TBUFOVFLW      The  number  of bytes allocated for an incoming argument
81                      (maxlen) is greater than 0 but not sufficient  to  store
82                      the  value  of  that  argument. The provider's state, as
83                      seen by the user, changes to T_INCON, and the connection
84                      indication  information  to  be returned in call is dis‐
85                      carded. The value of sequence returned can be used to do
86                      a t_snddis(3NSL).
87
88
89       TLOOK          An  asynchronous  event  has  occurred on this transport
90                      endpoint and requires immediate attention.
91
92
93       TNODATA        O_NONBLOCK was set, but no  connection  indications  had
94                      been queued.
95
96
97       TNOTSUPPORT    This  function is not supported by the underlying trans‐
98                      port provider.
99
100
101       TOUTSTATE      The communications endpoint referenced by  fd is not  in
102                      one  of  the  states in which a call to this function is
103                      valid.
104
105
106       TPROTO         This error indicates that a  communication  problem  has
107                      been detected between XTI and the transport provider for
108                      which there is no other suitable XTI error (t_errno).
109
110
111       TQFULL         The maximum number of  outstanding  connection   indica‐
112                      tions  has  been  reached for the endpoint referenced by
113                      fd. Note that a subsequent call to t_listen() may  block
114                      until  another  incoming connection indication is avail‐
115                      able. This can only occur if at least one  of  the  out‐
116                      standing  connection  indications becomes no longer out‐
117                      standing, for example through a call to t_accept(3NSL).
118
119
120       TSYSERR        A system error has occurred  during  execution  of  this
121                      function.
122
123

TLI COMPATIBILITY

125       The XTI and TLI interface definitions have common names but use differ‐
126       ent header files. This, and other semantic differences between the  two
127       interfaces are described in the subsections below.
128
129   Interface Header
130       The  XTI  interfaces  use the header file, xti.h. TLI interfaces should
131       not use this header.  They should use the header:
132
133         #include <tiuser.h>
134
135
136   Error Description Values
137       The t_errno values TPROT0, TBADQLEN, and TQFULL can be set by  the  XTI
138       interface but not by the TLI interface.
139
140
141       A  t_errno  value  that this routine can return under different circum‐
142       stances than its XTI counterpart is TBUFOVFLW. It can be returned  even
143       when the maxlen field of the corresponding buffer has been set to zero.
144
145   Option Buffers
146       The format of the options in an opt buffer is dictated by the transport
147       provider. Unlike the XTI interface, the TLI interface does not fix  the
148       buffer format.
149

ATTRIBUTES

151       See attributes(5)  for descriptions of the following attributes:
152
153
154
155
156       ┌─────────────────────────────┬─────────────────────────────┐
157       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
158       ├─────────────────────────────┼─────────────────────────────┤
159       │MT Level                     │Safe                         │
160       └─────────────────────────────┴─────────────────────────────┘
161

SEE ALSO

163       fcntl(2), t_accept(3NSL), t_alloc(3NSL), t_bind(3NSL), t_connect(3NSL),
164       t_open(3NSL),  t_optmgmt(3NSL),   t_rcvconnect(3NSL),   t_snddis(3NSL),
165       attributes(5)
166

WARNINGS

168       Some  transport  providers  do  not  differentiate between a connection
169       indication and the connection itself. If this is the case, a successful
170       return of t_listen() indicates an existing connection.
171
172
173
174SunOS 5.11                        7 May 1998                    t_listen(3NSL)
Impressum