This is a replay method I implemented into AODVRouting.cc (already in inet). When I launch the simulation, it runs for a little while but then I get this error:
check_and_cast(): cannot cast NULL pointer to type 'IPv4ControlInfo *'
This is my method:
void AODVRouting::Replay (cMessage *msg)
{
std::cout<<"Mal Host Activity"<<endl;
EV <<"Mal Host Activity \n";
this->bubble("Replaying...");
this->host->setDisplayString("i=misc/node,red");
cMessage *ReplayMsg = msg->dup();
std::cout<<"Done Duplicating MSG"<<endl;
EV<<"Done Duplicating MSG \n";
//we can add a delay before sending the copy of the message again (10 time units)
//scheduleAt(simTime() + 1, ReplayMsg);
send(ReplayMsg, "ipOut");
//sendDelayed(ReplayMsg, 0.01,"ipOut");
std::cout<<"Launched Replayed Packet!\n";
EV<<"Launched Replayed Packet!\n";
this->bubble("Attack");
}
Any ideas how to fix the error?
It seems that ipv4address was pointing to a null factor - packet is destroyed prior to reaching the command I'm attempting. I found a fix by referring to the index instead of the IP using: getIndex()