Hi everyone,
I am tracing packets at the Physical Layer as follows -
template <int node>
void MonitorRx(Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber,
uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu
,struct signalNoiseDbm signalNoise)
{
static long int count = 1;
std::stringstream ss;
ss << "SniffRx-"<<node<<".log"; //Node ID (IP = N.ID + 1)
static std::fstream f (ss.str().c_str(), std::ios::out);
f << "Packet Number - " << count << ":\n";
f << "Packet Size: " << packet->GetSize() << std::endl;
f << "Channel Number: " << channelNumber << std::endl;
f << "\n";
count++;
}
int main()
{
.
.
.
Config::ConnectWithoutContext("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MonitorSnifferRx",MakeCallback(&MonitorRx<0>));
.
.
.
}
Through this scheme, I want to observe the SNR of packets being received at Node 0 (the AP) based on the source IP address of the packet. My question is - how can I extract the source IP address of from 'packet' in the MonitorRx() function? My understanding is that the header at the Physical Layer would have several encapsulated headers, so how do I access the IP header?
Thanks.