[Gd-chatter] r11524 - trunk/libraries/gui-sniffer

andreas at gwydiondylan.org andreas at gwydiondylan.org
Wed Dec 5 22:09:05 CET 2007


Author: andreas
Date: Wed Dec  5 22:09:04 2007
New Revision: 11524

Added:
   trunk/libraries/gui-sniffer/commands.dylan   (contents, props changed)
   trunk/libraries/gui-sniffer/main.dylan   (contents, props changed)
Modified:
   trunk/libraries/gui-sniffer/gui-sniffer.dylan
   trunk/libraries/gui-sniffer/gui-sniffer.hdp
Log:
job: minor

Slight refactoring of commands, and re-enabling the command line.


Added: trunk/libraries/gui-sniffer/commands.dylan
==============================================================================
--- (empty file)
+++ trunk/libraries/gui-sniffer/commands.dylan	Wed Dec  5 22:09:04 2007
@@ -0,0 +1,60 @@
+module: gui-sniffer
+
+define method parse-next-argument
+    (context :: <nnv-context>, type == <ipv4-address>,
+     text :: <string>,
+     #key start :: <integer> = 0, end: stop = #f)
+ => (value :: <ipv4-address>, next-index :: <integer>)
+   block (return)
+     let (name, next-index)
+       = parse-next-word(text, start: start, end: stop);
+     if (name)
+       values(ipv4-address(name), next-index)
+     else
+       parse-error("Missing argument.")
+     end
+   exception (e :: <condition>)
+     parse-error("Not a valid target.")
+   end;
+end;
+
+define class <ping-command> (<basic-command>)
+  constant slot %target :: <ipv4-address>, required-init-keyword: target:;
+end;
+
+define command-line ping => <ping-command>
+    (summary: "Ping host.",
+     documentation: "Sends an ICMP Echo Request to the specified target address.")
+  argument target :: <ipv4-address> = "target host address";
+end;
+
+define method do-execute-command (context :: <nnv-context>, command :: <ping-command>)
+  let target = command.%target;
+  let stream = context.context-server.server-output-stream;
+  let icmp = icmp-frame(code: 0, icmp-type: 8,
+                        payload: read-frame(<raw-frame>, "123412341234123412341234123412341234123412341234"));
+  send(context.nnv-context.ip-layer, target, icmp);
+  format(stream, "Ping sent!\n");
+end;
+
+define command-group nnv
+    (summary: "Network Night Vision commands",
+     documentation: "The set of commands provided by Network Night Vision.")
+  command ping;
+  group basic;
+  group property;
+end command-group;
+
+define method context-command-group
+    (context :: <nnv-context>) => (group :: <command-group>)
+  $nnv-command-group
+end method context-command-group;
+
+define method context-command-prefix
+    (context :: <nnv-context>) => (prefix :: <character>)
+  '>'
+end method context-command-prefix;
+
+
+
+

Modified: trunk/libraries/gui-sniffer/gui-sniffer.dylan
==============================================================================
--- trunk/libraries/gui-sniffer/gui-sniffer.dylan	(original)
+++ trunk/libraries/gui-sniffer/gui-sniffer.dylan	Wed Dec  5 22:09:04 2007
@@ -538,8 +538,8 @@
                         children: vector(frame.packet-table,
                                          frame.packet-tree-view,
                                          //scrolling (scroll-bars: #"both")
-                                           frame.packet-hex-dump
-//                                           frame.nnv-shell
+                                           frame.packet-hex-dump,
+                                           frame.nnv-shell
                                          //end
                                          ));
                  end;
@@ -822,7 +822,7 @@
     let ethernet-socket = create-raw-socket(ethernet-layer);
     connect(ethernet-socket, frame);
     connect(frame, ethernet-socket);
-    frame.ip-layer := build-ip-layer(ethernet-layer);
+    frame.ip-layer := build-ip-layer(ethernet-layer, ip-address: ipv4-address("192.168.0.69"));
     reinit-gui(frame);
     frame.ethernet-layer := ethernet-layer;
     frame.listening-socket := ethernet-socket;
@@ -942,88 +942,9 @@
 */
 end;
 
-define class <nnvhelp-command> (<basic-command>)
-end;
-
 
-define command-line nnvhelp => <nnvhelp-command>
-    (summary: "Help",
-     documentation: "You expected more help, right?")
-end;
 
