OverSim
RealworldConnector.h File Reference
#include "realtimescheduler.h"
#include <omnetpp.h>
#include "INETDefs.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...

Macros

#define BUFFERZITE   mtu + 4

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

Definition at line 72 of file RealworldConnector.h.

Function Documentation

u_short cksum ( uint16_t *  buf,
int  nbytes 
)
inline

helper funcition needed for computing checksums

Parameters
bufThe buffer containing the data to be checksummed
nbytesThe 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;
}