![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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/ethernet.h
- Revision:
- 2:e8e09adc41fc
- Parent:
- 0:d494b853ce97
- Child:
- 3:c32d9660b888
--- a/net/ethernet.h Tue Oct 12 05:54:52 2010 +0000 +++ b/net/ethernet.h Tue Oct 12 06:10:41 2010 +0000 @@ -3,27 +3,33 @@ #include "net.h" +/// \file Ethernet frames + +/// Ethernet MAC address typedef struct { - unsigned char octet[6]; + unsigned char octet[6]; ///< Individual octsts of the MAC address } Ethernet_MAC; +/// Memory map for Ethernet Frame Header (according to the Ethernet II Framing Standard) typedef struct { - // In the Ethernet II Framing Standard: - // Destination MAC address (6 octets) + /// Destination MAC address (6 octets) Ethernet_MAC destination; - // Source MAC address (6 octets) + /// Source MAC address (6 octets) Ethernet_MAC source; // (optional) VLAN Tag (unsupported) - // Ethernet type or length (only <0x600 or 0x0800 IPv4 supported) + /// Ethernet type or length (only <0x600 or 0x0800 IPv4 supported) u16 ethertype; + /// Payload (used for memory mapping; has zero size) unsigned char payload[]; } Ethernet_FrameHeader; +/// Convert from wire to host or host to wire endian-ness inline void fix_endian_ethernet(Ethernet_FrameHeader *header) { fix_endian_u16(&header->ethertype); } +/// Print out an ethernet packet inline void print_ethernet(Ethernet_FrameHeader *frame) { main_log.printf("Ethernet frame:");