]> git.saurik.com Git - apple/network_cmds.git/blob - tcpdump.tproj/decnet.h
37a6127e1edbf8247e406f86ad2c1e2ca6370b43
[apple/network_cmds.git] / tcpdump.tproj / decnet.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
12 * this file.
13 *
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
20 * under the License."
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24 /*
25 * Copyright (c) 1992, 1994, 1996
26 * The Regents of the University of California. All rights reserved.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that: (1) source code distributions
30 * retain the above copyright notice and this paragraph in its entirety, (2)
31 * distributions including binary code include the above copyright notice and
32 * this paragraph in its entirety in the documentation or other materials
33 * provided with the distribution, and (3) all advertising materials mentioning
34 * features or use of this software display the following acknowledgement:
35 * ``This product includes software developed by the University of California,
36 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
37 * the University nor the names of its contributors may be used to endorse
38 * or promote products derived from this software without specific prior
39 * written permission.
40 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
41 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
42 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
43 *
44 * @(#) $Header: /cvs/Darwin/Commands/NeXT/network_cmds/tcpdump.tproj/decnet.h,v 1.1.1.1 1999/05/02 03:58:31 wsanchez Exp $ (LBL)
45 */
46
47 typedef unsigned char byte[1]; /* single byte field */
48 typedef unsigned char word[2]; /* 2 byte field */
49 typedef unsigned char longword[4]; /* 4 bytes field */
50
51 /*
52 * Definitions for DECNET Phase IV protocol headers
53 */
54 union etheraddress {
55 unsigned char dne_addr[6]; /* full ethernet address */
56 struct {
57 unsigned char dne_hiord[4]; /* DECnet HIORD prefix */
58 unsigned char dne_nodeaddr[2]; /* DECnet node address */
59 } dne_remote;
60 };
61
62 typedef union etheraddress etheraddr; /* Ethernet address */
63
64 #define HIORD 0x000400aa /* high 32-bits of address (swapped) */
65
66 #define AREAMASK 0176000 /* mask for area field */
67 #define AREASHIFT 10 /* bit-offset for area field */
68 #define NODEMASK 01777 /* mask for node address field */
69
70 #define DN_MAXADDL 20 /* max size of DECnet address */
71 struct dn_naddr {
72 unsigned short a_len; /* length of address */
73 unsigned char a_addr[DN_MAXADDL]; /* address as bytes */
74 };
75
76 /*
77 * Define long and short header formats.
78 */
79 struct shorthdr
80 {
81 byte sh_flags; /* route flags */
82 word sh_dst; /* destination node address */
83 word sh_src; /* source node address */
84 byte sh_visits; /* visit count */
85 };
86
87 struct longhdr
88 {
89 byte lg_flags; /* route flags */
90 byte lg_darea; /* destination area (reserved) */
91 byte lg_dsarea; /* destination subarea (reserved) */
92 etheraddr lg_dst; /* destination id */
93 byte lg_sarea; /* source area (reserved) */
94 byte lg_ssarea; /* source subarea (reserved) */
95 etheraddr lg_src; /* source id */
96 byte lg_nextl2; /* next level 2 router (reserved) */
97 byte lg_visits; /* visit count */
98 byte lg_service; /* service class (reserved) */
99 byte lg_pt; /* protocol type (reserved) */
100 };
101
102 union routehdr
103 {
104 struct shorthdr rh_short; /* short route header */
105 struct longhdr rh_long; /* long route header */
106 };
107
108 /*
109 * Define the values of various fields in the protocol messages.
110 *
111 * 1. Data packet formats.
112 */
113 #define RMF_MASK 7 /* mask for message type */
114 #define RMF_SHORT 2 /* short message format */
115 #define RMF_LONG 6 /* long message format */
116 #ifndef RMF_RQR
117 #define RMF_RQR 010 /* request return to sender */
118 #define RMF_RTS 020 /* returning to sender */
119 #define RMF_IE 040 /* intra-ethernet packet */
120 #endif /* RMR_RQR */
121 #define RMF_FVER 0100 /* future version flag */
122 #define RMF_PAD 0200 /* pad field */
123 #define RMF_PADMASK 0177 /* pad field mask */
124
125 #define VIS_MASK 077 /* visit field mask */
126
127 /*
128 * 2. Control packet formats.
129 */
130 #define RMF_CTLMASK 017 /* mask for message type */
131 #define RMF_CTLMSG 01 /* control message indicator */
132 #define RMF_INIT 01 /* initialization message */
133 #define RMF_VER 03 /* verification message */
134 #define RMF_TEST 05 /* hello and test message */
135 #define RMF_L1ROUT 07 /* level 1 routing message */
136 #define RMF_L2ROUT 011 /* level 2 routing message */
137 #define RMF_RHELLO 013 /* router hello message */
138 #define RMF_EHELLO 015 /* endnode hello message */
139
140 #define TI_L2ROUT 01 /* level 2 router */
141 #define TI_L1ROUT 02 /* level 1 router */
142 #define TI_ENDNODE 03 /* endnode */
143 #define TI_VERIF 04 /* verification required */
144 #define TI_BLOCK 010 /* blocking requested */
145
146 #define VE_VERS 2 /* version number (2) */
147 #define VE_ECO 0 /* ECO number */
148 #define VE_UECO 0 /* user ECO number (0) */
149
150 #define P3_VERS 1 /* phase III version number (1) */
151 #define P3_ECO 3 /* ECO number (3) */
152 #define P3_UECO 0 /* user ECO number (0) */
153
154 #define II_L2ROUT 01 /* level 2 router */
155 #define II_L1ROUT 02 /* level 1 router */
156 #define II_ENDNODE 03 /* endnode */
157 #define II_VERIF 04 /* verification required */
158 #define II_NOMCAST 040 /* no multicast traffic accepted */
159 #define II_BLOCK 0100 /* blocking requested */
160 #define II_TYPEMASK 03 /* mask for node type */
161
162 #define TESTDATA 0252 /* test data bytes */
163 #define TESTLEN 1 /* length of transmitted test data */
164
165 /*
166 * Define control message formats.
167 */
168 struct initmsgIII /* phase III initialization message */
169 {
170 byte inIII_flags; /* route flags */
171 word inIII_src; /* source node address */
172 byte inIII_info; /* routing layer information */
173 word inIII_blksize; /* maximum data link block size */
174 byte inIII_vers; /* version number */
175 byte inIII_eco; /* ECO number */
176 byte inIII_ueco; /* user ECO number */
177 byte inIII_rsvd; /* reserved image field */
178 };
179
180 struct initmsg /* initialization message */
181 {
182 byte in_flags; /* route flags */
183 word in_src; /* source node address */
184 byte in_info; /* routing layer information */
185 word in_blksize; /* maximum data link block size */
186 byte in_vers; /* version number */
187 byte in_eco; /* ECO number */
188 byte in_ueco; /* user ECO number */
189 word in_hello; /* hello timer */
190 byte in_rsvd; /* reserved image field */
191 };
192
193 struct verifmsg /* verification message */
194 {
195 byte ve_flags; /* route flags */
196 word ve_src; /* source node address */
197 byte ve_fcnval; /* function value image field */
198 };
199
200 struct testmsg /* hello and test message */
201 {
202 byte te_flags; /* route flags */
203 word te_src; /* source node address */
204 byte te_data; /* test data image field */
205 };
206
207 struct l1rout /* level 1 routing message */
208 {
209 byte r1_flags; /* route flags */
210 word r1_src; /* source node address */
211 byte r1_rsvd; /* reserved field */
212 };
213
214 struct l2rout /* level 2 routing message */
215 {
216 byte r2_flags; /* route flags */
217 word r2_src; /* source node address */
218 byte r2_rsvd; /* reserved field */
219 };
220
221 struct rhellomsg /* router hello message */
222 {
223 byte rh_flags; /* route flags */
224 byte rh_vers; /* version number */
225 byte rh_eco; /* ECO number */
226 byte rh_ueco; /* user ECO number */
227 etheraddr rh_src; /* source id */
228 byte rh_info; /* routing layer information */
229 word rh_blksize; /* maximum data link block size */
230 byte rh_priority; /* router's priority */
231 byte rh_area; /* reserved */
232 word rh_hello; /* hello timer */
233 byte rh_mpd; /* reserved */
234 };
235
236 struct ehellomsg /* endnode hello message */
237 {
238 byte eh_flags; /* route flags */
239 byte eh_vers; /* version number */
240 byte eh_eco; /* ECO number */
241 byte eh_ueco; /* user ECO number */
242 etheraddr eh_src; /* source id */
243 byte eh_info; /* routing layer information */
244 word eh_blksize; /* maximum data link block size */
245 byte eh_area; /* area (reserved) */
246 byte eh_seed[8]; /* verification seed */
247 etheraddr eh_router; /* designated router */
248 word eh_hello; /* hello timer */
249 byte eh_mpd; /* (reserved) */
250 byte eh_data; /* test data image field */
251 };
252
253 union controlmsg
254 {
255 struct initmsg cm_init; /* initialization message */
256 struct verifmsg cm_ver; /* verification message */
257 struct testmsg cm_test; /* hello and test message */
258 struct l1rout cm_l1rou; /* level 1 routing message */
259 struct l2rout cm_l2rout; /* level 2 routing message */
260 struct rhellomsg cm_rhello; /* router hello message */
261 struct ehellomsg cm_ehello; /* endnode hello message */
262 };
263
264 /* Macros for decoding routing-info fields */
265 #define RI_COST(x) ((x)&0777)
266 #define RI_HOPS(x) (((x)>>10)&037)
267 \f
268 /*
269 * NSP protocol fields and values.
270 */
271
272 #define NSP_TYPEMASK 014 /* mask to isolate type code */
273 #define NSP_SUBMASK 0160 /* mask to isolate subtype code */
274 #define NSP_SUBSHFT 4 /* shift to move subtype code */
275
276 #define MFT_DATA 0 /* data message */
277 #define MFT_ACK 04 /* acknowledgement message */
278 #define MFT_CTL 010 /* control message */
279
280 #define MFS_ILS 020 /* data or I/LS indicator */
281 #define MFS_BOM 040 /* beginning of message (data) */
282 #define MFS_MOM 0 /* middle of message (data) */
283 #define MFS_EOM 0100 /* end of message (data) */
284 #define MFS_INT 040 /* interrupt message */
285
286 #define MFS_DACK 0 /* data acknowledgement */
287 #define MFS_IACK 020 /* I/LS acknowledgement */
288 #define MFS_CACK 040 /* connect acknowledgement */
289
290 #define MFS_NOP 0 /* no operation */
291 #define MFS_CI 020 /* connect initiate */
292 #define MFS_CC 040 /* connect confirm */
293 #define MFS_DI 060 /* disconnect initiate */
294 #define MFS_DC 0100 /* disconnect confirm */
295 #define MFS_RCI 0140 /* retransmitted connect initiate */
296
297 #define SGQ_ACK 0100000 /* ack */
298 #define SGQ_NAK 0110000 /* negative ack */
299 #define SGQ_OACK 0120000 /* other channel ack */
300 #define SGQ_ONAK 0130000 /* other channel negative ack */
301 #define SGQ_MASK 07777 /* mask to isolate seq # */
302 #define SGQ_OTHER 020000 /* other channel qualifier */
303 #define SGQ_DELAY 010000 /* ack delay flag */
304
305 #define SGQ_EOM 0100000 /* pseudo flag for end-of-message */
306
307 #define LSM_MASK 03 /* mask for modifier field */
308 #define LSM_NOCHANGE 0 /* no change */
309 #define LSM_DONOTSEND 1 /* do not send data */
310 #define LSM_SEND 2 /* send data */
311
312 #define LSI_MASK 014 /* mask for interpretation field */
313 #define LSI_DATA 0 /* data segment or message count */
314 #define LSI_INTR 4 /* interrupt request count */
315 #define LSI_INTM 0377 /* funny marker for int. message */
316
317 #define COS_MASK 014 /* mask for flow control field */
318 #define COS_NONE 0 /* no flow control */
319 #define COS_SEGMENT 04 /* segment flow control */
320 #define COS_MESSAGE 010 /* message flow control */
321 #define COS_CRYPTSER 020 /* cryptographic services requested */
322 #define COS_DEFAULT 1 /* default value for field */
323
324 #define COI_MASK 3 /* mask for version field */
325 #define COI_32 0 /* version 3.2 */
326 #define COI_31 1 /* version 3.1 */
327 #define COI_40 2 /* version 4.0 */
328 #define COI_41 3 /* version 4.1 */
329
330 #define MNU_MASK 140 /* mask for session control version */
331 #define MNU_10 000 /* session V1.0 */
332 #define MNU_20 040 /* session V2.0 */
333 #define MNU_ACCESS 1 /* access control present */
334 #define MNU_USRDATA 2 /* user data field present */
335 #define MNU_INVKPROXY 4 /* invoke proxy field present */
336 #define MNU_UICPROXY 8 /* use uic-based proxy */
337
338 #define DC_NORESOURCES 1 /* no resource reason code */
339 #define DC_NOLINK 41 /* no link terminate reason code */
340 #define DC_COMPLETE 42 /* disconnect complete reason code */
341
342 #define DI_NOERROR 0 /* user disconnect */
343 #define DI_SHUT 3 /* node is shutting down */
344 #define DI_NOUSER 4 /* destination end user does not exist */
345 #define DI_INVDEST 5 /* invalid end user destination */
346 #define DI_REMRESRC 6 /* insufficient remote resources */
347 #define DI_TPA 8 /* third party abort */
348 #define DI_PROTOCOL 7 /* protocol error discovered */
349 #define DI_ABORT 9 /* user abort */
350 #define DI_LOCALRESRC 32 /* insufficient local resources */
351 #define DI_REMUSERRESRC 33 /* insufficient remote user resources */
352 #define DI_BADACCESS 34 /* bad access control information */
353 #define DI_BADACCNT 36 /* bad ACCOUNT information */
354 #define DI_CONNECTABORT 38 /* connect request cancelled */
355 #define DI_TIMEDOUT 38 /* remote node or user crashed */
356 #define DI_UNREACHABLE 39 /* local timers expired due to ... */
357 #define DI_BADIMAGE 43 /* bad image data in connect */
358 #define DI_SERVMISMATCH 54 /* cryptographic service mismatch */
359
360 #define UC_OBJREJECT 0 /* object rejected connect */
361 #define UC_USERDISCONNECT 0 /* user disconnect */
362 #define UC_RESOURCES 1 /* insufficient resources (local or remote) */
363 #define UC_NOSUCHNODE 2 /* unrecognized node name */
364 #define UC_REMOTESHUT 3 /* remote node shutting down */
365 #define UC_NOSUCHOBJ 4 /* unrecognized object */
366 #define UC_INVOBJFORMAT 5 /* invalid object name format */
367 #define UC_OBJTOOBUSY 6 /* object too busy */
368 #define UC_NETWORKABORT 8 /* network abort */
369 #define UC_USERABORT 9 /* user abort */
370 #define UC_INVNODEFORMAT 10 /* invalid node name format */
371 #define UC_LOCALSHUT 11 /* local node shutting down */
372 #define UC_ACCESSREJECT 34 /* invalid access control information */
373 #define UC_NORESPONSE 38 /* no response from object */
374 #define UC_UNREACHABLE 39 /* node unreachable */
375
376 /*
377 * NSP message formats.
378 */
379 struct nsphdr /* general nsp header */
380 {
381 byte nh_flags; /* message flags */
382 word nh_dst; /* destination link address */
383 word nh_src; /* source link address */
384 };
385
386 struct seghdr /* data segment header */
387 {
388 byte sh_flags; /* message flags */
389 word sh_dst; /* destination link address */
390 word sh_src; /* source link address */
391 word sh_seq[3]; /* sequence numbers */
392 };
393
394 struct minseghdr /* minimum data segment header */
395 {
396 byte ms_flags; /* message flags */
397 word ms_dst; /* destination link address */
398 word ms_src; /* source link address */
399 word ms_seq; /* sequence number */
400 };
401
402 struct lsmsg /* link service message (after hdr) */
403 {
404 byte ls_lsflags; /* link service flags */
405 byte ls_fcval; /* flow control value */
406 };
407
408 struct ackmsg /* acknowledgement message */
409 {
410 byte ak_flags; /* message flags */
411 word ak_dst; /* destination link address */
412 word ak_src; /* source link address */
413 word ak_acknum[2]; /* acknowledgement numbers */
414 };
415
416 struct minackmsg /* minimum acknowledgement message */
417 {
418 byte mk_flags; /* message flags */
419 word mk_dst; /* destination link address */
420 word mk_src; /* source link address */
421 word mk_acknum; /* acknowledgement number */
422 };
423
424 struct ciackmsg /* connect acknowledgement message */
425 {
426 byte ck_flags; /* message flags */
427 word ck_dst; /* destination link address */
428 };
429
430 struct cimsg /* connect initiate message */
431 {
432 byte ci_flags; /* message flags */
433 word ci_dst; /* destination link address (0) */
434 word ci_src; /* source link address */
435 byte ci_services; /* requested services */
436 byte ci_info; /* information */
437 word ci_segsize; /* maximum segment size */
438 };
439
440 struct ccmsg /* connect confirm message */
441 {
442 byte cc_flags; /* message flags */
443 word cc_dst; /* destination link address */
444 word cc_src; /* source link address */
445 byte cc_services; /* requested services */
446 byte cc_info; /* information */
447 word cc_segsize; /* maximum segment size */
448 byte cc_optlen; /* optional data length */
449 };
450
451 struct cnmsg /* generic connect message */
452 {
453 byte cn_flags; /* message flags */
454 word cn_dst; /* destination link address */
455 word cn_src; /* source link address */
456 byte cn_services; /* requested services */
457 byte cn_info; /* information */
458 word cn_segsize; /* maximum segment size */
459 };
460
461 struct dimsg /* disconnect initiate message */
462 {
463 byte di_flags; /* message flags */
464 word di_dst; /* destination link address */
465 word di_src; /* source link address */
466 word di_reason; /* reason code */
467 byte di_optlen; /* optional data length */
468 };
469
470 struct dcmsg /* disconnect confirm message */
471 {
472 byte dc_flags; /* message flags */
473 word dc_dst; /* destination link address */
474 word dc_src; /* source link address */
475 word dc_reason; /* reason code */
476 };