A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
he-operation.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Sébastien Deronne
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Sébastien Deronne <sebastien.deronne@gmail.com>
7 * Stefano Avallone <stavallo@unina.it>
8 */
9
10#ifndef HE_OPERATION_H
11#define HE_OPERATION_H
12
13#include "ns3/wifi-export.h"
14#include "ns3/wifi-information-element.h"
15#include "ns3/wifi-opt-field.h"
16
17namespace ns3
18{
19
20/**
21 * @brief The HE Operation Information Element
22 * @ingroup wifi
23 *
24 * This class knows how to serialize and deserialize
25 * the HE Operation Information Element
26 */
27class WIFI_EXPORT HeOperation : public WifiInformationElement
28{
29 public:
31
32 /**
33 * Copy constructor
34 *
35 * @param other the object to copy from
36 */
37 HeOperation(const HeOperation& other);
38
39 /**
40 * Copy assignment operator
41 *
42 * @param other the object to assign from
43 * @return a reference to this object
44 */
45 HeOperation& operator=(const HeOperation& other);
46
47 // Implementations of pure virtual methods of WifiInformationElement
48 WifiInformationElementId ElementId() const override;
50 void Print(std::ostream& os) const override;
51
52 /// HE Operation Parameters field
53 struct WIFI_EXPORT HeOperationParams
54 {
55 uint8_t m_defaultPeDuration : 3 {0}; ///< Default PE Duration
56 uint8_t m_twtRequired : 1 {0}; ///< TWT Required
57 uint16_t m_txopDurRtsThresh : 10 {0}; ///< TXOP Duration RTS Threshold
58 uint8_t m_vhOpPresent : 1 {0}; ///< VHT Operation Information Present (value 1 unsupported)
59 uint8_t m_coHostedBss : 1 {0}; ///< Co-Hosted BSS (value 1 unsupported)
60 uint8_t m_erSuDisable : 1 {0}; ///< ER SU Disable
61 bool m_6GHzOpPresent{false}; ///< 6 GHz Operation Information Present (do not set, it is
62 ///< set by the OptFieldWithPresenceInd)
63
64 /**
65 * Print the content of the HE Operation Parameters field.
66 *
67 * @param os output stream
68 */
69 void Print(std::ostream& os) const;
70
71 /**
72 * @return the serialized size of the HE Operation Parameters field
73 */
74 uint16_t GetSerializedSize() const;
75
76 /**
77 * Serialize the HE Operation Parameters field
78 *
79 * @param start an iterator which points to where the information should be written
80 */
81 void Serialize(Buffer::Iterator& start) const;
82
83 /**
84 * Deserialize the HE Operation Parameters field.
85 *
86 * @param start an iterator which points to where the information should be read from
87 * @return the number of bytes read
88 */
89 uint16_t Deserialize(Buffer::Iterator& start);
90 };
91
92 /// BSS Color Information field
93 struct WIFI_EXPORT BssColorInfo
94 {
95 uint8_t m_bssColor : 6 {0}; ///< BSS Color
96 uint8_t m_partialBssColor : 1 {0}; ///< Partial BSS Color
97 uint8_t m_bssColorDisabled : 1 {0}; ///< BSS Color Disabled
98
99 /**
100 * Print the content of the BSS Color Information field.
101 *
102 * @param os output stream
103 */
104 void Print(std::ostream& os) const;
105
106 /**
107 * @return the serialized size of the BSS Color Information field
108 */
109 uint16_t GetSerializedSize() const;
110
111 /**
112 * Serialize the BSS Color Information field
113 *
114 * @param start an iterator which points to where the information should be written
115 */
116 void Serialize(Buffer::Iterator& start) const;
117
118 /**
119 * Deserialize the BSS Color Information field.
120 *
121 * @param start an iterator which points to where the information should be read from
122 * @return the number of bytes read
123 */
124 uint16_t Deserialize(Buffer::Iterator& start);
125 };
126
127 /// 6 GHz Operation Information field
128 struct WIFI_EXPORT OpInfo6GHz
129 {
130 uint8_t m_primCh{0}; ///< Primary Channel
131 uint8_t m_chWid : 2 {0}; ///< Channel Width
132 uint8_t m_dupBeacon : 1 {0}; ///< Duplicate Beacon
133 uint8_t m_regInfo : 3 {0}; ///< Regulatory Info
134 uint8_t : 2; ///< Reserved bits
135 uint8_t m_chCntrFreqSeg0{0}; ///< Channel center frequency segment 0
136 uint8_t m_chCntrFreqSeg1{0}; ///< Channel center frequency segment 1
137 uint8_t m_minRate{0}; ///< Minimum Rate
138
139 /**
140 * Print the content of the 6 GHz Operation Information field.
141 *
142 * @param os output stream
143 */
144 void Print(std::ostream& os) const;
145
146 /**
147 * @return the serialized size of the 6 GHz Operation Information field
148 */
149 uint16_t GetSerializedSize() const;
150
151 /**
152 * Serialize the 6 GHz Operation Information field
153 *
154 * @param start an iterator which points to where the information should be written
155 */
156 void Serialize(Buffer::Iterator& start) const;
157
158 /**
159 * Deserialize the 6 GHz Operation Information field.
160 *
161 * @param start an iterator which points to where the information should be read from
162 * @return the number of bytes read
163 */
164 uint16_t Deserialize(Buffer::Iterator& start);
165 };
166
167 /**
168 * Set the Basic HE-MCS and NSS field in the HE Operation information element
169 * by specifying the pair (<i>nss</i>, <i>maxMcs</i>).
170 *
171 * @param nss the NSS
172 * @param maxHeMcs the maximum supported HE-MCS value corresponding to that NSS
173 */
174 void SetMaxHeMcsPerNss(uint8_t nss, uint8_t maxHeMcs);
175
176 // Fields
177 HeOperationParams m_heOpParams; //!< HE Operation Parameters field
178 BssColorInfo m_bssColorInfo; //!< BSS Color Information field
179 uint16_t m_basicHeMcsAndNssSet; ///< Basic HE-MCS And NSS set (use setter to set value)
180 OptFieldWithPresenceInd<OpInfo6GHz> m_6GHzOpInfo; ///< 6 GHz Operation Information field
181
182 private:
183 uint16_t GetInformationFieldSize() const override;
184 void SerializeInformationField(Buffer::Iterator start) const override;
185 uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
186};
187
188} // namespace ns3
189
190#endif /* HE_OPERATION_H */
iterator in a Buffer instance
Definition buffer.h:109
OptFieldWithPresenceInd< OpInfo6GHz > m_6GHzOpInfo
6 GHz Operation Information field
WifiInformationElementId ElementIdExt() const override
Get the wifi information element ID extension.
uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets).
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
uint16_t m_basicHeMcsAndNssSet
Basic HE-MCS And NSS set (use setter to set value).
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
HeOperation & operator=(const HeOperation &other)
Copy assignment operator.
HeOperationParams m_heOpParams
HE Operation Parameters field.
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets).
BssColorInfo m_bssColorInfo
BSS Color Information field.
OptFieldWithPresenceInd is a class modeling an optional field (in an Information Element,...
Information element, as defined in 802.11-2007 standard.
uint16_t GetSerializedSize() const
Get the size of the serialized IE including Element ID and length fields (for every element this IE i...
Buffer::Iterator Deserialize(Buffer::Iterator i)
Deserialize entire IE (which may possibly be fragmented into multiple elements), which must be presen...
Buffer::Iterator Serialize(Buffer::Iterator i) const
Serialize entire IE including Element ID and length fields.
void Print(ComponentCarrier cc)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
BSS Color Information field.
uint8_t m_bssColorDisabled
BSS Color Disabled.
uint8_t m_partialBssColor
Partial BSS Color.
HE Operation Parameters field.
uint8_t m_erSuDisable
ER SU Disable.
uint8_t m_vhOpPresent
VHT Operation Information Present (value 1 unsupported).
bool m_6GHzOpPresent
6 GHz Operation Information Present (do not set, it is set by the OptFieldWithPresenceInd)
uint8_t m_coHostedBss
Co-Hosted BSS (value 1 unsupported).
uint8_t m_defaultPeDuration
Default PE Duration.
uint8_t m_twtRequired
TWT Required.
uint16_t m_txopDurRtsThresh
TXOP Duration RTS Threshold.
6 GHz Operation Information field
uint8_t m_chCntrFreqSeg0
Channel center frequency segment 0.
uint8_t m_chWid
Channel Width.
uint8_t m_chCntrFreqSeg1
Channel center frequency segment 1.
uint8_t m_minRate
Minimum Rate.
uint8_t m_regInfo
Regulatory Info.
uint8_t m_dupBeacon
Duplicate Beacon.
uint8_t m_primCh
Primary Channel.