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