1 /* Copyright (c) 2010 The Regents of the University of California
2 * Barret Rhoden <brho@cs.berkeley.edu>
3 * See LICENSE for details.
5 * Arch independent networking infrastructure */
10 #include <bits/netinet.h>
13 /* A few other useful standard defines. Note the IP header can change size. */
16 #define IP_ETH_TYPE 0x0800
19 #define DEFAULT_TTL 64
21 /* Don't forget the bytes are in network order */
26 /* might be an optional 802.1q tag here */
29 /* For the bit-enumerated fields, note that you need to read "backwards" through
30 * the byte (first bits in memory are the "LSB" of the byte). Can't seem to be
31 * able to do it with flags/fragments (3/13 bits each...). */
44 /* Options could be here (depends on the hdr length) */
45 } __attribute__((packed));
54 uint16_t __ip_checksum(void *buf, unsigned int len, uint32_t sum);
55 uint16_t ip_checksum(struct ip_hdr *ip_hdr);
56 uint16_t udp_checksum(struct ip_hdr *ip_hdr, struct udp_hdr *udp_hdr);
58 // TODO: Move this to a better location
59 void dumppacket(unsigned char *buff, size_t len);
60 #endif /* ROS_KERN_NET_H */