RealworldConnector.h File Reference


Detailed Description

Author:
Stephan Krause

#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 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

Referenced by TunOutDevice::encapsulate().

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 }


Generated on Fri Sep 19 13:05:05 2008 for ITM OverSim by  doxygen 1.5.5