-define method do-execute-command (context :: <nnv-context>, command :: <nnvhelp-command>)
- => ()
-  let stream = context.context-server.server-output-stream;
-  format(stream, "Yeah, right!\n");
-end;
-
-define method parse-next-argument
-    (context :: <nnv-context>, type == <ipv4-address>,
-     text :: <string>,
-     #key start :: <integer> = 0, end: stop = #f)
- => (value :: <ipv4-address>, next-index :: <integer>)
-   block (return)
-     let (name, next-index)
-       = parse-next-word(text, start: start, end: stop);
-     if (name)
-       values(ipv4-address(name), next-index)
-     else
-       parse-error("Missing argument.")
-     end
-   exception (e :: <condition>)
-     parse-error("Not a valid target.")
-   end;
-end;
-
-define class <ping-command> (<basic-command>)
-  constant slot %target :: <ipv4-address>, required-init-keyword: target:;
-end;
-
-define command-line ping => <ping-command>
-    (summary: "Ping host.",
-     documentation: "Sends an ICMP Echo Request to the specified target address.")
-  argument target :: <ipv4-address> = "target host address";
-end;
-
-define method do-execute-command (context :: <nnv-context>, command :: <ping-command>)
-  let target = command.%target;
-  let icmp = icmp-frame(code: 0, icmp-type: 8,
-                        payload: read-frame(<raw-frame>, "123412341234123412341234123412341234123412341234"));
-  send(context.nnv-context.ip-layer, target, icmp);
-end;
-
-define command-group nnv
-    (summary: "Network Night Vision commands",
-     documentation: "The set of commands provided by Network Night Vision.")
-  command nnvhelp;
-  command ping;
-  group basic;
-end command-group;
-
-define method context-command-group
-    (context :: <nnv-context>) => (group :: <command-group>)
-  $nnv-command-group
-end method context-command-group;
-
-define method context-command-prefix
-    (context :: <nnv-context>) => (prefix :: <character>)
-  '>'
-end method context-command-prefix;
-
-define function main()
-  initialize-icons();
-  let gui-sniffer = make(<gui-sniffer-frame>);
-  set-frame-size(gui-sniffer, 1024, 768);
-  deuce/frame-window(gui-sniffer) := gui-sniffer.packet-hex-dump;
-  deuce/*editor-frame* := gui-sniffer;
-  deuce/*buffer* := deuce/make-initial-buffer();
-  deuce/select-buffer(frame-window(gui-sniffer), deuce/*buffer*);
-  command-enabled?(close-interface, gui-sniffer) := #f;
-  gadget-enabled?(gui-sniffer.stop-button) := #f;
-  start-frame(gui-sniffer);
-end;
 
-main()
 
 
 

Modified: trunk/libraries/gui-sniffer/gui-sniffer.hdp
==============================================================================
--- trunk/libraries/gui-sniffer/gui-sniffer.hdp	(original)
+++ trunk/libraries/gui-sniffer/gui-sniffer.hdp	Wed Dec  5 22:09:04 2007
@@ -6,6 +6,8 @@
 	hex-view
 	command-line
 	gui-sniffer
+	commands
+	main
 base-address:	0x63FE0000
 start-function:	main
 linker-options:	$(guilflags)

Added: trunk/libraries/gui-sniffer/main.dylan
==============================================================================
--- (empty file)
+++ trunk/libraries/gui-sniffer/main.dylan	Wed Dec  5 22:09:04 2007
@@ -0,0 +1,17 @@
+module: gui-sniffer
+
+define function main()
+  initialize-icons();
+  let gui-sniffer = make(<gui-sniffer-frame>);
+  set-frame-size(gui-sniffer, 1024, 768);
+  deuce/frame-window(gui-sniffer) := gui-sniffer.packet-hex-dump;
+  deuce/*editor-frame* := gui-sniffer;
+  deuce/*buffer* := deuce/make-initial-buffer();
+  deuce/select-buffer(frame-window(gui-sniffer), deuce/*buffer*);
+  command-enabled?(close-interface, gui-sniffer) := #f;
+  gadget-enabled?(gui-sniffer.stop-button) := #f;
+  start-frame(gui-sniffer);
+end;
+
+main()
+



More information about the chatter mailing list