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

NAME

6       t_connect - establish a connection with another transport user
7

SYNOPSIS

9       #include <xti.h>
10
11       int t_connect(int fd, const struct t_call *sndcall,
12            struct t_call *rcvcall);
13
14

DESCRIPTION

16       This  routine  is part of the XTI interfaces which evolved from the TLI
17       interfaces. XTI represents the future evolution  of  these  interfaces.
18       However,  TLI  interfaces are supported for compatibility. When using a
19       TLI routine that has the same name as an  XTI  routine,  the   tiuser.h
20       header  file must be used.  Refer to the  TLI COMPATIBILITY section for
21       a description of differences between the two interfaces. This  function
22       enables  a transport user to request a connection to the specified des‐
23       tination transport user.
24
25
26       This function can only be issued in the  T_IDLE state. The parameter fd
27       identifies  the  local  transport  endpoint where communication will be
28       established, while sndcall and rcvcall  point  to  a  t_call  structure
29       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       The  parameter  sndcall  specifies  information needed by the transport
39       provider to establish a connection and  rcvcall  specifies  information
40       that is associated with the newly established connection.
41
42
43       In  sndcall,  addr  specifies  the  protocol address of the destination
44       transport user, opt presents  any  protocol-specific  information  that
45       might  be  needed  by  the transport provider, udata points to optional
46       user data that may be passed to the destination transport  user  during
47       connection  establishment,  and  sequence has no meaning for this func‐
48       tion.
49
50
51       On return, in rcvcall, addr contains the  protocol  address  associated
52       with  the  responding  transport endpoint, opt represents any protocol-
53       specific information associated with the connection,  udata  points  to
54       optional  user  data  that may be returned by the destination transport
55       user during connection establishment, and sequence has no  meaning  for
56       this function.
57
58
59       The opt argument permits users to define the options that may be passed
60       to the transport provider. The user may choose not to negotiate  proto‐
61       col  options by setting the len field of opt to zero. In this case, the
62       provider uses the option values currently set  for  the  communications
63       endpoint.
64
65
66       If  used, sndcall→opt.buf must point to a buffer with the corresponding
67       options, and  sndcall→opt.len must specify its length. The  maxlen  and
68       buf  fields  of  the  netbuf structure pointed by rcvcall→addr and rcv‐
69       call→opt must be set before the call.
70
71
72       The udata argument enables the caller to pass user data to the destina‐
73       tion  transport  user  and  receive user data from the destination user
74       during connection establishment. However, the amount of user data  must
75       not  exceed  the limits supported by the transport provider as returned
76       in the connect field of the info argument  of  t_open(3NSL)  or  t_get‐
77       info(3NSL).  If  the  len  of udata is zero in sndcall, no data will be
78       sent to the destination transport user.
79
80
81       On return, the addr, opt and udata fields of rcvcall will be updated to
82       reflect  values  associated with the connection. Thus, the maxlen field
83       of each argument must be set before issuing this function  to  indicate
84       the  maximum size of the buffer for each. However, maxlen can be set to
85       zero, in which case no information to this specific argument  is  given
86       to  the user on the return from  t_connect(). If maxlen is greater than
87       zero and less than the length of the  value,   t_connect()  fails  with
88       t_errno  set  to TBUFOVFLW. If  rcvcall is set to  NULL, no information
89       at all is returned.
90
91
92       By default, t_connect() executes in synchronous mode, and will wait for
93       the  destination  user's response before returning control to the local
94       user. A successful return (that is, return  value  of  zero)  indicates
95       that the requested connection has been established. However, if  O_NON‐
96       BLOCK is set  by means of t_open(3NSL) or  fcntl(2),  t_connect()  exe‐
97       cutes  in  asynchronous  mode. In this case, the call will not wait for
98       the remote user's response, but will return control immediately to  the
99       local  user and return  -1 with t_errno set to TNODATA to indicate that
100       the connection has not yet been established. In this way, the  function
101       simply  initiates  the  connection establishment procedure by sending a
102       connection request to the destination  transport  user.  The  t_rcvcon‐
103       nect(3NSL)  function  is used in conjunction with t_connect() to deter‐
104       mine the status of the requested connection.
105
106
107       When a synchronous t_connect() call is interrupted by the arrival of  a
108       signal, the state of the corresponding transport endpoint is  T_OUTCON,
109       allowing a further call to either t_rcvconnect(3NSL), t_rcvdis(3NSL) or
110       t_snddis(3NSL).  When  an asynchronous  t_connect() call is interrupted
111       by the arrival of a signal,  the state of the  corresponding  transport
112       endpoint is  T_IDLE.
113

