#include <ErrorHandling.h>
Protected Member Functions | |
| virtual void | initialize () |
| virtual void | handleMessage (cMessage *msg) |
Protected Attributes | |
| long | numReceived |
Error Handling: print out received error
Definition at line 34 of file ErrorHandling.h.
| void ErrorHandling::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
Definition at line 37 of file ErrorHandling.cc.
{
numReceived++;
ICMPMessage *icmpMsg = check_and_cast<ICMPMessage *>(msg);
// Note: we must NOT use decapsulate() because payload in ICMP is conceptually truncated
IPDatagram *d = check_and_cast<IPDatagram *>(icmpMsg->getEncapsulatedMsg());
EV << "Error Handler: ICMP message received:\n";
EV << " Type: " << (int)icmpMsg->getType()
<< " Code: " << (int)icmpMsg->getCode()
<< " Bytelength: " << d->getByteLength()
<< " Src: " << d->getSrcAddress()
<< " Dest: " << d->getDestAddress()
<< " Time: " << simTime()
<< "\n";
delete icmpMsg;
if (ev.isGUI())
{
char buf[80];
sprintf(buf, "errors: %ld", numReceived);
getDisplayString().setTagArg("t",0,buf);
}
}
| void ErrorHandling::initialize | ( | ) | [protected, virtual] |
Definition at line 31 of file ErrorHandling.cc.
{
numReceived = 0;
WATCH(numReceived);
}
long ErrorHandling::numReceived [protected] |
Definition at line 37 of file ErrorHandling.h.
Referenced by handleMessage(), and initialize().
1.7.1