Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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) 2016 Sébastien Deronne | 3 * Copyright (c) 2016 Sébastien Deronne |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 m_reservedMcsSet1 (0), | 44 m_reservedMcsSet1 (0), |
45 m_rxHighestSupportedDataRate (0), | 45 m_rxHighestSupportedDataRate (0), |
46 m_reservedMcsSet2 (0), | 46 m_reservedMcsSet2 (0), |
47 m_txMcsSetDefined (0), | 47 m_txMcsSetDefined (0), |
48 m_txRxMcsSetUnequal (0), | 48 m_txRxMcsSetUnequal (0), |
49 m_txMaxNSpatialStreams (0), | 49 m_txMaxNSpatialStreams (0), |
50 m_txUnequalModulation (0), | 50 m_txUnequalModulation (0), |
51 m_reservedMcsSet3 (0), | 51 m_reservedMcsSet3 (0), |
52 m_htSupported (0) | 52 m_htSupported (0) |
53 { | 53 { |
54 for (uint32_t k = 0; k < MAX_SUPPORTED_MCS; k++) | 54 for (uint8_t k = 0; k < MAX_SUPPORTED_MCS; k++) |
55 { | 55 { |
56 m_rxMcsBitmask[k] = 0; | 56 m_rxMcsBitmask[k] = 0; |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 WifiInformationElementId | 60 WifiInformationElementId |
61 HtOperation::ElementId () const | 61 HtOperation::ElementId () const |
62 { | 62 { |
63 return IE_HT_OPERATION; | 63 return IE_HT_OPERATION; |
64 } | 64 } |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 if (m_htSupported < 1) | 325 if (m_htSupported < 1) |
326 { | 326 { |
327 return 0; | 327 return 0; |
328 } | 328 } |
329 return WifiInformationElement::GetSerializedSize (); | 329 return WifiInformationElement::GetSerializedSize (); |
330 } | 330 } |
331 | 331 |
332 uint8_t | 332 uint8_t |
333 HtOperation::GetInformationSubset1 (void) const | 333 HtOperation::GetInformationSubset1 (void) const |
334 { | 334 { |
335 uint16_t val = 0; | 335 uint8_t val = 0; |
S. Deronne
2018/02/18 14:52:55
correct
| |
336 val |= m_secondaryChannelOffset & 0x03; | 336 val |= m_secondaryChannelOffset & 0x03; |
337 val |= (m_staChannelWidth & 0x01) << 2; | 337 val |= (m_staChannelWidth & 0x01) << 2; |
338 val |= (m_rifsMode & 0x01) << 3; | 338 val |= (m_rifsMode & 0x01) << 3; |
339 val |= (m_reservedInformationSubset1 & 0x0f) << 4; | 339 val |= (m_reservedInformationSubset1 & 0x0f) << 4; |
340 return static_cast<uint8_t>(val); | 340 return val; |
S. Deronne
2017/12/17 15:39:14
val should have the correct number of bits, I don'
ammo6818-vandals.uidaho.edu
2017/12/20 04:16:33
val is defined as uint16_t while the function retu
| |
341 } | 341 } |
342 | 342 |
343 void | 343 void |
344 HtOperation::SetInformationSubset1 (uint8_t ctrl) | 344 HtOperation::SetInformationSubset1 (uint8_t ctrl) |
345 { | 345 { |
346 m_secondaryChannelOffset = ctrl & 0x03; | 346 m_secondaryChannelOffset = ctrl & 0x03; |
347 m_staChannelWidth = (ctrl >> 2) & 0x01; | 347 m_staChannelWidth = (ctrl >> 2) & 0x01; |
348 m_rifsMode = (ctrl >> 3) & 0x01; | 348 m_rifsMode = (ctrl >> 3) & 0x01; |
349 m_reservedInformationSubset1 = (ctrl >> 4) & 0x0f; | 349 m_reservedInformationSubset1 = (ctrl >> 4) & 0x0f; |
350 } | 350 } |
(...skipping 10 matching lines...) Expand all Loading... | |
361 return val; | 361 return val; |
362 } | 362 } |
363 | 363 |
364 void | 364 void |
365 HtOperation::SetInformationSubset2 (uint16_t ctrl) | 365 HtOperation::SetInformationSubset2 (uint16_t ctrl) |
366 { | 366 { |
367 m_htProtection = ctrl & 0x03; | 367 m_htProtection = ctrl & 0x03; |
368 m_nonGfHtStasPresent = (ctrl >> 2) & 0x01; | 368 m_nonGfHtStasPresent = (ctrl >> 2) & 0x01; |
369 m_reservedInformationSubset2_1 = (ctrl >> 3) & 0x01; | 369 m_reservedInformationSubset2_1 = (ctrl >> 3) & 0x01; |
370 m_obssNonHtStasPresent = (ctrl >> 4) & 0x01; | 370 m_obssNonHtStasPresent = (ctrl >> 4) & 0x01; |
371 m_reservedInformationSubset2_1 = static_cast<uint8_t>((ctrl >> 5) & 0x07ff); | 371 m_reservedInformationSubset2_1 = static_cast<uint8_t>((ctrl >> 5) & 0x07ff); |
S. Deronne
2018/02/18 14:52:55
OK
| |
372 } | 372 } |
373 | 373 |
374 uint16_t | 374 uint16_t |
375 HtOperation::GetInformationSubset3 (void) const | 375 HtOperation::GetInformationSubset3 (void) const |
376 { | 376 { |
377 uint16_t val = 0; | 377 uint16_t val = 0; |
378 val |= m_reservedInformationSubset3_1 & 0x3f; | 378 val |= m_reservedInformationSubset3_1 & 0x3f; |
379 val |= (m_dualBeacon & 0x01) << 6; | 379 val |= (m_dualBeacon & 0x01) << 6; |
380 val |= (m_dualCtsProtection & 0x01) << 7; | 380 val |= (m_dualCtsProtection & 0x01) << 7; |
381 val |= (m_stbcBeacon & 0x01) << 8; | 381 val |= (m_stbcBeacon & 0x01) << 8; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 } | 470 } |
471 } | 471 } |
472 | 472 |
473 uint8_t | 473 uint8_t |
474 HtOperation::DeserializeInformationField (Buffer::Iterator start, | 474 HtOperation::DeserializeInformationField (Buffer::Iterator start, |
475 uint8_t length) | 475 uint8_t length) |
476 { | 476 { |
477 Buffer::Iterator i = start; | 477 Buffer::Iterator i = start; |
478 uint8_t primarychannel = i.ReadU8 (); | 478 uint8_t primarychannel = i.ReadU8 (); |
479 uint8_t informationsubset1 = i.ReadU8 (); | 479 uint8_t informationsubset1 = i.ReadU8 (); |
480 uint8_t informationsubset2 = static_cast<uint8_t>(i.ReadU16 ()); | 480 uint16_t informationsubset2 = i.ReadU16 (); |
481 uint8_t informationsubset3 = static_cast<uint8_t>(i.ReadU16 ()); | 481 uint16_t informationsubset3 = i.ReadU16 (); |
S. Deronne
2017/12/17 15:39:14
there is something strange here, we read 16 bits b
ammo6818-vandals.uidaho.edu
2017/12/20 04:16:33
informationsubset2 and informationsubset3 change t
|
S. Deronne
2018/02/18 14:52:55
correct
|
482 uint64_t mcsset1 = i.ReadLsbtohU64 (); | 482 uint64_t mcsset1 = i.ReadLsbtohU64 (); |
483 uint64_t mcsset2 = i.ReadLsbtohU64 (); | 483 uint64_t mcsset2 = i.ReadLsbtohU64 (); |
484 SetPrimaryChannel (primarychannel); | 484 SetPrimaryChannel (primarychannel); |
485 SetInformationSubset1 (informationsubset1); | 485 SetInformationSubset1 (informationsubset1); |
486 SetInformationSubset2 (informationsubset2); | 486 SetInformationSubset2 (informationsubset2); |
487 SetInformationSubset3 (informationsubset3); | 487 SetInformationSubset3 (informationsubset3); |
488 SetBasicMcsSet (mcsset1, mcsset2); | 488 SetBasicMcsSet (mcsset1, mcsset2); |
489 return length; | 489 return length; |
490 } | 490 } |
491 | 491 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 bool c1, c2, c3; | 523 bool c1, c2, c3; |
524 is >> c1 >> c2 >> c3; | 524 is >> c1 >> c2 >> c3; |
525 htOperation.SetStaChannelWidth (c1); | 525 htOperation.SetStaChannelWidth (c1); |
526 htOperation.SetRifsMode (c2); | 526 htOperation.SetRifsMode (c2); |
527 htOperation.SetDualCtsProtection (c3); | 527 htOperation.SetDualCtsProtection (c3); |
528 | 528 |
529 return is; | 529 return is; |
530 } | 530 } |
531 | 531 |
532 } //namespace ns3 | 532 } //namespace ns3 |
LEFT | RIGHT |