author | Stefano Avallone <stefano.avallone@unina.it> |
Fri, 05 Sep 2014 16:33:57 -0700 | |
changeset 10883 | d919e7194e23 |
parent 10652 | dc18deba4502 |
child 10968 | 2d29fee2b7b8 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7141
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
5948 | 2 |
/* |
3 |
* Copyright (c) 2009 MIRKO BANCHI |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
5948 | 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 |
#include "ns3/fatal-error.h" |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
21 |
#include "ns3/log.h" |
5948 | 22 |
|
23 |
#include "ctrl-headers.h" |
|
24 |
||
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
25 |
NS_LOG_COMPONENT_DEFINE ("CtrlHeaders"); |
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
26 |
|
5948 | 27 |
namespace ns3 { |
28 |
||
29 |
/*********************************** |
|
30 |
* Block ack request |
|
31 |
***********************************/ |
|
32 |
||
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10410
diff
changeset
|
33 |
NS_OBJECT_ENSURE_REGISTERED (CtrlBAckRequestHeader); |
5948 | 34 |
|
35 |
CtrlBAckRequestHeader::CtrlBAckRequestHeader () |
|
36 |
: m_barAckPolicy (false), |
|
37 |
m_multiTid (false), |
|
38 |
m_compressed (false) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
39 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
40 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
41 |
} |
5948 | 42 |
|
43 |
CtrlBAckRequestHeader::~CtrlBAckRequestHeader () |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
44 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
45 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
46 |
} |
5948 | 47 |
|
48 |
TypeId |
|
49 |
CtrlBAckRequestHeader::GetTypeId (void) |
|
50 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
51 |
NS_LOG_FUNCTION_NOARGS (); |
5948 | 52 |
static TypeId tid = TypeId ("ns3::CtrlBAckRequestHeader") |
53 |
.SetParent<Header> () |
|
54 |
.AddConstructor<CtrlBAckRequestHeader> () |
|
55 |
; |
|
56 |
return tid; |
|
57 |
} |
|
58 |
||
59 |
TypeId |
|
60 |
CtrlBAckRequestHeader::GetInstanceTypeId (void) const |
|
61 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
62 |
NS_LOG_FUNCTION (this); |
5948 | 63 |
return GetTypeId (); |
64 |
} |
|
65 |
||
66 |
void |
|
67 |
CtrlBAckRequestHeader::Print (std::ostream &os) const |
|
68 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
69 |
NS_LOG_FUNCTION (this << &os); |
9778
45a56374ae2b
[Coverity] Not restoring ostream format (STREAM_FORMAT_STATE)
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
7386
diff
changeset
|
70 |
os << "TID_INFO=" << m_tidInfo << ", StartingSeq=" << std::hex << m_startingSeq << std::dec; |
5948 | 71 |
} |
72 |
||
73 |
uint32_t |
|
74 |
CtrlBAckRequestHeader::GetSerializedSize () const |
|
75 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
76 |
NS_LOG_FUNCTION (this); |
5948 | 77 |
uint32_t size = 0; |
78 |
size += 2; //Bar control |
|
79 |
if (!m_multiTid) |
|
80 |
{ |
|
81 |
size += 2; //Starting sequence control |
|
82 |
} |
|
83 |
else |
|
84 |
{ |
|
85 |
if (m_compressed) |
|
86 |
{ |
|
87 |
size += (2 + 2) * (m_tidInfo + 1); //Multi-tid block ack |
|
88 |
} |
|
89 |
else |
|
90 |
{ |
|
91 |
NS_FATAL_ERROR ("Reserved configuration."); |
|
92 |
} |
|
93 |
} |
|
94 |
return size; |
|
95 |
} |
|
96 |
||
97 |
void |
|
98 |
CtrlBAckRequestHeader::Serialize (Buffer::Iterator start) const |
|
99 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
100 |
NS_LOG_FUNCTION (this << &start); |
5948 | 101 |
Buffer::Iterator i = start; |
102 |
i.WriteHtolsbU16 (GetBarControl ()); |
|
103 |
if (!m_multiTid) |
|
104 |
{ |
|
105 |
i.WriteHtolsbU16 (GetStartingSequenceControl ()); |
|
106 |
} |
|
107 |
else |
|
108 |
{ |
|
109 |
if (m_compressed) |
|
110 |
{ |
|
111 |
NS_FATAL_ERROR ("Multi-tid block ack is not supported."); |
|
112 |
} |
|
113 |
else |
|
114 |
{ |
|
115 |
NS_FATAL_ERROR ("Reserved configuration."); |
|
116 |
} |
|
117 |
} |
|
118 |
} |
|
119 |
||
120 |
uint32_t |
|
121 |
CtrlBAckRequestHeader::Deserialize (Buffer::Iterator start) |
|
122 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
123 |
NS_LOG_FUNCTION (this << &start); |
5948 | 124 |
Buffer::Iterator i = start; |
125 |
SetBarControl (i.ReadLsbtohU16 ()); |
|
126 |
if (!m_multiTid) |
|
127 |
{ |
|
128 |
SetStartingSequenceControl (i.ReadLsbtohU16 ()); |
|
129 |
} |
|
130 |
else |
|
131 |
{ |
|
132 |
if (m_compressed) |
|
133 |
{ |
|
134 |
NS_FATAL_ERROR ("Multi-tid block ack is not supported."); |
|
135 |
} |
|
136 |
else |
|
137 |
{ |
|
138 |
NS_FATAL_ERROR ("Reserved configuration."); |
|
139 |
} |
|
140 |
} |
|
141 |
return i.GetDistanceFrom (start); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
142 |
} |
5948 | 143 |
|
144 |
uint16_t |
|
145 |
CtrlBAckRequestHeader::GetBarControl (void) const |
|
146 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
147 |
NS_LOG_FUNCTION (this); |
5948 | 148 |
uint16_t res = 0; |
149 |
if (m_barAckPolicy) |
|
150 |
{ |
|
151 |
res |= 0x1; |
|
152 |
} |
|
153 |
if (m_multiTid) |
|
154 |
{ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
155 |
res |= (0x1 << 1); |
5948 | 156 |
} |
157 |
if (m_compressed) |
|
158 |
{ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
159 |
res |= (0x1 << 2); |
5948 | 160 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
161 |
res |= (m_tidInfo << 12) & (0xf << 12); |
5948 | 162 |
return res; |
163 |
} |
|
164 |
||
165 |
void |
|
166 |
CtrlBAckRequestHeader::SetBarControl (uint16_t bar) |
|
167 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
168 |
NS_LOG_FUNCTION (this << bar); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
169 |
m_barAckPolicy = ((bar & 0x01) == 1) ? true : false; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
170 |
m_multiTid = (((bar >> 1) & 0x01) == 1) ? true : false; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
171 |
m_compressed = (((bar >> 2) & 0x01) == 1) ? true : false; |
5948 | 172 |
m_tidInfo = (bar >> 12) & 0x0f; |
173 |
} |
|
174 |
||
175 |
uint16_t |
|
176 |
CtrlBAckRequestHeader::GetStartingSequenceControl (void) const |
|
177 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
178 |
NS_LOG_FUNCTION (this); |
5948 | 179 |
return (m_startingSeq << 4) & 0xfff0; |
180 |
} |
|
181 |
||
182 |
void |
|
183 |
CtrlBAckRequestHeader::SetStartingSequenceControl (uint16_t seqControl) |
|
184 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
185 |
NS_LOG_FUNCTION (this << seqControl); |
5948 | 186 |
m_startingSeq = (seqControl >> 4) & 0x0fff; |
187 |
} |
|
188 |
||
189 |
void |
|
190 |
CtrlBAckRequestHeader::SetHtImmediateAck (bool immediateAck) |
|
191 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
192 |
NS_LOG_FUNCTION (this << immediateAck); |
5948 | 193 |
m_barAckPolicy = immediateAck; |
194 |
} |
|
195 |
||
196 |
void |
|
197 |
CtrlBAckRequestHeader::SetType (enum BlockAckType type) |
|
198 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
199 |
NS_LOG_FUNCTION (this << type); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
200 |
switch (type) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
201 |
{ |
5948 | 202 |
case BASIC_BLOCK_ACK: |
203 |
m_multiTid = false; |
|
204 |
m_compressed = false; |
|
205 |
break; |
|
206 |
case COMPRESSED_BLOCK_ACK: |
|
207 |
m_multiTid = false; |
|
208 |
m_compressed = true; |
|
209 |
break; |
|
210 |
case MULTI_TID_BLOCK_ACK: |
|
211 |
m_multiTid = true; |
|
212 |
m_compressed = true; |
|
213 |
break; |
|
214 |
default: |
|
215 |
NS_FATAL_ERROR ("Invalid variant type"); |
|
216 |
break; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
217 |
} |
5948 | 218 |
} |
219 |
||
220 |
void |
|
221 |
CtrlBAckRequestHeader::SetTidInfo (uint8_t tid) |
|
222 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
223 |
NS_LOG_FUNCTION (this << static_cast<uint32_t> (tid)); |
5948 | 224 |
m_tidInfo = static_cast<uint16_t> (tid); |
225 |
} |
|
226 |
||
227 |
void |
|
228 |
CtrlBAckRequestHeader::SetStartingSequence (uint16_t seq) |
|
229 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
230 |
NS_LOG_FUNCTION (this << seq); |
5948 | 231 |
m_startingSeq = seq; |
232 |
} |
|
233 |
||
234 |
bool |
|
235 |
CtrlBAckRequestHeader::MustSendHtImmediateAck (void) const |
|
236 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
237 |
NS_LOG_FUNCTION (this); |
5948 | 238 |
return m_barAckPolicy; |
239 |
} |
|
240 |
||
241 |
uint8_t |
|
242 |
CtrlBAckRequestHeader::GetTidInfo (void) const |
|
243 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
244 |
NS_LOG_FUNCTION (this); |
5948 | 245 |
uint8_t tid = static_cast<uint8_t> (m_tidInfo); |
246 |
return tid; |
|
247 |
} |
|
248 |
||
249 |
uint16_t |
|
250 |
CtrlBAckRequestHeader::GetStartingSequence (void) const |
|
251 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
252 |
NS_LOG_FUNCTION (this); |
5948 | 253 |
return m_startingSeq; |
254 |
} |
|
255 |
||
256 |
bool |
|
257 |
CtrlBAckRequestHeader::IsBasic (void) const |
|
258 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
259 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
260 |
return (!m_multiTid && !m_compressed) ? true : false; |
5948 | 261 |
} |
262 |
||
263 |
bool |
|
264 |
CtrlBAckRequestHeader::IsCompressed (void) const |
|
265 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
266 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
267 |
return (!m_multiTid && m_compressed) ? true : false; |
5948 | 268 |
} |
269 |
||
270 |
bool |
|
271 |
CtrlBAckRequestHeader::IsMultiTid (void) const |
|
272 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
273 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
274 |
return (m_multiTid && m_compressed) ? true : false; |
5948 | 275 |
} |
276 |
||
277 |
/*********************************** |
|
278 |
* Block ack response |
|
279 |
***********************************/ |
|
280 |
||
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10410
diff
changeset
|
281 |
NS_OBJECT_ENSURE_REGISTERED (CtrlBAckResponseHeader); |
5948 | 282 |
|
283 |
CtrlBAckResponseHeader::CtrlBAckResponseHeader () |
|
284 |
: m_baAckPolicy (false), |
|
285 |
m_multiTid (false), |
|
286 |
m_compressed (false) |
|
287 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
288 |
NS_LOG_FUNCTION (this); |
5948 | 289 |
memset (&bitmap, 0, sizeof (bitmap)); |
290 |
} |
|
291 |
||
292 |
CtrlBAckResponseHeader::~CtrlBAckResponseHeader () |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
293 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
294 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
295 |
} |
5948 | 296 |
|
297 |
TypeId |
|
298 |
CtrlBAckResponseHeader::GetTypeId (void) |
|
299 |
{ |
|
300 |
static TypeId tid = TypeId ("ns3::CtrlBAckResponseHeader") |
|
301 |
.SetParent<Header> () |
|
302 |
.AddConstructor<CtrlBAckResponseHeader> () |
|
303 |
; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
304 |
return tid; |
5948 | 305 |
} |
306 |
||
307 |
TypeId |
|
308 |
CtrlBAckResponseHeader::GetInstanceTypeId (void) const |
|
309 |
{ |
|
310 |
return GetTypeId (); |
|
311 |
} |
|
312 |
||
313 |
void |
|
314 |
CtrlBAckResponseHeader::Print (std::ostream &os) const |
|
315 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
316 |
NS_LOG_FUNCTION (this << &os); |
9877
7511dc1f8ae8
[Coverity] Not restoring ostream format (STREAM_FORMAT_STATE)
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
9802
diff
changeset
|
317 |
os << "TID_INFO=" << m_tidInfo << ", StartingSeq=" << std::hex << m_startingSeq << std::dec; |
5948 | 318 |
} |
319 |
||
320 |
uint32_t |
|
321 |
CtrlBAckResponseHeader::GetSerializedSize (void) const |
|
322 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
323 |
NS_LOG_FUNCTION (this); |
5948 | 324 |
uint32_t size = 0; |
325 |
size += 2; //Bar control |
|
326 |
if (!m_multiTid) |
|
327 |
{ |
|
328 |
if (!m_compressed) |
|
329 |
{ |
|
330 |
size += (2 + 128); //Basic block ack |
|
331 |
} |
|
332 |
else |
|
333 |
{ |
|
334 |
size += (2 + 8); //Compressed block ack |
|
335 |
} |
|
336 |
} |
|
337 |
else |
|
338 |
{ |
|
339 |
if (m_compressed) |
|
340 |
{ |
|
341 |
size += (2 + 2 + 8) * (m_tidInfo + 1); //Multi-tid block ack |
|
342 |
} |
|
343 |
else |
|
344 |
{ |
|
345 |
NS_FATAL_ERROR ("Reserved configuration."); |
|
346 |
} |
|
347 |
} |
|
348 |
return size; |
|
349 |
} |
|
350 |
||
351 |
void |
|
352 |
CtrlBAckResponseHeader::Serialize (Buffer::Iterator start) const |
|
353 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
354 |
NS_LOG_FUNCTION (this << &start); |
5948 | 355 |
Buffer::Iterator i = start; |
356 |
i.WriteHtolsbU16 (GetBaControl ()); |
|
357 |
if (!m_multiTid) |
|
358 |
{ |
|
359 |
i.WriteHtolsbU16 (GetStartingSequenceControl ()); |
|
360 |
i = SerializeBitmap (i); |
|
361 |
} |
|
362 |
else |
|
363 |
{ |
|
364 |
if (m_compressed) |
|
365 |
{ |
|
366 |
NS_FATAL_ERROR ("Multi-tid block ack is not supported."); |
|
367 |
} |
|
368 |
else |
|
369 |
{ |
|
370 |
NS_FATAL_ERROR ("Reserved configuration."); |
|
371 |
} |
|
372 |
} |
|
373 |
} |
|
374 |
||
375 |
uint32_t |
|
376 |
CtrlBAckResponseHeader::Deserialize (Buffer::Iterator start) |
|
377 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
378 |
NS_LOG_FUNCTION (this << &start); |
5948 | 379 |
Buffer::Iterator i = start; |
380 |
SetBaControl (i.ReadLsbtohU16 ()); |
|
381 |
if (!m_multiTid) |
|
382 |
{ |
|
383 |
SetStartingSequenceControl (i.ReadLsbtohU16 ()); |
|
384 |
i = DeserializeBitmap (i); |
|
385 |
} |
|
386 |
else |
|
387 |
{ |
|
388 |
if (m_compressed) |
|
389 |
{ |
|
390 |
NS_FATAL_ERROR ("Multi-tid block ack is not supported."); |
|
391 |
} |
|
392 |
else |
|
393 |
{ |
|
394 |
NS_FATAL_ERROR ("Reserved configuration."); |
|
395 |
} |
|
396 |
} |
|
397 |
return i.GetDistanceFrom (start); |
|
398 |
} |
|
399 |
||
400 |
void |
|
401 |
CtrlBAckResponseHeader::SetHtImmediateAck (bool immediateAck) |
|
402 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
403 |
NS_LOG_FUNCTION (this << immediateAck); |
5948 | 404 |
m_baAckPolicy = immediateAck; |
405 |
} |
|
406 |
||
407 |
void |
|
408 |
CtrlBAckResponseHeader::SetType (enum BlockAckType type) |
|
409 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
410 |
NS_LOG_FUNCTION (this << type); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
411 |
switch (type) |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
412 |
{ |
5948 | 413 |
case BASIC_BLOCK_ACK: |
414 |
m_multiTid = false; |
|
415 |
m_compressed = false; |
|
416 |
break; |
|
417 |
case COMPRESSED_BLOCK_ACK: |
|
418 |
m_multiTid = false; |
|
419 |
m_compressed = true; |
|
420 |
break; |
|
421 |
case MULTI_TID_BLOCK_ACK: |
|
422 |
m_multiTid = true; |
|
423 |
m_compressed = true; |
|
424 |
break; |
|
425 |
default: |
|
426 |
NS_FATAL_ERROR ("Invalid variant type"); |
|
427 |
break; |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
428 |
} |
5948 | 429 |
} |
430 |
||
431 |
void |
|
432 |
CtrlBAckResponseHeader::SetTidInfo (uint8_t tid) |
|
433 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
434 |
NS_LOG_FUNCTION (this << static_cast<uint32_t> (tid)); |
5948 | 435 |
m_tidInfo = static_cast<uint16_t> (tid); |
436 |
} |
|
437 |
||
438 |
void |
|
439 |
CtrlBAckResponseHeader::SetStartingSequence (uint16_t seq) |
|
440 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
441 |
NS_LOG_FUNCTION (this << seq); |
5948 | 442 |
m_startingSeq = seq; |
443 |
} |
|
444 |
||
445 |
bool |
|
446 |
CtrlBAckResponseHeader::MustSendHtImmediateAck (void) const |
|
447 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
448 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
449 |
return (m_baAckPolicy) ? true : false; |
5948 | 450 |
} |
451 |
||
452 |
uint8_t |
|
453 |
CtrlBAckResponseHeader::GetTidInfo (void) const |
|
454 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
455 |
NS_LOG_FUNCTION (this); |
5948 | 456 |
uint8_t tid = static_cast<uint8_t> (m_tidInfo); |
457 |
return tid; |
|
458 |
} |
|
459 |
||
460 |
uint16_t |
|
461 |
CtrlBAckResponseHeader::GetStartingSequence (void) const |
|
462 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
463 |
NS_LOG_FUNCTION (this); |
5948 | 464 |
return m_startingSeq; |
465 |
} |
|
466 |
||
467 |
bool |
|
468 |
CtrlBAckResponseHeader::IsBasic (void) const |
|
469 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
470 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
471 |
return (!m_multiTid && !m_compressed) ? true : false; |
5948 | 472 |
} |
473 |
||
474 |
bool |
|
475 |
CtrlBAckResponseHeader::IsCompressed (void) const |
|
476 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
477 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
478 |
return (!m_multiTid && m_compressed) ? true : false; |
5948 | 479 |
} |
480 |
||
481 |
bool |
|
482 |
CtrlBAckResponseHeader::IsMultiTid (void) const |
|
483 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
484 |
NS_LOG_FUNCTION (this); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
485 |
return (m_multiTid && m_compressed) ? true : false; |
5948 | 486 |
} |
487 |
||
488 |
uint16_t |
|
489 |
CtrlBAckResponseHeader::GetBaControl (void) const |
|
490 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
491 |
NS_LOG_FUNCTION (this); |
5948 | 492 |
uint16_t res = 0; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
493 |
if (m_baAckPolicy) |
5948 | 494 |
{ |
495 |
res |= 0x1; |
|
496 |
} |
|
497 |
if (m_multiTid) |
|
498 |
{ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
499 |
res |= (0x1 << 1); |
5948 | 500 |
} |
501 |
if (m_compressed) |
|
502 |
{ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
503 |
res |= (0x1 << 2); |
5948 | 504 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
505 |
res |= (m_tidInfo << 12) & (0xf << 12); |
5948 | 506 |
return res; |
507 |
} |
|
508 |
||
509 |
void |
|
510 |
CtrlBAckResponseHeader::SetBaControl (uint16_t ba) |
|
511 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
512 |
NS_LOG_FUNCTION (this << ba); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
513 |
m_baAckPolicy = ((ba & 0x01) == 1) ? true : false; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
514 |
m_multiTid = (((ba >> 1) & 0x01) == 1) ? true : false; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
515 |
m_compressed = (((ba >> 2) & 0x01) == 1) ? true : false; |
5948 | 516 |
m_tidInfo = (ba >> 12) & 0x0f; |
517 |
} |
|
518 |
||
519 |
uint16_t |
|
520 |
CtrlBAckResponseHeader::GetStartingSequenceControl (void) const |
|
521 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
522 |
NS_LOG_FUNCTION (this); |
5948 | 523 |
return (m_startingSeq << 4) & 0xfff0; |
524 |
} |
|
525 |
||
526 |
void |
|
527 |
CtrlBAckResponseHeader::SetStartingSequenceControl (uint16_t seqControl) |
|
528 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
529 |
NS_LOG_FUNCTION (this << seqControl); |
5948 | 530 |
m_startingSeq = (seqControl >> 4) & 0x0fff; |
531 |
} |
|
532 |
||
533 |
Buffer::Iterator |
|
534 |
CtrlBAckResponseHeader::SerializeBitmap (Buffer::Iterator start) const |
|
535 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
536 |
NS_LOG_FUNCTION (this << &start); |
5948 | 537 |
Buffer::Iterator i = start; |
538 |
if (!m_multiTid) |
|
539 |
{ |
|
540 |
if (!m_compressed) |
|
541 |
{ |
|
542 |
for (uint32_t j = 0; j < 64; j++) |
|
543 |
{ |
|
544 |
i.WriteHtolsbU16 (bitmap.m_bitmap[j]); |
|
545 |
} |
|
546 |
} |
|
547 |
else |
|
548 |
{ |
|
549 |
i.WriteHtolsbU64 (bitmap.m_compressedBitmap); |
|
550 |
} |
|
551 |
} |
|
552 |
else |
|
553 |
{ |
|
554 |
if (m_compressed) |
|
555 |
{ |
|
556 |
NS_FATAL_ERROR ("Multi-tid block ack is not supported."); |
|
557 |
} |
|
558 |
else |
|
559 |
{ |
|
560 |
NS_FATAL_ERROR ("Reserved configuration."); |
|
561 |
} |
|
562 |
} |
|
563 |
return i; |
|
564 |
} |
|
565 |
||
566 |
Buffer::Iterator |
|
567 |
CtrlBAckResponseHeader::DeserializeBitmap (Buffer::Iterator start) |
|
568 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
569 |
NS_LOG_FUNCTION (this << &start); |
5948 | 570 |
Buffer::Iterator i = start; |
571 |
if (!m_multiTid) |
|
572 |
{ |
|
573 |
if (!m_compressed) |
|
574 |
{ |
|
575 |
for (uint32_t j = 0; j < 64; j++) |
|
576 |
{ |
|
577 |
bitmap.m_bitmap[j] = i.ReadLsbtohU16 (); |
|
578 |
} |
|
579 |
} |
|
580 |
else |
|
581 |
{ |
|
582 |
bitmap.m_compressedBitmap = i.ReadLsbtohU64 (); |
|
583 |
} |
|
584 |
} |
|
585 |
else |
|
586 |
{ |
|
587 |
if (m_compressed) |
|
588 |
{ |
|
589 |
NS_FATAL_ERROR ("Multi-tid block ack is not supported."); |
|
590 |
} |
|
591 |
else |
|
592 |
{ |
|
593 |
NS_FATAL_ERROR ("Reserved configuration."); |
|
594 |
} |
|
595 |
} |
|
596 |
return i; |
|
597 |
} |
|
598 |
||
599 |
void |
|
600 |
CtrlBAckResponseHeader::SetReceivedPacket (uint16_t seq) |
|
601 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
602 |
NS_LOG_FUNCTION (this << seq); |
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
603 |
if (!IsInBitmap (seq)) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
604 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
605 |
return; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
606 |
} |
5948 | 607 |
if (!m_multiTid) |
608 |
{ |
|
609 |
if (!m_compressed) |
|
610 |
{ |
|
611 |
/* To set correctly basic block ack bitmap we need fragment number too. |
|
612 |
So if it's not specified, we consider packet not fragmented. */ |
|
613 |
bitmap.m_bitmap[IndexInBitmap (seq)] |= 0x0001; |
|
614 |
} |
|
615 |
else |
|
616 |
{ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
617 |
bitmap.m_compressedBitmap |= (uint64_t (0x0000000000000001) << IndexInBitmap (seq)); |
5948 | 618 |
} |
619 |
} |
|
620 |
else |
|
621 |
{ |
|
622 |
if (m_compressed) |
|
623 |
{ |
|
624 |
NS_FATAL_ERROR ("Multi-tid block ack is not supported."); |
|
625 |
} |
|
626 |
else |
|
627 |
{ |
|
628 |
NS_FATAL_ERROR ("Reserved configuration."); |
|
629 |
} |
|
630 |
} |
|
631 |
} |
|
632 |
||
633 |
void |
|
634 |
CtrlBAckResponseHeader::SetReceivedFragment (uint16_t seq, uint8_t frag) |
|
635 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
636 |
NS_LOG_FUNCTION (this << seq << static_cast<uint32_t> (frag)); |
5948 | 637 |
NS_ASSERT (frag < 16); |
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
638 |
if (!IsInBitmap (seq)) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
639 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
640 |
return; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
641 |
} |
5948 | 642 |
if (!m_multiTid) |
643 |
{ |
|
644 |
if (!m_compressed) |
|
645 |
{ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
646 |
bitmap.m_bitmap[IndexInBitmap (seq)] |= (0x0001 << frag); |
5948 | 647 |
} |
648 |
else |
|
649 |
{ |
|
650 |
/* We can ignore this...compressed block ack doesn't support |
|
651 |
acknowledgement of single fragments */ |
|
652 |
} |
|
653 |
} |
|
654 |
else |
|
655 |
{ |
|
656 |
if (m_compressed) |
|
657 |
{ |
|
658 |
NS_FATAL_ERROR ("Multi-tid block ack is not supported."); |
|
659 |
} |
|
660 |
else |
|
661 |
{ |
|
662 |
NS_FATAL_ERROR ("Reserved configuration."); |
|
663 |
} |
|
664 |
} |
|
665 |
} |
|
666 |
||
667 |
bool |
|
668 |
CtrlBAckResponseHeader::IsPacketReceived (uint16_t seq) const |
|
669 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
670 |
NS_LOG_FUNCTION (this << seq); |
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
671 |
if (!IsInBitmap (seq)) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
672 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
673 |
return false; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
674 |
} |
5948 | 675 |
if (!m_multiTid) |
676 |
{ |
|
677 |
if (!m_compressed) |
|
678 |
{ |
|
679 |
/*It's impossible to say if an entire packet was correctly received. */ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
680 |
return false; |
5948 | 681 |
} |
682 |
else |
|
683 |
{ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
684 |
uint64_t mask = uint64_t (0x0000000000000001); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
685 |
return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1) ? true : false; |
5948 | 686 |
} |
687 |
} |
|
688 |
else |
|
689 |
{ |
|
690 |
if (m_compressed) |
|
691 |
{ |
|
692 |
NS_FATAL_ERROR ("Multi-tid block ack is not supported."); |
|
693 |
} |
|
694 |
else |
|
695 |
{ |
|
696 |
NS_FATAL_ERROR ("Reserved configuration."); |
|
697 |
} |
|
698 |
} |
|
699 |
return false; |
|
700 |
} |
|
701 |
||
702 |
bool |
|
703 |
CtrlBAckResponseHeader::IsFragmentReceived (uint16_t seq, uint8_t frag) const |
|
704 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
705 |
NS_LOG_FUNCTION (this << seq << static_cast<uint32_t> (frag)); |
5948 | 706 |
NS_ASSERT (frag < 16); |
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
707 |
if (!IsInBitmap (seq)) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
708 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
709 |
return false; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
710 |
} |
5948 | 711 |
if (!m_multiTid) |
712 |
{ |
|
713 |
if (!m_compressed) |
|
714 |
{ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
715 |
return ((bitmap.m_bitmap[IndexInBitmap (seq)] & (0x0001 << frag)) != 0x0000) ? true : false; |
5948 | 716 |
} |
717 |
else |
|
718 |
{ |
|
719 |
/* Although this could make no sense, if packet with sequence number |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
720 |
equal to <i>seq</i> was correctly received, also all of its fragments |
5948 | 721 |
were correctly received. */ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
722 |
uint64_t mask = uint64_t (0x0000000000000001); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
723 |
return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1) ? true : false; |
5948 | 724 |
} |
725 |
} |
|
726 |
else |
|
727 |
{ |
|
728 |
if (m_compressed) |
|
729 |
{ |
|
730 |
NS_FATAL_ERROR ("Multi-tid block ack is not supported."); |
|
731 |
} |
|
732 |
else |
|
733 |
{ |
|
734 |
NS_FATAL_ERROR ("Reserved configuration."); |
|
735 |
} |
|
736 |
} |
|
737 |
return false; |
|
738 |
} |
|
739 |
||
740 |
uint8_t |
|
741 |
CtrlBAckResponseHeader::IndexInBitmap (uint16_t seq) const |
|
742 |
{ |
|
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
743 |
NS_LOG_FUNCTION (this << seq); |
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
744 |
uint8_t index; |
5948 | 745 |
if (seq >= m_startingSeq) |
746 |
{ |
|
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
747 |
index = seq - m_startingSeq; |
5948 | 748 |
} |
749 |
else |
|
750 |
{ |
|
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
751 |
index = 4096 - m_startingSeq + seq; |
5948 | 752 |
} |
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
753 |
NS_ASSERT (index <= 63); |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
754 |
return index; |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
755 |
} |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
756 |
|
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
757 |
bool |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
758 |
CtrlBAckResponseHeader::IsInBitmap (uint16_t seq) const |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
759 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
760 |
NS_LOG_FUNCTION (this << seq); |
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
761 |
return (seq - m_startingSeq + 4096) % 4096 < 64; |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
762 |
} |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
763 |
|
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
764 |
const uint16_t* |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
765 |
CtrlBAckResponseHeader::GetBitmap (void) const |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
766 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
767 |
NS_LOG_FUNCTION (this); |
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
768 |
return bitmap.m_bitmap; |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
769 |
} |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
770 |
|
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
771 |
uint64_t |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
772 |
CtrlBAckResponseHeader::GetCompressedBitmap (void) const |
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
773 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
774 |
NS_LOG_FUNCTION (this); |
6588
a83484625502
Improve block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
5948
diff
changeset
|
775 |
return bitmap.m_compressedBitmap; |
5948 | 776 |
} |
777 |
||
6589
385ef147f7b6
Add ResetBitmap method to block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6588
diff
changeset
|
778 |
void |
385ef147f7b6
Add ResetBitmap method to block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6588
diff
changeset
|
779 |
CtrlBAckResponseHeader::ResetBitmap (void) |
385ef147f7b6
Add ResetBitmap method to block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6588
diff
changeset
|
780 |
{ |
9705
43fa2408aa05
Partially clean up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents:
7386
diff
changeset
|
781 |
NS_LOG_FUNCTION (this); |
6589
385ef147f7b6
Add ResetBitmap method to block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6588
diff
changeset
|
782 |
memset (&bitmap, 0, sizeof (bitmap)); |
385ef147f7b6
Add ResetBitmap method to block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6588
diff
changeset
|
783 |
} |
385ef147f7b6
Add ResetBitmap method to block ack response header
Mirko Banchi <mk.banchi@gmail.com>
parents:
6588
diff
changeset
|
784 |
|
7386
2310ed220a61
standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
785 |
} // namespace ns3 |