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