Protected Member Functions | Protected Attributes

ErrorHandling Class Reference

#include <ErrorHandling.h>

List of all members.

Protected Member Functions

virtual void initialize ()
virtual void handleMessage (cMessage *msg)

Protected Attributes

long numReceived

Detailed Description

Error Handling: print out received error

Definition at line 34 of file ErrorHandling.h.


Member Function Documentation

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);
}


Member Data Documentation

long ErrorHandling::numReceived [protected]

Definition at line 37 of file ErrorHandling.h.

Referenced by handleMessage(), and initialize().


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