Merge branch 'master' into topic/jsiwek/mobile-ipv6

Conflicts:
	src/IP.cc
This commit is contained in:
Jon Siwek 2012-04-05 12:05:06 -05:00
commit 29724415c3
78 changed files with 4199 additions and 1169 deletions

View file

@ -5,6 +5,13 @@
#include "config.h"
// Define first.
typedef enum {
TRANSPORT_UNKNOWN, TRANSPORT_TCP, TRANSPORT_UDP, TRANSPORT_ICMP,
} TransportProto;
typedef enum { IPv4, IPv6 } IPFamily;
#include <assert.h>
#include <sys/types.h>
@ -21,7 +28,6 @@
#include <netinet/ip_icmp.h>
#include "util.h"
#include "IPAddr.h"
#ifdef HAVE_NETINET_IP6_H
#include <netinet/ip6.h>
@ -58,15 +64,12 @@ inline int seq_delta(uint32 a, uint32 b)
return int(a-b);
}
class IPAddr;
// Returns the ones-complement checksum of a chunk of b short-aligned bytes.
extern int ones_complement_checksum(const void* p, int b, uint32 sum);
inline int ones_complement_checksum(const IPAddr& a, uint32 sum)
{
const uint32* bytes;
int len = a.GetBytes(&bytes);
return ones_complement_checksum(bytes, len*4, sum);
}
extern int ones_complement_checksum(const IPAddr& a, uint32 sum);
extern int icmp_checksum(const struct icmp* icmpp, int len);