1
0
Files
2022-09-29 17:59:04 +03:00

298 lines
7.5 KiB
Plaintext

/*
* Copyright 1992 Silicon Graphics, Inc. All rights reserved.
*
* LLC
*
* $Revision: 1.5 $
* $Date: 1996/11/15 22:39:10 $
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*/
%{
/*
* Hand crafting reminder:
* - Copy llc.h to llc_nostruct.h and edit llc_nostruct.h to
* remove struct llc completely.
*
*/
%}
//
// Logical Link Control, 802.2 type 1 & 2
//
export llc.dsap, llc.type;
import ether;
import fddi;
import tokenring;
import hippi;
import atm;
protocol llc "Logical Link Control" (dsap, type) :
tokenring(1), ether(0), fddi(31), hippi(0), atm(0)
{
const u_char UI = 0;
const u_char DM = 0x3;
const u_char DISC = 0x8;
const u_char UA = 0xc;
const u_char SABME = 0xf;
const u_char FRMR = 0x11;
const u_char XID = 0x17;
const u_char TEST = 0x1c;
enum protype {
ip=0x800, arp=0x806, ddp=0x809b, aarp=0x80f3
};
/*
enum ubit {
UserDefine, IEEEdefine
};
enum igbit {
IndividualAddr, GroupAddr
};
*/
enum crbit {
Command, Response
};
enum sfunction {
ReceiverReady, ReceiverNotReady, Reject
};
enum servclass {
Connectionless=1, Both=3
};
/*
export
struct dsapaddr {
u_char da "Destination SAP" : 6;
ubit u "User Defined Addr" : 1;
igbit ig "Individual/Group" : 1;
};
struct ssapaddr {
u_char sa "Source SAP" : 6;
ubit u "User Defined Addr" : 1;
crbit cr "Command/Response" : 1;
};
*/
//
// LLC Frame
//
u_char dsap "DSAP Address Field" -v;
u_char ssap "SSAP Address Field" -v;
//if ((dsap.sa==0x2a) && (dsap.u==1) && (ssap.sa==0x2a) && (ssap.u==1)
//&& (cont==3))
// Control=6 for Vines.
if ((dsap==0xaa) && (ssap==0xaa) && ((cont==3) || (cont==6)))
{
u_char cont "Control" -v;
u_char org "Organization" [3] -v;
protype type "Packet Type" : 16;
}
else
{
switch (itype)
{
case 0: // I frame
u_char ns "Transmitter Send Seq #" : 7 -v;
u_char itype "I Frame" : 1;
u_char inr "Transmitter Receive Seq #" : 7 -v;
u_char pf "Poll/Final Bit" : 1 -v;
default: // S frame or unnumbered frame
switch (stype)
{
case 1: // S frame
u_char pad1 "Padding" : 4 -vv;
sfunction sfunc "Supervisory Function" : 2;
u_char stype "Supervisory Frame" : 2;
u_char snr "Transmitter Receive Seq #" : 7 -v;
u_char pf : 1 -v;
default:
switch ((ui1<<2) | ui2)
{
case UI:
u_char ui1 "UI Code, Part 1" : 3 -v;
u_char pf : 1 -v;
u_char ui2 "UI Code, Part 2" : 2 -v;
u_char ifunc "Unnumbered Frame" : 2 expect 3;
case DM:
u_char dm1 "DM Code, Part 1" : 3 -v;
u_char pf : 1 -v;
u_char dm2 "DM Code, Part 2" : 2 -v;
u_char mfunc "Unnumbered Frame" : 2 expect 3;
case DISC:
u_char disc1 "DISC Code, Part 1" : 3 -v;
u_char pf : 1 -v;
u_char disc2 "DISC Code, Part 2" : 2 -v;
u_char dfunc "Unnumbered Frame" : 2 expect 3;
case UA:
u_char ua1 "UA Code, Part 1" : 3 -v;
u_char pf : 1 -v;
u_char ua2 "UA Code, Part 2" : 2 -v;
u_char afunc "Unnumbered Frame" : 2 expect 3;
case SABME:
u_char sabme1 "SABME Code, Part 1" : 3 -v;
u_char pf : 1 -v;
u_char sabme2 "SABME Code, Part 2" : 2 -v;
u_char bfunc "Unnumbered Frame" : 2 expect 3;
case FRMR:
u_char frmr1 "FRMR Code, Part 1" : 3 -v;
u_char pf : 1 -v;
u_char frmr2 "FRMR Code, Part 2" : 2 -v;
u_char ffunc "Unnumbered Frame" : 2 expect 3;
u_char rejc0 "Rejected Control Field, Byte 0" -v;
u_char rejc1 "Rejected Control Field, Byte 1" -v;
u_char vs "Send State Variable" : 7 -v;
u_char pad2 "Padding" : 1 -vv;
u_char vr "Receive State Variable" : 7 -v;
crbit cr : 1 -v;
u_char pad3 "Padding" : 3 -vv;
if (v)
u_char v "Send Seq # Invalid" : 1;
else
u_char notv "V Bit Not Set" : 1 -vv;
if (z)
u_char z "Receive Seq # Invalid" : 1;
else
u_char notz "Z Bit Not Set" : 1 -vv;
if (y)
u_char y "I Field Exceeded Buffer Capacity" : 1;
else
u_char noty "Y Bit Not Set" : 1 -vv;
if (x)
u_char x "Invalid I Field/Bad FRMR Resp" : 1;
else
u_char notx "X Bit Not Set" : 1 -vv;
if (w)
u_char w "Control Field Invalid" : 1;
else
u_char notw "W Bit Not Set" : 1 -vv;
case XID:
// After the 1st byte there may not be any data.
// If the 2nd byte is not 81 decode differently.
u_char xid1 "XID Code, Part 1" : 3 -v;
u_char pf : 1 -v;
u_char xid2 "XID Code, Part 2" : 2 -v;
u_char xfunc "Unnumbered Frame" : 2 expect 3;
if (tk_check_end($ds))
if (xidb0 == 0x81)
{
u_char xidb0 "IEEE 802.2 Basic Format" -v;
u_char pad4 "Padding" : 3 -vv expect 0;
servclass servc "Class of Service" : 5 -v;
u_char rw "Max Receive Window Size" : 7 -v;
u_char pad5 "Padding" : 1 -vv expect 0;
}
else
{
u_char frmt "Format" : 4 -v,
ntype "Node Type" : 4 -v;
if (frmt)
u_char ilen "Length of I field" -v;
else
u_char ifd "I field";
u_long blknum "Block Number" : 12 -vv,
id "Station ID" : 20 -v;
if (tk_check_end($ds))
{
switch (frmt)
{
case 1:
case 2:
case 3:
default:
//opaque data "XID Data" [] -vv;
u_char data "XID Data" [] -vv;
}
}
}
case TEST:
u_char test1 "TEST Code, Part 1" : 3 -v;
u_char pf : 1 -v;
u_char test2 "TEST Code, Part 2" : 2 -v;
u_char tfunc "Unnumbered Frame" : 2 expect 3;
if (tk_check_end($ds))
// opaque tdata "Test Data" [] -vv;
u_char tdata "Test Data" [] -vv;
}
}
}
}
%{
static int
tk_check_end(DataStream *ds)
{
return ds->ds_count > 0;
}
%}
// define filter nicknames
define LLC = "llc";
define ddp2 = "llc.ddp";
define DDP2 = "llc.ddp";
define rtmp2 = "llc.ddp.rtmp";
define RTMP2 = "llc.ddp.rtmp";
define aep2 = "llc.ddp.aep";
define AEP2 = "llc.ddp.aep";
define atp2 = "llc.ddp.atp";
define ATP2 = "llc.ddp.atp";
define nbp2 = "llc.ddp.nbp";
define NBP2 = "llc.ddp.nbp";
define adsp2 = "llc.ddp.adsp";
define ADSP2 = "llc.ddp.adsp";
define zip2 = "llc.ddp.zip";
define ZIP2 = "llc.ddp.zip";
define asp2 = "llc.ddp.atp.asp";
define ASP2 = "llc.ddp.atp.asp";
define pap2 = "llc.ddp.atp.pap";
define PAP2 = "llc.ddp.atp.pap";
define afp2 = "llc.ddp.atp.asp.afp";
define AFP2 = "llc.ddp.atp.asp.afp";
define llcip = "llc.ip";
define LLCIP = "llc.ip";
define llcicmp = "llc.ip.icmp";
define LLCICMP = "llc.ip.icmp";
define llcarp = "llc.arp";
define LLCARP = "llc.arp";
define llcarpip = "llc.arp.arpip";
define LLCARPIP = "llc.arp.arpip";
define llcosi = "llc.osi";
define LLCOSI = "llc.osi";
define llcsna = "llc.sna";
define LLCSNA = "llc.sna";
define llcnetbios = "llc.netbios";
define LLCNETBIOS = "llc.netbios";
define llcvines = "llc.vines";
define LLCVINES = "llc.vines";
}