OLD | NEW |
(Empty) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2009 MIRKO BANCHI |
| 4 * |
| 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· |
| 7 * published by the Free Software Foundation; |
| 8 * |
| 9 * This program is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with this program; if not, write to the Free Software |
| 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 * |
| 18 * Author: Mirko Banchi <mk.banchi@gmail.com> |
| 19 */ |
| 20 #ifndef CTRL_HEADERS_H |
| 21 #define CTRL_HEADERS_H |
| 22 |
| 23 #include "ns3/header.h" |
| 24 |
| 25 namespace ns3 { |
| 26 |
| 27 /** Headers for Block ack request and response. |
| 28 * 802.11n standard includes three types of block ack: |
| 29 * - Basic block ack (unique type in 802.11e) |
| 30 * - Compressed block ack |
| 31 * - Multi-TID block ack |
| 32 * For now only basic block ack and compressed block ack· |
| 33 * are supported. |
| 34 * Basic block ack is also default variant. |
| 35 */ |
| 36 enum BlockAckType |
| 37 { |
| 38 BASIC_BLOCK_ACK, |
| 39 COMPRESSED_BLOCK_ACK, |
| 40 MULTI_TID_BLOCK_ACK |
| 41 }; |
| 42 |
| 43 class CtrlBAckRequestHeader : public Header { |
| 44 public: |
| 45 CtrlBAckRequestHeader (); |
| 46 ~CtrlBAckRequestHeader (); |
| 47 static TypeId GetTypeId (void); |
| 48 virtual TypeId GetInstanceTypeId (void) const; |
| 49 virtual void Print (std::ostream &os) const; |
| 50 virtual uint32_t GetSerializedSize (void) const; |
| 51 virtual void Serialize (Buffer::Iterator start) const; |
| 52 virtual uint32_t Deserialize (Buffer::Iterator start); |
| 53 |
| 54 void SetHtImmediateAck (bool immediateAck); |
| 55 void SetType (enum BlockAckType type); |
| 56 void SetTidInfo (uint8_t tid); |
| 57 void SetStartingSequence (uint16_t seq); |
| 58 |
| 59 bool MustSendHtImmediateAck (void) const; |
| 60 uint8_t GetTidInfo (void) const; |
| 61 uint16_t GetStartingSequence (void) const; |
| 62 bool IsBasic (void) const; |
| 63 bool IsCompressed (void) const; |
| 64 bool IsMultiTid (void) const; |
| 65 |
| 66 uint16_t GetStartingSequenceControl (void) const; |
| 67 ·· |
| 68 private: |
| 69 ·· |
| 70 void SetStartingSequenceControl (uint16_t seqControl); |
| 71 uint16_t GetBarControl (void) const; |
| 72 void SetBarControl (uint16_t bar); |
| 73 ·· |
| 74 /** |
| 75 * The lsb bit of the BAR control field is used only for the |
| 76 * HT (High Throughput) delayed block ack configuration. |
| 77 * For now only non HT immediate block ack is implemented so this field |
| 78 * is here only for a future implementation of HT delayed variant. |
| 79 */ |
| 80 bool m_barAckPolicy; |
| 81 bool m_multiTid; |
| 82 bool m_compressed; |
| 83 uint16_t m_tidInfo; |
| 84 uint16_t m_startingSeq; |
| 85 }; |
| 86 |
| 87 class CtrlBAckResponseHeader : public Header { |
| 88 public: |
| 89 CtrlBAckResponseHeader (); |
| 90 ~CtrlBAckResponseHeader (); |
| 91 static TypeId GetTypeId (void); |
| 92 virtual TypeId GetInstanceTypeId (void) const; |
| 93 virtual void Print (std::ostream &os) const; |
| 94 virtual uint32_t GetSerializedSize (void) const; |
| 95 virtual void Serialize (Buffer::Iterator start) const; |
| 96 virtual uint32_t Deserialize (Buffer::Iterator start); |
| 97 |
| 98 void SetHtImmediateAck (bool immeadiateAck); |
| 99 void SetType (enum BlockAckType type); |
| 100 void SetTidInfo (uint8_t tid); |
| 101 void SetStartingSequence (uint16_t seq); |
| 102 |
| 103 bool MustSendHtImmediateAck (void) const; |
| 104 uint8_t GetTidInfo (void) const; |
| 105 uint16_t GetStartingSequence (void) const; |
| 106 bool IsBasic (void) const; |
| 107 bool IsCompressed (void) const; |
| 108 bool IsMultiTid (void) const; |
| 109 |
| 110 void SetReceivedPacket (uint16_t seq); |
| 111 void SetReceivedFragment (uint16_t seq, uint8_t frag); |
| 112 bool IsPacketReceived (uint16_t seq) const; |
| 113 bool IsFragmentReceived (uint16_t seq, uint8_t frag) const; |
| 114 |
| 115 uint16_t GetStartingSequenceControl (void) const; |
| 116 void SetStartingSequenceControl (uint16_t seqControl); |
| 117 ·· |
| 118 private: |
| 119 ·· |
| 120 uint16_t GetBaControl (void) const; |
| 121 void SetBaControl (uint16_t bar); |
| 122 ·· |
| 123 Buffer::Iterator SerializeBitmap (Buffer::Iterator start) const; |
| 124 Buffer::Iterator DeserializeBitmap (Buffer::Iterator start); |
| 125 |
| 126 /** |
| 127 * This function is used to correctly index in both bitmap |
| 128 * and compressed bitmap, one bit or one block of 16 bits respectly. |
| 129 * If we are using basic block ack, return value represents index of· |
| 130 * block of 16 bits for packet having sequence number equals to <i>seq</i>. |
| 131 * If we are using compressed block ack, return value represents bit· |
| 132 * to set to 1 in the compressed bitmap to indicate that packet having· |
| 133 * sequence number equals to <i>seq</i> was correctly received. |
| 134 * |
| 135 * for more details see 7.2.1.8 in IEEE 802.11n/D4.00 |
| 136 */ |
| 137 uint8_t IndexInBitmap (uint16_t seq) const; |
| 138 |
| 139 /** |
| 140 * The lsb bit of the BA control field is used only for the |
| 141 * HT (High Throughput) delayed block ack configuration. |
| 142 * For now only non HT immediate block ack is implemented so this field |
| 143 * is here only for a future implementation of HT delayed variant. |
| 144 */ |
| 145 bool m_baAckPolicy; |
| 146 bool m_multiTid; |
| 147 bool m_compressed; |
| 148 uint16_t m_tidInfo; |
| 149 uint16_t m_startingSeq; |
| 150 |
| 151 union { |
| 152 uint16_t m_bitmap[64]; |
| 153 uint64_t m_compressedBitmap; |
| 154 } bitmap; |
| 155 }; |
| 156 |
| 157 } //namespace ns3 |
| 158 |
| 159 #endif /* CTRL_HEADERS_H */ |
OLD | NEW |