1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
*/
/* Copyright (c) 1996 Sun Microsystems, Inc. */
/* All Rights Reserved */
/*
* Copyright 2017 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _XTI_H
#define _XTI_H
#include <sys/types.h>
/*
* The following include file has declarations needed by both the kernel
* level transport providers and the user level library. This file includes
* it to expose its namespaces to XTI user level interface.
*/
#include <sys/tpicommon.h>
/*
* Include XTI interface level options management declarations
*/
#include <sys/xti_xtiopt.h>
#if !defined(_XPG5)
/*
* Include declarations related to OSI transport and management data
* structures, and the Internet Protocol Suite.
* Note: The older Unix95/XNS4 XTI spec required these to be
* exposed through the generic interface header.
*/
#include <sys/xti_osi.h>
#include <sys/xti_inet.h>
#endif /* !defined(_XPG5) */
#ifdef __cplusplus
extern "C" {
#endif
/*
* The following t_errno error codes are included in the namespace by
* inclusion of <sys/tpicommon.h> above. The english language error strings
* associated with the error values are reproduced here for easy reference.
*
* Error Value Error message string
* ---- ----- --------------------
* TBADADDR 1 Incorrect address format
* TBADOPT 2 Incorrect options format
* TACCES 3 Illegal permissions
* TBADF 4 Illegal file descriptor
* TNOADDR 5 Couldn't allocate address
* TOUTSTATE 6 Routine will place interface out of state
* TBADSEQ 7 Illegal called/calling sequence number
* TSYSERR 8 System error
* TLOOK 9 An event requires attention
* TBADDATA 10 Illegal amount of data
* TBUFOVFLW 11 Buffer not large enough
* TFLOW 12 Can't send message - (blocked)
* TNODATA 13 No message currently available
* TNODIS 14 Disconnect message not found
* TNOUDERR 15 Unitdata error message not found
* TBADFLAG 16 Incorrect flags specified
* TNOREL 17 Orderly release message not found
* TNOTSUPPORT 18 Primitive not supported by provider
* TSTATECHNG 19 State is in process of changing
* TNOSTRUCTYPE 20 Unsupported structure type requested
* TBADNAME 21 Invalid transport provider name
* TBADQLEN 22 Listener queue length limit is zero
* TADDRBUSY 23 Transport address is in use
* TINDOUT 24 Outstanding connection indications
* TPROVMISMATCH 25 Listener-acceptor transport provider mismatch
* TRESQLEN 26 Connection acceptor has listen queue length
* limit greater than zero
* TRESADDR 27 Connection acceptor-listener addresses not
* same but required by transport
* TQFULL 28 Incoming connection queue is full
* TPROTO 29 Protocol error on transport primitive
*
*/
/*
* The following are the events returned by t_look
*/
#define T_LISTEN 0x0001 /* connection indication received */
#define T_CONNECT 0x0002 /* connect confirmation received */
#define T_DATA 0x0004 /* normal data received */
#define T_EXDATA 0x0008 /* expedited data received */
#define T_DISCONNECT 0x0010 /* disconnect received */
#define T_UDERR 0x0040 /* data gram error indication */
#define T_ORDREL 0x0080 /* orderly release indication */
#define T_GODATA 0x0100 /* sending normal data is again possible */
#define T_GOEXDATA 0x0200 /* sending expedited data is again possible */
/*
* Flags for data primitives
*/
#define T_MORE 0x001 /* more data */
#define T_EXPEDITED 0x002 /* expedited data */
#define T_PUSH 0x004 /* send data immediately */
/*
* XTI error return
*/
#if defined(_REENTRANT) || defined(_TS_ERRNO)
extern int *__t_errno();
#define t_errno (*(__t_errno()))
#else
#error "extern int t_errno?"
#endif /* defined(_REENTRANT) || defined(_TS_ERRNO) */
/*
* The following are for t_sysconf()
*/
#ifndef T_IOV_MAX
#define T_IOV_MAX 16 /* Maximum number of scatter/gather buffers */
#endif /* Should be <= IOV_MAX */
#ifndef _SC_T_IOV_MAX
#define _SC_T_IOV_MAX 79 /* Should be same in <unistd.h> for use by */
#endif /* sysconf() */
struct t_iovec {
void *iov_base;
size_t iov_len;
};
/*
* Translate source level interface to binary entry point names.
*
* Note: This is done to maintain co-existence of TLI and XTI
* interfaces which have identical names for most functions but
* different semantics. The XTI names are moved to the different
* prefix space in the ABI. The #ifdef is required to make use of
* of the compiler feature to allow redefinition of external names
* where available. Otherwise a simple #define is used when this
* header is used with other compilers.
* The use of #define also has the effect of renaming all names (not
* just function names) to the new name. The TLI function names
* (e.g. t_bind) can have identical names for structure names
* (e.g struct t_bind). Therefore, this redefinition of names needs
* to be before all structure and function name declarations in the header.
*/
#ifdef __PRAGMA_REDEFINE_EXTNAME
#if defined(_XOPEN_SOURCE) && !defined(_XPG5)
#pragma redefine_extname t_accept _xti_accept
#else
#pragma redefine_extname t_accept _xti_xns5_accept
#endif
#pragma redefine_extname t_alloc _xti_alloc
#pragma redefine_extname t_bind _xti_bind
#pragma redefine_extname t_close _xti_close
#pragma redefine_extname t_connect _xti_connect
#pragma redefine_extname t_error _xti_error
#pragma redefine_extname t_free _xti_free
#pragma redefine_extname t_getinfo _xti_getinfo
#pragma redefine_extname t_getstate _xti_getstate
#pragma redefine_extname t_getprotaddr _xti_getprotaddr
#pragma redefine_extname t_listen _xti_listen
#pragma redefine_extname t_look _xti_look
#pragma redefine_extname t_open _xti_open
#pragma redefine_extname t_optmgmt _xti_optmgmt
#pragma redefine_extname t_rcv _xti_rcv
#pragma redefine_extname t_rcvconnect _xti_rcvconnect
#pragma redefine_extname t_rcvdis _xti_rcvdis
#pragma redefine_extname t_rcvrel _xti_rcvrel
#pragma redefine_extname t_rcvreldata _xti_rcvreldata
#pragma redefine_extname t_rcvudata _xti_rcvudata
#pragma redefine_extname t_rcvuderr _xti_rcvuderr
#pragma redefine_extname t_rcvv _xti_rcvv
#pragma redefine_extname t_rcvvudata _xti_rcvvudata
#if defined(_XOPEN_SOURCE) && !defined(_XPG5)
#pragma redefine_extname t_snd _xti_snd
#else
#pragma redefine_extname t_snd _xti_xns5_snd
#endif
#pragma redefine_extname t_snddis _xti_snddis
#pragma redefine_extname t_sndrel _xti_sndrel
#pragma redefine_extname t_sndreldata _xti_sndreldata
#pragma redefine_extname t_sndudata _xti_sndudata
#pragma redefine_extname t_sndv _xti_sndv
#pragma redefine_extname t_sndvudata _xti_sndvudata
#pragma redefine_extname t_strerror _xti_strerror
#pragma redefine_extname t_sync _xti_sync
#pragma redefine_extname t_sysconf _xti_sysconf
#pragma redefine_extname t_unbind _xti_unbind
#else /* __PRAGMA_REDEFINE_EXTNAME */
#if defined(_XOPEN_SOURCE) && !defined(_XPG5)
#define t_accept _xti_accept
#else
#define t_accept _xti_xns5_accept
#endif
#define t_alloc _xti_alloc
#define t_bind(a,b,c) _xti_bind(a,b,c)
#define t_close _xti_close
#define t_connect _xti_connect
#define t_error _xti_error
#define t_free _xti_free
#define t_getinfo _xti_getinfo
#define t_getstate _xti_getstate
#define t_getprotaddr _xti_getprotaddr
#define t_listen _xti_listen
#define t_look _xti_look
#define t_open _xti_open
#define t_optmgmt(a,b,c) _xti_optmgmt(a,b,c)
#define t_rcv _xti_rcv
#define t_rcvconnect _xti_rcvconnect
#define t_rcvdis _xti_rcvdis
#define t_rcvrel _xti_rcvrel
#define t_rcvreldata _xti_rcvreldata
#define t_rcvudata _xti_rcvudata
#define t_rcvuderr _xti_rcvuderr
#define t_rcvv _xti_rcvv
#define t_rcvvudata _xti_rcvvudata
#if defined(_XOPEN_SOURCE) && !defined(_XPG5)
#define t_snd _xti_snd
#else
#define t_snd _xti_xns5_snd
#endif
#define t_snddis _xti_snddis
#define t_sndrel _xti_sndrel
#define t_sndreldata _xti_sndreldata
#define t_sndudata _xti_sndudata
#define t_sndv _xti_sndv
#define t_sndvudata _xti_sndvudata
#define t_strerror _xti_strerror
#define t_sync _xti_sync
#define t_sysconf _xti_sysconf
#define t_unbind _xti_unbind
#endif /* __PRAGMA_REDEFINE_EXTNAME */
/*
* All the rest of the standard xti.h removed because the structs:
* netbuf, t_info, t_opthdr, t_optmgmt, t_bind, t_call, ...
* all conflict with definitions in tiuser.h which we need
* for the (simulated) kernel interfaces in fake_ktli.c.
*
* The XTI library functions below would normally be defined by
* including tiuser.h after the defines above, which we can't.
*/
int _xti_accept(int, int, struct t_call *);
int _xti_xns5_accept(int, int, struct t_call *);
char *_xti_alloc(int, int, int);
int _xti_bind(int, struct t_bind *, struct t_bind *);
int _xti_close(int);
int _xti_connect(int, struct t_call *, struct t_call *);
int _xti_error(char *);
int _xti_free(char *, int);
int _xti_getinfo(int, struct t_info *);
int _xti_getprotaddr(int, struct t_bind *, struct t_bind *);
int _xti_getstate(int);
int _xti_listen(int, struct t_call *);
int _xti_look(int);
int _xti_open(char *, int, struct t_info *);
int _xti_optmgmt(int, struct t_optmgmt *, struct t_optmgmt *);
int _xti_rcv(int, char *, unsigned int, int *);
int _xti_rcvconnect(int, struct t_call *);
int _xti_rcvdis(int, struct t_discon *);
int _xti_rcvrel(int);
int _xti_rcvreldata(int, struct t_discon *);
int _xti_rcvudata(int, struct t_unitdata *, int *);
int _xti_rcvuderr(int, struct t_uderr *);
int _xti_rcvv(int, struct t_iovec *, unsigned int, int *);
int _xti_rcvvudata(int, struct t_unitdata *, struct t_iovec *,
unsigned int, int *);
int _xti_snd(int, char *, unsigned int, int);
int _xti_xns5_snd(int, char *, unsigned int, int);
int _xti_snddis(int, struct t_call *);
int _xti_sndrel(int);
int _xti_sndreldata(int, struct t_discon *);
int _xti_sndudata(int, struct t_unitdata *);
int _xti_sndv(int, const struct t_iovec *, unsigned int, int);
int _xti_sndvudata(int, struct t_unitdata *, struct t_iovec *, unsigned int);
char *_xti_strerror(int);
int _xti_sync(int);
int _xti_sysconf(int);
int _xti_unbind(int);
#ifdef __cplusplus
}
#endif
#endif /* _XTI_H */
|