This is a low-level network debugging utility that utilizes raw packet i/o to construct and deconstruct tcp, udp, ipv4, arp, and icmp packets over ethernet.

Dependencies:   mbed

Revision:
2:e8e09adc41fc
Parent:
0:d494b853ce97
Child:
5:c56386b9fc33
--- a/net/net.h	Tue Oct 12 05:54:52 2010 +0000
+++ b/net/net.h	Tue Oct 12 06:10:41 2010 +0000
@@ -6,7 +6,11 @@
 
 #include "ctype.h"
 
-// General networking checksum
+/// \file Overall networking header - Includes all other net/ headers
+
+/// General networking checksum - Used for IP, TCP, UDP, ICMP, etc.
+/// Computes the one's complement of the one's complement sum of all of the given bytes except for the memory
+/// at skip_byte for skip_count bytes (e.g. the checksum).  Optionally resumes computation from the (given) last checksum.
 inline u16 checksum(void *_mem, unsigned int bytes, void *skip_byte = NULL, unsigned int skip_count = 0, u16 last = 0)
 {
   u32 sum = 0;
@@ -39,7 +43,7 @@
   return (u16)(sum);
 }
 
-// Generic u16 endian swapping
+/// Generic u16 endian swapping
 inline void fix_endian_u16(u16 *p)
 {
   char *bytes = (char*)p;
@@ -48,7 +52,7 @@
   bytes[0] ^= bytes[1];
 }
 
-// Generic u32 endian swapping
+/// Generic u32 endian swapping
 inline void fix_endian_u32(u32 *p)
 {
   char *bytes = (char*)p;
@@ -65,7 +69,7 @@
 /* Printing character */
 #define PCHAR(x) (isprint(x)?(x):'.')
 
-/* Hex dump a word-aligned number of bytes (may misbehave if length is not a multiple of 32 bits */
+/// Hex dump a word-aligned number of bytes (will print extra bytes if length is not a multiple of 32 bits)
 inline void hex_dump(void *base, unsigned int length)
 {
   char line[/*indent*/ 2 + /*0x*/ 2 + /*addr*/ 8 + /* : */ 3 + /*4xXXXX */ 4*5 + /*: */ 2 + /*8x.*/ 8 + /*\0*/ 1];