2 |
7u83 |
1 |
# Crown Copyright (c) 1997
|
|
|
2 |
#
|
|
|
3 |
# This TenDRA(r) Computer Program is subject to Copyright
|
|
|
4 |
# owned by the United Kingdom Secretary of State for Defence
|
|
|
5 |
# acting through the Defence Evaluation and Research Agency
|
|
|
6 |
# (DERA). It is made available to Recipients with a
|
|
|
7 |
# royalty-free licence for its use, reproduction, transfer
|
|
|
8 |
# to other parties and amendment for any purpose not excluding
|
|
|
9 |
# product development provided that any such use et cetera
|
|
|
10 |
# shall be deemed to be acceptance of the following conditions:-
|
|
|
11 |
#
|
|
|
12 |
# (1) Its Recipients shall ensure that this Notice is
|
|
|
13 |
# reproduced upon any copies or amended versions of it;
|
|
|
14 |
#
|
|
|
15 |
# (2) Any amended version of it shall be clearly marked to
|
|
|
16 |
# show both the nature of and the organisation responsible
|
|
|
17 |
# for the relevant amendment or amendments;
|
|
|
18 |
#
|
|
|
19 |
# (3) Its onward transfer from a recipient to another
|
|
|
20 |
# party shall be deemed to be that party's acceptance of
|
|
|
21 |
# these conditions;
|
|
|
22 |
#
|
|
|
23 |
# (4) DERA gives no warranty or assurance as to its
|
|
|
24 |
# quality or suitability for any purpose and DERA accepts
|
|
|
25 |
# no liability whatsoever in relation to any use to which
|
|
|
26 |
# it may be put.
|
|
|
27 |
#
|
|
|
28 |
# CAE, Networking Services, Issue 4
|
|
|
29 |
|
|
|
30 |
# Events
|
|
|
31 |
+CONST int T_LISTEN, T_CONNECT, T_DATA, T_EXDATA, T_DISCONNECT, T_ORDREL ;
|
|
|
32 |
+CONST int T_UDERR ;
|
|
|
33 |
+CONST int T_GODATA, T_GOEXDATA ;
|
|
|
34 |
|
|
|
35 |
# States
|
|
|
36 |
+CONST int T_UNINIT, T_UNBND, T_IDLE, T_OUTCON, T_INCON, T_DATAXFER ;
|
|
|
37 |
+CONST int T_INREL, T_OUTREL ;
|
|
|
38 |
|
|
|
39 |
# Service types
|
|
|
40 |
+CONST int T_COTS, T_COTS_ORD, T_CLTS ;
|
|
|
41 |
|
|
|
42 |
# Errors
|
|
|
43 |
+CONST int TBADADDR, TBADOPT, TACCES, TBADF, TNOADDR, TOUTSTATE, TBADSEQ ;
|
|
|
44 |
+CONST int TSYSERR, TLOOK, TBADDATA, TBUFOVFLW, TFLOW, TNODATA, TNODIS ;
|
|
|
45 |
+CONST int TNOUDERR, TBADFLAG, TNOREL, TNOTSUPPORT, TSTATECHNG, TNOSTRUCTYPE ;
|
|
|
46 |
+CONST int TBADNAME, TBADQLEN, TADDRBUSY ;
|
|
|
47 |
+CONST int TINDOUT, TPROVMISMATCH, TRESQLEN, TRESADDR, TQFULL, TPROTO ;
|
|
|
48 |
|
|
|
49 |
# Structure types for t_alloc
|
|
|
50 |
+CONST int T_BIND, T_CALL, T_OPTMGMT, T_DIS, T_UNITDATA, T_UDERROR, T_INFO ;
|
|
|
51 |
|
|
|
52 |
# Fields for t_alloc
|
|
|
53 |
+CONST int T_ADDR, T_OPT, T_UDATA, T_ALL ;
|
|
|
54 |
|
|
|
55 |
# Flags for t_optmgmt
|
|
|
56 |
+CONST int T_NEGOTIATE, T_CHECK, T_DEFAULT, T_CURRENT ;
|
|
|
57 |
+CONST int T_ALLOPT ;
|
|
|
58 |
|
|
|
59 |
# XTI level options for t_optmgmt
|
|
|
60 |
+CONST int XTI_GENERIC ;
|
|
|
61 |
+CONST int XTI_DEBUG, XTI_LINGER, XTI_RCVBUF, XTI_RCVLOWAT ;
|
|
|
62 |
+CONST int XTI_SNDBUF, XTI_SNDLOWAT ;
|
|
|
63 |
|
|
|
64 |
# l_onoff of struct t_linger
|
|
|
65 |
+CONST int T_YES, T_NO ;
|
|
|
66 |
|
|
|
67 |
# l_linger of struct t_linger
|
|
|
68 |
+CONST int T_UNSPEC, T_INFINITE ;
|
|
|
69 |
|
|
|
70 |
# Flags for t_send
|
|
|
71 |
+CONST int T_EXPEDITED, T_MORE ;
|
|
|
72 |
|
|
|
73 |
# Flags of struct t_info
|
|
|
74 |
+CONST long T_SENDZERO ;
|
|
|
75 |
|
|
|
76 |
# Status of struct t_opthdr
|
|
|
77 |
+CONST unsigned long T_SUCCESS, T_FAILURE, T_PARTSUCCESS ;
|
|
|
78 |
+CONST unsigned long T_READONLY, T_NOTSUPPORT ;
|
|
|
79 |
|
|
|
80 |
# Structures
|
|
|
81 |
|
|
|
82 |
+FIELD struct netbuf {
|
|
|
83 |
unsigned int maxlen ;
|
|
|
84 |
unsigned int len ;
|
|
|
85 |
char *buf ;
|
|
|
86 |
} ;
|
|
|
87 |
|
|
|
88 |
+FIELD struct t_call {
|
|
|
89 |
struct netbuf addr ;
|
|
|
90 |
struct netbuf opt ;
|
|
|
91 |
struct netbuf udata ;
|
|
|
92 |
int sequence ;
|
|
|
93 |
} ;
|
|
|
94 |
|
|
|
95 |
+FIELD struct t_bind | t_bind_struct {
|
|
|
96 |
struct netbuf addr ;
|
|
|
97 |
unsigned int qlen ;
|
|
|
98 |
} ;
|
|
|
99 |
|
|
|
100 |
+FIELD struct t_info {
|
|
|
101 |
long addr ;
|
|
|
102 |
long options ;
|
|
|
103 |
long tsdu ;
|
|
|
104 |
long etsdu ;
|
|
|
105 |
long connect ;
|
|
|
106 |
long discon ;
|
|
|
107 |
long servtype ;
|
|
|
108 |
long flags ;
|
|
|
109 |
} ;
|
|
|
110 |
|
|
|
111 |
+FIELD struct t_optmgmt | t_optmgmt_struct {
|
|
|
112 |
struct netbuf opt ;
|
|
|
113 |
long flags ;
|
|
|
114 |
} ;
|
|
|
115 |
|
|
|
116 |
+FIELD struct t_opthdr {
|
|
|
117 |
unsigned long len ;
|
|
|
118 |
unsigned long level ;
|
|
|
119 |
unsigned long name ;
|
|
|
120 |
unsigned long status ;
|
|
|
121 |
} ;
|
|
|
122 |
|
|
|
123 |
+MACRO struct t_opthdr * OPT_NEXTHDR ( char *, long, struct t_opthdr * ) ;
|
|
|
124 |
|
|
|
125 |
+FIELD struct t_discon {
|
|
|
126 |
struct netbuf udata ;
|
|
|
127 |
int reason ;
|
|
|
128 |
int sequence ;
|
|
|
129 |
} ;
|
|
|
130 |
|
|
|
131 |
+FIELD struct t_unitdata {
|
|
|
132 |
struct netbuf addr ;
|
|
|
133 |
struct netbuf opt ;
|
|
|
134 |
struct netbuf udata ;
|
|
|
135 |
} ;
|
|
|
136 |
|
|
|
137 |
+FIELD struct t_uderr {
|
|
|
138 |
struct netbuf addr ;
|
|
|
139 |
struct netbuf opt ;
|
|
|
140 |
long error ;
|
|
|
141 |
} ;
|
|
|
142 |
|
|
|
143 |
+FIELD struct t_linger := {
|
|
|
144 |
long l_onoff ;
|
|
|
145 |
long l_linger ;
|
|
|
146 |
} ;
|
|
|
147 |
|
|
|
148 |
# Error handling
|
|
|
149 |
+EXP (extern) int t_errno ;
|
|
|
150 |
|
|
|
151 |
# Functions
|
|
|
152 |
|
|
|
153 |
+FUNC int t_bind ( int, struct t_bind *, struct t_bind * ) ;
|
|
|
154 |
+FUNC int t_close ( int ) ;
|
|
|
155 |
+FUNC int t_look ( int ) ;
|
|
|
156 |
+FUNC int t_open ( char *, int, struct t_info * ) ;
|
|
|
157 |
+FUNC int t_sync ( int ) ;
|
|
|
158 |
+FUNC int t_unbind ( int ) ;
|
|
|
159 |
|
|
|
160 |
+FUNC int t_accept ( int, int, struct t_call * ) ;
|
|
|
161 |
+FUNC int t_connect ( int, struct t_call *, struct t_call * ) ;
|
|
|
162 |
+FUNC int t_listen ( int, struct t_call * ) ;
|
|
|
163 |
+FUNC int t_rcv ( int, char *, unsigned, int * ) ;
|
|
|
164 |
+FUNC int t_rcvconnect ( int, struct t_call * ) ;
|
|
|
165 |
+FUNC int t_rcvdis ( int, struct t_discon * ) ;
|
|
|
166 |
+FUNC int t_snd ( int, char *, unsigned, int ) ;
|
|
|
167 |
+FUNC int t_snddis ( int, struct t_call * ) ;
|
|
|
168 |
|
|
|
169 |
+FUNC int t_rcvrel ( int ) ;
|
|
|
170 |
+FUNC int t_sndrel ( int ) ;
|
|
|
171 |
|
|
|
172 |
+FUNC int t_rcvudata ( int, struct t_unitdata *, int * ) ;
|
|
|
173 |
+FUNC int t_rcvuderr ( int, struct t_uderr * ) ;
|
|
|
174 |
+FUNC int t_sndudata ( int, struct t_unitdata * ) ;
|
|
|
175 |
|
|
|
176 |
+FUNC int t_error ( char * ) ;
|
|
|
177 |
+FUNC char * t_strerror ( int ) ;
|
|
|
178 |
+FUNC int t_getinfo ( int, struct t_info * ) ;
|
|
|
179 |
+FUNC int t_getprotaddr( int, struct t_bind *, struct t_bind * ) ;
|
|
|
180 |
+FUNC int t_getstate ( int ) ;
|
|
|
181 |
+FUNC int t_optmgmt ( int, struct t_optmgmt *, struct t_optmgmt * ) ;
|
|
|
182 |
+FUNC char *t_alloc ( int, int, int ) ;
|
|
|
183 |
+FUNC int t_free ( char *, int ) ;
|
|
|
184 |
|
|
|
185 |
# Appendix A
|
|
|
186 |
|
|
|
187 |
+FIELD struct rate {
|
|
|
188 |
long targetvalue ;
|
|
|
189 |
long minacceptvalue ;
|
|
|
190 |
} ;
|
|
|
191 |
|
|
|
192 |
+FIELD struct reqvalue {
|
|
|
193 |
struct rate called ;
|
|
|
194 |
struct rate calling ;
|
|
|
195 |
} ;
|
|
|
196 |
|
|
|
197 |
+FIELD struct thrpt {
|
|
|
198 |
struct reqvalue maxthrpt ;
|
|
|
199 |
struct reqvalue avgthrpt ;
|
|
|
200 |
} ;
|
|
|
201 |
|
|
|
202 |
+FIELD struct transdel {
|
|
|
203 |
struct reqvalue maxdel ;
|
|
|
204 |
struct reqvalue avgdel ;
|
|
|
205 |
} ;
|
|
|
206 |
|
|
|
207 |
# Protocol level
|
|
|
208 |
+CONST int ISO_TP ;
|
|
|
209 |
|
|
|
210 |
# Connection-mode quality of service options
|
|
|
211 |
+CONST int TCO_THROUGHPUT, TCO_TRANSDEL, TCO_RESERRORRATE ;
|
|
|
212 |
+CONST int TCO_TRANSFFAILPROB, TCO_ESTFAILPROB, TCO_RELFAILPROB ;
|
|
|
213 |
+CONST int TCO_ESTDELAY, TCO_RELDELAY, TCO_CONNRESIL ;
|
|
|
214 |
+CONST int TCO_PROTECTION, TCO_PRIORITY, TCO_EXPD ;
|
|
|
215 |
|
|
|
216 |
# Connection-mode management options
|
|
|
217 |
+CONST int TCO_LTPDU, TCO_ACKTIME, TCO_REASTIME, TCO_PREFCLASS ;
|
|
|
218 |
+CONST int TCO_ALTCLASS1, TCO_ALTCLASS2, TCO_ALTCLASS3, TCO_ALTCLASS4 ;
|
|
|
219 |
+CONST int TCO_EXTFORM, TCO_FLOWCTRL, TCO_CHECKSUM, TCO_NETEXP, TCO_NETRECPTCF ;
|
|
|
220 |
|
|
|
221 |
# Various extra codes
|
|
|
222 |
+CONST int T_CLASS0, T_CLASS1, T_CLASS2, T_CLASS3, T_CLASS4 ;
|
|
|
223 |
+CONST int T_PRIDFLT, T_PRILOW, T_PRIMID, T_PRIHIGH, T_PRITOP ;
|
|
|
224 |
+CONST int T_NOPROTECT, T_PASSIVEPROTECT, T_ACTIVEPROTECT ;
|
|
|
225 |
+CONST int T_ABSREQ ;
|
|
|
226 |
|
|
|
227 |
# Connectionless-mode quality of service options
|
|
|
228 |
+CONST int TCL_TRANSDEL, TCL_RESERRORRATE, TCL_PROTECTION, TCL_PRIORITY ;
|
|
|
229 |
|
|
|
230 |
# Connectionless-mode management options
|
|
|
231 |
+CONST int TCL_CHECKSUM ;
|
|
|
232 |
|
|
|
233 |
# Appendix B
|
|
|
234 |
|
|
|
235 |
# Protocol levels
|
|
|
236 |
+CONST int INET_TCP, INET_UDP, INET_IP ;
|
|
|
237 |
|
|
|
238 |
# TCP options
|
|
|
239 |
+CONST int TCP_KEEPALIVE, TCP_MAXSEG, TCP_NODELAY ;
|
|
|
240 |
|
|
|
241 |
+FIELD struct t_kpalive := {
|
|
|
242 |
long kp_onoff ;
|
|
|
243 |
long kp_timeout ;
|
|
|
244 |
} ;
|
|
|
245 |
|
|
|
246 |
# kp_onoff of struct t_kpalive
|
|
|
247 |
+CONST int T_GARBAGE ;
|
|
|
248 |
|
|
|
249 |
# UDP options
|
|
|
250 |
+CONST int UDP_CHECKSUM ;
|
|
|
251 |
|
|
|
252 |
# IP options
|
|
|
253 |
+CONST int IP_BROADCAST, IP_DONTROUTE, IP_OPTIONS ;
|
|
|
254 |
+CONST int IP_REUSEADDR, IP_TOS, IP_TTL ;
|
|
|
255 |
|
|
|
256 |
# IP_TOS precedence
|
|
|
257 |
+CONST int T_ROUTINE, T_PRIORITY, T_IMMEDIATE, T_FLASH, T_OVERRIDEFLASH ;
|
|
|
258 |
+CONST int T_CRITIC_ECP, T_INETCONTROL, T_NETCONTROL ;
|
|
|
259 |
|
|
|
260 |
# IP_TOS service
|
|
|
261 |
+CONST int T_NOTOS, T_LDELAY, T_HITHRPT, T_HIREL ;
|
|
|
262 |
|
|
|
263 |
# Appendix D - NetBIOS
|
|
|
264 |
|
|
|
265 |
+DEFINE NB_UNIQUE 0 ;
|
|
|
266 |
+DEFINE NB_GROUP 1 ;
|
|
|
267 |
+DEFINE NB_NAMELEN 16 ;
|
|
|
268 |
+DEFINE NB_BCAST_NAME %% "* " %% ;
|
|
|
269 |
|
|
|
270 |
+DEFINE NB_ABORT %% 0x18 %% ;
|
|
|
271 |
+DEFINE NB_CLOSED %% 0x0A %% ;
|
|
|
272 |
+DEFINE NB_NOANSWER %% 0x14 %% ;
|
|
|
273 |
+DEFINE NB_OPREJ %% 0x12 %% ;
|
|
|
274 |
|
|
|
275 |
# Appendix I - SNA
|
|
|
276 |
|
|
|
277 |
# SNA transport provider option not specified
|