A Discrete-Event Network Simulator
API
extended-capabilities.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017
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 * Authors: Sébastien Deronne <sebastien.deronne@gmail.com>
18 */
19
21
22namespace ns3
23{
24
26 : m_20_40_bssCoexistenceManagementSupport(0),
27 m_extendedChannelSwitching(0),
28 m_psmpCapability(0),
29 m_spsmpSupport(0),
30 m_event(0),
31 m_diagnostics(0),
32 m_multicastDiagnostics(0),
33 m_locationTracking(0),
34 m_fms(0),
35 m_proxyArpService(0),
36 m_collocatedInterferenceReporting(0),
37 m_civicLocation(0),
38 m_geospatialLocation(0),
39 m_tfs(0),
40 m_wnmSleepMode(0),
41 m_timBroadcast(0),
42 m_bssTransition(0),
43 m_qosTrafficCapability(0),
44 m_acStationCount(0),
45 m_multipleBssid(0),
46 m_timingMeasurement(0),
47 m_channelUsage(0),
48 m_ssidList(0),
49 m_dms(0),
50 m_utcTsfOffset(0),
51 m_tpuBufferStaSupport(0),
52 m_tdlsPeerPsmSupport(0),
53 m_tdlsChannelSwitching(0),
54 m_interworking(0),
55 m_qosMap(0),
56 m_ebr(0),
57 m_sspnInterface(0),
58 m_msgcfCapability(0),
59 m_tdlsSupport(0),
60 m_tdlsProhibited(0),
61 m_tdlsChannelSwitchingProhibited(0),
62 m_rejectUnadmittedFrame(0),
63 m_serviceIntervalGranularity(0),
64 m_identifierLocation(0),
65 m_uapsdCoexistence(0),
66 m_wnmNotification(0),
67 m_qabCapability(0),
68 m_utf8Ssid(0),
69 m_qmfActivated(0),
70 m_qmfReconfigurationActivated(0),
71 m_robustAvStreaming(0),
72 m_advancedGcr(0),
73 m_meshGcr(0),
74 m_scs(0),
75 m_qloadReport(0),
76 m_alternateEdca(0),
77 m_unprotectedTxopNegotiation(0),
78 m_protectedTxopNegotiation(0),
79 m_protectedQloadReport(0),
80 m_tdlsWiderBandwidth(0),
81 m_operatingModeNotification(0),
82 m_maxNumberOfMsdusInAmsdu(0),
83 m_htSupported(0),
84 m_vhtSupported(0)
85{
86}
87
90{
92}
93
94void
96{
97 m_htSupported = htSupported;
98}
99
100void
102{
103 m_vhtSupported = vhtSupported;
104}
105
106uint16_t
108{
109 // we should not be here if it is not supported
111 if (!m_vhtSupported)
112 {
113 return 1;
114 }
115 return 8;
116}
117
118void
120{
122 m_extendedChannelSwitching = (ctrl >> 2) & 0x01;
123 m_psmpCapability = (ctrl >> 4) & 0x01;
124 m_spsmpSupport = (ctrl >> 6) & 0x01;
125 m_event = (ctrl >> 7) & 0x01;
126}
127
128uint8_t
130{
131 uint8_t val = 0;
133 val |= (m_extendedChannelSwitching & 0x01) << 2;
134 val |= (m_psmpCapability & 0x01) << 4;
135 val |= (m_spsmpSupport & 0x01) << 6;
136 val |= (m_event & 0x01) << 7;
137 return val;
138}
139
140void
142{
143 m_diagnostics = ctrl & 0x01;
144 m_multicastDiagnostics = (ctrl >> 1) & 0x01;
145 m_locationTracking = (ctrl >> 2) & 0x01;
146 m_fms = (ctrl >> 3) & 0x01;
147 m_proxyArpService = (ctrl >> 4) & 0x01;
148 m_collocatedInterferenceReporting = (ctrl >> 5) & 0x01;
149 m_civicLocation = (ctrl >> 6) & 0x01;
150 m_geospatialLocation = (ctrl >> 7) & 0x01;
151}
152
153uint8_t
155{
156 uint8_t val = 0;
157 val |= m_diagnostics & 0x01;
158 val |= (m_multicastDiagnostics & 0x01) << 1;
159 val |= (m_locationTracking & 0x01) << 2;
160 val |= (m_fms & 0x01) << 3;
161 val |= (m_proxyArpService & 0x01) << 4;
162 val |= (m_collocatedInterferenceReporting & 0x01) << 5;
163 val |= (m_civicLocation & 0x01) << 6;
164 val |= (m_geospatialLocation & 0x01) << 7;
165 return val;
166}
167
168void
170{
171 m_tfs = ctrl & 0x01;
172 m_wnmSleepMode = (ctrl >> 1) & 0x01;
173 m_timBroadcast = (ctrl >> 2) & 0x01;
174 m_bssTransition = (ctrl >> 3) & 0x01;
175 m_qosTrafficCapability = (ctrl >> 4) & 0x01;
176 m_acStationCount = (ctrl >> 5) & 0x01;
177 m_multipleBssid = (ctrl >> 6) & 0x01;
178 m_timingMeasurement = (ctrl >> 7) & 0x01;
179}
180
181uint8_t
183{
184 uint8_t val = 0;
185 val |= m_tfs & 0x01;
186 val |= (m_wnmSleepMode & 0x01) << 1;
187 val |= (m_timBroadcast & 0x01) << 2;
188 val |= (m_bssTransition & 0x01) << 3;
189 val |= (m_qosTrafficCapability & 0x01) << 4;
190 val |= (m_acStationCount & 0x01) << 5;
191 val |= (m_multipleBssid & 0x01) << 6;
192 val |= (m_timingMeasurement & 0x01) << 7;
193 return val;
194}
195
196void
198{
199 m_channelUsage = ctrl & 0x01;
200 m_ssidList = (ctrl >> 1) & 0x01;
201 m_dms = (ctrl >> 2) & 0x01;
202 m_utcTsfOffset = (ctrl >> 3) & 0x01;
203 m_tpuBufferStaSupport = (ctrl >> 4) & 0x01;
204 m_tdlsPeerPsmSupport = (ctrl >> 5) & 0x01;
205 m_tdlsChannelSwitching = (ctrl >> 6) & 0x01;
206 m_interworking = (ctrl >> 7) & 0x01;
207}
208
209uint8_t
211{
212 uint8_t val = 0;
213 val |= m_channelUsage & 0x01;
214 val |= (m_ssidList & 0x01) << 1;
215 val |= (m_dms & 0x01) << 2;
216 val |= (m_utcTsfOffset & 0x01) << 3;
217 val |= (m_tpuBufferStaSupport & 0x01) << 4;
218 val |= (m_tdlsPeerPsmSupport & 0x01) << 5;
219 val |= (m_tdlsChannelSwitching & 0x01) << 6;
220 val |= (m_interworking & 0x01) << 7;
221 return val;
222}
223
224void
226{
227 m_qosMap = ctrl & 0x01;
228 m_ebr = (ctrl >> 1) & 0x01;
229 m_sspnInterface = (ctrl >> 2) & 0x01;
230 m_msgcfCapability = (ctrl >> 4) & 0x01;
231 m_tdlsSupport = (ctrl >> 5) & 0x01;
232 m_tdlsProhibited = (ctrl >> 6) & 0x01;
233 m_tdlsChannelSwitchingProhibited = (ctrl >> 7) & 0x01;
234}
235
236uint8_t
238{
239 uint8_t val = 0;
240 val |= m_qosMap & 0x01;
241 val |= (m_ebr & 0x01) << 1;
242 val |= (m_sspnInterface & 0x01) << 2;
243 val |= (m_msgcfCapability & 0x01) << 4;
244 val |= (m_tdlsSupport & 0x01) << 5;
245 val |= (m_tdlsProhibited & 0x01) << 6;
246 val |= (m_tdlsChannelSwitchingProhibited & 0x01) << 7;
247 return val;
248}
249
250void
252{
253 m_rejectUnadmittedFrame = ctrl & 0x01;
254 m_serviceIntervalGranularity = (ctrl >> 1) & 0x07;
255 m_identifierLocation = (ctrl >> 4) & 0x01;
256 m_uapsdCoexistence = (ctrl >> 5) & 0x01;
257 m_wnmNotification = (ctrl >> 6) & 0x01;
258 m_qabCapability = (ctrl >> 7) & 0x01;
259}
260
261uint8_t
263{
264 uint8_t val = 0;
265 val |= m_rejectUnadmittedFrame & 0x01;
266 val |= (m_serviceIntervalGranularity & 0x07) << 1;
267 val |= (m_identifierLocation & 0x01) << 4;
268 val |= (m_uapsdCoexistence & 0x01) << 5;
269 val |= (m_wnmNotification & 0x01) << 6;
270 val |= (m_qabCapability & 0x01) << 7;
271 return val;
272}
273
274void
276{
277 m_utf8Ssid = ctrl & 0x01;
278 m_qmfActivated = (ctrl >> 1) & 0x01;
279 m_qmfReconfigurationActivated = (ctrl >> 2) & 0x01;
280 m_robustAvStreaming = (ctrl >> 3) & 0x01;
281 m_advancedGcr = (ctrl >> 4) & 0x01;
282 m_meshGcr = (ctrl >> 5) & 0x01;
283 m_scs = (ctrl >> 6) & 0x01;
284 m_qloadReport = (ctrl >> 7) & 0x01;
285}
286
287uint8_t
289{
290 uint8_t val = 0;
291 val |= m_utf8Ssid & 0x01;
292 val |= (m_qmfActivated & 0x01) << 1;
293 val |= (m_qmfReconfigurationActivated & 0x01) << 2;
294 val |= (m_robustAvStreaming & 0x01) << 3;
295 val |= (m_advancedGcr & 0x01) << 4;
296 val |= (m_meshGcr & 0x01) << 5;
297 val |= (m_scs & 0x01) << 6;
298 val |= (m_qloadReport & 0x01) << 7;
299 return val;
300}
301
302void
304{
305 m_alternateEdca = ctrl & 0x01;
306 m_unprotectedTxopNegotiation = (ctrl >> 1) & 0x01;
307 m_protectedTxopNegotiation = (ctrl >> 2) & 0x01;
308 m_protectedQloadReport = (ctrl >> 3) & 0x01;
309 m_tdlsWiderBandwidth = (ctrl >> 4) & 0x01;
310 m_operatingModeNotification = (ctrl >> 5) & 0x01;
311 m_maxNumberOfMsdusInAmsdu = (ctrl >> 6) & 0x03;
312}
313
314uint8_t
316{
317 uint8_t val = 0;
318 val |= m_alternateEdca & 0x01;
319 val |= (m_unprotectedTxopNegotiation & 0x01) << 1;
320 val |= (m_protectedTxopNegotiation & 0x01) << 2;
321 val |= (m_protectedQloadReport & 0x01) << 3;
322 val |= (m_tdlsWiderBandwidth & 0x01) << 4;
323 val |= (m_operatingModeNotification & 0x01) << 5;
324 val |= (m_maxNumberOfMsdusInAmsdu & 0x03) << 6;
325 return val;
326}
327
328void
330{
331 if (m_htSupported > 0 && m_vhtSupported == 0)
332 {
333 // write the corresponding value for each bit
334 start.WriteU8(GetExtendedCapabilitiesByte1() & 0x7f);
335 }
336 else if (m_vhtSupported > 0)
337 {
338 // write the corresponding value for each bit
347 }
348}
349
350uint16_t
352{
354 uint8_t byte1 = i.ReadU8();
356 if (m_vhtSupported > 0)
357 {
358 uint8_t byte2 = i.ReadU8();
359 uint8_t byte3 = i.ReadU8();
360 uint8_t byte4 = i.ReadU8();
361 uint8_t byte5 = i.ReadU8();
362 uint8_t byte6 = i.ReadU8();
363 uint8_t byte7 = i.ReadU8();
364 uint8_t byte8 = i.ReadU8();
372 }
373 return length;
374}
375
376std::ostream&
377operator<<(std::ostream& os, const ExtendedCapabilities& extendedCapabilities)
378{
379 os << +extendedCapabilities.GetExtendedCapabilitiesByte1();
380 return os;
381}
382
383} // namespace ns3
iterator in a Buffer instance
Definition: buffer.h:100
uint8_t ReadU8()
Definition: buffer.h:1027
The Extended Capabilities Information Element.
uint8_t m_tdlsWiderBandwidth
TDLS Wider Bandwidth.
uint8_t GetExtendedCapabilitiesByte7() const
Return the seventh byte in the Extended Capabilities information element.
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
uint8_t GetExtendedCapabilitiesByte8() const
Return the eighth byte in the Extended Capabilities information element.
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)
uint8_t m_wnmNotification
WNM Notification.
uint8_t GetExtendedCapabilitiesByte1() const
Return the first byte in the Extended Capabilities information element.
uint8_t m_utcTsfOffset
UTC TSF Offset.
uint8_t GetExtendedCapabilitiesByte3() const
Return the third byte in the Extended Capabilities information element.
uint8_t m_unprotectedTxopNegotiation
Unprotected TXOP Negotiation.
void SetHtSupported(uint8_t htSupported)
Set the HT Supported flag.
uint8_t m_identifierLocation
Identifier Location.
void SetExtendedCapabilitiesByte3(uint8_t ctrl)
Set the third byte in the Extended Capabilities information element.
void SetVhtSupported(uint8_t vhtSupported)
Set the VHT Supported flag.
uint8_t m_diagnostics
Diagnostics.
uint8_t m_multicastDiagnostics
Multicast Diagnostics.
uint8_t m_alternateEdca
Alternate EDCA.
uint8_t m_vhtSupported
Flag to indicate VHT is supported in order to decide whether this element should be added to the fram...
uint8_t m_qmfActivated
QMFActivated.
uint8_t m_operatingModeNotification
Operating Mode Notification.
uint8_t m_extendedChannelSwitching
Extended Channel Switching.
void SetExtendedCapabilitiesByte8(uint8_t ctrl)
Set the eighth byte in the Extended Capabilities information element.
uint8_t m_wnmSleepMode
WNM Sleep Mode.
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
void SetExtendedCapabilitiesByte1(uint8_t ctrl)
Set the first byte in the Extended Capabilities information element.
uint8_t m_proxyArpService
Proxy ARP Service.
uint8_t m_acStationCount
AC Station Count.
uint8_t m_msgcfCapability
MSGCF Capability.
uint8_t m_geospatialLocation
Geospatial Location.
uint8_t m_serviceIntervalGranularity
Service Interval Granularity.
void SetExtendedCapabilitiesByte2(uint8_t ctrl)
Set the second byte in the Extended Capabilities information element.
uint8_t m_qosTrafficCapability
QoS Traffic Capability.
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
uint8_t m_timingMeasurement
Timing Measurement.
uint8_t m_tdlsProhibited
TDLS Prohibited.
uint8_t m_channelUsage
Channel Usage.
uint8_t GetExtendedCapabilitiesByte4() const
Return the fourth byte in the Extended Capabilities information element.
uint8_t m_qloadReport
QLoad Report.
uint8_t m_bssTransition
BSS Transition.
uint8_t m_multipleBssid
Multiple BSSID.
uint8_t m_tdlsPeerPsmSupport
TDLS Peer PSM Support.
uint8_t m_interworking
Interworking.
uint8_t m_tdlsChannelSwitching
TDLS Channel Switching.
uint8_t m_timBroadcast
TIM Broadcast.
uint8_t m_protectedQloadReport
Protected QLoad Report.
uint8_t GetExtendedCapabilitiesByte5() const
Return the fifth byte in the Extended Capabilities information element.
void SetExtendedCapabilitiesByte6(uint8_t ctrl)
Set the sixth byte in the Extended Capabilities information element.
uint8_t m_tdlsChannelSwitchingProhibited
TDLS Channel Switching Prohibited.
uint8_t m_advancedGcr
Advanced GCR.
uint8_t m_locationTracking
Location Tracking.
void SetExtendedCapabilitiesByte4(uint8_t ctrl)
Set the fourth byte in the Extended Capabilities information element.
uint8_t m_htSupported
Flag to indicate HT is supported in order to decide whether this element should be added to the frame...
uint8_t GetExtendedCapabilitiesByte6() const
Return the sixth byte in the Extended Capabilities information element.
void SetExtendedCapabilitiesByte7(uint8_t ctrl)
Set the seventh byte in the Extended Capabilities information element.
uint8_t m_tdlsSupport
TDLS Support.
uint8_t m_psmpCapability
PSMP Capability.
uint8_t GetExtendedCapabilitiesByte2() const
Return the second byte in the Extended Capabilities information element.
uint8_t m_tpuBufferStaSupport
TPU Buffer STA Support.
uint8_t m_qmfReconfigurationActivated
QMFReconfigurationActivated.
uint8_t m_qabCapability
QAB Capability.
void SetExtendedCapabilitiesByte5(uint8_t ctrl)
Set the fifth byte in the Extended Capabilities information element.
uint8_t m_protectedTxopNegotiation
Protected TXOP Negotiation.
uint8_t m_rejectUnadmittedFrame
Reject Unadmitted Frame.
uint8_t m_sspnInterface
SSPN Interface.
uint8_t m_robustAvStreaming
Robust AV Streaming.
uint8_t m_spsmpSupport
S-PSMP Support.
uint8_t m_collocatedInterferenceReporting
Collocated Interference Reporting.
uint8_t m_maxNumberOfMsdusInAmsdu
Max Number Of MSDUs In A-MSDU.
uint8_t m_20_40_bssCoexistenceManagementSupport
20/40 BSS Coexistence Management Support
uint8_t m_civicLocation
Civic Location.
uint8_t m_uapsdCoexistence
U-APSD Coexistence.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:129
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
#define IE_EXTENDED_CAPABILITIES