[Gd-chatter] r11012 - trunk/libraries/protocols
hannes at gwydiondylan.org
hannes at gwydiondylan.org
Thu Nov 30 01:05:47 CET 2006
Author: hannes
Date: Thu Nov 30 01:05:44 2006
New Revision: 11012
Modified:
trunk/libraries/protocols/ethernet.dylan
trunk/libraries/protocols/ipv4.dylan
Log:
Bug: 7299
*moved <stp> and <ip-option> to <variably-typed-container-frame>
Modified: trunk/libraries/protocols/ethernet.dylan
==============================================================================
--- trunk/libraries/protocols/ethernet.dylan (original)
+++ trunk/libraries/protocols/ethernet.dylan Thu Nov 30 01:05:44 2006
@@ -85,27 +85,15 @@
field bridge-address :: <mac-address>;
end;
-define protocol stp-frame (container-frame)
+define protocol stp-frame (variably-typed-container-frame)
field protocol-identifier :: <2byte-big-endian-unsigned-integer>;
field protocol-version :: <unsigned-byte>;
- field bpdu-type :: <unsigned-byte>;
-end;
-
-define method parse-frame (frame-type == <stp-frame>,
- packet :: <byte-sequence>,
- #key parent)
- => (value :: <stp-frame>, next-unparsed :: <integer>);
- let bpdu-type = next-method().bpdu-type;
- let bpdu-class = select (bpdu-type)
- 0 => <stp-configuration-frame>;
- #x80 => <stp-topology-change-frame>;
- otherwise => signal(make(<malformed-packet-error>));
- end;
- parse-frame(bpdu-class, packet, parent: parent);
+ layering field bpdu-type :: <unsigned-byte>;
end;
define protocol stp-configuration-frame (stp-frame)
summary "STP configuration";
+ over <stp-frame> 0;
field flags :: <unsigned-byte>;
field root-identifier :: <stp-identifier>;
field root-path-cost :: <big-endian-unsigned-integer-4byte>;
@@ -118,6 +106,7 @@
end;
define protocol stp-topology-change-frame (stp-frame)
+ over <stp-frame> #x80;
summary "STP topology change notification";
end;
Modified: trunk/libraries/protocols/ipv4.dylan
==============================================================================
--- trunk/libraries/protocols/ipv4.dylan (original)
+++ trunk/libraries/protocols/ipv4.dylan Thu Nov 30 01:05:44 2006
@@ -2,60 +2,27 @@
Author: Andreas Bogk, Hannes Mehnert
Copyright: (C) 2005, 2006, All rights reserved. Free for non-commercial use.
-define protocol ip-option-type-frame (container-frame)
- field flag :: <1bit-unsigned-integer>;
- field class :: <2bit-unsigned-integer>;
- field number :: <5bit-unsigned-integer>;
-end;
-
-define protocol ip-option-frame (container-frame)
- field option-type :: <ip-option-type-frame>;
-end;
-
-define method parse-frame (frame-type == <ip-option-frame>,
- packet :: <byte-sequence>,
- #key parent)
- => (value :: <ip-option-frame>, next-unparsed :: <integer>)
- let ip-option-type = parse-frame(<ip-option-type-frame>, packet, parent: parent);
- let option-frame-type
- = select (ip-option-type.class)
- 0 => select (ip-option-type.number)
- 0 => <end-of-option-ip-option>;
- 1 => <no-operation-ip-option>;
- 2 => <security-ip-option>;
- 3 => <loose-source-and-record-route-ip-option>;
- 9 => <strict-source-and-record-route-ip-option>;
- 7 => <record-route-ip-option>;
- 8 => <stream-id-ip-option>;
- 20 => <router-alert-ip-option>;
- otherwise => signal(make(<malformed-packet-error>))
- end;
- 1 => select (ip-option-type.class)
- 1 => <general-error-ip-option>;
- otherwise => signal(make(<malformed-packet-error>))
- end;
- 2 => select (ip-option-type.class)
- 4 => <internet-timestamp-ip-option>;
- 5 => <satellite-timestamp-ip-option>;
- otherwise => signal(make(<malformed-packet-error>))
- end;
- otherwise => signal(make(<malformed-packet-error>))
- end;
- parse-frame(option-frame-type, packet, parent: parent);
+define protocol ip-option-frame (variably-typed-container-frame)
+ field copy-flag :: <1bit-unsigned-integer>;
+ layering field option-type :: <7bit-unsigned-integer>;
end;
define protocol router-alert-ip-option (ip-option-frame)
+ over <ip-option-frame> 20;
field router-alert-length :: <unsigned-byte> = 4;
field router-alert-value :: <2byte-big-endian-unsigned-integer>;
end;
define protocol end-of-option-ip-option (ip-option-frame)
+ over <ip-option-frame> 0;
end;
define protocol no-operation-ip-option (ip-option-frame)
+ over <ip-option-frame> 1;
end;
define protocol security-ip-option-frame (ip-option-frame)
+ over <ip-option-frame> 2;
field security-length :: <unsigned-byte>;
field security :: <2byte-big-endian-unsigned-integer>;
field compartments :: <2byte-big-endian-unsigned-integer>;
More information about the chatter
mailing list