00001 #ifndef UDP_H 00002 #define UDP_H 00003 00004 #include "ip.h" 00005 00006 struct udp_header { 00007 Xuint16 sport; 00008 Xuint16 dport; 00009 //using data and header for len 00010 Xuint16 len; 00011 Xuint16 chksum; 00012 }; 00013 00014 #define UDP_HEADER_OFFSET IP_PAYLOAD_OFFSET 00015 #define UDP_PAYLOAD_OFFSET UDP_HEADER_OFFSET + sizeof(struct udp_header) 00016 #define MAX_UDP_PAYLOAD MAX_IP_PAYLOAD - sizeof(struct udp_header) 00017 00018 #endif