Classes | Defines | Functions

RealworldConnector.h File Reference

#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

Detailed Description

Author:
Stephan Krause

Definition in file RealworldConnector.h.


Define 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:
buf The buffer containing the data to be checksummed
nbytes The 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;
}