A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ctrl-headers.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 MIRKO BANCHI
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Mirko Banchi <mk.banchi@gmail.com>
18 */
19
20#ifndef CTRL_HEADERS_H
21#define CTRL_HEADERS_H
22
23#include "block-ack-type.h"
24#include "wifi-phy-common.h"
25
26#include "ns3/he-ru.h"
27#include "ns3/header.h"
28#include "ns3/mac48-address.h"
29
30#include <list>
31#include <vector>
32
33namespace ns3
34{
35
36class WifiTxVector;
37enum AcIndex : uint8_t;
38
39/**
40 * \ingroup wifi
41 * \brief Headers for BlockAckRequest.
42 *
43 * 802.11n standard includes three types of BlockAck:
44 * - Basic BlockAck (unique type in 802.11e)
45 * - Compressed BlockAck
46 * - Multi-TID BlockAck
47 * For now only basic BlockAck and compressed BlockAck
48 * are supported.
49 * Basic BlockAck is also default variant.
50 */
52{
53 public:
55 ~CtrlBAckRequestHeader() override;
56 /**
57 * \brief Get the type ID.
58 * \return the object TypeId
59 */
60 static TypeId GetTypeId();
61
62 TypeId GetInstanceTypeId() const override;
63 void Print(std::ostream& os) const override;
64 uint32_t GetSerializedSize() const override;
65 void Serialize(Buffer::Iterator start) const override;
67
68 /**
69 * Enable or disable HT immediate Ack.
70 *
71 * \param immediateAck enable or disable HT immediate Ack
72 */
73 void SetHtImmediateAck(bool immediateAck);
74 /**
75 * Set the BlockAckRequest type.
76 *
77 * \param type the BlockAckRequest type
78 */
79 void SetType(BlockAckReqType type);
80 /**
81 * Set Traffic ID (TID).
82 *
83 * \param tid the TID
84 */
85 void SetTidInfo(uint8_t tid);
86 /**
87 * Set the starting sequence number from the given
88 * raw sequence control field.
89 *
90 * \param seq the raw sequence control
91 */
92 void SetStartingSequence(uint16_t seq);
93
94 /**
95 * Check if the current Ack Policy is immediate.
96 *
97 * \return true if the current Ack Policy is immediate,
98 * false otherwise
99 */
100 bool MustSendHtImmediateAck() const;
101 /**
102 * Return the BlockAckRequest type.
103 *
104 * \return the type of the BlockAckRequest
105 */
106 BlockAckReqType GetType() const;
107 /**
108 * Return the Traffic ID (TID).
109 *
110 * \return TID
111 */
112 uint8_t GetTidInfo() const;
113 /**
114 * Return the starting sequence number.
115 *
116 * \return the starting sequence number
117 */
118 uint16_t GetStartingSequence() const;
119 /**
120 * Check if the current Ack Policy is Basic Block Ack
121 * (i.e. not multi-TID nor compressed).
122 *
123 * \return true if the current Ack Policy is Basic Block Ack,
124 * false otherwise
125 */
126 bool IsBasic() const;
127 /**
128 * Check if the current Ack Policy is Compressed Block Ack
129 * and not multi-TID.
130 *
131 * \return true if the current Ack Policy is Compressed Block Ack,
132 * false otherwise
133 */
134 bool IsCompressed() const;
135 /**
136 * Check if the current Ack Policy is Extended Compressed Block Ack.
137 *
138 * \return true if the current Ack Policy is Extended Compressed Block Ack,
139 * false otherwise
140 */
141 bool IsExtendedCompressed() const;
142 /**
143 * Check if the current Ack Policy has Multi-TID Block Ack.
144 *
145 * \return true if the current Ack Policy has Multi-TID Block Ack,
146 * false otherwise
147 */
148 bool IsMultiTid() const;
149
150 /**
151 * Return the starting sequence control.
152 *
153 * \return the starting sequence control
154 */
155 uint16_t GetStartingSequenceControl() const;
156
157 private:
158 /**
159 * Set the starting sequence control with the given
160 * sequence control value
161 *
162 * \param seqControl the sequence control value
163 */
164 void SetStartingSequenceControl(uint16_t seqControl);
165 /**
166 * Return the Block Ack control.
167 *
168 * \return the Block Ack control
169 */
170 uint16_t GetBarControl() const;
171 /**
172 * Set the Block Ack control.
173 *
174 * \param bar the BAR control value
175 */
176 void SetBarControl(uint16_t bar);
177
178 /**
179 * The LSB bit of the BAR control field is used only for the
180 * HT (High Throughput) delayed block ack configuration.
181 * For now only non HT immediate BlockAck is implemented so this field
182 * is here only for a future implementation of HT delayed variant.
183 */
184 bool m_barAckPolicy; ///< bar ack policy
186 uint16_t m_tidInfo; ///< TID info
187 uint16_t m_startingSeq; ///< starting seq
188};
189
190/**
191 * \ingroup wifi
192 * \brief Headers for BlockAck response.
193 *
194 * 802.11n standard includes three types of BlockAck:
195 * - Basic BlockAck (unique type in 802.11e)
196 * - Compressed BlockAck
197 * - Multi-TID BlockAck
198 * For now only basic BlockAck and compressed BlockAck
199 * are supported.
200 * Basic BlockAck is also default variant.
201 */
203{
204 public:
206 ~CtrlBAckResponseHeader() override;
207 /**
208 * \brief Get the type ID.
209 * \return the object TypeId
210 */
211 static TypeId GetTypeId();
212 TypeId GetInstanceTypeId() const override;
213 void Print(std::ostream& os) const override;
214 uint32_t GetSerializedSize() const override;
215 void Serialize(Buffer::Iterator start) const override;
216 uint32_t Deserialize(Buffer::Iterator start) override;
217
218 /**
219 * Enable or disable HT immediate Ack.
220 *
221 * \param immediateAck enable or disable HT immediate Ack
222 */
223 void SetHtImmediateAck(bool immediateAck);
224 /**
225 * Set the block ack type.
226 *
227 * \param type the BA type
228 */
229 void SetType(BlockAckType type);
230 /**
231 * For Block Ack variants other than Multi-STA Block Ack, set the TID_INFO subfield
232 * of the BA Control field. For Multi-STA Block Acks, set the TID subfield of the
233 * AID TID Info subfield of the Per AID TID Info subfield identified by the given
234 * index.
235 *
236 * \param tid the traffic ID
237 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
238 */
239 void SetTidInfo(uint8_t tid, std::size_t index = 0);
240 /**
241 * For Block Ack variants other than Multi-STA Block Ack, set the starting sequence
242 * number to the given value. For Multi-STA Block Acks, set the starting sequence
243 * number in the Per AID TID Info subfield identified by the given index to the
244 * given value.
245 *
246 * \param seq the starting sequence number
247 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
248 */
249 void SetStartingSequence(uint16_t seq, std::size_t index = 0);
250
251 /**
252 * Check if the current Ack Policy is immediate.
253 *
254 * \return true if the current Ack Policy is immediate,
255 * false otherwise
256 */
257 bool MustSendHtImmediateAck() const;
258 /**
259 * Return the block ack type ID.
260 *
261 * \return type
262 */
263 BlockAckType GetType() const;
264 /**
265 * For Block Ack variants other than Multi-STA Block Ack, get the TID_INFO subfield
266 * of the BA Control field. For Multi-STA Block Acks, get the TID subfield of the
267 * AID TID Info subfield of the Per AID TID Info subfield identified by the given
268 * index.
269 *
270 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
271 * \return the Traffic ID
272 */
273 uint8_t GetTidInfo(std::size_t index = 0) const;
274 /**
275 * For Block Ack variants other than Multi-STA Block Ack, get the starting sequence
276 * number. For Multi-STA Block Acks, get the starting sequence number in the
277 * Per AID TID Info subfield identified by the given index.
278 *
279 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
280 * \return the starting sequence number
281 */
282 uint16_t GetStartingSequence(std::size_t index = 0) const;
283 /**
284 * Check if the current BA policy is Basic Block Ack.
285 *
286 * \return true if the current BA policy is Basic Block Ack,
287 * false otherwise
288 */
289 bool IsBasic() const;
290 /**
291 * Check if the current BA policy is Compressed Block Ack.
292 *
293 * \return true if the current BA policy is Compressed Block Ack,
294 * false otherwise
295 */
296 bool IsCompressed() const;
297 /**
298 * Check if the current BA policy is Extended Compressed Block Ack.
299 *
300 * \return true if the current BA policy is Extended Compressed Block Ack,
301 * false otherwise
302 */
303 bool IsExtendedCompressed() const;
304 /**
305 * Check if the current BA policy is Multi-TID Block Ack.
306 *
307 * \return true if the current BA policy is Multi-TID Block Ack,
308 * false otherwise
309 */
310 bool IsMultiTid() const;
311 /**
312 * Check if the BlockAck frame variant is Multi-STA Block Ack.
313 *
314 * \return true if the BlockAck frame variant is Multi-STA Block Ack,
315 * false otherwise
316 */
317 bool IsMultiSta() const;
318
319 /**
320 * For Multi-STA Block Acks, set the AID11 subfield of the Per AID TID Info
321 * subfield identified by the given index to the given value
322 *
323 * \param aid the AID11 value
324 * \param index the index of the Per AID TID Info subfield
325 */
326 void SetAid11(uint16_t aid, std::size_t index);
327 /**
328 * For Multi-STA Block Acks, get the AID11 subfield of the Per AID TID Info
329 * subfield identified by the given index.
330 *
331 * \param index the index of the Per AID TID Info subfield
332 * \return the AID11 subfield
333 */
334 uint16_t GetAid11(std::size_t index) const;
335 /**
336 * For Multi-STA Block Acks, set the Ack Type subfield of the Per AID TID Info
337 * subfield identified by the given index to the given value
338 *
339 * \param type the ack type value
340 * \param index the index of the Per AID TID Info subfield
341 */
342 void SetAckType(bool type, std::size_t index);
343 /**
344 * For Multi-STA Block Acks, get the Ack Type subfield of the Per AID TID Info
345 * subfield identified by the given index.
346 *
347 * \param index the index of the Per AID TID Info subfield
348 * \return the Ack Type
349 */
350 bool GetAckType(std::size_t index) const;
351 /**
352 * For Multi-STA Block Acks, set the RA subfield of the Per AID TID Info
353 * subfield (with AID11 subfield equal to 2045) identified by the given index
354 * to the given MAC address.
355 *
356 * \param ra the MAC address
357 * \param index the index of the Per AID TID Info subfield
358 */
359 void SetUnassociatedStaAddress(const Mac48Address& ra, std::size_t index);
360 /**
361 * For Multi-STA Block Acks, get the RA subfield of the Per AID TID Info
362 * subfield (with AID11 subfield equal to 2045) identified by the given index
363 * to the given MAC address.
364 *
365 * \param index the index of the Per AID TID Info subfield
366 * \return the MAC address stored in the RA subfield
367 */
368 Mac48Address GetUnassociatedStaAddress(std::size_t index) const;
369 /**
370 * For Multi-STA Block Acks, get the number of Per AID TID Info subfields
371 * included in this Block Ack.
372 *
373 * \return the number of Per AID TID Info subfields included in this Multi-STA Block Ack
374 */
375 std::size_t GetNPerAidTidInfoSubfields() const;
376 /**
377 * For Multi-STA Block Acks, get the indices of the Per AID TID Info subfields
378 * carrying the given AID in the AID11 subfield.
379 *
380 * \param aid the given AID
381 * \return a vector containing the indices of the Per AID TID Info subfields
382 * carrying the given AID in the AID11 subfield
383 */
384 std::vector<uint32_t> FindPerAidTidInfoWithAid(uint16_t aid) const;
385
386 /**
387 * Record in the bitmap that the packet with the given sequence number was
388 * received. For Multi-STA Block Acks, <i>index</i> identifies the Per AID
389 * TID Info subfield whose bitmap has to be updated.
390 *
391 * \param seq the sequence number of the received packet
392 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
393 */
394 void SetReceivedPacket(uint16_t seq, std::size_t index = 0);
395 /**
396 * Set the bitmap that the packet with the given sequence
397 * number and fragment number was received.
398 *
399 * \param seq the sequence number
400 * \param frag the fragment number
401 */
402 void SetReceivedFragment(uint16_t seq, uint8_t frag);
403 /**
404 * Check if the packet with the given sequence number was acknowledged in this
405 * BlockAck response. For Multi-STA Block Acks, <i>index</i> identifies the
406 * Per AID TID Info subfield whose bitmap has to be checked.
407 *
408 * \param seq the sequence number to be checked
409 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
410 * \return true if the packet with the given sequence number
411 * was ACKed in this BlockAck response, false otherwise
412 */
413 bool IsPacketReceived(uint16_t seq, std::size_t index = 0) const;
414 /**
415 * Check if the packet with the given sequence number
416 * and fragment number was acknowledged in this BlockAck response.
417 *
418 * \param seq the sequence number
419 * \param frag the fragment number
420 * \return true if the packet with the given sequence number
421 * and sequence number was acknowledged in this BlockAck response,
422 * false otherwise
423 */
424 bool IsFragmentReceived(uint16_t seq, uint8_t frag) const;
425
426 /**
427 * Return the value of the Starting Sequence Control subfield. For Multi-STA
428 * Block Acks, <i>index</i> identifies the Per AID TID Info subfield whose
429 * Starting Sequence Control subfield has to be returned.
430 *
431 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
432 * \return the value of the Starting Sequence Control subfield
433 */
434 uint16_t GetStartingSequenceControl(std::size_t index = 0) const;
435 /**
436 * Set the Starting Sequence Control subfield with the given sequence control
437 * value. For Multi-STA Block Acks, <i>index</i> identifies the Per AID TID Info
438 * subfield whose Starting Sequence Control subfield has to be set.
439 *
440 * \param seqControl the raw sequence control value
441 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
442 */
443 void SetStartingSequenceControl(uint16_t seqControl, std::size_t index = 0);
444 /**
445 * Return a const reference to the bitmap from the BlockAck response header.
446 * For Multi-STA Block Acks, return a const reference to the bitmap included
447 * in the Per AID TID Info subfield identified by <i>index</i>.
448 *
449 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
450 * \return a const reference to the bitmap from the BlockAck response header
451 */
452 const std::vector<uint8_t>& GetBitmap(std::size_t index = 0) const;
453
454 /**
455 * Reset the bitmap to 0. For Multi-STA Block Acks, reset the bitmap included
456 * in the Per AID TID Info subfield identified by <i>index</i>.
457 *
458 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
459 */
460 void ResetBitmap(std::size_t index = 0);
461
462 private:
463 /**
464 * Return the Block Ack control.
465 *
466 * \return the Block Ack control
467 */
468 uint16_t GetBaControl() const;
469 /**
470 * Set the Block Ack control.
471 *
472 * \param ba the BA control to set
473 */
474 void SetBaControl(uint16_t ba);
475
476 /**
477 * Serialize bitmap to the given buffer. For Multi-STA Block Acks, <i>index</i>
478 * identifies the Per AID TID Info subfield whose bitmap has to be serialized.
479 *
480 * \param start iterator pointing to the beginning of the buffer to write into.
481 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
482 * \return Buffer::Iterator to the next available buffer
483 */
484 Buffer::Iterator SerializeBitmap(Buffer::Iterator start, std::size_t index = 0) const;
485 /**
486 * Deserialize bitmap from the given buffer. For Multi-STA Block Acks, <i>index</i>
487 * identifies the Per AID TID Info subfield whose bitmap has to be deserialized.
488 *
489 * \param start iterator pointing to the beginning of the buffer to read from.
490 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
491 * \return Buffer::Iterator to the next available buffer
492 */
493 Buffer::Iterator DeserializeBitmap(Buffer::Iterator start, std::size_t index = 0);
494
495 /**
496 * This function is used to correctly index in both bitmap
497 * and compressed bitmap, one bit or one block of 16 bits respectively.
498 *
499 * for more details see 7.2.1.8 in IEEE 802.11n/D4.00
500 *
501 * \param seq the sequence number
502 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
503 *
504 * \return If we are using basic block ack, return value represents index of
505 * block of 16 bits for packet having sequence number equals to <i>seq</i>.
506 * If we are using compressed block ack, return value represents bit
507 * to set to 1 in the compressed bitmap to indicate that packet having
508 * sequence number equals to <i>seq</i> was correctly received.
509 */
510 uint16_t IndexInBitmap(uint16_t seq, std::size_t index = 0) const;
511
512 /**
513 * Check if sequence number <i>seq</i> can be acknowledged in the bitmap. For
514 * Multi-STA Block Acks, check if sequence number <i>seq</i> can be acknowledged
515 * in the bitmap included in the Per AID TID Info subfield identified by <i>index</i>.
516 *
517 * \param seq the sequence number
518 * \param index the index of the Per AID TID Info subfield (Multi-STA Block Ack only)
519 * \return true if the sequence number is concerned by the bitmap
520 */
521 bool IsInBitmap(uint16_t seq, std::size_t index = 0) const;
522
523 /**
524 * The LSB bit of the BA control field is used only for the
525 * HT (High Throughput) delayed block ack configuration.
526 * For now only non HT immediate block ack is implemented so this field
527 * is here only for a future implementation of HT delayed variant.
528 */
529 bool m_baAckPolicy; ///< BA Ack Policy
530 BlockAckType m_baType; ///< BA type
531 uint16_t m_tidInfo; ///< TID info (reserved if Multi-STA Block Ack)
532
533 /**
534 * The following structure can hold the BA Information field for the Basic and
535 * Compressed variants, one instance of the {Per TID Info, Block Ack Starting
536 * Sequence Control, Block Ack Bitmap} subfields for the Multi-TID variant or
537 * one instance of the Per AID TID Info subfield for the Multi-STA variant
538 * (which includes the AID TID Info, Block Ack Starting Sequence Control and
539 * Block Ack Bitmap subfields).
540 */
542 {
543 uint16_t m_aidTidInfo; //!< Reserved for Basic and Compressed
544 //!< Per TID Info subfield for Multi-TID
545 //!< AID TID Info subfield for Multi-STA
546 uint16_t m_startingSeq; //!< Block Ack Starting Sequence Control subfield
547 std::vector<uint8_t> m_bitmap; //!< block ack bitmap
548 Mac48Address m_ra; //!< RA subfield (address of an unassociated station)
549 //!< for Multi-STA; reserved for other variants
550 };
551
552 std::vector<BaInfoInstance> m_baInfo; //!< BA Information field
553};
554
555/**
556 * \ingroup wifi
557 * The different Trigger frame types.
558 */
559enum class TriggerFrameType : uint8_t
560{
561 BASIC_TRIGGER = 0, // Basic
562 BFRP_TRIGGER = 1, // Beamforming Report Poll
563 MU_BAR_TRIGGER = 2, // Multi-User Block Ack Request
564 MU_RTS_TRIGGER = 3, // Multi-User Request To Send
565 BSRP_TRIGGER = 4, // Buffer Status Report Poll
566 GCR_MU_BAR_TRIGGER = 5, // Groupcast with Retries MU-BAR
567 BQRP_TRIGGER = 6, // Bandwidth Query Report Poll
568 NFRP_TRIGGER = 7 // NDP Feedback Report Poll
569};
570
571/**
572 * \ingroup wifi
573 * The different variants for Common Info field and User Info field of Trigger Frames.
574 */
575enum class TriggerFrameVariant : uint8_t
576{
577 HE = 0,
578 EHT
579};
580
581/**
582 * \ingroup wifi
583 * \brief User Info field of Trigger frames.
584 *
585 * Trigger frames, introduced by 802.11ax amendment (see Section 9.3.1.23 of D3.0),
586 * include one or more User Info fields, each of which carries information about the
587 * HE TB PPDU that the addressed station sends in response to the Trigger frame.
588 */
590{
591 public:
592 /**
593 * Constructor
594 *
595 * \param triggerType the Trigger frame type
596 * \param variant the Trigger Frame variant
597 */
599 /**
600 * Copy assignment operator.
601 *
602 * \param userInfo the User Info field to copy
603 * \return a reference to the copied object
604 *
605 * Checks that the given User Info fields is included in the same type
606 * of Trigger Frame.
607 */
609 /**
610 * Destructor
611 */
613 /**
614 * Print the content of this User Info field
615 *
616 * \param os output stream
617 */
618 void Print(std::ostream& os) const;
619 /**
620 * Get the expected size of this User Info field
621 *
622 * \return the expected size of this User Info field.
623 */
625 /**
626 * Serialize the User Info field to the given buffer.
627 *
628 * \param start an iterator which points to where the header should
629 * be written
630 * \return Buffer::Iterator to the next available buffer
631 */
633 /**
634 * Deserialize the User Info field from the given buffer.
635 *
636 * \param start an iterator which points to where the header should
637 * read from
638 * \return Buffer::Iterator to the next available buffer
639 */
641 /**
642 * Get the type of the Trigger Frame this User Info field belongs to.
643 *
644 * \return the type of the Trigger Frame this User Info field belongs to
645 */
647 /**
648 * \return the preamble type of the TB PPDU solicited by this User Info field.
649 */
651 /**
652 * Set the AID12 subfield, which carries the 12 LSBs of the AID of the
653 * station for which this User Info field is intended. The whole AID can
654 * be passed, since the passed value is properly masked.
655 *
656 * \param aid the value for the AID12 subfield
657 */
658 void SetAid12(uint16_t aid);
659 /**
660 * Get the value of the AID12 subfield.
661 *
662 * \return the AID12 subfield
663 */
664 uint16_t GetAid12() const;
665 /**
666 * Check if this User Info field allocates a Random Access RU for stations
667 * associated with the AP that transmitted the Trigger frame.
668 *
669 * \return true if a Random Access RU for associated stations is allocated
670 */
671 bool HasRaRuForAssociatedSta() const;
672 /**
673 * Check if this User Info field allocates a Random Access RU for stations
674 * not associated with the AP that transmitted the Trigger frame.
675 *
676 * \return true if a Random Access RU for unassociated stations is allocated
677 */
678 bool HasRaRuForUnassociatedSta() const;
679 /**
680 * Set the RU Allocation subfield according to the specified RU.
681 * This method cannot be called on MU-RTS Trigger Frames (call SetMuRtsRuAllocation instead).
682 *
683 * \param ru the RU this User Info field is allocating
684 */
686 /**
687 * Get the RU specified by the RU Allocation subfield.
688 * This method cannot be called on MU-RTS Trigger Frames (call GetMuRtsRuAllocation instead).
689 *
690 * \return the RU this User Info field is allocating
691 */
693 /**
694 * Set the RU Allocation subfield based on the given value for the B7-B1 bits.
695 * This method can only be called on MU-RTS Trigger Frames.
696 *
697 * B7–B1 of the RU Allocation subfield is set to indicate the primary 20 MHz channel
698 * as follows:
699 * - 61 if the primary 20 MHz channel is the only 20 MHz channel or the lowest frequency
700 * 20 MHz channel in the primary 40 MHz channel or primary 80 MHz channel
701 * - 62 if the primary 20 MHz channel is the second lowest frequency 20 MHz channel in the
702 * primary 40 MHz channel or primary 80 MHz channel
703 * - 63 if the primary 20 MHz channel is the third lowest frequency 20 MHz channel in the
704 * primary 80 MHz channel
705 * - 64 if the primary 20 MHz channel is the fourth lowest frequency 20 MHz channel in the
706 * primary 80 MHz channel
707 *
708 * B7–B1 of the RU Allocation subfield is set to indicate the primary 40 MHz channel
709 * as follows:
710 * - 65 if the primary 40 MHz channel is the only 40 MHz channel or the lowest frequency
711 * 40 MHz channel in the primary 80 MHz channel
712 * - 66 if the primary 40 MHz channel is the second lowest frequency 40 MHz channel in the
713 * primary 80 MHz channel
714 *
715 * B7–B1 of the RU Allocation subfield is set to 67 to indicate the primary 80 MHz channel.
716 *
717 * B7–B1 of the RU Allocation subfield is set to 68 to indicate the primary and secondary
718 * 80 MHz channel.
719 *
720 * \param value the value for B7–B1 of the RU Allocation subfield
721 */
722 void SetMuRtsRuAllocation(uint8_t value);
723 /**
724 * This method can only be called on MU-RTS Trigger Frames.
725 *
726 * \return the value of B7–B1 of the RU Allocation subfield (\see SetMuRtsRuAllocation)
727 */
728 uint8_t GetMuRtsRuAllocation() const;
729 /**
730 * Set the UL FEC Coding Type subfield, which indicates whether BCC or LDPC is used
731 *
732 * \param ldpc whether to use LDPC or not
733 */
734 void SetUlFecCodingType(bool ldpc);
735 /**
736 * Get the UL FEC Coding Type subfield, which indicates whether BCC or LDPC is used
737 *
738 * \return true if LDPC is used
739 */
740 bool GetUlFecCodingType() const;
741 /**
742 * Set the UL MCS subfield, which indicates the MCS of the solicited HE TB PPDU
743 *
744 * \param mcs the MCS index (a value between 0 and 11)
745 */
746 void SetUlMcs(uint8_t mcs);
747 /**
748 * Get the UL MCS subfield, which indicates the MCS of the solicited HE TB PPDU
749 *
750 * \return the MCS index (a value between 0 and 11)
751 */
752 uint8_t GetUlMcs() const;
753 /**
754 * Set the UL DCM subfield, which indicates whether or not DCM is used.
755 * This method can only be used with HE variant User Info field.
756 *
757 * \param dcm whether to use DCM or not
758 */
759 void SetUlDcm(bool dcm);
760 /**
761 * Get the UL DCM subfield, which indicates whether or not DCM is used
762 * This method can only be used with HE variant User Info field.
763 *
764 * \return true if DCM is used
765 */
766 bool GetUlDcm() const;
767 /**
768 * Set the SS Allocation subfield, which is present when the AID12 subfield
769 * is neither 0 nor 2045. This method must be called after setting the AID12
770 * subfield to a value other than 0 and 2045.
771 *
772 * \param startingSs the starting spatial stream (a value from 1 to 8)
773 * \param nSs the number of spatial streams (a value from 1 to 8)
774 */
775 void SetSsAllocation(uint8_t startingSs, uint8_t nSs);
776 /**
777 * Get the starting spatial stream.
778 *
779 * \return the starting spatial stream (a value between 1 and 8)
780 */
781 uint8_t GetStartingSs() const;
782 /**
783 * Get the number of spatial streams.
784 *
785 * \return the number of spatial streams (a value between 1 and 8)
786 */
787 uint8_t GetNss() const;
788 /**
789 * Set the RA-RU Information subfield, which is present when the AID12 subfield
790 * is 0 or 2045. This method must be called after setting the AID12 subfield to
791 * 0 or 2045.
792 *
793 * \param nRaRu the number (from 1 to 32) of contiguous RUs allocated for Random Access.
794 * \param moreRaRu whether RA-RUs are allocated in subsequent Trigger frames
795 */
796 void SetRaRuInformation(uint8_t nRaRu, bool moreRaRu);
797 /**
798 * Get the number of contiguous RUs for Random Access. This method can only be
799 * called if the AID12 subfield has been set to 0 or 2045
800 *
801 * \return the number of contiguous RA-RUs (a value between 1 and 32)
802 */
803 uint8_t GetNRaRus() const;
804 /**
805 * Return true if more RA-RUs are allocated in subsequent Trigger frames
806 * that are sent before the end of the current TXOP. This method can only be
807 * called if the AID12 subfield has been set to 0 or 2045
808 *
809 * \return true if more RA-RUs are allocated in subsequent Trigger frames
810 */
811 bool GetMoreRaRu() const;
812 /**
813 * Set the UL Target RSSI subfield to indicate to the station to transmit an
814 * HE TB PPDU response at its maximum transmit power for the assigned MCS
815 */
817 /**
818 * Set the UL Target RSSI subfield to indicate the expected receive signal
819 * power in dBm
820 *
821 * \param dBm the expected receive signal power (a value between -110 and -20)
822 */
823 void SetUlTargetRssi(int8_t dBm);
824 /**
825 * Return true if the UL Target RSSI subfield indicates to the station to transmit
826 * an HE TB PPDU response at its maximum transmit power for the assigned MCS
827 *
828 * \return true if the UL Target RSSI subfield indicates to the station to transmit
829 * an HE TB PPDU response at its maximum transmit power for the assigned MCS
830 */
831 bool IsUlTargetRssiMaxTxPower() const;
832 /**
833 * Get the expected receive signal power for the solicited HE TB PPDU. This
834 * method can only be called if IsUlTargetRssiMaxTxPower returns false.
835 *
836 * \return the expected receive signal power in dBm
837 */
838 int8_t GetUlTargetRssi() const;
839 /**
840 * Set the Trigger Dependent User Info subfield for Basic Trigger frames.
841 *
842 * \param spacingFactor the MPDU MU spacing factor
843 * \param tidLimit the value for the TID Aggregation Limit subfield
844 * \param prefAc the lowest AC recommended for aggregation of MPDUs
845 */
846 void SetBasicTriggerDepUserInfo(uint8_t spacingFactor, uint8_t tidLimit, AcIndex prefAc);
847 /**
848 * Get the MPDU MU spacing factor. This method can only be called if this
849 * User Info field is included in a Basic Trigger frame.
850 *
851 * \return the MPDU MU spacing factor
852 */
853 uint8_t GetMpduMuSpacingFactor() const;
854 /**
855 * Get the TID Aggregation Limit. This method can only be called if this
856 * User Info field is included in a Basic Trigger frame.
857 *
858 * \return the TID Aggregation Limit
859 */
860 uint8_t GetTidAggregationLimit() const;
861 /**
862 * Get the Preferred AC subfield. This method can only be called if this
863 * User Info field is included in a Basic Trigger frame.
864 *
865 * \return the Preferred AC subfield
866 */
867 AcIndex GetPreferredAc() const;
868 /**
869 * Set the Trigger Dependent User Info subfield for the MU-BAR variant of
870 * Trigger frames, which includes a BAR Control subfield and a BAR Information
871 * subfield. The BAR Control subfield must indicate either a Compressed
872 * BlockAckReq variant or a Multi-TID BlockAckReq variant.
873 *
874 * \param bar the BlockAckRequest header object including the BAR Control
875 * subfield and the BAR Information subfield
876 */
878 /**
879 * Get the Trigger Dependent User Info subfield for the MU-BAR variant of
880 * Trigger frames, which includes a BAR Control subfield and a BAR Information
881 * subfield. The BAR Control subfield must indicate either a Compressed
882 * BlockAckReq variant or a Multi-TID BlockAckReq variant.
883 *
884 * \return the BlockAckRequest header object including the BAR Control
885 * subfield and the BAR Information subfield
886 */
888
889 private:
890 TriggerFrameVariant m_variant; //!< User Info field variant
891
892 uint16_t m_aid12; //!< Association ID of the addressed station
893 uint8_t m_ruAllocation; //!< RU Allocation
894 bool m_ulFecCodingType; //!< UL FEC Coding Type
895 uint8_t m_ulMcs; //!< MCS to be used by the addressed station
896 bool m_ulDcm; //!< whether or not to use Dual Carrier Modulation (HE variant only)
897 bool m_ps160; //!< identifies the location of the RU (EHT variant only)
898
899 union {
900 struct
901 {
902 uint8_t startingSs; //!< Starting spatial stream
903 uint8_t nSs; //!< Number of spatial streams
904 } ssAllocation; //!< Used when AID12 is neither 0 nor 2045
905
906 struct
907 {
908 uint8_t nRaRu; //!< Number of Random Access RUs
909 bool moreRaRu; //!< More RA-RU in subsequent Trigger frames
910 } raRuInformation; //!< Used when AID12 is 0 or 2045
911 } m_bits26To31; //!< Fields occupying bits 26-31 in the User Info field
912
913 uint8_t m_ulTargetRssi; //!< Expected receive signal power
914 TriggerFrameType m_triggerType; //!< Trigger frame type
915 uint8_t m_basicTriggerDependentUserInfo; //!< Basic Trigger variant of Trigger Dependent User
916 //!< Info subfield
918 m_muBarTriggerDependentUserInfo; //!< MU-BAR variant of Trigger Dependent User Info subfield
919};
920
921/**
922 * \ingroup wifi
923 * \brief Headers for Trigger frames.
924 *
925 * 802.11ax amendment defines eight types of Trigger frames (see Section 9.3.1.23 of D3.0):
926 * - Basic
927 * - Beamforming Report Poll (BFRP)
928 * - Multi-User Block Ack Request (MU-BAR)
929 * - Multi-User Request To Send (MU-RTS)
930 * - Buffer Status Report Poll (BSRP)
931 * - Groupcast with Retries (GCR) MU-BAR
932 * - Bandwidth Query Report Poll (BQRP)
933 * - NDP Feedback Report Poll (NFRP)
934 * For now only the Basic, MU-BAR, MU-RTS, BSRP and BQRP variants are supported.
935 * Basic Trigger is also the default variant.
936 *
937 * The Padding field is optional, given that other techniques (post-EOF A-MPDU
938 * padding, aggregating other MPDUs in the A-MPDU) are available to satisfy the
939 * minimum time requirement. The size in bytes of the Padding field is configurable.
940 */
942{
943 public:
945 /**
946 * \brief Constructor
947 *
948 * Construct a Trigger Frame of the given type from the values stored in the
949 * given TX vector. In particular:
950 * - the UL Bandwidth, UL Length and GI And LTF Type subfields of the Common Info
951 * field are set based on the values stored in the TX vector;
952 * - as many User Info fields as the number of entries in the HeMuUserInfoMap
953 * of the TX vector are added to the Trigger Frame. The AID12, RU Allocation,
954 * UL MCS and SS Allocation subfields of each User Info field are set based
955 * on the values stored in the corresponding entry of the HeMuUserInfoMap.
956 *
957 * This constructor cannot be used to construct MU-RTS Trigger Frames.
958 *
959 * \param type the Trigger frame type
960 * \param txVector the TX vector used to build this Trigger Frame
961 */
962 CtrlTriggerHeader(TriggerFrameType type, const WifiTxVector& txVector);
963 ~CtrlTriggerHeader() override;
964 /**
965 * Copy assignment operator.
966 *
967 * \param trigger the Trigger frame to copy
968 * \return a reference to the copied object
969 *
970 * Ensure that the type of this Trigger Frame is set to the type of the given
971 * Trigger Frame before copying the User Info fields.
972 */
974 /**
975 * \brief Get the type ID.
976 * \return the object TypeId
977 */
978 static TypeId GetTypeId();
979 TypeId GetInstanceTypeId() const override;
980 void Print(std::ostream& os) const override;
981 uint32_t GetSerializedSize() const override;
982 void Serialize(Buffer::Iterator start) const override;
983 uint32_t Deserialize(Buffer::Iterator start) override;
984
985 /**
986 * Set the Common Info field variant.
987 *
988 * For the moment, all User Info fields are of the same variant type, hence we
989 * forbid changing the Common Info field variant type after adding User Info fields.
990 *
991 * \param variant the Common Info field variant
992 */
993 void SetVariant(TriggerFrameVariant variant);
994 /**
995 * Get the Common Info field variant.
996 *
997 * \return the Common Info field variant
998 */
1000 /**
1001 * Set the Trigger frame type.
1002 *
1003 * \param type the Trigger frame type
1004 */
1005 void SetType(TriggerFrameType type);
1006 /**
1007 * Get the Trigger Frame type.
1008 *
1009 * \return the Trigger Frame type
1010 */
1011 TriggerFrameType GetType() const;
1012 /**
1013 * Return a string corresponding to the Trigger Frame type.
1014 *
1015 * \returns a string corresponding to the Trigger Frame type.
1016 */
1017 const char* GetTypeString() const;
1018 /**
1019 * Return a string corresponding to the given Trigger Frame type.
1020 *
1021 * \param type the Trigger Frame type
1022 * \returns a string corresponding to the Trigger Frame type.
1023 */
1024 static const char* GetTypeString(TriggerFrameType type);
1025 /**
1026 * Check if this is a Basic Trigger frame.
1027 *
1028 * \return true if this is a Basic Trigger frame,
1029 * false otherwise
1030 */
1031 bool IsBasic() const;
1032 /**
1033 * Check if this is a Beamforming Report Poll Trigger frame.
1034 *
1035 * \return true if this is a Beamforming Report Poll Trigger frame,
1036 * false otherwise
1037 */
1038 bool IsBfrp() const;
1039 /**
1040 * Check if this is a MU-BAR Trigger frame.
1041 *
1042 * \return true if this is a MU-BAR Trigger frame,
1043 * false otherwise
1044 */
1045 bool IsMuBar() const;
1046 /**
1047 * Check if this is a MU-RTS Trigger frame.
1048 *
1049 * \return true if this is a MU-RTS Trigger frame,
1050 * false otherwise
1051 */
1052 bool IsMuRts() const;
1053 /**
1054 * Check if this is a Buffer Status Report Poll Trigger frame.
1055 *
1056 * \return true if this is a Buffer Status Report Poll Trigger frame,
1057 * false otherwise
1058 */
1059 bool IsBsrp() const;
1060 /**
1061 * Check if this is a Groupcast with Retries (GCR) MU-BAR Trigger frame.
1062 *
1063 * \return true if this is a Groupcast with Retries (GCR) MU-BAR Trigger frame,
1064 * false otherwise
1065 */
1066 bool IsGcrMuBar() const;
1067 /**
1068 * Check if this is a Bandwidth Query Report Poll Trigger frame.
1069 *
1070 * \return true if this is a Bandwidth Query Report Poll Trigger frame,
1071 * false otherwise
1072 */
1073 bool IsBqrp() const;
1074 /**
1075 * Check if this is a NDP Feedback Report Poll Trigger frame.
1076 *
1077 * \return true if this is a NDP Feedback Report Poll Trigger frame,
1078 * false otherwise
1079 */
1080 bool IsNfrp() const;
1081 /**
1082 * Set the UL Length subfield of the Common Info field.
1083 *
1084 * \param len the value for the UL Length subfield
1085 */
1086 void SetUlLength(uint16_t len);
1087 /**
1088 * Get the UL Length subfield of the Common Info field.
1089 *
1090 * \return the UL Length subfield
1091 */
1092 uint16_t GetUlLength() const;
1093 /**
1094 * Get the TX vector that the station with the given STA-ID will use to send
1095 * the HE TB PPDU solicited by this Trigger Frame. Note that the TX power
1096 * level is not set by this method.
1097 *
1098 * \param staId the STA-ID of a station addressed by this Trigger Frame
1099 * \return the TX vector of the solicited HE TB PPDU
1100 */
1101 WifiTxVector GetHeTbTxVector(uint16_t staId) const;
1102 /**
1103 * Set the More TF subfield of the Common Info field.
1104 *
1105 * \param more the value for the More TF subfield
1106 */
1107 void SetMoreTF(bool more);
1108 /**
1109 * Get the More TF subfield of the Common Info field.
1110 *
1111 * \return the More TF subfield
1112 */
1113 bool GetMoreTF() const;
1114 /**
1115 * Set the CS Required subfield of the Common Info field.
1116 *
1117 * \param cs the value for the CS Required subfield
1118 */
1119 void SetCsRequired(bool cs);
1120 /**
1121 * Get the CS Required subfield of the Common Info field.
1122 *
1123 * \return the CS Required subfield
1124 */
1125 bool GetCsRequired() const;
1126 /**
1127 * Set the bandwidth of the solicited HE TB PPDU.
1128 *
1129 * \param bw bandwidth (allowed values: 20, 40, 80, 160)
1130 */
1131 void SetUlBandwidth(uint16_t bw);
1132 /**
1133 * Get the bandwidth of the solicited HE TB PPDU.
1134 *
1135 * \return the bandwidth (20, 40, 80 or 160)
1136 */
1137 uint16_t GetUlBandwidth() const;
1138 /**
1139 * Set the GI And LTF Type subfield of the Common Info field.
1140 * Allowed combinations are:
1141 * - 1x LTF + 1.6us GI
1142 * - 2x LTF + 1.6us GI
1143 * - 4x LTF + 3.2us GI
1144 *
1145 * \param guardInterval the guard interval duration (in nanoseconds)
1146 * \param ltfType the HE-LTF type (1, 2 or 4)
1147 */
1148 void SetGiAndLtfType(uint16_t guardInterval, uint8_t ltfType);
1149 /**
1150 * Get the guard interval duration (in nanoseconds) of the solicited HE TB PPDU.
1151 *
1152 * \return the guard interval duration (in nanoseconds) of the solicited HE TB PPDU
1153 */
1154 uint16_t GetGuardInterval() const;
1155 /**
1156 * Get the LTF type of the solicited HE TB PPDU.
1157 *
1158 * \return the LTF type of the solicited HE TB PPDU
1159 */
1160 uint8_t GetLtfType() const;
1161 /**
1162 * Set the AP TX Power subfield of the Common Info field.
1163 *
1164 * \param power the value (from -20 to 40) for the AP TX Power (dBm)
1165 */
1166 void SetApTxPower(int8_t power);
1167 /**
1168 * Get the power value (dBm) indicated by the AP TX Power subfield of the
1169 * Common Info field.
1170 *
1171 * \return the AP TX Power (dBm) per 20 MHz
1172 */
1173 int8_t GetApTxPower() const;
1174 /**
1175 * Set the UL Spatial Reuse subfield of the Common Info field.
1176 *
1177 * \param sr the value for the UL Spatial Reuse subfield
1178 */
1179 void SetUlSpatialReuse(uint16_t sr);
1180 /**
1181 * Get the UL Spatial Reuse subfield of the Common Info field.
1182 *
1183 * \return the UL Spatial Reuse subfield
1184 */
1185 uint16_t GetUlSpatialReuse() const;
1186 /**
1187 * Set the size in bytes of the Padding field. The Padding field, if present,
1188 * shall be at least two octets in length.
1189 *
1190 * \param size the size in bytes of the Padding field
1191 */
1192 void SetPaddingSize(std::size_t size);
1193 /**
1194 * \return the size in bytes of the Padding field
1195 */
1196 std::size_t GetPaddingSize() const;
1197 /**
1198 * Get a copy of the Common Info field of this Trigger frame.
1199 * Note that the User Info fields are excluded.
1200 *
1201 * \return a Trigger frame including a copy of the Common Info field of this frame.
1202 */
1204
1205 /**
1206 * Append a new User Info field to this Trigger frame and return
1207 * a non-const reference to it. Make sure to call this method after
1208 * setting the type of the Trigger frame.
1209 *
1210 * \return a non-const reference to the newly added User Info field
1211 */
1213 /**
1214 * Append the given User Info field to this Trigger frame and return
1215 * a non-const reference to it. Make sure that the type of the given
1216 * User Info field matches the type of this Trigger Frame.
1217 *
1218 * \param userInfo the User Info field to append to this Trigger Frame
1219 * \return a non-const reference to the newly added User Info field
1220 */
1222
1223 /// User Info fields list const iterator
1224 typedef std::list<CtrlTriggerUserInfoField>::const_iterator ConstIterator;
1225
1226 /// User Info fields list iterator
1227 typedef std::list<CtrlTriggerUserInfoField>::iterator Iterator;
1228
1229 /**
1230 * \brief Get a const iterator pointing to the first User Info field in the list.
1231 *
1232 * \return a const iterator pointing to the first User Info field in the list
1233 */
1234 ConstIterator begin() const;
1235 /**
1236 * \brief Get a const iterator indicating past-the-last User Info field in the list.
1237 *
1238 * \return a const iterator indicating past-the-last User Info field in the list
1239 */
1240 ConstIterator end() const;
1241 /**
1242 * \brief Get an iterator pointing to the first User Info field in the list.
1243 *
1244 * \return an iterator pointing to the first User Info field in the list
1245 */
1246 Iterator begin();
1247 /**
1248 * \brief Get an iterator indicating past-the-last User Info field in the list.
1249 *
1250 * \return an iterator indicating past-the-last User Info field in the list
1251 */
1252 Iterator end();
1253 /**
1254 * \brief Get the number of User Info fields in this Trigger Frame.
1255 *
1256 * \return the number of User Info fields in this Trigger Frame
1257 */
1258 std::size_t GetNUserInfoFields() const;
1259 /**
1260 * Get a const iterator pointing to the first User Info field found (starting from
1261 * the one pointed to by the given iterator) whose AID12 subfield is set to
1262 * the given value.
1263 *
1264 * \param start a const iterator pointing to the User Info field to start the search from
1265 * \param aid12 the value of the AID12 subfield to match
1266 * \return a const iterator pointing to the User Info field matching the specified
1267 * criterion, if any, or an iterator indicating past-the-last User Info field.
1268 */
1269 ConstIterator FindUserInfoWithAid(ConstIterator start, uint16_t aid12) const;
1270 /**
1271 * Get a const iterator pointing to the first User Info field found whose AID12
1272 * subfield is set to the given value.
1273 *
1274 * \param aid12 the value of the AID12 subfield to match
1275 * \return a const iterator pointing to the User Info field matching the specified
1276 * criterion, if any, or an iterator indicating past-the-last User Info field.
1277 */
1278 ConstIterator FindUserInfoWithAid(uint16_t aid12) const;
1279 /**
1280 * Get a const iterator pointing to the first User Info field found (starting from
1281 * the one pointed to by the given iterator) which allocates a Random Access
1282 * RU for associated stations.
1283 *
1284 * \param start a const iterator pointing to the User Info field to start the search from
1285 * \return a const iterator pointing to the User Info field matching the specified
1286 * criterion, if any, or an iterator indicating past-the-last User Info field.
1287 */
1289 /**
1290 * Get a const iterator pointing to the first User Info field found which allocates
1291 * a Random Access RU for associated stations.
1292 *
1293 * \return a const iterator pointing to the User Info field matching the specified
1294 * criterion, if any, or an iterator indicating past-the-last User Info field.
1295 */
1297 /**
1298 * Get a const iterator pointing to the first User Info field found (starting from
1299 * the one pointed to by the given iterator) which allocates a Random Access
1300 * RU for unassociated stations.
1301 *
1302 * \param start a const iterator pointing to the User Info field to start the search from
1303 * \return a const iterator pointing to the User Info field matching the specified
1304 * criterion, if any, or an iterator indicating past-the-last User Info field.
1305 */
1307 /**
1308 * Get a const iterator pointing to the first User Info field found which allocates
1309 * a Random Access RU for unassociated stations.
1310 *
1311 * \return a const iterator pointing to the User Info field matching the specified
1312 * criterion, if any, or an iterator indicating past-the-last User Info field.
1313 */
1315 /**
1316 * Check the validity of this Trigger frame.
1317 * TODO Implement the checks listed in Section 27.5.3.2.3 of 802.11ax amendment
1318 * D3.0 (Allowed settings of the Trigger frame fields and TRS Control subfield).
1319 *
1320 * This function shall be invoked before transmitting and upon receiving
1321 * a Trigger frame.
1322 *
1323 * \return true if the Trigger frame is valid, false otherwise.
1324 */
1325 bool IsValid() const;
1326
1327 private:
1328 /**
1329 * Common Info field
1330 */
1331 TriggerFrameVariant m_variant; //!< Common Info field variant
1333 uint16_t m_ulLength; //!< Value for the L-SIG Length field
1334 bool m_moreTF; //!< True if a subsequent Trigger frame follows
1335 bool m_csRequired; //!< Carrier Sense required
1336 uint8_t m_ulBandwidth; //!< UL BW subfield
1337 uint8_t m_giAndLtfType; //!< GI And LTF Type subfield
1338 uint8_t m_apTxPower; //!< Tx Power used by AP to transmit the Trigger Frame
1339 uint16_t m_ulSpatialReuse; //!< Value for the Spatial Reuse field in HE-SIG-A
1340 std::size_t m_padding; //!< the size in bytes of the Padding field
1341
1342 /**
1343 * List of User Info fields
1344 */
1345 std::list<CtrlTriggerUserInfoField> m_userInfoFields; //!< list of User Info fields
1346};
1347
1348} // namespace ns3
1349
1350#endif /* CTRL_HEADERS_H */
iterator in a Buffer instance
Definition: buffer.h:100
Headers for BlockAckRequest.
Definition: ctrl-headers.h:52
uint16_t GetStartingSequence() const
Return the starting sequence number.
uint32_t GetSerializedSize() const override
Definition: ctrl-headers.cc:72
void Serialize(Buffer::Iterator start) const override
Definition: ctrl-headers.cc:94
uint16_t m_startingSeq
starting seq
Definition: ctrl-headers.h:187
bool m_barAckPolicy
The LSB bit of the BAR control field is used only for the HT (High Throughput) delayed block ack conf...
Definition: ctrl-headers.h:184
uint16_t m_tidInfo
TID info.
Definition: ctrl-headers.h:186
uint8_t GetTidInfo() const
Return the Traffic ID (TID).
bool IsExtendedCompressed() const
Check if the current Ack Policy is Extended Compressed Block Ack.
void Print(std::ostream &os) const override
Definition: ctrl-headers.cc:66
void SetType(BlockAckReqType type)
Set the BlockAckRequest type.
BlockAckReqType m_barType
BAR type.
Definition: ctrl-headers.h:185
void SetStartingSequenceControl(uint16_t seqControl)
Set the starting sequence control with the given sequence control value.
bool IsMultiTid() const
Check if the current Ack Policy has Multi-TID Block Ack.
BlockAckReqType GetType() const
Return the BlockAckRequest type.
void SetHtImmediateAck(bool immediateAck)
Enable or disable HT immediate Ack.
uint32_t Deserialize(Buffer::Iterator start) override
bool IsCompressed() const
Check if the current Ack Policy is Compressed Block Ack and not multi-TID.
void SetStartingSequence(uint16_t seq)
Set the starting sequence number from the given raw sequence control field.
void SetTidInfo(uint8_t tid)
Set Traffic ID (TID).
uint16_t GetBarControl() const
Return the Block Ack control.
static TypeId GetTypeId()
Get the type ID.
Definition: ctrl-headers.cc:50
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: ctrl-headers.cc:60
uint16_t GetStartingSequenceControl() const
Return the starting sequence control.
void SetBarControl(uint16_t bar)
Set the Block Ack control.
bool MustSendHtImmediateAck() const
Check if the current Ack Policy is immediate.
bool IsBasic() const
Check if the current Ack Policy is Basic Block Ack (i.e.
Headers for BlockAck response.
Definition: ctrl-headers.h:203
void SetBaControl(uint16_t ba)
Set the Block Ack control.
bool IsExtendedCompressed() const
Check if the current BA policy is Extended Compressed Block Ack.
void SetStartingSequence(uint16_t seq, std::size_t index=0)
For Block Ack variants other than Multi-STA Block Ack, set the starting sequence number to the given ...
uint32_t Deserialize(Buffer::Iterator start) override
uint16_t GetStartingSequenceControl(std::size_t index=0) const
Return the value of the Starting Sequence Control subfield.
BlockAckType m_baType
BA type.
Definition: ctrl-headers.h:530
bool IsFragmentReceived(uint16_t seq, uint8_t frag) const
Check if the packet with the given sequence number and fragment number was acknowledged in this Block...
void Serialize(Buffer::Iterator start) const override
bool IsPacketReceived(uint16_t seq, std::size_t index=0) const
Check if the packet with the given sequence number was acknowledged in this BlockAck response.
void SetStartingSequenceControl(uint16_t seqControl, std::size_t index=0)
Set the Starting Sequence Control subfield with the given sequence control value.
std::vector< uint32_t > FindPerAidTidInfoWithAid(uint16_t aid) const
For Multi-STA Block Acks, get the indices of the Per AID TID Info subfields carrying the given AID in...
Buffer::Iterator SerializeBitmap(Buffer::Iterator start, std::size_t index=0) const
Serialize bitmap to the given buffer.
std::size_t GetNPerAidTidInfoSubfields() const
For Multi-STA Block Acks, get the number of Per AID TID Info subfields included in this Block Ack.
uint16_t GetStartingSequence(std::size_t index=0) const
For Block Ack variants other than Multi-STA Block Ack, get the starting sequence number.
Mac48Address GetUnassociatedStaAddress(std::size_t index) const
For Multi-STA Block Acks, get the RA subfield of the Per AID TID Info subfield (with AID11 subfield e...
uint8_t GetTidInfo(std::size_t index=0) const
For Block Ack variants other than Multi-STA Block Ack, get the TID_INFO subfield of the BA Control fi...
bool IsBasic() const
Check if the current BA policy is Basic Block Ack.
const std::vector< uint8_t > & GetBitmap(std::size_t index=0) const
Return a const reference to the bitmap from the BlockAck response header.
bool m_baAckPolicy
The LSB bit of the BA control field is used only for the HT (High Throughput) delayed block ack confi...
Definition: ctrl-headers.h:529
bool IsCompressed() const
Check if the current BA policy is Compressed Block Ack.
void SetUnassociatedStaAddress(const Mac48Address &ra, std::size_t index)
For Multi-STA Block Acks, set the RA subfield of the Per AID TID Info subfield (with AID11 subfield e...
bool MustSendHtImmediateAck() const
Check if the current Ack Policy is immediate.
Buffer::Iterator DeserializeBitmap(Buffer::Iterator start, std::size_t index=0)
Deserialize bitmap from the given buffer.
void ResetBitmap(std::size_t index=0)
Reset the bitmap to 0.
void SetAckType(bool type, std::size_t index)
For Multi-STA Block Acks, set the Ack Type subfield of the Per AID TID Info subfield identified by th...
void SetTidInfo(uint8_t tid, std::size_t index=0)
For Block Ack variants other than Multi-STA Block Ack, set the TID_INFO subfield of the BA Control fi...
uint16_t m_tidInfo
TID info (reserved if Multi-STA Block Ack)
Definition: ctrl-headers.h:531
void Print(std::ostream &os) const override
void SetType(BlockAckType type)
Set the block ack type.
uint32_t GetSerializedSize() const override
uint16_t GetBaControl() const
Return the Block Ack control.
BlockAckType GetType() const
Return the block ack type ID.
void SetReceivedFragment(uint16_t seq, uint8_t frag)
Set the bitmap that the packet with the given sequence number and fragment number was received.
static TypeId GetTypeId()
Get the type ID.
void SetReceivedPacket(uint16_t seq, std::size_t index=0)
Record in the bitmap that the packet with the given sequence number was received.
bool IsMultiTid() const
Check if the current BA policy is Multi-TID Block Ack.
void SetHtImmediateAck(bool immediateAck)
Enable or disable HT immediate Ack.
std::vector< BaInfoInstance > m_baInfo
BA Information field.
Definition: ctrl-headers.h:552
void SetAid11(uint16_t aid, std::size_t index)
For Multi-STA Block Acks, set the AID11 subfield of the Per AID TID Info subfield identified by the g...
bool GetAckType(std::size_t index) const
For Multi-STA Block Acks, get the Ack Type subfield of the Per AID TID Info subfield identified by th...
uint16_t GetAid11(std::size_t index) const
For Multi-STA Block Acks, get the AID11 subfield of the Per AID TID Info subfield identified by the g...
bool IsMultiSta() const
Check if the BlockAck frame variant is Multi-STA Block Ack.
bool IsInBitmap(uint16_t seq, std::size_t index=0) const
Check if sequence number seq can be acknowledged in the bitmap.
uint16_t IndexInBitmap(uint16_t seq, std::size_t index=0) const
This function is used to correctly index in both bitmap and compressed bitmap, one bit or one block o...
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Headers for Trigger frames.
Definition: ctrl-headers.h:942
std::size_t GetPaddingSize() const
CtrlTriggerUserInfoField & AddUserInfoField()
Append a new User Info field to this Trigger frame and return a non-const reference to it.
uint32_t GetSerializedSize() const override
bool IsBasic() const
Check if this is a Basic Trigger frame.
ConstIterator FindUserInfoWithRaRuAssociated() const
Get a const iterator pointing to the first User Info field found which allocates a Random Access RU f...
void Print(std::ostream &os) const override
bool IsNfrp() const
Check if this is a NDP Feedback Report Poll Trigger frame.
void SetApTxPower(int8_t power)
Set the AP TX Power subfield of the Common Info field.
ConstIterator end() const
Get a const iterator indicating past-the-last User Info field in the list.
uint16_t GetUlSpatialReuse() const
Get the UL Spatial Reuse subfield of the Common Info field.
std::size_t m_padding
the size in bytes of the Padding field
uint8_t m_giAndLtfType
GI And LTF Type subfield.
WifiTxVector GetHeTbTxVector(uint16_t staId) const
Get the TX vector that the station with the given STA-ID will use to send the HE TB PPDU solicited by...
bool IsMuRts() const
Check if this is a MU-RTS Trigger frame.
TriggerFrameType m_triggerType
Trigger type.
void SetPaddingSize(std::size_t size)
Set the size in bytes of the Padding field.
uint32_t Deserialize(Buffer::Iterator start) override
uint16_t GetGuardInterval() const
Get the guard interval duration (in nanoseconds) of the solicited HE TB PPDU.
bool IsBsrp() const
Check if this is a Buffer Status Report Poll Trigger frame.
TriggerFrameType GetType() const
Get the Trigger Frame type.
bool IsMuBar() const
Check if this is a MU-BAR Trigger frame.
void SetUlBandwidth(uint16_t bw)
Set the bandwidth of the solicited HE TB PPDU.
ConstIterator FindUserInfoWithRaRuUnassociated() const
Get a const iterator pointing to the first User Info field found which allocates a Random Access RU f...
bool IsBfrp() const
Check if this is a Beamforming Report Poll Trigger frame.
ConstIterator begin() const
Get a const iterator pointing to the first User Info field in the list.
std::size_t GetNUserInfoFields() const
Get the number of User Info fields in this Trigger Frame.
uint8_t GetLtfType() const
Get the LTF type of the solicited HE TB PPDU.
bool GetMoreTF() const
Get the More TF subfield of the Common Info field.
std::list< CtrlTriggerUserInfoField >::const_iterator ConstIterator
User Info fields list const iterator.
bool IsBqrp() const
Check if this is a Bandwidth Query Report Poll Trigger frame.
static TypeId GetTypeId()
Get the type ID.
bool IsValid() const
Check the validity of this Trigger frame.
void SetType(TriggerFrameType type)
Set the Trigger frame type.
ConstIterator FindUserInfoWithAid(ConstIterator start, uint16_t aid12) const
Get a const iterator pointing to the first User Info field found (starting from the one pointed to by...
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetCsRequired(bool cs)
Set the CS Required subfield of the Common Info field.
const char * GetTypeString() const
Return a string corresponding to the Trigger Frame type.
uint16_t GetUlLength() const
Get the UL Length subfield of the Common Info field.
uint16_t GetUlBandwidth() const
Get the bandwidth of the solicited HE TB PPDU.
TriggerFrameVariant m_variant
Common Info field.
uint16_t m_ulLength
Value for the L-SIG Length field.
bool m_csRequired
Carrier Sense required.
TriggerFrameVariant GetVariant() const
Get the Common Info field variant.
CtrlTriggerHeader GetCommonInfoField() const
Get a copy of the Common Info field of this Trigger frame.
void SetGiAndLtfType(uint16_t guardInterval, uint8_t ltfType)
Set the GI And LTF Type subfield of the Common Info field.
std::list< CtrlTriggerUserInfoField > m_userInfoFields
List of User Info fields.
bool m_moreTF
True if a subsequent Trigger frame follows.
void SetVariant(TriggerFrameVariant variant)
Set the Common Info field variant.
void SetUlSpatialReuse(uint16_t sr)
Set the UL Spatial Reuse subfield of the Common Info field.
uint8_t m_ulBandwidth
UL BW subfield.
bool GetCsRequired() const
Get the CS Required subfield of the Common Info field.
bool IsGcrMuBar() const
Check if this is a Groupcast with Retries (GCR) MU-BAR Trigger frame.
std::list< CtrlTriggerUserInfoField >::iterator Iterator
User Info fields list iterator.
void SetUlLength(uint16_t len)
Set the UL Length subfield of the Common Info field.
void Serialize(Buffer::Iterator start) const override
int8_t GetApTxPower() const
Get the power value (dBm) indicated by the AP TX Power subfield of the Common Info field.
uint8_t m_apTxPower
Tx Power used by AP to transmit the Trigger Frame.
CtrlTriggerHeader & operator=(const CtrlTriggerHeader &trigger)
Copy assignment operator.
uint16_t m_ulSpatialReuse
Value for the Spatial Reuse field in HE-SIG-A.
void SetMoreTF(bool more)
Set the More TF subfield of the Common Info field.
User Info field of Trigger frames.
Definition: ctrl-headers.h:590
bool GetUlFecCodingType() const
Get the UL FEC Coding Type subfield, which indicates whether BCC or LDPC is used.
bool GetUlDcm() const
Get the UL DCM subfield, which indicates whether or not DCM is used This method can only be used with...
struct ns3::CtrlTriggerUserInfoField::@69::@71 raRuInformation
Used when AID12 is 0 or 2045.
AcIndex GetPreferredAc() const
Get the Preferred AC subfield.
uint8_t GetMpduMuSpacingFactor() const
Get the MPDU MU spacing factor.
int8_t GetUlTargetRssi() const
Get the expected receive signal power for the solicited HE TB PPDU.
uint8_t startingSs
Starting spatial stream.
Definition: ctrl-headers.h:902
TriggerFrameType m_triggerType
Trigger frame type.
Definition: ctrl-headers.h:914
uint8_t GetUlMcs() const
Get the UL MCS subfield, which indicates the MCS of the solicited HE TB PPDU.
WifiPreamble GetPreambleType() const
uint32_t GetSerializedSize() const
Get the expected size of this User Info field.
void SetMuRtsRuAllocation(uint8_t value)
Set the RU Allocation subfield based on the given value for the B7-B1 bits.
void Print(std::ostream &os) const
Print the content of this User Info field.
uint8_t nRaRu
Number of Random Access RUs.
Definition: ctrl-headers.h:908
union ns3::CtrlTriggerUserInfoField::@69 m_bits26To31
Fields occupying bits 26-31 in the User Info field.
void SetAid12(uint16_t aid)
Set the AID12 subfield, which carries the 12 LSBs of the AID of the station for which this User Info ...
struct ns3::CtrlTriggerUserInfoField::@69::@70 ssAllocation
Used when AID12 is neither 0 nor 2045.
bool m_ps160
identifies the location of the RU (EHT variant only)
Definition: ctrl-headers.h:897
const CtrlBAckRequestHeader & GetMuBarTriggerDepUserInfo() const
Get the Trigger Dependent User Info subfield for the MU-BAR variant of Trigger frames,...
void SetUlFecCodingType(bool ldpc)
Set the UL FEC Coding Type subfield, which indicates whether BCC or LDPC is used.
bool HasRaRuForUnassociatedSta() const
Check if this User Info field allocates a Random Access RU for stations not associated with the AP th...
void SetUlTargetRssiMaxTxPower()
Set the UL Target RSSI subfield to indicate to the station to transmit an HE TB PPDU response at its ...
void SetUlMcs(uint8_t mcs)
Set the UL MCS subfield, which indicates the MCS of the solicited HE TB PPDU.
void SetMuBarTriggerDepUserInfo(const CtrlBAckRequestHeader &bar)
Set the Trigger Dependent User Info subfield for the MU-BAR variant of Trigger frames,...
void SetUlDcm(bool dcm)
Set the UL DCM subfield, which indicates whether or not DCM is used.
void SetSsAllocation(uint8_t startingSs, uint8_t nSs)
Set the SS Allocation subfield, which is present when the AID12 subfield is neither 0 nor 2045.
uint16_t m_aid12
Association ID of the addressed station.
Definition: ctrl-headers.h:892
uint8_t nSs
Number of spatial streams.
Definition: ctrl-headers.h:903
uint8_t m_basicTriggerDependentUserInfo
Basic Trigger variant of Trigger Dependent User Info subfield.
Definition: ctrl-headers.h:915
TriggerFrameVariant m_variant
User Info field variant.
Definition: ctrl-headers.h:890
uint8_t GetTidAggregationLimit() const
Get the TID Aggregation Limit.
uint8_t m_ulMcs
MCS to be used by the addressed station.
Definition: ctrl-headers.h:895
TriggerFrameType GetType() const
Get the type of the Trigger Frame this User Info field belongs to.
uint8_t m_ruAllocation
RU Allocation.
Definition: ctrl-headers.h:893
HeRu::RuSpec GetRuAllocation() const
Get the RU specified by the RU Allocation subfield.
uint8_t GetNss() const
Get the number of spatial streams.
bool HasRaRuForAssociatedSta() const
Check if this User Info field allocates a Random Access RU for stations associated with the AP that t...
uint8_t GetMuRtsRuAllocation() const
This method can only be called on MU-RTS Trigger Frames.
uint16_t GetAid12() const
Get the value of the AID12 subfield.
Buffer::Iterator Serialize(Buffer::Iterator start) const
Serialize the User Info field to the given buffer.
uint8_t GetNRaRus() const
Get the number of contiguous RUs for Random Access.
bool m_ulDcm
whether or not to use Dual Carrier Modulation (HE variant only)
Definition: ctrl-headers.h:896
void SetUlTargetRssi(int8_t dBm)
Set the UL Target RSSI subfield to indicate the expected receive signal power in dBm.
uint8_t GetStartingSs() const
Get the starting spatial stream.
CtrlTriggerUserInfoField & operator=(const CtrlTriggerUserInfoField &userInfo)
Copy assignment operator.
uint8_t m_ulTargetRssi
Expected receive signal power.
Definition: ctrl-headers.h:913
void SetRaRuInformation(uint8_t nRaRu, bool moreRaRu)
Set the RA-RU Information subfield, which is present when the AID12 subfield is 0 or 2045.
Buffer::Iterator Deserialize(Buffer::Iterator start)
Deserialize the User Info field from the given buffer.
bool IsUlTargetRssiMaxTxPower() const
Return true if the UL Target RSSI subfield indicates to the station to transmit an HE TB PPDU respons...
void SetRuAllocation(HeRu::RuSpec ru)
Set the RU Allocation subfield according to the specified RU.
void SetBasicTriggerDepUserInfo(uint8_t spacingFactor, uint8_t tidLimit, AcIndex prefAc)
Set the Trigger Dependent User Info subfield for Basic Trigger frames.
bool moreRaRu
More RA-RU in subsequent Trigger frames.
Definition: ctrl-headers.h:909
bool m_ulFecCodingType
UL FEC Coding Type.
Definition: ctrl-headers.h:894
CtrlBAckRequestHeader m_muBarTriggerDependentUserInfo
MU-BAR variant of Trigger Dependent User Info subfield.
Definition: ctrl-headers.h:918
bool GetMoreRaRu() const
Return true if more RA-RUs are allocated in subsequent Trigger frames that are sent before the end of...
RU Specification.
Definition: he-ru.h:66
Protocol header serialization and deserialization.
Definition: header.h:44
an EUI-48 address
Definition: mac48-address.h:46
a unique identifier for an interface.
Definition: type-id.h:59
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
TriggerFrameVariant
The different variants for Common Info field and User Info field of Trigger Frames.
Definition: ctrl-headers.h:576
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:73
TriggerFrameType
The different Trigger frame types.
Definition: ctrl-headers.h:560
Every class exported by the ns3 library is enclosed in the ns3 namespace.
The different BlockAckRequest variants.
The different BlockAck variants.
The following structure can hold the BA Information field for the Basic and Compressed variants,...
Definition: ctrl-headers.h:542
Mac48Address m_ra
RA subfield (address of an unassociated station) for Multi-STA; reserved for other variants.
Definition: ctrl-headers.h:548
uint16_t m_startingSeq
Block Ack Starting Sequence Control subfield.
Definition: ctrl-headers.h:546
std::vector< uint8_t > m_bitmap
block ack bitmap
Definition: ctrl-headers.h:547
uint16_t m_aidTidInfo
Reserved for Basic and Compressed Per TID Info subfield for Multi-TID AID TID Info subfield for Multi...
Definition: ctrl-headers.h:543
Declaration of the following enums: