INET Framework for OMNeT++/OMNEST
AnsaIP Class Reference

#include <AnsaIP.h>

Inheritance diagram for AnsaIP:
IP QueueBase AbstractQueue

List of all members.

Public Member Functions

 AnsaIP ()

Protected Member Functions

virtual void handlePacketFromNetwork (IPDatagram *datagram)
virtual void initialize ()

Detailed Description

Implements the IP protocol.

Definition at line 48 of file AnsaIP.h.


Constructor & Destructor Documentation

AnsaIP::AnsaIP ( ) [inline]

Definition at line 59 of file AnsaIP.h.

{}

Member Function Documentation

void AnsaIP::handlePacketFromNetwork ( IPDatagram datagram) [protected, virtual]

Handle IPDatagram messages arriving from lower layer. Decrements TTL, then invokes routePacket().

Reimplemented from IP.

Definition at line 38 of file AnsaIP.cc.

{
    //
    // "Prerouting"
    //

    // check for header biterror
    if (datagram->hasBitError())
    {
        // probability of bit error in header = size of header / size of total message
        // (ignore bit error if in payload)
        double relativeHeaderLength = datagram->getHeaderLength() / (double)datagram->getByteLength();
        if (dblrand() <= relativeHeaderLength)
        {
            EV << "bit error found, sending ICMP_PARAMETER_PROBLEM\n";
            icmpAccess.get()->sendErrorMessage(datagram, ICMP_PARAMETER_PROBLEM, 0);
            return;
        }
    }

    // remove control info
    //if (datagram->getTransportProtocol()!=IP_PROT_DSR && datagram->getTransportProtocol()!=IP_PROT_MANET)
    //{
    //    delete datagram->removeControlInfo();
    //}
    if (datagram->getMoreFragments()) delete datagram->removeControlInfo(); // delete all control message except the last

    // hop counter decrement; FIXME but not if it will be locally delivered
    datagram->setTimeToLive(datagram->getTimeToLive()-1);

    // FIXME send IGMP packet to IGMP module 
    if (datagram->getTransportProtocol() == IP_PROT_IGMP)
    {
        cPacket *packet = decapsulateIP(datagram);
        send(packet, "transportOut", mapping.getOutputGateForProtocol(IP_PROT_IGMP));
        return;
    }

    // send PIM packet to PIM module
    if (datagram->getTransportProtocol() == IP_PROT_PIM)
        {
                cPacket *packet = decapsulateIP(datagram);
                send(packet, "transportOut", mapping.getOutputGateForProtocol(IP_PROT_PIM));
        return;
        }
        
    // route packet
    if (!datagram->getDestAddress().isMulticast())
        routePacket(datagram, NULL, false);
    else
        routeMulticastPacket(datagram, NULL, getSourceInterfaceFrom(datagram));
}
void AnsaIP::initialize ( ) [protected, virtual]

Initialization

Reimplemented from IP.

Definition at line 33 of file AnsaIP.cc.


The documentation for this class was generated from the following files: