decnet.h revision 75115
117680Spst/* 217680Spst * Copyright (c) 1992, 1994, 1996 317680Spst * The Regents of the University of California. All rights reserved. 417680Spst * 517680Spst * Redistribution and use in source and binary forms, with or without 617680Spst * modification, are permitted provided that: (1) source code distributions 717680Spst * retain the above copyright notice and this paragraph in its entirety, (2) 817680Spst * distributions including binary code include the above copyright notice and 917680Spst * this paragraph in its entirety in the documentation or other materials 1017680Spst * provided with the distribution, and (3) all advertising materials mentioning 1117680Spst * features or use of this software display the following acknowledgement: 1217680Spst * ``This product includes software developed by the University of California, 1317680Spst * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 1417680Spst * the University nor the names of its contributors may be used to endorse 1517680Spst * or promote products derived from this software without specific prior 1617680Spst * written permission. 1717680Spst * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 1817680Spst * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 1917680Spst * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 2017680Spst * 2175115Sfenner * @(#) $Header: /tcpdump/master/tcpdump/decnet.h,v 1.7 2000/10/03 02:54:55 itojun Exp $ (LBL) 2217680Spst */ 2317680Spst 2475115Sfennertypedef u_int8_t byte[1]; /* single byte field */ 2575115Sfennertypedef u_int8_t word[2]; /* 2 byte field */ 2675115Sfennertypedef u_int8_t longword[4]; /* 4 bytes field */ 2717680Spst 2817680Spst/* 2917680Spst * Definitions for DECNET Phase IV protocol headers 3017680Spst */ 3117680Spstunion etheraddress { 3275115Sfenner u_int8_t dne_addr[6]; /* full ethernet address */ 3317680Spst struct { 3475115Sfenner u_int8_t dne_hiord[4]; /* DECnet HIORD prefix */ 3575115Sfenner u_int8_t dne_nodeaddr[2]; /* DECnet node address */ 3617680Spst } dne_remote; 3717680Spst}; 3817680Spst 3917680Spsttypedef union etheraddress etheraddr; /* Ethernet address */ 4017680Spst 4117680Spst#define HIORD 0x000400aa /* high 32-bits of address (swapped) */ 4217680Spst 4317680Spst#define AREAMASK 0176000 /* mask for area field */ 4417680Spst#define AREASHIFT 10 /* bit-offset for area field */ 4517680Spst#define NODEMASK 01777 /* mask for node address field */ 4617680Spst 4717680Spst#define DN_MAXADDL 20 /* max size of DECnet address */ 4817680Spststruct dn_naddr { 4975115Sfenner u_int16_t a_len; /* length of address */ 5075115Sfenner u_int8_t a_addr[DN_MAXADDL]; /* address as bytes */ 5117680Spst}; 5217680Spst 5317680Spst/* 5417680Spst * Define long and short header formats. 5517680Spst */ 5617680Spststruct shorthdr 5717680Spst { 5817680Spst byte sh_flags; /* route flags */ 5917680Spst word sh_dst; /* destination node address */ 6017680Spst word sh_src; /* source node address */ 6117680Spst byte sh_visits; /* visit count */ 6217680Spst }; 6317680Spst 6417680Spststruct longhdr 6517680Spst { 6617680Spst byte lg_flags; /* route flags */ 6717680Spst byte lg_darea; /* destination area (reserved) */ 6817680Spst byte lg_dsarea; /* destination subarea (reserved) */ 6917680Spst etheraddr lg_dst; /* destination id */ 7017680Spst byte lg_sarea; /* source area (reserved) */ 7117680Spst byte lg_ssarea; /* source subarea (reserved) */ 7217680Spst etheraddr lg_src; /* source id */ 7317680Spst byte lg_nextl2; /* next level 2 router (reserved) */ 7417680Spst byte lg_visits; /* visit count */ 7517680Spst byte lg_service; /* service class (reserved) */ 7617680Spst byte lg_pt; /* protocol type (reserved) */ 7717680Spst }; 7817680Spst 7917680Spstunion routehdr 8017680Spst { 8117680Spst struct shorthdr rh_short; /* short route header */ 8217680Spst struct longhdr rh_long; /* long route header */ 8317680Spst }; 8417680Spst 8517680Spst/* 8617680Spst * Define the values of various fields in the protocol messages. 8717680Spst * 8817680Spst * 1. Data packet formats. 8917680Spst */ 9017680Spst#define RMF_MASK 7 /* mask for message type */ 9117680Spst#define RMF_SHORT 2 /* short message format */ 9217680Spst#define RMF_LONG 6 /* long message format */ 9317680Spst#ifndef RMF_RQR 9417680Spst#define RMF_RQR 010 /* request return to sender */ 9517680Spst#define RMF_RTS 020 /* returning to sender */ 9617680Spst#define RMF_IE 040 /* intra-ethernet packet */ 9717680Spst#endif /* RMR_RQR */ 9817680Spst#define RMF_FVER 0100 /* future version flag */ 9917680Spst#define RMF_PAD 0200 /* pad field */ 10017680Spst#define RMF_PADMASK 0177 /* pad field mask */ 10117680Spst 10217680Spst#define VIS_MASK 077 /* visit field mask */ 10317680Spst 10417680Spst/* 10517680Spst * 2. Control packet formats. 10617680Spst */ 10717680Spst#define RMF_CTLMASK 017 /* mask for message type */ 10817680Spst#define RMF_CTLMSG 01 /* control message indicator */ 10917680Spst#define RMF_INIT 01 /* initialization message */ 11017680Spst#define RMF_VER 03 /* verification message */ 11117680Spst#define RMF_TEST 05 /* hello and test message */ 11217680Spst#define RMF_L1ROUT 07 /* level 1 routing message */ 11317680Spst#define RMF_L2ROUT 011 /* level 2 routing message */ 11417680Spst#define RMF_RHELLO 013 /* router hello message */ 11517680Spst#define RMF_EHELLO 015 /* endnode hello message */ 11617680Spst 11717680Spst#define TI_L2ROUT 01 /* level 2 router */ 11817680Spst#define TI_L1ROUT 02 /* level 1 router */ 11917680Spst#define TI_ENDNODE 03 /* endnode */ 12017680Spst#define TI_VERIF 04 /* verification required */ 12117680Spst#define TI_BLOCK 010 /* blocking requested */ 12217680Spst 12317680Spst#define VE_VERS 2 /* version number (2) */ 12417680Spst#define VE_ECO 0 /* ECO number */ 12517680Spst#define VE_UECO 0 /* user ECO number (0) */ 12617680Spst 12717680Spst#define P3_VERS 1 /* phase III version number (1) */ 12817680Spst#define P3_ECO 3 /* ECO number (3) */ 12917680Spst#define P3_UECO 0 /* user ECO number (0) */ 13017680Spst 13117680Spst#define II_L2ROUT 01 /* level 2 router */ 13217680Spst#define II_L1ROUT 02 /* level 1 router */ 13317680Spst#define II_ENDNODE 03 /* endnode */ 13417680Spst#define II_VERIF 04 /* verification required */ 13517680Spst#define II_NOMCAST 040 /* no multicast traffic accepted */ 13617680Spst#define II_BLOCK 0100 /* blocking requested */ 13717680Spst#define II_TYPEMASK 03 /* mask for node type */ 13817680Spst 13917680Spst#define TESTDATA 0252 /* test data bytes */ 14017680Spst#define TESTLEN 1 /* length of transmitted test data */ 14117680Spst 14217680Spst/* 14317680Spst * Define control message formats. 14417680Spst */ 14517680Spststruct initmsgIII /* phase III initialization message */ 14617680Spst { 14717680Spst byte inIII_flags; /* route flags */ 14817680Spst word inIII_src; /* source node address */ 14917680Spst byte inIII_info; /* routing layer information */ 15017680Spst word inIII_blksize; /* maximum data link block size */ 15117680Spst byte inIII_vers; /* version number */ 15217680Spst byte inIII_eco; /* ECO number */ 15317680Spst byte inIII_ueco; /* user ECO number */ 15417680Spst byte inIII_rsvd; /* reserved image field */ 15517680Spst }; 15617680Spst 15717680Spststruct initmsg /* initialization message */ 15817680Spst { 15917680Spst byte in_flags; /* route flags */ 16017680Spst word in_src; /* source node address */ 16117680Spst byte in_info; /* routing layer information */ 16217680Spst word in_blksize; /* maximum data link block size */ 16317680Spst byte in_vers; /* version number */ 16417680Spst byte in_eco; /* ECO number */ 16517680Spst byte in_ueco; /* user ECO number */ 16617680Spst word in_hello; /* hello timer */ 16717680Spst byte in_rsvd; /* reserved image field */ 16817680Spst }; 16917680Spst 17017680Spststruct verifmsg /* verification message */ 17117680Spst { 17217680Spst byte ve_flags; /* route flags */ 17317680Spst word ve_src; /* source node address */ 17417680Spst byte ve_fcnval; /* function value image field */ 17517680Spst }; 17617680Spst 17717680Spststruct testmsg /* hello and test message */ 17817680Spst { 17917680Spst byte te_flags; /* route flags */ 18017680Spst word te_src; /* source node address */ 18117680Spst byte te_data; /* test data image field */ 18217680Spst }; 18317680Spst 18417680Spststruct l1rout /* level 1 routing message */ 18517680Spst { 18617680Spst byte r1_flags; /* route flags */ 18717680Spst word r1_src; /* source node address */ 18817680Spst byte r1_rsvd; /* reserved field */ 18917680Spst }; 19017680Spst 19117680Spststruct l2rout /* level 2 routing message */ 19217680Spst { 19317680Spst byte r2_flags; /* route flags */ 19417680Spst word r2_src; /* source node address */ 19517680Spst byte r2_rsvd; /* reserved field */ 19617680Spst }; 19717680Spst 19817680Spststruct rhellomsg /* router hello message */ 19917680Spst { 20017680Spst byte rh_flags; /* route flags */ 20117680Spst byte rh_vers; /* version number */ 20217680Spst byte rh_eco; /* ECO number */ 20317680Spst byte rh_ueco; /* user ECO number */ 20417680Spst etheraddr rh_src; /* source id */ 20517680Spst byte rh_info; /* routing layer information */ 20617680Spst word rh_blksize; /* maximum data link block size */ 20717680Spst byte rh_priority; /* router's priority */ 20817680Spst byte rh_area; /* reserved */ 20917680Spst word rh_hello; /* hello timer */ 21017680Spst byte rh_mpd; /* reserved */ 21117680Spst }; 21217680Spst 21317680Spststruct ehellomsg /* endnode hello message */ 21417680Spst { 21517680Spst byte eh_flags; /* route flags */ 21617680Spst byte eh_vers; /* version number */ 21717680Spst byte eh_eco; /* ECO number */ 21817680Spst byte eh_ueco; /* user ECO number */ 21917680Spst etheraddr eh_src; /* source id */ 22017680Spst byte eh_info; /* routing layer information */ 22117680Spst word eh_blksize; /* maximum data link block size */ 22217680Spst byte eh_area; /* area (reserved) */ 22317680Spst byte eh_seed[8]; /* verification seed */ 22417680Spst etheraddr eh_router; /* designated router */ 22517680Spst word eh_hello; /* hello timer */ 22617680Spst byte eh_mpd; /* (reserved) */ 22717680Spst byte eh_data; /* test data image field */ 22817680Spst }; 22917680Spst 23017680Spstunion controlmsg 23117680Spst { 23217680Spst struct initmsg cm_init; /* initialization message */ 23317680Spst struct verifmsg cm_ver; /* verification message */ 23417680Spst struct testmsg cm_test; /* hello and test message */ 23517680Spst struct l1rout cm_l1rou; /* level 1 routing message */ 23617680Spst struct l2rout cm_l2rout; /* level 2 routing message */ 23717680Spst struct rhellomsg cm_rhello; /* router hello message */ 23817680Spst struct ehellomsg cm_ehello; /* endnode hello message */ 23917680Spst }; 24017680Spst 24117680Spst/* Macros for decoding routing-info fields */ 24217680Spst#define RI_COST(x) ((x)&0777) 24317680Spst#define RI_HOPS(x) (((x)>>10)&037) 24417680Spst 24517680Spst/* 24617680Spst * NSP protocol fields and values. 24717680Spst */ 24817680Spst 24917680Spst#define NSP_TYPEMASK 014 /* mask to isolate type code */ 25017680Spst#define NSP_SUBMASK 0160 /* mask to isolate subtype code */ 25117680Spst#define NSP_SUBSHFT 4 /* shift to move subtype code */ 25217680Spst 25317680Spst#define MFT_DATA 0 /* data message */ 25417680Spst#define MFT_ACK 04 /* acknowledgement message */ 25517680Spst#define MFT_CTL 010 /* control message */ 25617680Spst 25717680Spst#define MFS_ILS 020 /* data or I/LS indicator */ 25817680Spst#define MFS_BOM 040 /* beginning of message (data) */ 25917680Spst#define MFS_MOM 0 /* middle of message (data) */ 26017680Spst#define MFS_EOM 0100 /* end of message (data) */ 26117680Spst#define MFS_INT 040 /* interrupt message */ 26217680Spst 26317680Spst#define MFS_DACK 0 /* data acknowledgement */ 26417680Spst#define MFS_IACK 020 /* I/LS acknowledgement */ 26517680Spst#define MFS_CACK 040 /* connect acknowledgement */ 26617680Spst 26717680Spst#define MFS_NOP 0 /* no operation */ 26817680Spst#define MFS_CI 020 /* connect initiate */ 26917680Spst#define MFS_CC 040 /* connect confirm */ 27017680Spst#define MFS_DI 060 /* disconnect initiate */ 27117680Spst#define MFS_DC 0100 /* disconnect confirm */ 27217680Spst#define MFS_RCI 0140 /* retransmitted connect initiate */ 27317680Spst 27417680Spst#define SGQ_ACK 0100000 /* ack */ 27517680Spst#define SGQ_NAK 0110000 /* negative ack */ 27617680Spst#define SGQ_OACK 0120000 /* other channel ack */ 27717680Spst#define SGQ_ONAK 0130000 /* other channel negative ack */ 27817680Spst#define SGQ_MASK 07777 /* mask to isolate seq # */ 27917680Spst#define SGQ_OTHER 020000 /* other channel qualifier */ 28017680Spst#define SGQ_DELAY 010000 /* ack delay flag */ 28117680Spst 28217680Spst#define SGQ_EOM 0100000 /* pseudo flag for end-of-message */ 28317680Spst 28417680Spst#define LSM_MASK 03 /* mask for modifier field */ 28517680Spst#define LSM_NOCHANGE 0 /* no change */ 28617680Spst#define LSM_DONOTSEND 1 /* do not send data */ 28717680Spst#define LSM_SEND 2 /* send data */ 28817680Spst 28917680Spst#define LSI_MASK 014 /* mask for interpretation field */ 29017680Spst#define LSI_DATA 0 /* data segment or message count */ 29117680Spst#define LSI_INTR 4 /* interrupt request count */ 29217680Spst#define LSI_INTM 0377 /* funny marker for int. message */ 29317680Spst 29417680Spst#define COS_MASK 014 /* mask for flow control field */ 29517680Spst#define COS_NONE 0 /* no flow control */ 29617680Spst#define COS_SEGMENT 04 /* segment flow control */ 29717680Spst#define COS_MESSAGE 010 /* message flow control */ 29817680Spst#define COS_CRYPTSER 020 /* cryptographic services requested */ 29917680Spst#define COS_DEFAULT 1 /* default value for field */ 30017680Spst 30117680Spst#define COI_MASK 3 /* mask for version field */ 30217680Spst#define COI_32 0 /* version 3.2 */ 30317680Spst#define COI_31 1 /* version 3.1 */ 30417680Spst#define COI_40 2 /* version 4.0 */ 30517680Spst#define COI_41 3 /* version 4.1 */ 30617680Spst 30717680Spst#define MNU_MASK 140 /* mask for session control version */ 30817680Spst#define MNU_10 000 /* session V1.0 */ 30917680Spst#define MNU_20 040 /* session V2.0 */ 31017680Spst#define MNU_ACCESS 1 /* access control present */ 31117680Spst#define MNU_USRDATA 2 /* user data field present */ 31217680Spst#define MNU_INVKPROXY 4 /* invoke proxy field present */ 31317680Spst#define MNU_UICPROXY 8 /* use uic-based proxy */ 31417680Spst 31517680Spst#define DC_NORESOURCES 1 /* no resource reason code */ 31617680Spst#define DC_NOLINK 41 /* no link terminate reason code */ 31717680Spst#define DC_COMPLETE 42 /* disconnect complete reason code */ 31817680Spst 31917680Spst#define DI_NOERROR 0 /* user disconnect */ 32017680Spst#define DI_SHUT 3 /* node is shutting down */ 32117680Spst#define DI_NOUSER 4 /* destination end user does not exist */ 32217680Spst#define DI_INVDEST 5 /* invalid end user destination */ 32317680Spst#define DI_REMRESRC 6 /* insufficient remote resources */ 32417680Spst#define DI_TPA 8 /* third party abort */ 32517680Spst#define DI_PROTOCOL 7 /* protocol error discovered */ 32617680Spst#define DI_ABORT 9 /* user abort */ 32717680Spst#define DI_LOCALRESRC 32 /* insufficient local resources */ 32817680Spst#define DI_REMUSERRESRC 33 /* insufficient remote user resources */ 32917680Spst#define DI_BADACCESS 34 /* bad access control information */ 33017680Spst#define DI_BADACCNT 36 /* bad ACCOUNT information */ 33117680Spst#define DI_CONNECTABORT 38 /* connect request cancelled */ 33217680Spst#define DI_TIMEDOUT 38 /* remote node or user crashed */ 33317680Spst#define DI_UNREACHABLE 39 /* local timers expired due to ... */ 33417680Spst#define DI_BADIMAGE 43 /* bad image data in connect */ 33517680Spst#define DI_SERVMISMATCH 54 /* cryptographic service mismatch */ 33617680Spst 33717680Spst#define UC_OBJREJECT 0 /* object rejected connect */ 33817680Spst#define UC_USERDISCONNECT 0 /* user disconnect */ 33917680Spst#define UC_RESOURCES 1 /* insufficient resources (local or remote) */ 34017680Spst#define UC_NOSUCHNODE 2 /* unrecognized node name */ 34117680Spst#define UC_REMOTESHUT 3 /* remote node shutting down */ 34217680Spst#define UC_NOSUCHOBJ 4 /* unrecognized object */ 34317680Spst#define UC_INVOBJFORMAT 5 /* invalid object name format */ 34417680Spst#define UC_OBJTOOBUSY 6 /* object too busy */ 34517680Spst#define UC_NETWORKABORT 8 /* network abort */ 34617680Spst#define UC_USERABORT 9 /* user abort */ 34717680Spst#define UC_INVNODEFORMAT 10 /* invalid node name format */ 34817680Spst#define UC_LOCALSHUT 11 /* local node shutting down */ 34917680Spst#define UC_ACCESSREJECT 34 /* invalid access control information */ 35017680Spst#define UC_NORESPONSE 38 /* no response from object */ 35117680Spst#define UC_UNREACHABLE 39 /* node unreachable */ 35217680Spst 35317680Spst/* 35417680Spst * NSP message formats. 35517680Spst */ 35617680Spststruct nsphdr /* general nsp header */ 35717680Spst { 35817680Spst byte nh_flags; /* message flags */ 35917680Spst word nh_dst; /* destination link address */ 36017680Spst word nh_src; /* source link address */ 36117680Spst }; 36217680Spst 36317680Spststruct seghdr /* data segment header */ 36417680Spst { 36517680Spst byte sh_flags; /* message flags */ 36617680Spst word sh_dst; /* destination link address */ 36717680Spst word sh_src; /* source link address */ 36817680Spst word sh_seq[3]; /* sequence numbers */ 36917680Spst }; 37017680Spst 37117680Spststruct minseghdr /* minimum data segment header */ 37217680Spst { 37317680Spst byte ms_flags; /* message flags */ 37417680Spst word ms_dst; /* destination link address */ 37517680Spst word ms_src; /* source link address */ 37617680Spst word ms_seq; /* sequence number */ 37717680Spst }; 37817680Spst 37917680Spststruct lsmsg /* link service message (after hdr) */ 38017680Spst { 38117680Spst byte ls_lsflags; /* link service flags */ 38217680Spst byte ls_fcval; /* flow control value */ 38317680Spst }; 38417680Spst 38517680Spststruct ackmsg /* acknowledgement message */ 38617680Spst { 38717680Spst byte ak_flags; /* message flags */ 38817680Spst word ak_dst; /* destination link address */ 38917680Spst word ak_src; /* source link address */ 39017680Spst word ak_acknum[2]; /* acknowledgement numbers */ 39117680Spst }; 39217680Spst 39317680Spststruct minackmsg /* minimum acknowledgement message */ 39417680Spst { 39517680Spst byte mk_flags; /* message flags */ 39617680Spst word mk_dst; /* destination link address */ 39717680Spst word mk_src; /* source link address */ 39817680Spst word mk_acknum; /* acknowledgement number */ 39917680Spst }; 40017680Spst 40117680Spststruct ciackmsg /* connect acknowledgement message */ 40217680Spst { 40317680Spst byte ck_flags; /* message flags */ 40417680Spst word ck_dst; /* destination link address */ 40517680Spst }; 40617680Spst 40717680Spststruct cimsg /* connect initiate message */ 40817680Spst { 40917680Spst byte ci_flags; /* message flags */ 41017680Spst word ci_dst; /* destination link address (0) */ 41117680Spst word ci_src; /* source link address */ 41217680Spst byte ci_services; /* requested services */ 41317680Spst byte ci_info; /* information */ 41417680Spst word ci_segsize; /* maximum segment size */ 41517680Spst }; 41617680Spst 41717680Spststruct ccmsg /* connect confirm message */ 41817680Spst { 41917680Spst byte cc_flags; /* message flags */ 42017680Spst word cc_dst; /* destination link address */ 42117680Spst word cc_src; /* source link address */ 42217680Spst byte cc_services; /* requested services */ 42317680Spst byte cc_info; /* information */ 42417680Spst word cc_segsize; /* maximum segment size */ 42517680Spst byte cc_optlen; /* optional data length */ 42617680Spst }; 42717680Spst 42817680Spststruct cnmsg /* generic connect message */ 42917680Spst { 43017680Spst byte cn_flags; /* message flags */ 43117680Spst word cn_dst; /* destination link address */ 43217680Spst word cn_src; /* source link address */ 43317680Spst byte cn_services; /* requested services */ 43417680Spst byte cn_info; /* information */ 43517680Spst word cn_segsize; /* maximum segment size */ 43617680Spst }; 43717680Spst 43817680Spststruct dimsg /* disconnect initiate message */ 43917680Spst { 44017680Spst byte di_flags; /* message flags */ 44117680Spst word di_dst; /* destination link address */ 44217680Spst word di_src; /* source link address */ 44317680Spst word di_reason; /* reason code */ 44417680Spst byte di_optlen; /* optional data length */ 44517680Spst }; 44617680Spst 44717680Spststruct dcmsg /* disconnect confirm message */ 44817680Spst { 44917680Spst byte dc_flags; /* message flags */ 45017680Spst word dc_dst; /* destination link address */ 45117680Spst word dc_src; /* source link address */ 45217680Spst word dc_reason; /* reason code */ 45317680Spst }; 454