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

135 lines
3.2 KiB
Plaintext

/*
* Copyright 1991, Silicon Graphics, Inc.
* All Rights Reserved.
*
* 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.
*
* $Revision: 1.2 $
*/
/*
* AppleTalk Zone Information Protocol.
*/
import ddp, atp;
protocol zip "AppleTalk Zone Information Protocol"
: ddp(6:6), atp(3:6)
{
enum bitval {
False, True
};
enum zipfunc {
Query=1, Reply=2, TakeDown=3, BringUp=4, GetNetInfo=5,
GetNetInfoReply=6, Notify=7, ExtendedReply=8
};
enum atpzipfunc {
GetMyZone=7, GetZoneList=8, GetLocalZones=9
};
struct zonename {
u_char len "Zone Name Length" -v;
char name "Zone Name" [len];
};
struct netzonepair {
u_short net "Network Number";
zonename zone "Zone";
};
/*
struct flagbits {
bool zoneinval "Zone Invalid" : 1;
bool broadcast "Use Broadcast Flag" : 1;
bool onlyone "Only One Zone Flag" : 1;
u_char bpad "Bit Padding" : 5 -vv;
};
*/
struct flagbits {
bitval zoneinval "Zone Invalid" : 1;
bitval broadcast "Use Broadcast Flag" : 1;
bitval onlyone "Only One Zone Flag" : 1;
bitval bpad "Bit Padding" : 5 -vv;
};
switch (ddp.type) {
case 6:
zipfunc func "ZIP Function Code" : 8;
switch (func) {
case Query:
u_char cnt "Network Count" -v;
u_short net [cnt];
case Reply:
case ExtendedReply:
u_char cnt -v;
netzonepair netzone "Network Zone" [];
case GetNetInfo:
u_char pad "Padding" [5] -vv;
zonename zone;
case GetNetInfoReply:
flagbits zflags "Zone Flags";
u_short bgnnet "Network Number Range Start";
u_short endnet "Network Number Range End";
zonename zone;
u_char addlen "Multicast Address Length" -v;
u_char multiaddr "Multicast Address" [addlen];
if (zflags.zoneinval)
{
u_char zlen "Default Zone Length" -v;
char zname "Default Zone Name" [zlen];
}
case Notify:
flagbits zflags;
u_char pad [4] -vv;
u_char olen "Old Zone Name Length" -v;
char oname "Old Zone Name" [olen];
u_char addlen -v;
u_char multiaddr [addlen];
u_char nlen "New Zone Name Length" -v;
char nname "New Zone Name" [nlen];
// Phase I only
case TakeDown:
u_char cnt -v expect 1;
// Phase I only
case BringUp:
u_char cnt -v expect 1;
u_char pad [2] -vv;
zonename zone;
}
case 3:
switch (atp.func) {
case atp.TReq:
atpzipfunc fun "ZIP Function Code" : 8;
u_char pad [1] -vv;
u_short start "Start Index";
case atp.TResp:
u_char last "Last Flag";
u_char pad [1] -vv;
u_short num "Number of Zones" -v;
zonename nzone [num];
}
}
}