#include "realtimescheduler.h"
#include <omnetpp.h>
#include "INETDefs.h"
#include "PacketParser.h"
Go to the source code of this file.
Functions |
u_short | cksum (uint16_t *buf, int nbytes) |
| helper funcition needed for computing checksums
|
Detailed Description
- Author
- Stephan Krause
Definition in file RealworldConnector.h.
Macro Definition Documentation
#define BUFFERZITE mtu + 4 |
Function Documentation
u_short cksum |
( |
uint16_t * |
buf, |
|
|
int |
nbytes |
|
) |
| |
|
inline |
helper funcition needed for computing checksums
- Parameters
-
buf | The buffer containing the data to be checksummed |
nbytes | The length of the buffer in bytes |
- Returns
- the Checksum
Definition at line 39 of file RealworldConnector.h.
{
register unsigned long sum;
u_short oddbyte;
sum = 0;
while (nbytes > 1) {
sum += *buf++;
nbytes -= 2;
}
if (nbytes == 1) {
oddbyte = 0;
*((u_char *) &oddbyte) = *(u_char *) buf;
sum += oddbyte;
}
sum = (sum >> 16) + (sum & 0xffff);
sum += (sum >> 16);
return ~sum;
}