author | Nicola Baldo <nbaldo@cttc.es> |
Fri, 06 May 2011 18:34:24 +0200 | |
changeset 7139 | 79dd02ed46ec |
parent 6852 | 8f1a53d3f6ca |
child 7141 | 072fb225b714 |
permissions | -rw-r--r-- |
5948 | 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 |
||
7139
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
27 |
enum BlockAckType |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
28 |
{ |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
29 |
BASIC_BLOCK_ACK, |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
30 |
COMPRESSED_BLOCK_ACK, |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
31 |
MULTI_TID_BLOCK_ACK |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
32 |
}; |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
33 |
|
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
34 |
/** |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
35 |
* \ingroup wifi |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
36 |
* \brief Headers for Block ack request. |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
37 |
* |
5948 | 38 |
* 802.11n standard includes three types of block ack: |
39 |
* - Basic block ack (unique type in 802.11e) |
|
40 |
* - Compressed block ack |
|
41 |
* - Multi-TID block ack |
|
42 |
* For now only basic block ack and compressed block ack |
|
43 |
* are supported. |
|
44 |
* Basic block ack is also default variant. |
|
45 |
*/ |
|
46 |
class CtrlBAckRequestHeader : public Header { |
|
47 |
public: |
|
48 |
CtrlBAckRequestHeader (); |
|
49 |
~CtrlBAckRequestHeader (); |
|
50 |
static TypeId GetTypeId (void); |
|
51 |
virtual TypeId GetInstanceTypeId (void) const; |
|
52 |
virtual void Print (std::ostream &os) const; |
|
53 |
virtual uint32_t GetSerializedSize (void) const; |
|
54 |
virtual void Serialize (Buffer::Iterator start) const; |
|
55 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
56 |
||
57 |
void SetHtImmediateAck (bool immediateAck); |
|
58 |
void SetType (enum BlockAckType type); |
|
59 |
void SetTidInfo (uint8_t tid); |
|
60 |
void SetStartingSequence (uint16_t seq); |
|
61 |
||
62 |
bool MustSendHtImmediateAck (void) const; |
|
63 |
uint8_t GetTidInfo (void) const; |
|
64 |
uint16_t GetStartingSequence (void) const; |
|
65 |
bool IsBasic (void) const; |
|
66 |
bool IsCompressed (void) const; |
|
67 |
bool IsMultiTid (void) const; |
|
68 |
||
69 |
uint16_t GetStartingSequenceControl (void) const; |
|
70 |
||
71 |
private: |
|
72 |
||
73 |
void SetStartingSequenceControl (uint16_t seqControl); |
|
74 |
uint16_t GetBarControl (void) const; |
|
75 |
void SetBarControl (uint16_t bar); |
|
76 |
||
77 |
/** |
|
78 |
* The lsb bit of the BAR control field is used only for the |
|
79 |
* HT (High Throughput) delayed block ack configuration. |
|
80 |
* For now only non HT immediate block ack is implemented so this field |
|
81 |
* is here only for a future implementation of HT delayed variant. |
|
82 |
*/ |
|
83 |
bool m_barAckPolicy; |
|
84 |
bool m_multiTid; |
|
85 |
bool m_compressed; |
|
86 |
uint16_t m_tidInfo; |
|
87 |
uint16_t m_startingSeq; |
|
88 |
}; |
|
89 |
||
7139
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
90 |
/** |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
91 |
* \ingroup wifi |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
92 |
* \brief Headers for Block ack response. |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
93 |
* |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
94 |
* 802.11n standard includes three types of block ack: |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
95 |
* - Basic block ack (unique type in 802.11e) |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
96 |
* - Compressed block ack |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
97 |
* - Multi-TID block ack |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
98 |
* For now only basic block ack and compressed block ack |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
99 |
* are supported. |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
100 |
* Basic block ack is also default variant. |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
101 |
*/ |
5948 | 102 |
class CtrlBAckResponseHeader : public Header { |
103 |
public: |
|
104 |
CtrlBAckResponseHeader (); |
|
105 |
~CtrlBAckResponseHeader (); |
|
106 |
static TypeId GetTypeId (void); |
|
107 |
virtual TypeId GetInstanceTypeId (void) const; |
|
108 |
virtual void Print (std::ostream &os) const; |
|
109 |
virtual uint32_t GetSerializedSize (void) const; |
|
110 |
virtual void Serialize (Buffer::Iterator start) const; |
|
111 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
112 |
||
113 |
void SetHtImmediateAck (bool immeadiateAck); |
|
114 |
void SetType (enum BlockAckType type); |
|
115 |
void SetTidInfo (uint8_t tid); |
|
116 |
void SetStartingSequence (uint16_t seq); |
|
117 |
||
118 |
bool MustSendHtImmediateAck (void) const; |
|
119 |
uint8_t GetTidInfo (void) const; |
|
120 |
uint16_t GetStartingSequence (void) const; |
|
121 |
bool IsBasic (void) const; |
|
122 |
bool IsCompressed (void) const; |
|
123 |
bool IsMultiTid (void) const; |
|
124 |
||
125 |
void SetReceivedPacket (uint16_t seq); |
|
126 |
void SetReceivedFragment (uint16_t seq, uint8_t frag); |
|
127 |
bool IsPacketReceived (uint16_t seq) const; |
|
128 |
bool IsFragmentReceived (uint16_t seq, uint8_t frag) const; |
|
129 |
||
130 |
uint16_t GetStartingSequenceControl (void) const; |
|
131 |
void SetStartingSequenceControl (uint16_t seqControl); |
|
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6273
diff
changeset
|
132 |
const uint16_t* GetBitmap (void) const; |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6273
diff
changeset
|
133 |
uint64_t GetCompressedBitmap (void) const; |
6589
385ef147f7b6
Add ResetBitmap method to block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6588
diff
changeset
|
134 |
|
385ef147f7b6
Add ResetBitmap method to block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6588
diff
changeset
|
135 |
void ResetBitmap (void); |
5948 | 136 |
|
137 |
private: |
|
138 |
||
139 |
uint16_t GetBaControl (void) const; |
|
140 |
void SetBaControl (uint16_t bar); |
|
141 |
||
142 |
Buffer::Iterator SerializeBitmap (Buffer::Iterator start) const; |
|
143 |
Buffer::Iterator DeserializeBitmap (Buffer::Iterator start); |
|
144 |
||
145 |
/** |
|
146 |
* This function is used to correctly index in both bitmap |
|
6273
8d70de29d514
spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents:
5948
diff
changeset
|
147 |
* and compressed bitmap, one bit or one block of 16 bits respectively. |
7139
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
148 |
* |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
149 |
* for more details see 7.2.1.8 in IEEE 802.11n/D4.00 |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
150 |
* |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
151 |
* \param seq the sequence number |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
152 |
* |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
153 |
* \return If we are using basic block ack, return value represents index of |
5948 | 154 |
* block of 16 bits for packet having sequence number equals to <i>seq</i>. |
155 |
* If we are using compressed block ack, return value represents bit |
|
156 |
* to set to 1 in the compressed bitmap to indicate that packet having |
|
157 |
* sequence number equals to <i>seq</i> was correctly received. |
|
158 |
*/ |
|
159 |
uint8_t IndexInBitmap (uint16_t seq) const; |
|
7139
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
160 |
|
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6273
diff
changeset
|
161 |
/** |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6273
diff
changeset
|
162 |
* Checks if sequence number <i>seq</i> can be acknowledged in the bitmap. |
7139
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
163 |
* |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
164 |
* \param seq the sequence number |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
165 |
* |
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
166 |
* \return |
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6273
diff
changeset
|
167 |
*/ |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6273
diff
changeset
|
168 |
bool IsInBitmap (uint16_t seq) const; |
5948 | 169 |
|
170 |
/** |
|
171 |
* The lsb bit of the BA control field is used only for the |
|
172 |
* HT (High Throughput) delayed block ack configuration. |
|
173 |
* For now only non HT immediate block ack is implemented so this field |
|
174 |
* is here only for a future implementation of HT delayed variant. |
|
175 |
*/ |
|
176 |
bool m_baAckPolicy; |
|
177 |
bool m_multiTid; |
|
178 |
bool m_compressed; |
|
179 |
uint16_t m_tidInfo; |
|
180 |
uint16_t m_startingSeq; |
|
181 |
||
182 |
union { |
|
183 |
uint16_t m_bitmap[64]; |
|
184 |
uint64_t m_compressedBitmap; |
|
185 |
} bitmap; |
|
186 |
}; |
|
187 |
||
188 |
} //namespace ns3 |
|
189 |
||
190 |
#endif /* CTRL_HEADERS_H */ |