#include <omnetpp.h>
#include "INETDefs.h"
#include "realtimescheduler.h"
#include "PacketParser.h"
Classes | |
class | RealworldConnector |
RealworldConnector is a pseudo interface that allows communcation with the real world through the TunOutScheduler. More... | |
Defines | |
#define | BUFFERZITE mtu + 4 |
Functions | |
u_short | cksum (uint16_t *buf, int nbytes) |
helper funcition needed for computing checksums |
#define BUFFERZITE mtu + 4 |
u_short cksum | ( | uint16_t * | buf, | |
int | nbytes | |||
) | [inline] |
helper funcition needed for computing checksums
buf | The buffer containing the data to be checksummed | |
nbytes | The length of the buffer in bytes |
00017 { 00018 register unsigned long sum; 00019 u_short oddbyte; 00020 00021 sum = 0; 00022 while (nbytes > 1) { 00023 sum += *buf++; 00024 nbytes -= 2; 00025 } 00026 00027 if (nbytes == 1) { 00028 oddbyte = 0; 00029 *((u_char *) &oddbyte) = *(u_char *) buf; 00030 sum += oddbyte; 00031 } 00032 00033 sum = (sum >> 16) + (sum & 0xffff); 00034 sum += (sum >> 16); 00035 00036 return ~sum; 00037 }