145 lines
3.8 KiB
Plaintext
145 lines
3.8 KiB
Plaintext
/*
|
|
* Copyright 1992 Silicon Graphics, Inc. All rights reserved.
|
|
*
|
|
* tokenring
|
|
*
|
|
* $Revision: 1.1 $
|
|
* $Date: 1992/07/07 18:44:17 $
|
|
*
|
|
* 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 crafted reminder:
|
|
* - Search for "Protocol tokenring_proto" change from 20 to 34
|
|
* - Search for "(fid >= 19)" and change that line to
|
|
* (fid >= 19 && fid < 22)
|
|
* - Search for "eaddr_to_name(tokenring->dst)" and change to
|
|
* "ether_hostname((struct etheraddr*)tokenring->dst)".
|
|
* In 2 places.
|
|
* - Search for "if ((*tokenring).src) {" and change to
|
|
* "if ((*tokenring).src[0] & 0x80) {"
|
|
* In 2 places.
|
|
*/
|
|
%}
|
|
|
|
//
|
|
// Token Ring Medium Access Control Header, 802.5
|
|
//
|
|
|
|
export tokenring.ftype, tokenring.src, tokenring.dst;
|
|
|
|
typedef address eaddr:48;
|
|
|
|
protocol tokenring "Token Ring Medium Access Control Header" (ftype)
|
|
{
|
|
// Frame Type
|
|
enum frmtype {
|
|
MACFrame, LLCFrame, Undefine, Undefined
|
|
};
|
|
/*
|
|
// I/G Bit
|
|
enum igbit {
|
|
IndividualAddr, GroupAddr
|
|
};
|
|
|
|
// U/L Bit
|
|
enum ulbit {
|
|
UniversallyAdmin, LocalAdmin
|
|
};
|
|
|
|
// FAI Bit
|
|
enum faibit {
|
|
FunctionalAddress, GroupAddress
|
|
};
|
|
|
|
// U Bit
|
|
enum ubit {
|
|
NoRoutingInfo, RoutingInfo
|
|
};
|
|
*/
|
|
// Direction Bit
|
|
enum dbit {
|
|
LeftToRight, RightToLeft
|
|
};
|
|
|
|
// Largest Frame Bits
|
|
enum frmbit {
|
|
LargestIs516, LargestIs1500, LargestIs2052, LargestIs4472,
|
|
LargestIs8144, LargestIs11407, LargestIs17800, AllRoutesBroadcast
|
|
};
|
|
|
|
// Route Designator Field
|
|
struct routedes {
|
|
u_short rnum "Ring Number" : 12;
|
|
u_short ibridge "Individual Bridge" : 4;
|
|
};
|
|
|
|
// Access Control Field
|
|
u_char prior "Priority Bits" : 3 -v,
|
|
tk "Token Bit" : 1 -v,
|
|
mon "Monitor Bit" : 1 -v,
|
|
resv "Reservation Bits" : 3 -vv;
|
|
// Frame Control Field
|
|
frmtype ftype "Frame Type Bits" : 2 -v;
|
|
u_char res "Reserved Bits" : 2 -vv,
|
|
ctrl "Control Bits" : 4 -v;
|
|
// Destination Address
|
|
eaddr dst "Destionation Address";
|
|
//igbit ig "Individual/Group Address" : 1 -v;
|
|
//ulbit dul "Universally/Locally Administered" : 1 -v;
|
|
//u_char da0 "Destination Address, MSB" : 6;
|
|
//faibit fai "Functional Address Indicator" : 1 -v;
|
|
//u_char da1 : 7;
|
|
//u_char da2;
|
|
//u_char da3;
|
|
//u_char da4;
|
|
//u_char da5 "Destination Address, LSB";
|
|
// Source Address
|
|
eaddr src "Source Address";
|
|
//ubit u "Routing Information Field" : 1 -v;
|
|
//ulbit sul : 1;
|
|
//u_char sa0 "Source Address, MSB" : 6;
|
|
//u_char sa1;
|
|
//u_char sa2;
|
|
//u_char sa3;
|
|
//u_char sa4;
|
|
//u_char sa5 "Source Address, LSB";
|
|
if (src)
|
|
//if (u)
|
|
{
|
|
// Routing Control Field
|
|
switch (srb & 0x6)
|
|
{
|
|
case 6:
|
|
u_short srb "Single Route Broadcast" : 3 -v;
|
|
|
|
case 4:
|
|
u_short arb "All Route Broadcast" : 3 -v;
|
|
|
|
default:
|
|
u_short nb "Non Broadcast" : 3 -v;
|
|
}
|
|
u_short len "Length Bits" : 5 -v;
|
|
dbit dir "Direction Bits" : 1 -v;
|
|
frmbit lf "Largest Frame Bits" : 3 -v;
|
|
u_short resb "Reserved Bits" : 4 -vv;
|
|
// Route Designator Field
|
|
routedes rd "Route Designator Field" [len/2 - 1] -v;
|
|
}
|
|
|
|
//define tokenllc = "tokenllc";
|
|
//define tokenmac = "tokenmac";
|
|
}
|