Build error when registering Promiscuous callback to wifi-net-device

30 views
Skip to first unread message

Jude Niroshan

unread,
Jul 9, 2018, 2:11:46 PM7/9/18
to ns-3-users
I have the following promiscuous function. This is just to check whether this function is being called once a packet is being received to a particular node.

bool AodvExample::PromiscuousReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType)
{
  NS_LOG_FUNCTION (device << packet << protocol << &from << &to << packetType);
  bool found = false;

  return found;
}

Then in my example device installation place;

  Ptr<ns3::Node> firstNode = nodes.Get(1);

  firstNode->GetDevice(0)->SetPromiscReceiveCallback(ns3::MakeCallback(&ReceiveFromDevice));

But I'm getting the following build error saying that parameters are not matching for the callback function.


../scratch/trust-aodv-test.cc:244:114: error: no matching function for call to ‘MakeCallback(bool (AodvExample::*)(ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, uint16_t, const ns3::Address&, const ns3::Address&, ns3::NetDevice::PacketType))’
   firstNode->GetDevice(0)->SetPromiscReceiveCallback(ns3::MakeCallback(&AodvExample::PromiscuousReceiveFromDevice));
                                                                                                                  ^
In file included from ./ns3/trace-source-accessor.h:24:0,
                 from ./ns3/type-id.h:25,
                 from ./ns3/object-base.h:23,
                 from ./ns3/object.h:29,
                 from ./ns3/object-factory.h:24,
                 from ./ns3/simulator.h:29,
                 from ./ns3/aodv-id-cache.h:33,
                 from ./ns3/aodv-dpd.h:26,
                 from ./ns3/aodv-module.h:10,
                 from ../scratch/trust-aodv-test.cc:25:
./ns3/callback.h:1489:13: note: candidate: template<class T, class OBJ, class R> ns3::Callback<R> ns3::MakeCallback(R (T::*)(), OBJ)
 Callback<R> MakeCallback (R (T::*memPtr)(void), OBJ objPtr) {
             ^
./ns3/callback.h:1489:13: note:   template argument deduction/substitution failed:
../scratch/trust-aodv-test.cc:244:114: note:   candidate expects 1 argument, 7 provided
   firstNode->GetDevice(0)->SetPromiscReceiveCallback(ns3::MakeCallback(&AodvExample::PromiscuousReceiveFromDevice));

Any help would be greatly appreciated!
Reply all
Reply to author
Forward
0 new messages