[Gd-chatter] r10976 - in trunk/libraries: network-flow protocols sniffer
hannes at gwydiondylan.org
hannes at gwydiondylan.org
Tue Nov 21 20:02:24 CET 2006
Author: hannes
Date: Tue Nov 21 20:02:21 2006
New Revision: 10976
Modified:
trunk/libraries/network-flow/network-flow.dylan
trunk/libraries/protocols/ethernet.dylan
trunk/libraries/protocols/ieee80211.dylan
trunk/libraries/protocols/ipv4.dylan
trunk/libraries/protocols/logical-link.dylan
trunk/libraries/sniffer/simple-sniffer.dylan
Log:
Bug: 7299
* don't call summary on payload in each header-frame
* implement recursive-summary in network-flow, which concatenates summary with summary of payload
Modified: trunk/libraries/network-flow/network-flow.dylan
==============================================================================
--- trunk/libraries/network-flow/network-flow.dylan (original)
+++ trunk/libraries/network-flow/network-flow.dylan Tue Nov 21 20:02:21 2006
@@ -10,10 +10,17 @@
slot stream :: <stream>, required-init-keyword: stream:;
end;
+define method recursive-summary (frame :: <header-frame>) => (res :: <string>)
+ concatenate(summary(frame), "/", recursive-summary(frame.payload));
+end;
+
+define method recursive-summary (frame :: <frame>) => (res :: <string>)
+ summary(frame);
+end;
define method push-data-aux (input :: <push-input>,
node :: <summary-printer>,
frame :: <frame>)
- format(node.stream, "%s\n", summary(frame));
+ format(node.stream, "%s\n", recursive-summary(frame));
force-output(node.stream);
end;
Modified: trunk/libraries/protocols/ethernet.dylan
==============================================================================
--- trunk/libraries/protocols/ethernet.dylan (original)
+++ trunk/libraries/protocols/ethernet.dylan Tue Nov 21 20:02:21 2006
@@ -37,8 +37,7 @@
end;
define protocol ethernet-frame (header-frame)
- summary "ETH %= -> %=/%s",
- source-address, destination-address, compose(summary, payload);
+ summary "ETH %= -> %=", source-address, destination-address;
field destination-address :: <mac-address>;
field source-address :: <mac-address>;
layering field type-code :: <2byte-big-endian-unsigned-integer>;
Modified: trunk/libraries/protocols/ieee80211.dylan
==============================================================================
--- trunk/libraries/protocols/ieee80211.dylan (original)
+++ trunk/libraries/protocols/ieee80211.dylan Tue Nov 21 20:02:21 2006
@@ -339,7 +339,7 @@
end;
define protocol ieee80211-frame (header-frame)
- summary "IEEE80211 %s/%s", compose(summary, frame-control), compose(summary, payload);
+ summary "IEEE80211 %s", compose(summary, frame-control);
field frame-control :: <ieee80211-frame-control>;
variably-typed-field payload,
type-function:
Modified: trunk/libraries/protocols/ipv4.dylan
==============================================================================
--- trunk/libraries/protocols/ipv4.dylan (original)
+++ trunk/libraries/protocols/ipv4.dylan Tue Nov 21 20:02:21 2006
@@ -97,20 +97,21 @@
end;
define method fixup! (frame :: <unparsed-ipv4-frame>,
+ foo :: <stretchy-vector-subsequence>,
#next next-method)
frame.header-checksum := calculate-checksum(frame.packet, frame.header-length * 4);
next-method();
end;
define method fixup! (frame :: <unparsed-icmp-frame>,
+ foo :: <stretchy-vector-subsequence>,
#next next-method)
frame.checksum := calculate-checksum(frame.packet, frame.packet.size);
next-method();
end;
define protocol ipv4-frame (header-frame)
- summary "IP SRC %= DST %=/%s",
- source-address, destination-address, compose(summary, payload);
+ summary "IP SRC %= DST %=", source-address, destination-address;
over <ethernet-frame> #x800;
over <link-control> #x800;
field version :: <4bit-unsigned-integer> = 4;
@@ -148,10 +149,10 @@
end;
define protocol udp-frame (header-frame)
- summary "UDP port %= -> %=/%s", source-port, destination-port, compose(summary, payload);
+ summary "UDP port %= -> %=", source-port, destination-port;
over <ipv4-frame> 17;
field source-port :: <2byte-big-endian-unsigned-integer>;
- field destination-port :: <2byte-big-endian-unsigned-integer>;
+ layering field destination-port :: <2byte-big-endian-unsigned-integer>;
field payload-size :: <2byte-big-endian-unsigned-integer>,
fixup: byte-offset(frame-size(frame.payload)) + 8;
field checksum :: <2byte-big-endian-unsigned-integer> = 0;
@@ -207,6 +208,7 @@
end;
define method fixup!(tcp-frame :: <unparsed-tcp-frame>,
+ foo :: <stretchy-vector-subsequence>,
#next next-method)
let pseudo-header = make(<pseudo-header>,
source-address: tcp-frame.parent.source-address,
Modified: trunk/libraries/protocols/logical-link.dylan
==============================================================================
--- trunk/libraries/protocols/logical-link.dylan (original)
+++ trunk/libraries/protocols/logical-link.dylan Tue Nov 21 20:02:21 2006
@@ -3,7 +3,6 @@
Copyright: (C) 2005, 2006, All rights reserved. Free for non-commercial use.
define protocol link-control (header-frame)
- summary "%s", compose(summary, payload);
field dsap :: <unsigned-byte>;
field ssap :: <unsigned-byte>;
field control :: <unsigned-byte>;
Modified: trunk/libraries/sniffer/simple-sniffer.dylan
==============================================================================
--- trunk/libraries/sniffer/simple-sniffer.dylan (original)
+++ trunk/libraries/sniffer/simple-sniffer.dylan Tue Nov 21 20:02:21 2006
@@ -3,7 +3,7 @@
Copyright: (C) 2005, 2006, All rights reserved. Free for non-commercial use.
begin
- let source = make(<ethernet-interface>, name: "eth0");
+ let source = make(<ethernet-interface>, name: "Intel");
connect(source, make(<summary-printer>, stream: *standard-output*));
toplevel(source);
-end;
\ No newline at end of file
+end;
More information about the chatter
mailing list