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