RealworldConnector.h File Reference

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


Generated on Fri May 11 14:52:39 2007 for ITM OverSim by  doxygen 1.4.7