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