#include <omnetpp.h>
#include "INETDefs.h"
#include "realtimescheduler.h"
#include "PacketParser.h"
Go to the source code of this file.
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 |
Definition in file RealworldConnector.h.
#define BUFFERZITE mtu + 4 |
Definition at line 72 of file RealworldConnector.h.
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 |
Definition at line 39 of file RealworldConnector.h.
00040 { 00041 register unsigned long sum; 00042 u_short oddbyte; 00043 00044 sum = 0; 00045 while (nbytes > 1) { 00046 sum += *buf++; 00047 nbytes -= 2; 00048 } 00049 00050 if (nbytes == 1) { 00051 oddbyte = 0; 00052 *((u_char *) &oddbyte) = *(u_char *) buf; 00053 sum += oddbyte; 00054 } 00055 00056 sum = (sum >> 16) + (sum & 0xffff); 00057 sum += (sum >> 16); 00058 00059 return ~sum; 00060 }