|
INET Framework for OMNeT++/OMNEST
|
#include <AnsaIP.h>
Public Member Functions | |
| AnsaIP () | |
Protected Member Functions | |
| virtual void | handlePacketFromNetwork (IPDatagram *datagram) |
| virtual void | initialize () |
| AnsaIP::AnsaIP | ( | ) | [inline] |
| 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.
{
INET_API IP::initialize();
}