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.

Dependencies:   mbed

Committer:
etherealflaim
Date:
Tue Oct 12 06:21:05 2010 +0000
Revision:
4:88fc7fa58931
Parent:
0:d494b853ce97
Child:
6:66c4cd9073aa
More documentation updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
etherealflaim 0:d494b853ce97 1 #ifndef UTIL_H
etherealflaim 0:d494b853ce97 2 #define UTIL_H
etherealflaim 0:d494b853ce97 3
etherealflaim 0:d494b853ce97 4 #include "types.h"
etherealflaim 0:d494b853ce97 5 #include "log.h"
etherealflaim 0:d494b853ce97 6
etherealflaim 4:88fc7fa58931 7 /// Is any byte memory at start for bytes nonzero?
etherealflaim 0:d494b853ce97 8 inline bool is_nonzero_mem(u8 *start, unsigned int bytes)
etherealflaim 0:d494b853ce97 9 {
etherealflaim 0:d494b853ce97 10 for (; bytes--; ++start) if (*start) return true;
etherealflaim 0:d494b853ce97 11 return false;
etherealflaim 0:d494b853ce97 12 }
etherealflaim 0:d494b853ce97 13
etherealflaim 4:88fc7fa58931 14 /// Are all bytes at start for bytes zero?
etherealflaim 0:d494b853ce97 15 inline bool is_zero_mem(u8 *start, unsigned int bytes)
etherealflaim 0:d494b853ce97 16 {
etherealflaim 0:d494b853ce97 17 for (; bytes--; ++start) if (*start) return false;
etherealflaim 0:d494b853ce97 18 return true;
etherealflaim 0:d494b853ce97 19 }
etherealflaim 0:d494b853ce97 20
etherealflaim 4:88fc7fa58931 21 /// Are the memory locations at and and b equal for bytes?
etherealflaim 0:d494b853ce97 22 inline bool is_equal_mem(u8 *a, u8 *b, unsigned int bytes)
etherealflaim 0:d494b853ce97 23 {
etherealflaim 0:d494b853ce97 24 for (; bytes--; ++a, ++b) if (*a != *b) return false;
etherealflaim 0:d494b853ce97 25 return true;
etherealflaim 0:d494b853ce97 26 }
etherealflaim 0:d494b853ce97 27
etherealflaim 0:d494b853ce97 28 #endif