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) 2009 MIRKO BANCHI | 3 * Copyright (c) 2009 MIRKO BANCHI |
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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 } | 489 } |
490 | 490 |
491 Buffer::Iterator | 491 Buffer::Iterator |
492 CtrlBAckResponseHeader::SerializeBitmap (Buffer::Iterator start) const | 492 CtrlBAckResponseHeader::SerializeBitmap (Buffer::Iterator start) const |
493 { | 493 { |
494 Buffer::Iterator i = start; | 494 Buffer::Iterator i = start; |
495 if (!m_multiTid) | 495 if (!m_multiTid) |
496 { | 496 { |
497 if (!m_compressed) | 497 if (!m_compressed) |
498 { | 498 { |
499 for (uint32_t j = 0; j < 64; j++) | 499 for (uint8_t j = 0; j < 64; j++) |
500 { | 500 { |
501 i.WriteHtolsbU16 (bitmap.m_bitmap[j]); | 501 i.WriteHtolsbU16 (bitmap.m_bitmap[j]); |
502 } | 502 } |
503 } | 503 } |
504 else | 504 else |
505 { | 505 { |
506 i.WriteHtolsbU64 (bitmap.m_compressedBitmap); | 506 i.WriteHtolsbU64 (bitmap.m_compressedBitmap); |
507 } | 507 } |
508 } | 508 } |
509 else | 509 else |
(...skipping 11 matching lines...) Expand all Loading... |
521 } | 521 } |
522 | 522 |
523 Buffer::Iterator | 523 Buffer::Iterator |
524 CtrlBAckResponseHeader::DeserializeBitmap (Buffer::Iterator start) | 524 CtrlBAckResponseHeader::DeserializeBitmap (Buffer::Iterator start) |
525 { | 525 { |
526 Buffer::Iterator i = start; | 526 Buffer::Iterator i = start; |
527 if (!m_multiTid) | 527 if (!m_multiTid) |
528 { | 528 { |
529 if (!m_compressed) | 529 if (!m_compressed) |
530 { | 530 { |
531 for (uint32_t j = 0; j < 64; j++) | 531 for (uint8_t j = 0; j < 64; j++) |
532 { | 532 { |
533 bitmap.m_bitmap[j] = i.ReadLsbtohU16 (); | 533 bitmap.m_bitmap[j] = i.ReadLsbtohU16 (); |
534 } | 534 } |
535 } | 535 } |
536 else | 536 else |
537 { | 537 { |
538 bitmap.m_compressedBitmap = i.ReadLsbtohU64 (); | 538 bitmap.m_compressedBitmap = i.ReadLsbtohU64 (); |
539 } | 539 } |
540 } | 540 } |
541 else | 541 else |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 } | 688 } |
689 return false; | 689 return false; |
690 } | 690 } |
691 | 691 |
692 uint8_t | 692 uint8_t |
693 CtrlBAckResponseHeader::IndexInBitmap (uint16_t seq) const | 693 CtrlBAckResponseHeader::IndexInBitmap (uint16_t seq) const |
694 { | 694 { |
695 uint8_t index; | 695 uint8_t index; |
696 if (seq >= m_startingSeq) | 696 if (seq >= m_startingSeq) |
697 { | 697 { |
698 index = (uint8_t)(seq - m_startingSeq); | 698 index = static_cast<uint8_t>(seq - m_startingSeq); |
699 } | 699 } |
700 else | 700 else |
701 { | 701 { |
702 index = (uint8_t)(4096 - m_startingSeq + seq); | 702 index = static_cast<uint8_t>(4096 - m_startingSeq + seq); |
703 } | 703 } |
704 NS_ASSERT (index <= 63); | 704 NS_ASSERT (index <= 63); |
705 return index; | 705 return index; |
706 } | 706 } |
707 | 707 |
708 bool | 708 bool |
709 CtrlBAckResponseHeader::IsInBitmap (uint16_t seq) const | 709 CtrlBAckResponseHeader::IsInBitmap (uint16_t seq) const |
710 { | 710 { |
711 return (seq - m_startingSeq + 4096) % 4096 < 64; | 711 return (seq - m_startingSeq + 4096) % 4096 < 64; |
712 } | 712 } |
(...skipping 10 matching lines...) Expand all Loading... |
723 return bitmap.m_compressedBitmap; | 723 return bitmap.m_compressedBitmap; |
724 } | 724 } |
725 | 725 |
726 void | 726 void |
727 CtrlBAckResponseHeader::ResetBitmap (void) | 727 CtrlBAckResponseHeader::ResetBitmap (void) |
728 { | 728 { |
729 memset (&bitmap, 0, sizeof (bitmap)); | 729 memset (&bitmap, 0, sizeof (bitmap)); |
730 } | 730 } |
731 | 731 |
732 } //namespace ns3 | 732 } //namespace ns3 |
LEFT | RIGHT |