Home | History | Annotate | Download | only in tcpdump
      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
     25 typedef u_int8_t byte[1];		/* single byte field */
     26 #else
     27 /*
     28  * the keyword 'byte' generates conflicts in Windows
     29  */
     30 typedef unsigned char Byte[1];		/* single byte field */
     31 #define byte Byte
     32 #endif /* WIN32 */
     33 typedef u_int8_t word[2];		/* 2 byte field */
     34 typedef u_int8_t longword[4];		/* 4 bytes field */
     35 
     36 /*
     37  * Definitions for DECNET Phase IV protocol headers
     38  */
     39 union 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 
     47 typedef 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 */
     56 struct 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  */
     64 struct 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 
     72 struct 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 
     87 union 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  */
    153 struct 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 
    165 struct 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 
    178 struct 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 
    185 struct 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 
    192 struct 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 
    199 struct 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 
    206 struct 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 
    221 struct 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 
    238 union 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 
    253 /*
    255  * NSP protocol fields and values.
    256  */
    257 
    258 #define NSP_TYPEMASK 014		/* mask to isolate type code */
    259 #define NSP_SUBMASK 0160		/* mask to isolate subtype code */
    260 #define NSP_SUBSHFT 4			/* shift to move subtype code */
    261 
    262 #define MFT_DATA 0			/* data message */
    263 #define MFT_ACK  04			/* acknowledgement message */
    264 #define MFT_CTL  010			/* control message */
    265 
    266 #define MFS_ILS  020			/* data or I/LS indicator */
    267 #define MFS_BOM  040			/* beginning of message (data) */
    268 #define MFS_MOM  0			/* middle of message (data) */
    269 #define MFS_EOM  0100			/* end of message (data) */
    270 #define MFS_INT  040			/* interrupt message */
    271 
    272 #define MFS_DACK 0			/* data acknowledgement */
    273 #define MFS_IACK 020			/* I/LS acknowledgement */
    274 #define MFS_CACK 040			/* connect acknowledgement */
    275 
    276 #define MFS_NOP  0			/* no operation */
    277 #define MFS_CI   020			/* connect initiate */
    278 #define MFS_CC   040			/* connect confirm */
    279 #define MFS_DI   060			/* disconnect initiate */
    280 #define MFS_DC   0100			/* disconnect confirm */
    281 #define MFS_RCI  0140			/* retransmitted connect initiate */
    282 
    283 #define SGQ_ACK  0100000		/* ack */
    284 #define SGQ_NAK  0110000		/* negative ack */
    285 #define SGQ_OACK 0120000		/* other channel ack */
    286 #define SGQ_ONAK 0130000		/* other channel negative ack */
    287 #define SGQ_MASK 07777			/* mask to isolate seq # */
    288 #define SGQ_OTHER 020000		/* other channel qualifier */
    289 #define SGQ_DELAY 010000		/* ack delay flag */
    290 
    291 #define SGQ_EOM  0100000		/* pseudo flag for end-of-message */
    292 
    293 #define LSM_MASK 03			/* mask for modifier field */
    294 #define LSM_NOCHANGE 0			/* no change */
    295 #define LSM_DONOTSEND 1			/* do not send data */
    296 #define LSM_SEND 2			/* send data */
    297 
    298 #define LSI_MASK 014			/* mask for interpretation field */
    299 #define LSI_DATA 0			/* data segment or message count */
    300 #define LSI_INTR 4			/* interrupt request count */
    301 #define LSI_INTM 0377			/* funny marker for int. message */
    302 
    303 #define COS_MASK 014			/* mask for flow control field */
    304 #define COS_NONE 0			/* no flow control */
    305 #define COS_SEGMENT 04			/* segment flow control */
    306 #define COS_MESSAGE 010			/* message flow control */
    307 #define COS_CRYPTSER 020		/* cryptographic services requested */
    308 #define COS_DEFAULT 1			/* default value for field */
    309 
    310 #define COI_MASK 3			/* mask for version field */
    311 #define COI_32 0			/* version 3.2 */
    312 #define COI_31 1			/* version 3.1 */
    313 #define COI_40 2			/* version 4.0 */
    314 #define COI_41 3			/* version 4.1 */
    315 
    316 #define MNU_MASK 140			/* mask for session control version */
    317 #define MNU_10 000				/* session V1.0 */
    318 #define MNU_20 040				/* session V2.0 */
    319 #define MNU_ACCESS 1			/* access control present */
    320 #define MNU_USRDATA 2			/* user data field present */
    321 #define MNU_INVKPROXY 4			/* invoke proxy field present */
    322 #define MNU_UICPROXY 8			/* use uic-based proxy */
    323 
    324 #define DC_NORESOURCES 1		/* no resource reason code */
    325 #define DC_NOLINK 41			/* no link terminate reason code */
    326 #define DC_COMPLETE 42			/* disconnect complete reason code */
    327 
    328 #define DI_NOERROR 0			/* user disconnect */
    329 #define DI_SHUT 3			/* node is shutting down */
    330 #define DI_NOUSER 4			/* destination end user does not exist */
    331 #define DI_INVDEST 5			/* invalid end user destination */
    332 #define DI_REMRESRC 6			/* insufficient remote resources */
    333 #define DI_TPA 8			/* third party abort */
    334 #define DI_PROTOCOL 7			/* protocol error discovered */
    335 #define DI_ABORT 9			/* user abort */
    336 #define DI_LOCALRESRC 32		/* insufficient local resources */
    337 #define DI_REMUSERRESRC 33		/* insufficient remote user resources */
    338 #define DI_BADACCESS 34			/* bad access control information */
    339 #define DI_BADACCNT 36			/* bad ACCOUNT information */
    340 #define DI_CONNECTABORT 38		/* connect request cancelled */
    341 #define DI_TIMEDOUT 38			/* remote node or user crashed */
    342 #define DI_UNREACHABLE 39		/* local timers expired due to ... */
    343 #define DI_BADIMAGE 43			/* bad image data in connect */
    344 #define DI_SERVMISMATCH 54		/* cryptographic service mismatch */
    345 
    346 #define UC_OBJREJECT 0			/* object rejected connect */
    347 #define UC_USERDISCONNECT 0		/* user disconnect */
    348 #define UC_RESOURCES 1			/* insufficient resources (local or remote) */
    349 #define UC_NOSUCHNODE 2			/* unrecognized node name */
    350 #define UC_REMOTESHUT 3			/* remote node shutting down */
    351 #define UC_NOSUCHOBJ 4			/* unrecognized object */
    352 #define UC_INVOBJFORMAT 5		/* invalid object name format */
    353 #define UC_OBJTOOBUSY 6			/* object too busy */
    354 #define UC_NETWORKABORT 8		/* network abort */
    355 #define UC_USERABORT 9			/* user abort */
    356 #define UC_INVNODEFORMAT 10		/* invalid node name format */
    357 #define UC_LOCALSHUT 11			/* local node shutting down */
    358 #define UC_ACCESSREJECT 34		/* invalid access control information */
    359 #define UC_NORESPONSE 38		/* no response from object */
    360 #define UC_UNREACHABLE 39		/* node unreachable */
    361 
    362 /*
    363  * NSP message formats.
    364  */
    365 struct nsphdr				/* general nsp header */
    366   {
    367     byte	nh_flags;		/* message flags */
    368     word	nh_dst;			/* destination link address */
    369     word	nh_src;			/* source link address */
    370   };
    371 
    372 struct seghdr				/* data segment header */
    373   {
    374     byte	sh_flags;		/* message flags */
    375     word	sh_dst;			/* destination link address */
    376     word	sh_src;			/* source link address */
    377     word	sh_seq[3];		/* sequence numbers */
    378   };
    379 
    380 struct minseghdr			/* minimum data segment header */
    381   {
    382     byte	ms_flags;		/* message flags */
    383     word	ms_dst;			/* destination link address */
    384     word	ms_src;			/* source link address */
    385     word	ms_seq;			/* sequence number */
    386   };
    387 
    388 struct lsmsg				/* link service message (after hdr) */
    389   {
    390     byte	ls_lsflags;		/* link service flags */
    391     byte	ls_fcval;		/* flow control value */
    392   };
    393 
    394 struct ackmsg				/* acknowledgement message */
    395   {
    396     byte	ak_flags;		/* message flags */
    397     word	ak_dst;			/* destination link address */
    398     word	ak_src;			/* source link address */
    399     word	ak_acknum[2];		/* acknowledgement numbers */
    400   };
    401 
    402 struct minackmsg			/* minimum acknowledgement message */
    403   {
    404     byte	mk_flags;		/* message flags */
    405     word	mk_dst;			/* destination link address */
    406     word	mk_src;			/* source link address */
    407     word	mk_acknum;		/* acknowledgement number */
    408   };
    409 
    410 struct ciackmsg				/* connect acknowledgement message */
    411   {
    412     byte	ck_flags;		/* message flags */
    413     word	ck_dst;			/* destination link address */
    414   };
    415 
    416 struct cimsg				/* connect initiate message */
    417   {
    418     byte	ci_flags;		/* message flags */
    419     word	ci_dst;			/* destination link address (0) */
    420     word	ci_src;			/* source link address */
    421     byte	ci_services;		/* requested services */
    422     byte	ci_info;		/* information */
    423     word	ci_segsize;		/* maximum segment size */
    424   };
    425 
    426 struct ccmsg				/* connect confirm message */
    427   {
    428     byte	cc_flags;		/* message flags */
    429     word	cc_dst;			/* destination link address */
    430     word	cc_src;			/* source link address */
    431     byte	cc_services;		/* requested services */
    432     byte	cc_info;		/* information */
    433     word	cc_segsize;		/* maximum segment size */
    434     byte	cc_optlen;		/* optional data length */
    435   };
    436 
    437 struct cnmsg				/* generic connect message */
    438   {
    439     byte	cn_flags;		/* message flags */
    440     word	cn_dst;			/* destination link address */
    441     word	cn_src;			/* source link address */
    442     byte	cn_services;		/* requested services */
    443     byte	cn_info;		/* information */
    444     word	cn_segsize;		/* maximum segment size */
    445   };
    446 
    447 struct dimsg				/* disconnect initiate message */
    448   {
    449     byte	di_flags;		/* message flags */
    450     word	di_dst;			/* destination link address */
    451     word	di_src;			/* source link address */
    452     word	di_reason;		/* reason code */
    453     byte	di_optlen;		/* optional data length */
    454   };
    455 
    456 struct dcmsg				/* disconnect confirm message */
    457   {
    458     byte	dc_flags;		/* message flags */
    459     word	dc_dst;			/* destination link address */
    460     word	dc_src;			/* source link address */
    461     word	dc_reason;		/* reason code */
    462   };
    463