OLD | NEW |
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 void | 73 void |
74 EdcaParameterSet::SetBeAci (uint8_t aci) | 74 EdcaParameterSet::SetBeAci (uint8_t aci) |
75 { | 75 { |
76 m_acBE |= (aci & 0x03) << 5; | 76 m_acBE |= (aci & 0x03) << 5; |
77 } | 77 } |
78 | 78 |
79 void | 79 void |
80 EdcaParameterSet::SetBeCWmin (uint8_t cwMin) | 80 EdcaParameterSet::SetBeCWmin (uint8_t cwMin) |
81 { | 81 { |
82 uint8_t ECWmin = log2 (cwMin + 1); | 82 uint8_t ECWmin = static_cast<uint8_t>(log2 (cwMin + 1)); |
83 m_acBE |= (ECWmin & 0x0f) << 8; | 83 m_acBE |= (ECWmin & 0x0f) << 8; |
84 } | 84 } |
85 | 85 |
86 void | 86 void |
87 EdcaParameterSet::SetBeCWmax (uint8_t cwMax) | 87 EdcaParameterSet::SetBeCWmax (uint8_t cwMax) |
88 { | 88 { |
89 uint8_t ECWmax = log2 (cwMax + 1); | 89 uint8_t ECWmax = static_cast<uint8_t>(log2 (cwMax + 1)); |
90 m_acBE |= (ECWmax & 0x0f) << 12; | 90 m_acBE |= (ECWmax & 0x0f) << 12; |
91 } | 91 } |
92 | 92 |
93 void | 93 void |
94 EdcaParameterSet::SetBeTXOPLimit (uint16_t txop) | 94 EdcaParameterSet::SetBeTXOPLimit (uint16_t txop) |
95 { | 95 { |
96 m_acBE |= txop << 16; | 96 m_acBE |= txop << 16; |
97 } | 97 } |
98 | 98 |
99 void | 99 void |
(...skipping 10 matching lines...) Expand all Loading... |
110 | 110 |
111 void | 111 void |
112 EdcaParameterSet::SetBkAci (uint8_t aci) | 112 EdcaParameterSet::SetBkAci (uint8_t aci) |
113 { | 113 { |
114 m_acBK |= (aci & 0x03) << 5; | 114 m_acBK |= (aci & 0x03) << 5; |
115 } | 115 } |
116 | 116 |
117 void | 117 void |
118 EdcaParameterSet::SetBkCWmin (uint8_t cwMin) | 118 EdcaParameterSet::SetBkCWmin (uint8_t cwMin) |
119 { | 119 { |
120 uint8_t ECWmin = log2 (cwMin + 1); | 120 uint8_t ECWmin = static_cast<uint8_t>(log2 (cwMin + 1)); |
121 m_acBK |= (ECWmin & 0x0f) << 8; | 121 m_acBK |= (ECWmin & 0x0f) << 8; |
122 } | 122 } |
123 | 123 |
124 void | 124 void |
125 EdcaParameterSet::SetBkCWmax (uint8_t cwMax) | 125 EdcaParameterSet::SetBkCWmax (uint8_t cwMax) |
126 { | 126 { |
127 uint8_t ECWmax = log2 (cwMax + 1); | 127 uint8_t ECWmax = static_cast<uint8_t>(log2 (cwMax + 1)); |
128 m_acBK |= (ECWmax & 0x0f) << 12; | 128 m_acBK |= (ECWmax & 0x0f) << 12; |
129 } | 129 } |
130 | 130 |
131 void | 131 void |
132 EdcaParameterSet::SetBkTXOPLimit (uint16_t txop) | 132 EdcaParameterSet::SetBkTXOPLimit (uint16_t txop) |
133 { | 133 { |
134 m_acBK |= txop << 16; | 134 m_acBK |= txop << 16; |
135 } | 135 } |
136 | 136 |
137 void | 137 void |
(...skipping 10 matching lines...) Expand all Loading... |
148 | 148 |
149 void | 149 void |
150 EdcaParameterSet::SetViAci (uint8_t aci) | 150 EdcaParameterSet::SetViAci (uint8_t aci) |
151 { | 151 { |
152 m_acVI |= (aci & 0x03) << 5; | 152 m_acVI |= (aci & 0x03) << 5; |
153 } | 153 } |
154 | 154 |
155 void | 155 void |
156 EdcaParameterSet::SetViCWmin (uint8_t cwMin) | 156 EdcaParameterSet::SetViCWmin (uint8_t cwMin) |
157 { | 157 { |
158 uint8_t ECWmin = log2 (cwMin + 1); | 158 uint8_t ECWmin = static_cast<uint8_t>(log2 (cwMin + 1)); |
159 m_acVI |= (ECWmin & 0x0f) << 8; | 159 m_acVI |= (ECWmin & 0x0f) << 8; |
160 } | 160 } |
161 | 161 |
162 void | 162 void |
163 EdcaParameterSet::SetViCWmax (uint8_t cwMax) | 163 EdcaParameterSet::SetViCWmax (uint8_t cwMax) |
164 { | 164 { |
165 uint8_t ECWmax = log2 (cwMax + 1); | 165 uint8_t ECWmax = static_cast<uint8_t>(log2 (cwMax + 1)); |
166 m_acVI |= (ECWmax & 0x0f) << 12; | 166 m_acVI |= (ECWmax & 0x0f) << 12; |
167 } | 167 } |
168 | 168 |
169 void | 169 void |
170 EdcaParameterSet::SetViTXOPLimit (uint16_t txop) | 170 EdcaParameterSet::SetViTXOPLimit (uint16_t txop) |
171 { | 171 { |
172 m_acVI |= txop << 16; | 172 m_acVI |= txop << 16; |
173 } | 173 } |
174 | 174 |
175 void | 175 void |
(...skipping 10 matching lines...) Expand all Loading... |
186 | 186 |
187 void | 187 void |
188 EdcaParameterSet::SetVoAci (uint8_t aci) | 188 EdcaParameterSet::SetVoAci (uint8_t aci) |
189 { | 189 { |
190 m_acVO |= (aci & 0x03) << 5; | 190 m_acVO |= (aci & 0x03) << 5; |
191 } | 191 } |
192 | 192 |
193 void | 193 void |
194 EdcaParameterSet::SetVoCWmin (uint8_t cwMin) | 194 EdcaParameterSet::SetVoCWmin (uint8_t cwMin) |
195 { | 195 { |
196 uint8_t ECWmin = log2 (cwMin + 1); | 196 uint8_t ECWmin = static_cast<uint8_t>(log2 (cwMin + 1)); |
197 m_acVO |= (ECWmin & 0x0f) << 8; | 197 m_acVO |= (ECWmin & 0x0f) << 8; |
198 } | 198 } |
199 | 199 |
200 void | 200 void |
201 EdcaParameterSet::SetVoCWmax (uint8_t cwMax) | 201 EdcaParameterSet::SetVoCWmax (uint8_t cwMax) |
202 { | 202 { |
203 uint8_t ECWmax = log2 (cwMax + 1); | 203 uint8_t ECWmax = static_cast<uint8_t>(log2 (cwMax + 1)); |
204 m_acVO |= (ECWmax & 0x0f) << 12; | 204 m_acVO |= (ECWmax & 0x0f) << 12; |
205 } | 205 } |
206 | 206 |
207 void | 207 void |
208 EdcaParameterSet::SetVoTXOPLimit (uint16_t txop) | 208 EdcaParameterSet::SetVoTXOPLimit (uint16_t txop) |
209 { | 209 { |
210 m_acVO |= txop << 16; | 210 m_acVO |= txop << 16; |
211 } | 211 } |
212 | 212 |
213 uint8_t | 213 uint8_t |
(...skipping 17 matching lines...) Expand all Loading... |
231 uint8_t | 231 uint8_t |
232 EdcaParameterSet::GetBeAci (void) const | 232 EdcaParameterSet::GetBeAci (void) const |
233 { | 233 { |
234 return ((m_acBE >> 5) & 0x03); | 234 return ((m_acBE >> 5) & 0x03); |
235 } | 235 } |
236 | 236 |
237 uint8_t | 237 uint8_t |
238 EdcaParameterSet::GetBeCWmin (void) const | 238 EdcaParameterSet::GetBeCWmin (void) const |
239 { | 239 { |
240 uint8_t ECWmin = ((m_acBE >> 8) & 0x0f); | 240 uint8_t ECWmin = ((m_acBE >> 8) & 0x0f); |
241 return (exp2 (ECWmin) - 1); | 241 return static_cast<uint8_t>(exp2 (ECWmin) - 1); |
242 } | 242 } |
243 | 243 |
244 uint8_t | 244 uint8_t |
245 EdcaParameterSet::GetBeCWmax (void) const | 245 EdcaParameterSet::GetBeCWmax (void) const |
246 { | 246 { |
247 uint8_t ECWmax = ((m_acBE >> 12) & 0x0f); | 247 uint8_t ECWmax = ((m_acBE >> 12) & 0x0f); |
248 return (exp2 (ECWmax) - 1); | 248 return static_cast<uint8_t>(exp2 (ECWmax) - 1); |
249 } | 249 } |
250 | 250 |
251 uint16_t | 251 uint16_t |
252 EdcaParameterSet::GetBeTXOPLimit (void) const | 252 EdcaParameterSet::GetBeTXOPLimit (void) const |
253 { | 253 { |
254 return (m_acBE >> 16); | 254 return (m_acBE >> 16); |
255 } | 255 } |
256 | 256 |
257 uint8_t | 257 uint8_t |
258 EdcaParameterSet::GetBkAifsn (void) const | 258 EdcaParameterSet::GetBkAifsn (void) const |
(...skipping 10 matching lines...) Expand all Loading... |
269 uint8_t | 269 uint8_t |
270 EdcaParameterSet::GetBkAci (void) const | 270 EdcaParameterSet::GetBkAci (void) const |
271 { | 271 { |
272 return ((m_acBK >> 5) & 0x03); | 272 return ((m_acBK >> 5) & 0x03); |
273 } | 273 } |
274 | 274 |
275 uint8_t | 275 uint8_t |
276 EdcaParameterSet::GetBkCWmin (void) const | 276 EdcaParameterSet::GetBkCWmin (void) const |
277 { | 277 { |
278 uint8_t ECWmin = ((m_acBK >> 8) & 0x0f); | 278 uint8_t ECWmin = ((m_acBK >> 8) & 0x0f); |
279 return (exp2 (ECWmin) - 1); | 279 return static_cast<uint8_t>(exp2 (ECWmin) - 1); |
280 } | 280 } |
281 | 281 |
282 uint8_t | 282 uint8_t |
283 EdcaParameterSet::GetBkCWmax (void) const | 283 EdcaParameterSet::GetBkCWmax (void) const |
284 { | 284 { |
285 uint8_t ECWmax = ((m_acBK >> 12) & 0x0f); | 285 uint8_t ECWmax = ((m_acBK >> 12) & 0x0f); |
286 return (exp2 (ECWmax) - 1); | 286 return static_cast<uint8_t>(exp2 (ECWmax) - 1); |
287 } | 287 } |
288 | 288 |
289 uint16_t | 289 uint16_t |
290 EdcaParameterSet::GetBkTXOPLimit (void) const | 290 EdcaParameterSet::GetBkTXOPLimit (void) const |
291 { | 291 { |
292 return (m_acBK >> 16); | 292 return (m_acBK >> 16); |
293 } | 293 } |
294 | 294 |
295 uint8_t | 295 uint8_t |
296 EdcaParameterSet::GetViAifsn (void) const | 296 EdcaParameterSet::GetViAifsn (void) const |
(...skipping 10 matching lines...) Expand all Loading... |
307 uint8_t | 307 uint8_t |
308 EdcaParameterSet::GetViAci (void) const | 308 EdcaParameterSet::GetViAci (void) const |
309 { | 309 { |
310 return ((m_acVI >> 5) & 0x03); | 310 return ((m_acVI >> 5) & 0x03); |
311 } | 311 } |
312 | 312 |
313 uint8_t | 313 uint8_t |
314 EdcaParameterSet::GetViCWmin (void) const | 314 EdcaParameterSet::GetViCWmin (void) const |
315 { | 315 { |
316 uint8_t ECWmin = ((m_acVI >> 8) & 0x0f); | 316 uint8_t ECWmin = ((m_acVI >> 8) & 0x0f); |
317 return (exp2 (ECWmin) - 1); | 317 return static_cast<uint8_t>(exp2 (ECWmin) - 1); |
318 } | 318 } |
319 | 319 |
320 uint8_t | 320 uint8_t |
321 EdcaParameterSet::GetViCWmax (void) const | 321 EdcaParameterSet::GetViCWmax (void) const |
322 { | 322 { |
323 uint8_t ECWmax = ((m_acVI >> 12) & 0x0f); | 323 uint8_t ECWmax = ((m_acVI >> 12) & 0x0f); |
324 return (exp2 (ECWmax) - 1); | 324 return static_cast<uint8_t>(exp2 (ECWmax) - 1); |
325 } | 325 } |
326 | 326 |
327 uint16_t | 327 uint16_t |
328 EdcaParameterSet::GetViTXOPLimit (void) const | 328 EdcaParameterSet::GetViTXOPLimit (void) const |
329 { | 329 { |
330 return (m_acVI >> 16); | 330 return (m_acVI >> 16); |
331 } | 331 } |
332 | 332 |
333 uint8_t | 333 uint8_t |
334 EdcaParameterSet::GetVoAifsn (void) const | 334 EdcaParameterSet::GetVoAifsn (void) const |
(...skipping 10 matching lines...) Expand all Loading... |
345 uint8_t | 345 uint8_t |
346 EdcaParameterSet::GetVoAci (void) const | 346 EdcaParameterSet::GetVoAci (void) const |
347 { | 347 { |
348 return ((m_acVO >> 5) & 0x03); | 348 return ((m_acVO >> 5) & 0x03); |
349 } | 349 } |
350 | 350 |
351 uint8_t | 351 uint8_t |
352 EdcaParameterSet::GetVoCWmin (void) const | 352 EdcaParameterSet::GetVoCWmin (void) const |
353 { | 353 { |
354 uint8_t ECWmin = ((m_acVO >> 8) & 0x0f); | 354 uint8_t ECWmin = ((m_acVO >> 8) & 0x0f); |
355 return (exp2 (ECWmin) - 1); | 355 return static_cast<uint8_t>(exp2 (ECWmin) - 1); |
356 } | 356 } |
357 | 357 |
358 uint8_t | 358 uint8_t |
359 EdcaParameterSet::GetVoCWmax (void) const | 359 EdcaParameterSet::GetVoCWmax (void) const |
360 { | 360 { |
361 uint8_t ECWmax = ((m_acVO >> 12) & 0x0f); | 361 uint8_t ECWmax = ((m_acVO >> 12) & 0x0f); |
362 return (exp2 (ECWmax) - 1); | 362 return static_cast<uint8_t>(exp2 (ECWmax) - 1); |
363 } | 363 } |
364 | 364 |
365 uint16_t | 365 uint16_t |
366 EdcaParameterSet::GetVoTXOPLimit (void) const | 366 EdcaParameterSet::GetVoTXOPLimit (void) const |
367 { | 367 { |
368 return (m_acVO >> 16); | 368 return (m_acVO >> 16); |
369 } | 369 } |
370 | 370 |
371 uint8_t | 371 uint8_t |
372 EdcaParameterSet::GetInformationFieldSize () const | 372 EdcaParameterSet::GetInformationFieldSize () const |
373 { | 373 { |
374 NS_ASSERT (m_qosSupported > 0); | 374 NS_ASSERT (m_qosSupported); |
375 return 18; | 375 return 18; |
376 } | 376 } |
377 | 377 |
378 Buffer::Iterator | 378 Buffer::Iterator |
379 EdcaParameterSet::Serialize (Buffer::Iterator i) const | 379 EdcaParameterSet::Serialize (Buffer::Iterator i) const |
380 { | 380 { |
381 if (m_qosSupported < 1) | 381 if (!m_qosSupported) |
382 { | 382 { |
383 return i; | 383 return i; |
384 } | 384 } |
385 return WifiInformationElement::Serialize (i); | 385 return WifiInformationElement::Serialize (i); |
386 } | 386 } |
387 | 387 |
388 uint16_t | 388 uint16_t |
389 EdcaParameterSet::GetSerializedSize () const | 389 EdcaParameterSet::GetSerializedSize () const |
390 { | 390 { |
391 if (m_qosSupported < 1) | 391 if (!m_qosSupported) |
392 { | 392 { |
393 return 0; | 393 return 0; |
394 } | 394 } |
395 return WifiInformationElement::GetSerializedSize (); | 395 return WifiInformationElement::GetSerializedSize (); |
396 } | 396 } |
397 | 397 |
398 void | 398 void |
399 EdcaParameterSet::SerializeInformationField (Buffer::Iterator start) const | 399 EdcaParameterSet::SerializeInformationField (Buffer::Iterator start) const |
400 { | 400 { |
401 if (m_qosSupported == 1) | 401 if (m_qosSupported) |
402 { | 402 { |
403 start.WriteU8 (m_qosInfo); | 403 start.WriteU8 (m_qosInfo); |
404 start.WriteU8 (m_reserved); | 404 start.WriteU8 (m_reserved); |
405 start.WriteU32 (m_acBE); | 405 start.WriteU32 (m_acBE); |
406 start.WriteU32 (m_acBK); | 406 start.WriteU32 (m_acBK); |
407 start.WriteU32 (m_acVI); | 407 start.WriteU32 (m_acVI); |
408 start.WriteU32 (m_acVO); | 408 start.WriteU32 (m_acVO); |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 uint8_t | 412 uint8_t |
413 EdcaParameterSet::DeserializeInformationField (Buffer::Iterator start, uint8_t l
ength) | 413 EdcaParameterSet::DeserializeInformationField (Buffer::Iterator start, uint8_t l
ength) |
414 { | 414 { |
415 Buffer::Iterator i = start; | 415 Buffer::Iterator i = start; |
416 m_qosInfo = i.ReadU8 (); | 416 m_qosInfo = i.ReadU8 (); |
417 m_reserved = i.ReadU8 (); | 417 m_reserved = i.ReadU8 (); |
418 m_acBE = i.ReadU32 (); | 418 m_acBE = i.ReadU32 (); |
419 m_acBK = i.ReadU32 (); | 419 m_acBK = i.ReadU32 (); |
420 m_acVI = i.ReadU32 (); | 420 m_acVI = i.ReadU32 (); |
421 m_acVO = i.ReadU32 (); | 421 m_acVO = i.ReadU32 (); |
422 return length; | 422 return length; |
423 } | 423 } |
424 | 424 |
425 } //namespace ns3 | 425 } //namespace ns3 |
OLD | NEW |