A simple Ethernet sniffer. A demonstration how to use the Ethernet interface.

Dependencies:   mbed

Revision:
0:29e2df9de9f1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hexview.h	Fri Sep 04 12:24:03 2009 +0000
@@ -0,0 +1,29 @@
+/* Function: hexview
+ *  Prints an array of char to stdout in hex.
+ *  The data is grouped in two 8 byte groups per line.
+ *  Each byte is displayed as 2 hex digits and every 
+ *  line starts with the address of the first byte.
+ *
+ *  There is no text view of a line.
+ *
+ * Variables:
+ *  buffer - The array to display.
+ *  size - The length of buffer.
+ */
+inline void hexview(char *buffer, unsigned int size) {
+    for(int i = 0; i < size; ++i) {
+        if((i%16)!=0) {
+            printf(" ");
+        } else {
+            printf("%04X:  ", (i));
+        }
+        printf("%02hhx", buffer[i]);
+        if((i%16) ==  7) { 
+            printf(" ");
+        }
+        if((i%16) == 15) {
+            printf("\n");
+        }
+    }
+    printf("\n\n\n");
+}
\ No newline at end of file