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:48:59 2010 +0000
Revision:
8:1c1f6ce348c6
Parent:
6:66c4cd9073aa
Documentation

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 6:66c4cd9073aa 7 /**
etherealflaim 6:66c4cd9073aa 8 \file util.h
etherealflaim 6:66c4cd9073aa 9 \brief Primary utility header
etherealflaim 6:66c4cd9073aa 10
etherealflaim 6:66c4cd9073aa 11 In addition to providing some utility functions, this file also includes
etherealflaim 6:66c4cd9073aa 12 the other utility headers automatically.
etherealflaim 6:66c4cd9073aa 13 */
etherealflaim 6:66c4cd9073aa 14
etherealflaim 4:88fc7fa58931 15 /// Is any byte memory at start for bytes nonzero?
etherealflaim 0:d494b853ce97 16 inline bool is_nonzero_mem(u8 *start, unsigned int bytes)
etherealflaim 0:d494b853ce97 17 {
etherealflaim 0:d494b853ce97 18 for (; bytes--; ++start) if (*start) return true;
etherealflaim 0:d494b853ce97 19 return false;
etherealflaim 0:d494b853ce97 20 }
etherealflaim 0:d494b853ce97 21
etherealflaim 4:88fc7fa58931 22 /// Are all bytes at start for bytes zero?
etherealflaim 0:d494b853ce97 23 inline bool is_zero_mem(u8 *start, unsigned int bytes)
etherealflaim 0:d494b853ce97 24 {
etherealflaim 0:d494b853ce97 25 for (; bytes--; ++start) if (*start) return false;
etherealflaim 0:d494b853ce97 26 return true;
etherealflaim 0:d494b853ce97 27 }
etherealflaim 0:d494b853ce97 28
etherealflaim 4:88fc7fa58931 29 /// Are the memory locations at and and b equal for bytes?
etherealflaim 0:d494b853ce97 30 inline bool is_equal_mem(u8 *a, u8 *b, unsigned int bytes)
etherealflaim 0:d494b853ce97 31 {
etherealflaim 0:d494b853ce97 32 for (; bytes--; ++a, ++b) if (*a != *b) return false;
etherealflaim 0:d494b853ce97 33 return true;
etherealflaim 0:d494b853ce97 34 }
etherealflaim 0:d494b853ce97 35
etherealflaim 0:d494b853ce97 36 #endif