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.
Diff: net/icmp.h
- Revision:
- 2:e8e09adc41fc
- Parent:
- 0:d494b853ce97
- Child:
- 3:c32d9660b888
diff -r 63d4ff534d65 -r e8e09adc41fc net/icmp.h --- a/net/icmp.h Tue Oct 12 05:54:52 2010 +0000 +++ b/net/icmp.h Tue Oct 12 06:10:41 2010 +0000 @@ -3,18 +3,23 @@ #include "net.h" +/// \file ICMP Packet + #define ICMP_ECHO_REPLY 0x00 #define ICMP_ECHO_REQUEST 0x08 #define IPPROTO_ICMP 0x01 + +/// Memory map of ICMP packet typedef struct { - u8 type; // type of ICMP message - u8 code; // code number associated with certain message types + u8 type; ///< type of ICMP message + u8 code; ///< code number associated with certain message types u16 checksum; - u16 id; // ID value, returned in ECHO REPLY - u16 sequence; // Sequence value to be returned with ECHO REPLY - u8 data[]; + u16 id; ///< ID value, returned in ECHO REPLY + u16 sequence; ///< Sequence value to be returned with ECHO REPLY + u8 data[]; ///< Data memory map } ICMP_Packet; +/// Convert from wire to host or host to wire endianness inline void fix_endian_icmp(ICMP_Packet *segment) { fix_endian_u16(&segment->checksum); @@ -22,6 +27,7 @@ fix_endian_u16(&segment->sequence); } +/// Print the ICMP packet inline void print_icmp(ICMP_Packet *segment) { main_log.printf("ICMP Packet:");