Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2008 INRIA | 3 * Copyright (c) 2008 INRIA |
4 * Copyright (c) 2009 MIRKO BANCHI | 4 * Copyright (c) 2009 MIRKO BANCHI |
5 * | 5 * |
6 * This program is free software; you can redistribute it and/or modify | 6 * This program is free software; you can redistribute it and/or modify |
7 * it under the terms of the GNU General Public License version 2 as | 7 * it under the terms of the GNU General Public License version 2 as |
8 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
9 * | 9 * |
10 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 | 200 |
201 header.SetFrameFlags (frameFlags); | 201 header.SetFrameFlags (frameFlags); |
202 | 202 |
203 uint32_t rate; | 203 uint32_t rate; |
204 if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT || tx Vector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT || txVector.GetMod e ().GetModulationClass () == WIFI_MOD_CLASS_HE) | 204 if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT || tx Vector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT || txVector.GetMod e ().GetModulationClass () == WIFI_MOD_CLASS_HE) |
205 { | 205 { |
206 rate = 128 + txVector.GetMode ().GetMcsValue (); | 206 rate = 128 + txVector.GetMode ().GetMcsValue (); |
207 } | 207 } |
208 else | 208 else |
209 { | 209 { |
210 rate = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1) * txVector.GetNss () / 500000; | 210 rate = static_cast<uint32_t>(txVector.GetMode ().GetDataRate (txVect or.GetChannelWidth (), txVector.GetGuardInterval (), 1) * txVector.GetNss () / 5 00000); |
S. Deronne
2017/12/23 10:19:58
I do not have a direct solution for that, I notice
| |
211 } | 211 } |
212 header.SetRate (rate); | 212 header.SetRate (static_cast<uint8_t>(rate)); |
213 | 213 |
214 uint16_t channelFlags = 0; | 214 uint16_t channelFlags = 0; |
215 switch (rate) | 215 switch (rate) |
216 { | 216 { |
217 case 2: //1Mbps | 217 case 2: //1Mbps |
218 case 4: //2Mbps | 218 case 4: //2Mbps |
219 case 10: //5Mbps | 219 case 10: //5Mbps |
220 case 22: //11Mbps | 220 case 22: //11Mbps |
221 channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK; | 221 channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK; |
222 break; | 222 break; |
(...skipping 14 matching lines...) Expand all Loading... | |
237 | 237 |
238 header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags); | 238 header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags); |
239 | 239 |
240 if (preamble == WIFI_PREAMBLE_HT_MF || preamble == WIFI_PREAMBLE_HT_GF | | preamble == WIFI_PREAMBLE_NONE) | 240 if (preamble == WIFI_PREAMBLE_HT_MF || preamble == WIFI_PREAMBLE_HT_GF | | preamble == WIFI_PREAMBLE_NONE) |
241 { | 241 { |
242 uint8_t mcsRate = 0; | 242 uint8_t mcsRate = 0; |
243 uint8_t mcsKnown = RadiotapHeader::MCS_KNOWN_NONE; | 243 uint8_t mcsKnown = RadiotapHeader::MCS_KNOWN_NONE; |
244 uint8_t mcsFlags = RadiotapHeader::MCS_FLAGS_NONE; | 244 uint8_t mcsFlags = RadiotapHeader::MCS_FLAGS_NONE; |
245 | 245 |
246 mcsKnown |= RadiotapHeader::MCS_KNOWN_INDEX; | 246 mcsKnown |= RadiotapHeader::MCS_KNOWN_INDEX; |
247 mcsRate = rate - 128; | 247 mcsRate = static_cast<uint8_t>(rate - 128); |
248 | 248 |
249 mcsKnown |= RadiotapHeader::MCS_KNOWN_BANDWIDTH; | 249 mcsKnown |= RadiotapHeader::MCS_KNOWN_BANDWIDTH; |
250 if (txVector.GetChannelWidth () == 40) | 250 if (txVector.GetChannelWidth () == 40) |
251 { | 251 { |
252 mcsFlags |= RadiotapHeader::MCS_FLAGS_BANDWIDTH_40; | 252 mcsFlags |= RadiotapHeader::MCS_FLAGS_BANDWIDTH_40; |
253 } | 253 } |
254 | 254 |
255 mcsKnown |= RadiotapHeader::MCS_KNOWN_GUARD_INTERVAL; | 255 mcsKnown |= RadiotapHeader::MCS_KNOWN_GUARD_INTERVAL; |
256 if (txVector.GetGuardInterval () == 400) | 256 if (txVector.GetGuardInterval () == 400) |
257 { | 257 { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 /* For PCAP file, MPDU Delimiter and Padding should be removed by th e MAC Driver */ | 292 /* For PCAP file, MPDU Delimiter and Padding should be removed by th e MAC Driver */ |
293 AmpduSubframeHeader hdr; | 293 AmpduSubframeHeader hdr; |
294 uint32_t extractedLength; | 294 uint32_t extractedLength; |
295 p->RemoveHeader (hdr); | 295 p->RemoveHeader (hdr); |
296 extractedLength = hdr.GetLength (); | 296 extractedLength = hdr.GetLength (); |
297 p = p->CreateFragment (0, static_cast<uint32_t> (extractedLength)); | 297 p = p->CreateFragment (0, static_cast<uint32_t> (extractedLength)); |
298 if (aMpdu.type == LAST_MPDU_IN_AGGREGATE || (hdr.GetEof () == true & & hdr.GetLength () > 0)) | 298 if (aMpdu.type == LAST_MPDU_IN_AGGREGATE || (hdr.GetEof () == true & & hdr.GetLength () > 0)) |
299 { | 299 { |
300 ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST; | 300 ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST; |
301 } | 301 } |
302 header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, hdr.Ge tCrc ()); | 302 header.SetAmpduStatus (static_cast<uint32_t>(aMpdu.mpduRefNumber), a mpduStatusFlags, hdr.GetCrc ()); |
303 } | 303 } |
304 | 304 |
305 if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) | 305 if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) |
306 { | 306 { |
307 uint16_t vhtKnown = RadiotapHeader::VHT_KNOWN_NONE; | 307 uint16_t vhtKnown = RadiotapHeader::VHT_KNOWN_NONE; |
308 uint8_t vhtFlags = RadiotapHeader::VHT_FLAGS_NONE; | 308 uint8_t vhtFlags = RadiotapHeader::VHT_FLAGS_NONE; |
309 uint8_t vhtBandwidth = 0; | 309 uint8_t vhtBandwidth = 0; |
310 uint8_t vhtMcsNss[4] = {0,0,0,0}; | 310 uint8_t vhtMcsNss[4] = {0,0,0,0}; |
311 uint8_t vhtCoding = 0; | 311 uint8_t vhtCoding = 0; |
312 uint8_t vhtGroupId = 0; | 312 uint8_t vhtGroupId = 0; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 | 401 |
402 header.SetFrameFlags (frameFlags); | 402 header.SetFrameFlags (frameFlags); |
403 | 403 |
404 uint32_t rate; | 404 uint32_t rate; |
405 if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT || tx Vector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT || txVector.GetMod e ().GetModulationClass () == WIFI_MOD_CLASS_HE) | 405 if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT || tx Vector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT || txVector.GetMod e ().GetModulationClass () == WIFI_MOD_CLASS_HE) |
406 { | 406 { |
407 rate = 128 + txVector.GetMode ().GetMcsValue (); | 407 rate = 128 + txVector.GetMode ().GetMcsValue (); |
408 } | 408 } |
409 else | 409 else |
410 { | 410 { |
411 rate = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1) * txVector.GetNss () / 500000; | 411 rate = static_cast<uint32_t>(txVector.GetMode ().GetDataRate (txVect or.GetChannelWidth (), txVector.GetGuardInterval (), 1) * txVector.GetNss () / 5 00000); |
412 } | 412 } |
413 header.SetRate (rate); | 413 header.SetRate (static_cast<uint8_t>(rate)); |
414 | 414 |
415 uint16_t channelFlags = 0; | 415 uint16_t channelFlags = 0; |
416 switch (rate) | 416 switch (rate) |
417 { | 417 { |
418 case 2: //1Mbps | 418 case 2: //1Mbps |
419 case 4: //2Mbps | 419 case 4: //2Mbps |
420 case 10: //5Mbps | 420 case 10: //5Mbps |
421 case 22: //11Mbps | 421 case 22: //11Mbps |
422 channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK; | 422 channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK; |
423 break; | 423 break; |
(...skipping 17 matching lines...) Expand all Loading... | |
441 header.SetAntennaSignalPower (signalNoise.signal); | 441 header.SetAntennaSignalPower (signalNoise.signal); |
442 header.SetAntennaNoisePower (signalNoise.noise); | 442 header.SetAntennaNoisePower (signalNoise.noise); |
443 | 443 |
444 if (preamble == WIFI_PREAMBLE_HT_MF || preamble == WIFI_PREAMBLE_HT_GF | | preamble == WIFI_PREAMBLE_NONE) | 444 if (preamble == WIFI_PREAMBLE_HT_MF || preamble == WIFI_PREAMBLE_HT_GF | | preamble == WIFI_PREAMBLE_NONE) |
445 { | 445 { |
446 uint8_t mcsRate = 0; | 446 uint8_t mcsRate = 0; |
447 uint8_t mcsKnown = RadiotapHeader::MCS_KNOWN_NONE; | 447 uint8_t mcsKnown = RadiotapHeader::MCS_KNOWN_NONE; |
448 uint8_t mcsFlags = RadiotapHeader::MCS_FLAGS_NONE; | 448 uint8_t mcsFlags = RadiotapHeader::MCS_FLAGS_NONE; |
449 | 449 |
450 mcsKnown |= RadiotapHeader::MCS_KNOWN_INDEX; | 450 mcsKnown |= RadiotapHeader::MCS_KNOWN_INDEX; |
451 mcsRate = rate - 128; | 451 mcsRate = static_cast<uint8_t>(rate - 128); |
452 | 452 |
453 mcsKnown |= RadiotapHeader::MCS_KNOWN_BANDWIDTH; | 453 mcsKnown |= RadiotapHeader::MCS_KNOWN_BANDWIDTH; |
454 if (txVector.GetChannelWidth () == 40) | 454 if (txVector.GetChannelWidth () == 40) |
455 { | 455 { |
456 mcsFlags |= RadiotapHeader::MCS_FLAGS_BANDWIDTH_40; | 456 mcsFlags |= RadiotapHeader::MCS_FLAGS_BANDWIDTH_40; |
457 } | 457 } |
458 | 458 |
459 mcsKnown |= RadiotapHeader::MCS_KNOWN_GUARD_INTERVAL; | 459 mcsKnown |= RadiotapHeader::MCS_KNOWN_GUARD_INTERVAL; |
460 if (txVector.GetGuardInterval () == 400) | 460 if (txVector.GetGuardInterval () == 400) |
461 { | 461 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 /* For PCAP file, MPDU Delimiter and Padding should be removed by th e MAC Driver */ | 497 /* For PCAP file, MPDU Delimiter and Padding should be removed by th e MAC Driver */ |
498 AmpduSubframeHeader hdr; | 498 AmpduSubframeHeader hdr; |
499 uint32_t extractedLength; | 499 uint32_t extractedLength; |
500 p->RemoveHeader (hdr); | 500 p->RemoveHeader (hdr); |
501 extractedLength = hdr.GetLength (); | 501 extractedLength = hdr.GetLength (); |
502 p = p->CreateFragment (0, static_cast<uint32_t> (extractedLength)); | 502 p = p->CreateFragment (0, static_cast<uint32_t> (extractedLength)); |
503 if (aMpdu.type == LAST_MPDU_IN_AGGREGATE || (hdr.GetEof () == true & & hdr.GetLength () > 0)) | 503 if (aMpdu.type == LAST_MPDU_IN_AGGREGATE || (hdr.GetEof () == true & & hdr.GetLength () > 0)) |
504 { | 504 { |
505 ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST; | 505 ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST; |
506 } | 506 } |
507 header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, hdr.Ge tCrc ()); | 507 header.SetAmpduStatus (static_cast<uint32_t>(aMpdu.mpduRefNumber), a mpduStatusFlags, hdr.GetCrc ()); |
S. Deronne
2017/12/23 10:19:58
mpduRefNumber should be limited to uint32_t
ammo6818-vandals.uidaho.edu
2017/12/23 15:14:33
changed declaration to uint32_t. Also changed cla
| |
508 } | 508 } |
509 | 509 |
510 if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) | 510 if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) |
511 { | 511 { |
512 uint16_t vhtKnown = RadiotapHeader::VHT_KNOWN_NONE; | 512 uint16_t vhtKnown = RadiotapHeader::VHT_KNOWN_NONE; |
513 uint8_t vhtFlags = RadiotapHeader::VHT_FLAGS_NONE; | 513 uint8_t vhtFlags = RadiotapHeader::VHT_FLAGS_NONE; |
514 uint8_t vhtBandwidth = 0; | 514 uint8_t vhtBandwidth = 0; |
515 uint8_t vhtMcsNss[4] = {0,0,0,0}; | 515 uint8_t vhtMcsNss[4] = {0,0,0,0}; |
516 uint8_t vhtCoding = 0; | 516 uint8_t vhtCoding = 0; |
517 uint8_t vhtGroupId = 0; | 517 uint8_t vhtGroupId = 0; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
583 | 583 |
584 PcapHelper::DataLinkType | 584 PcapHelper::DataLinkType |
585 WifiPhyHelper::GetPcapDataLinkType (void) const | 585 WifiPhyHelper::GetPcapDataLinkType (void) const |
586 { | 586 { |
587 return m_pcapDlt; | 587 return m_pcapDlt; |
588 } | 588 } |
589 | 589 |
590 void | 590 void |
591 WifiPhyHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool p romiscuous, bool explicitFilename) | 591 WifiPhyHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool p romiscuous, bool explicitFilename) |
592 { | 592 { |
593 NS_UNUSED(promiscuous); | |
593 //All of the Pcap enable functions vector through here including the ones | 594 //All of the Pcap enable functions vector through here including the ones |
594 //that are wandering through all of devices on perhaps all of the nodes in | 595 //that are wandering through all of devices on perhaps all of the nodes in |
595 //the system. We can only deal with devices of type WifiNetDevice. | 596 //the system. We can only deal with devices of type WifiNetDevice. |
596 Ptr<WifiNetDevice> device = nd->GetObject<WifiNetDevice> (); | 597 Ptr<WifiNetDevice> device = nd->GetObject<WifiNetDevice> (); |
597 if (device == 0) | 598 if (device == 0) |
598 { | 599 { |
599 NS_LOG_INFO ("WifiHelper::EnablePcapInternal(): Device " << &device << " n ot of type ns3::WifiNetDevice"); | 600 NS_LOG_INFO ("WifiHelper::EnablePcapInternal(): Device " << &device << " n ot of type ns3::WifiNetDevice"); |
600 return; | 601 return; |
601 } | 602 } |
602 | 603 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
899 { | 900 { |
900 currentStream += apmac->AssignStreams (currentStream); | 901 currentStream += apmac->AssignStreams (currentStream); |
901 } | 902 } |
902 } | 903 } |
903 } | 904 } |
904 } | 905 } |
905 return (currentStream - stream); | 906 return (currentStream - stream); |
906 } | 907 } |
907 | 908 |
908 } //namespace ns3 | 909 } //namespace ns3 |
OLD | NEW |