![](/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.
net/udp.h
- Committer:
- etherealflaim
- Date:
- 2010-10-12
- Revision:
- 0:d494b853ce97
- Child:
- 2:e8e09adc41fc
File content as of revision 0:d494b853ce97:
#ifndef UDP_H #define UDP_H #include "net.h" #define IPPROTO_UDP 0x11 typedef struct { u16 source_port; u16 destination_port; u16 length; // entire datagram in bytes u16 checksum; u8 data[]; } UDP_Packet; inline void fix_endian_udp(UDP_Packet *segment) { fix_endian_u16(&segment->source_port); fix_endian_u16(&segment->destination_port); fix_endian_u16(&segment->length); } inline void print_udp(UDP_Packet *segment) { main_log.printf("UDP Packet:"); main_log.printf(" Source: PORT %d", segment->source_port); main_log.printf(" Dest: PORT %d", segment->destination_port); main_log.printf(" Length: %d", segment->length); } #endif