I am editing the AODV module in NS-3.
When a node forwards a data packet to the next node, I want my AODV module to listen to overhear next node's forwarding process to make sure it is forwarding it right.
The pcap file correctly sniffs next node's transmission, but I cannot get my hands on it from the AODV module.
I am guessing that the packet is being dropped since it is not supposed to be involved on it, thus I want to know how to change that.
Can anyone give me clues on where to look to change any relevant codes?
Thanks
Overhearing can be accomplished by hooking one of the Wi-Fi device trace sources. The MonitorSnifferRx in the WifiPhy object is probably what you want. There are two steps: 1) obtain a pointer to the Wi-Fi Phy somehow, and 2) attach a callback function to that trace source.
Step 1) is already mostly done in Aodv in an existing method:
From this point, you can get a Phy object pointer:
From here, you will want to use TraceConnectWithoutContext() to hook the trace souce, with a callback that has a matching function signature to what the MonitorSniffRx trace expects.
See how the Mac-level trace source "TxErrHeader" is similarly hooked in that same method.