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

util/util.h

Committer:
etherealflaim
Date:
2010-10-12
Revision:
4:88fc7fa58931
Parent:
0:d494b853ce97
Child:
6:66c4cd9073aa

File content as of revision 4:88fc7fa58931:

#ifndef UTIL_H
#define UTIL_H

#include "types.h"
#include "log.h"

/// Is any byte memory at start for bytes nonzero?
inline bool is_nonzero_mem(u8 *start, unsigned int bytes)
{
  for (; bytes--; ++start) if (*start) return true;
  return false;
}

/// Are all bytes at start for bytes zero?
inline bool is_zero_mem(u8 *start, unsigned int bytes)
{
  for (; bytes--; ++start) if (*start) return false;
  return true;
}

/// Are the memory locations at and and b equal for bytes?
inline bool is_equal_mem(u8 *a, u8 *b, unsigned int bytes)
{
  for (; bytes--; ++a, ++b) if (*a != *b) return false;
  return true;
}

#endif