I want to access the WiFiPhy inside the reception callback of NetDevice with signature.
typedef Callback< bool, Ptr<NetDevice>, Ptr<const Packet>, uint16_t, const Address & > ReceiveCallback;
Inside the callback, i'm the the casting the NetDevice to WiFiDevice like to WiFiPhy functions.
Ptr<WifiNetDevice> wifiNetDevice = DynamicCast<WifiNetDevice>(device);
Ptr<WifiPhy> wifiPhyDev = wifiNetDevice->GetPhy();
But I am getting a segmentation fault during the run ? What actually im doing wrong here?
Thanks
Ok i found it.. when you create a NetDeviceContainer the object is of type NetDevice which does not have any WifiPhy. The solution is to DynamicCast it into WifiNetDevice and send the frame.
Ptr<WifiNetDevice> wifiNetDevice = DynamicCast<WifiNetDevice>(netDevice);