RETURN VALUES

115       Upon  successful  completion,  a value of  0 is returned.  Otherwise, a
116       value of  -1 is returned and t_errno is set to indicate an error.
117

VALID STATES

119       T_IDLE
120

ERRORS

122       On failure, t_errno is set to one of the following:
123
124       TACCES         The user does not have permission to use  the  specified
125                      address or options.
126
127
128       TADDRBUSY      This  transport  provider does not support multiple con‐
129                      nections with the same local and remote addresses.  This
130                      error indicates that a connection already exists.
131
132
133       TBADADDR       The  specified protocol address was in an incorrect for‐
134                      mat or contained illegal information.
135
136
137       TBADDATA       The amount of user data specified  was  not  within  the
138                      bounds allowed by the transport provider.
139
140
141       TBADF          The specified file descriptor does not refer to a trans‐
142                      port endpoint.
143
144
145       TBADOPT        The specified protocol options were in an incorrect for‐
146                      mat or contained illegal information.
147
148
149       TBUFOVFLW      The  number  of bytes allocated for an incoming argument
150                      (maxlen) is greater than 0 but not sufficient  to  store
151                      the  value  of that argument. If executed in synchronous
152                      mode, the provider's state, as seen by the user, changes
153                      to  T_DATAXFER,  and  the  information to be returned in
154                      rcvcall is discarded.
155
156
157       TLOOK          An asynchronous event has  occurred  on  this  transport
158                      endpoint and requires immediate attention.
159
160
161       TNODATA        O_NONBLOCK  was set, so the function successfully initi‐
162                      ated the connection establishment procedure, but did not
163                      wait for a response from the remote user.
164
165
166       TNOTSUPPORT    This  function is not supported by the underlying trans‐
167                      port provider.
168
169
170       TOUTSTATE      The communications endpoint referenced by  fd is not  in
171                      one  of  the  states in which a call to this function is
172                      valid.
173
174
175       TPROTO         This error indicates that a  communication  problem  has
176                      been detected between XTI and the transport provider for
177                      which there is no other suitable XTI error (t_errno).
178
179
180       TSYSERR        A system error has occurred  during  execution  of  this
181                      function.
182
183

TLI COMPATIBILITY

185       The XTI and TLI interface definitions have common names but use differ‐
186       ent header files. This, and other semantic differences between the  two
187       interfaces are described in the subsections below.
188
189   Interface Header
190       The  XTI  interfaces  use the header file, xti.h. TLI interfaces should
191       not use this header.  They should use the header:
192
193         #include <tiuser.h>
194
195
196   Error Description Values
197       The TPROTO and TADDRBUSY t_errno values can be set by the XTI interface
198       but not by the TLI interface.
199
200
201       A  t_errno  value  that this routine can return under different circum‐
202       stances than its XTI counterpart is TBUFOVFLW. It can be returned  even
203       when the maxlen field of the corresponding buffer has been set to zero.
204
205   Option Buffers
206       The format of the options in an opt buffer is dictated by the transport
207       provider. Unlike the XTI interface, the TLI interface does not fix  the
208       buffer format.
209

ATTRIBUTES

211       See attributes(5)  for descriptions of the following attributes:
212
213
214
215
216       ┌─────────────────────────────┬─────────────────────────────┐
217       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
218       ├─────────────────────────────┼─────────────────────────────┤
219       │MT Level                     │Safe                         │
220       └─────────────────────────────┴─────────────────────────────┘
221

SEE ALSO

223       fcntl(2),   t_accept(3NSL),   t_alloc(3NSL),   t_getinfo(3NSL),  t_lis‐
224       ten(3NSL),    t_open(3NSL),    t_optmgmt(3NSL),     t_rcvconnect(3NSL),
225       t_rcvdis(3NSL), t_snddis(3NSL), attributes
226
227
228
229SunOS 5.11                        7 May 1998                   t_connect(3NSL)
Impressum