#include <IPv6ErrorHandling.h>
Protected Member Functions | |
virtual void | initialize () |
virtual void | handleMessage (cMessage *msg) |
virtual void | displayType1Msg (int code) |
virtual void | displayType2Msg () |
virtual void | displayType3Msg (int code) |
virtual void | displayType4Msg (int code) |
Error Handling: print out received error for IPv6
Definition at line 36 of file IPv6ErrorHandling.h.
void IPv6ErrorHandling::displayType1Msg | ( | int | code | ) | [protected, virtual] |
Definition at line 85 of file IPv6ErrorHandling.cc.
Referenced by handleMessage().
{ EV << "Destination Unreachable: "; if (code == 0) EV << "no route to destination\n"; else if (code == 1) EV << "communication with destination administratively prohibited\n"; else if (code == 3) EV << "address unreachable\n"; else if (code == 4) EV << "port unreachable\n"; else EV << "Unknown Error Code!\n"; }
void IPv6ErrorHandling::displayType2Msg | ( | ) | [protected, virtual] |
Definition at line 100 of file IPv6ErrorHandling.cc.
Referenced by handleMessage().
{ EV << "Packet Too Big" << endl; //Code is always 0 and ignored by the receiver. }
void IPv6ErrorHandling::displayType3Msg | ( | int | code | ) | [protected, virtual] |
Definition at line 106 of file IPv6ErrorHandling.cc.
Referenced by handleMessage().
void IPv6ErrorHandling::displayType4Msg | ( | int | code | ) | [protected, virtual] |
Definition at line 117 of file IPv6ErrorHandling.cc.
Referenced by handleMessage().
void IPv6ErrorHandling::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
Definition at line 35 of file IPv6ErrorHandling.cc.
{ ICMPv6Message *icmpv6Msg = check_and_cast<ICMPv6Message *>(msg); IPv6Datagram *d = check_and_cast<IPv6Datagram *>(icmpv6Msg->getEncapsulatedMsg()); int type = (int)icmpv6Msg->getType(); int code; EV << " Type: " << type; if (dynamic_cast<ICMPv6DestUnreachableMsg *>(icmpv6Msg)) { ICMPv6DestUnreachableMsg *msg2 = (ICMPv6DestUnreachableMsg *)icmpv6Msg; code = msg2->getCode(); EV << " Code: " << code; } else if (dynamic_cast<ICMPv6PacketTooBigMsg *>(icmpv6Msg)) { ICMPv6PacketTooBigMsg *msg2 = (ICMPv6PacketTooBigMsg *)icmpv6Msg; code = 0; } else if (dynamic_cast<ICMPv6TimeExceededMsg *>(icmpv6Msg)) { ICMPv6TimeExceededMsg *msg2 = (ICMPv6TimeExceededMsg *)icmpv6Msg; code = msg2->getCode(); EV << " Code: " << code; } else if (dynamic_cast<ICMPv6ParamProblemMsg *>(icmpv6Msg)) { ICMPv6ParamProblemMsg *msg2 = (ICMPv6ParamProblemMsg *)icmpv6Msg; code = msg2->getCode(); EV << " Code: " << code; } EV << " Byte length: " << d->getByteLength() << " Src: " << d->getSrcAddress() << " Dest: " << d->getDestAddress() << " Time: " << simTime() << "\n"; if (type == 1) displayType1Msg(code); else if (type == 2) displayType2Msg(); else if (type == 3) displayType3Msg(code); else if (type == 4) displayType4Msg(code); else EV << "Unknown Error Type!" << endl; delete icmpv6Msg; }
void IPv6ErrorHandling::initialize | ( | ) | [protected, virtual] |
Definition at line 31 of file IPv6ErrorHandling.cc.
{ }