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.
util.h
00001 #ifndef UTIL_H 00002 #define UTIL_H 00003 00004 #include "types.h" 00005 #include "log.h" 00006 00007 /** 00008 \file util.h 00009 \brief Primary utility header 00010 00011 In addition to providing some utility functions, this file also includes 00012 the other utility headers automatically. 00013 */ 00014 00015 /// Is any byte memory at start for bytes nonzero? 00016 inline bool is_nonzero_mem(u8 *start, unsigned int bytes) 00017 { 00018 for (; bytes--; ++start) if (*start) return true; 00019 return false; 00020 } 00021 00022 /// Are all bytes at start for bytes zero? 00023 inline bool is_zero_mem(u8 *start, unsigned int bytes) 00024 { 00025 for (; bytes--; ++start) if (*start) return false; 00026 return true; 00027 } 00028 00029 /// Are the memory locations at and and b equal for bytes? 00030 inline bool is_equal_mem(u8 *a, u8 *b, unsigned int bytes) 00031 { 00032 for (; bytes--; ++a, ++b) if (*a != *b) return false; 00033 return true; 00034 } 00035 00036 #endif
Generated on Tue Jul 12 2022 11:59:40 by 1.7.2