Calculates checksum.
More...
#include <TCPIPchecksum.h>
|
static uint16_t | checksum (const void *addr, unsigned int count) |
|
static uint16_t | _checksum (const void *addr, unsigned int count) |
|
static uint16_t | checksum (unsigned int protocolId, const void *packet, unsigned int packetLength, const void *addr, unsigned int addrLength) |
|
inet::serializer::TCPIPchecksum::TCPIPchecksum |
( |
| ) |
|
|
inline |
uint16_t inet::serializer::TCPIPchecksum::_checksum |
( |
const void * |
addr, |
|
|
unsigned int |
count |
|
) |
| |
|
static |
Referenced by checksum().
26 const unsigned char *addr =
static_cast<const unsigned char *
>(_addr);
30 sum += (addr[0] << 8) | addr[1];
33 sum = (sum & 0xFFFF) + (sum >> 16);
38 sum += *(
const uint8_t *)addr;
41 sum = (sum & 0xFFFF) + (sum >> 16);
int count(const std::vector< T > &v, const T &a)
Definition: stlutils.h:58
static uint16_t inet::serializer::TCPIPchecksum::checksum |
( |
const void * |
addr, |
|
|
unsigned int |
count |
|
) |
| |
|
inlinestatic |
Referenced by inet::serializer::ICMPSerializer::deserialize(), inet::serializer::ICMPv6Serializer::deserialize(), inet::serializer::IGMPSerializer::deserialize(), inet::serializer::UDPSerializer::deserialize(), inet::serializer::TCPSerializer::deserialize(), inet::serializer::IPv4Serializer::deserialize(), inet::tcp::TCP_NSC::handleIpInputMessage(), inet::serializer::ICMPSerializer::serialize(), inet::serializer::UDPSerializer::serialize(), inet::serializer::ICMPv6Serializer::serialize(), inet::serializer::IGMPSerializer::serialize(), inet::serializer::TCPSerializer::serialize(), and inet::serializer::IPv4Serializer::serialize().
int count(const std::vector< T > &v, const T &a)
Definition: stlutils.h:58
static uint16_t _checksum(const void *addr, unsigned int count)
Definition: TCPIPchecksum.cc:24
uint16_t inet::serializer::TCPIPchecksum::checksum |
( |
unsigned int |
protocolId, |
|
|
const void * |
packet, |
|
|
unsigned int |
packetLength, |
|
|
const void * |
addr, |
|
|
unsigned int |
addrLength |
|
) |
| |
|
static |
53 sum = (sum & 0xFFFF) + (sum >> 16);
55 return (uint16_t) ~sum;
static uint16_t _checksum(const void *addr, unsigned int count)
Definition: TCPIPchecksum.cc:24
The documentation for this class was generated from the following files: