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: util/util.h
- Revision:
- 0:d494b853ce97
- Child:
- 4:88fc7fa58931
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/util/util.h Tue Oct 12 05:32:59 2010 +0000 @@ -0,0 +1,25 @@ +#ifndef UTIL_H +#define UTIL_H + +#include "types.h" +#include "log.h" + +inline bool is_nonzero_mem(u8 *start, unsigned int bytes) +{ + for (; bytes--; ++start) if (*start) return true; + return false; +} + +inline bool is_zero_mem(u8 *start, unsigned int bytes) +{ + for (; bytes--; ++start) if (*start) return false; + return true; +} + +inline bool is_equal_mem(u8 *a, u8 *b, unsigned int bytes) +{ + for (; bytes--; ++a, ++b) if (*a != *b) return false; + return true; +} + +#endif \ No newline at end of file