How to set a callback for packet drops of ping requests?

20 Views Asked by At

I'm trying to create a callback function for dropped ping requests in my simulation. Below is how I try to that.

void DropCallback(uint16_t seq, Ping::DropReason reason)
{
    std::cout << "Drop called!" << std::endl;
}

void AodvExample::InstallApplications()
{
    PingHelper ping(interfaces.GetAddress(size - 1));
    ping.SetAttribute("VerboseMode", EnumValue(Ping::VerboseMode::VERBOSE));

    ApplicationContainer p = ping.Install(nodes.Get(0));
    p.Start(Seconds(0));
    p.Stop(Seconds(totalTime) - Seconds(0.001));

    Config::Connect("/NodeList/*/ApplicationList/*/$ns3::Ping", MakeCallback(&DropCallback));

    // ... 
}

Although this program compiles, it fails at run-time while trying to connect the callback to the given method. The error prompt is as below.

msg="Could not connect callback to /NodeList//ApplicationList//$ns3::Ping", +0.000000000s -1 file=ns-3.40/src/core/model/config.cc, line=979 NS_FATAL, terminating

What do you think the problem is? How should I approach it?


The code I'm trying to modify can be found in here.

0

There are 0 best solutions below