Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mbed714
Date:
Mon May 30 15:06:52 2011 +0000
Parent:
0:55680e5cc478
Commit message:

Changed in this revision

NetServices/drv/eth/eth_drv.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/NetServices/drv/eth/eth_drv.cpp	Mon May 30 12:11:59 2011 +0000
+++ b/NetServices/drv/eth/eth_drv.cpp	Mon May 30 15:06:52 2011 +0000
@@ -68,18 +68,27 @@
   return ERR_OK;
 }
 
-/*
+bool broadcast(char *buf) {
+    return ((buf[0] == 0xff) &&
+        (buf[1] == 0xff) &&
+        (buf[2] == 0xff) &&
+        (buf[3] == 0xff) &&
+        (buf[4] == 0xff) &&
+        (buf[5] == 0xff));
+}
+
 void show(char *buf, int size) {
-    printf("Destination:  %02hx:%02hx:%02hx:%02hx:%02hx:%02hx\n",
+
+if (htons((short)buf[12]) == 0x0800 && !broadcast(buf)) {
+    printf("Destination: %02hx:%02hx:%02hx:%02hx:%02hx:%02hx | ",
             buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
-    printf("Source: %02hx:%02hx:%02hx:%02hx:%02hx:%02hx\n",
+    printf("Source: %02hx:%02hx:%02hx:%02hx:%02hx:%02hx | ",
             buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]);
   
-    printf("Type %hd\n", htons((short)buf[12]));
-    
+    printf("Type %hx\n", htons((short)buf[12]));
+    }
    // hexview(buf, size);
 }
-*/
 
 void eth_poll() {
   struct eth_hdr *ethhdr;
@@ -105,7 +114,7 @@
 
       ethhdr = (struct eth_hdr *)(frame->payload);
       
-     // show((char*)ethhdr, 13);
+     show((char*)ethhdr, 13);
       
       /*
       switch(htons(ethhdr->type)) {