|
|
| 54 |
|
54 |
|
| 55 |
|
55 |
|
| 56 |
void TxCallback(Ptr<CounterCalculator<uint32_t> > datac, |
56 |
void TxCallback(Ptr<CounterCalculator<uint32_t> > datac, |
| 57 |
std::string path, Ptr<const Packet> packet, |
57 |
std::string path, Ptr<const Packet> packet) { |
| 58 |
Mac48Address realto) { |
58 |
NS_LOG_INFO("Sent frame counted in " << |
| 59 |
NS_LOG_INFO("Sent frame to " << realto << "; counted in " << |
|
|
| 60 |
datac->GetKey()); |
59 |
datac->GetKey()); |
| 61 |
datac->Update(); |
60 |
datac->Update(); |
| 62 |
// end TxCallback |
61 |
// end TxCallback |
|
|
| 201 |
Ptr<CounterCalculator<uint32_t> > totalTx = |
200 |
Ptr<CounterCalculator<uint32_t> > totalTx = |
| 202 |
CreateObject<CounterCalculator<uint32_t> >(); |
201 |
CreateObject<CounterCalculator<uint32_t> >(); |
| 203 |
totalTx->SetKey("wifi-tx-frames"); |
202 |
totalTx->SetKey("wifi-tx-frames"); |
| 204 |
Config::Connect("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Tx", |
203 |
Config::Connect("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTx", |
| 205 |
MakeBoundCallback(&TxCallback, totalTx)); |
204 |
MakeBoundCallback(&TxCallback, totalTx)); |
| 206 |
data.AddDataCalculator(totalTx); |
205 |
data.AddDataCalculator(totalTx); |
| 207 |
|
206 |
|
|
|
| 212 |
Ptr<PacketCounterCalculator> totalRx = |
211 |
Ptr<PacketCounterCalculator> totalRx = |
| 213 |
CreateObject<PacketCounterCalculator>(); |
212 |
CreateObject<PacketCounterCalculator>(); |
| 214 |
totalRx->SetKey("wifi-rx-frames"); |
213 |
totalRx->SetKey("wifi-rx-frames"); |
| 215 |
Config::Connect("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Rx", |
214 |
Config::Connect("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRx", |
| 216 |
MakeCallback(&PacketCounterCalculator::FrameUpdate, |
215 |
MakeCallback(&PacketCounterCalculator::PacketUpdate, |
| 217 |
totalRx)); |
216 |
totalRx)); |
| 218 |
data.AddDataCalculator(totalRx); |
217 |
data.AddDataCalculator(totalRx); |
| 219 |
|
218 |
|
| 220 |
|
219 |
|