0

I'm using NS-3 v3.28.1 to simulation a WiFi Mesh network. The grid topology (actually only one line, with IEEE 802.11s stack installed at each node, HWMP protocol) contains 3 WiFi Mesh nodes, Node0, Node1 and Node2. Then I bind a UDP socket (acting as receiver) in Node0, and another (acting as sender) in Node2. Node2 send a UDP packet to Node0 through Node1 every 10ms. The topology as follow:

Node0 (receiver) <--- Node1 <---- Node2 (sender)

10.1.1.1/24              10.1.1.2/24      10.1.1.3/24

Then I set a MonitorSnifferRx function on Node1 to listen udp packets sent from Node2 to Node0 using Config::ConnectWithoutContext:

Config::ConnectWithoutContext ("/NodeList/1/DeviceList/*/Phy/MonitorSnifferRx", MakeCallback (&DecodeRxPktCB));

In Node1 callback function DecodeRxPktCB, I can decode the udp packet sent from Node2 to Node0.

My question is : when a specific UDP packet captured (with content match some rules) in Node1's MonitorSnifferRx callback function, how can I drop it thus it will not transfer to Node0? I see that the first parameter in MonitorSnifferRx callback function is "Ptr< const Packet > packet", with const value only can read.

Anton Menshov
  • 2,266
  • 14
  • 34
  • 55

1 Answers1

0

You can use the NS-3 Packet class to grab the information you need and filter it.

If you can, I'd recommend adding a packet tag (or ByteTag) on the sender, making it easier for your middle node to filter it. Packet tag details are also on the link above.

thenewjames
  • 966
  • 2
  • 14
  • 25