A Discrete-Event Network Simulator
API
extended-capabilities.cc
Go to the documentation of this file.
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2017
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: S├ębastien Deronne <sebastien.deronne@gmail.com>
19 */
20
22
23namespace ns3 {
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
106uint8_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
120{
121 if (m_htSupported < 1 && m_vhtSupported < 1)
122 {
123 return i;
124 }
126}
127
128uint16_t
130{
131 if (m_htSupported < 1 && m_vhtSupported < 1)
132 {
133 return 0;
134 }
136}
137
138void
140{
142 m_extendedChannelSwitching = (ctrl >> 2) & 0x01;
143 m_psmpCapability = (ctrl >> 4) & 0x01;
144 m_spsmpSupport = (ctrl >> 6) & 0x01;
145 m_event = (ctrl >> 7) & 0x01;
146}
147
148uint8_t
150{
151 uint8_t val = 0;
153 val |= (m_extendedChannelSwitching & 0x01) << 2;
154 val |= (m_psmpCapability & 0x01) << 4;
155 val |= (m_spsmpSupport & 0x01) << 6;
156 val |= (m_event & 0x01) << 7;
157 return val;
158}
159
160void
162{
163 m_diagnostics = ctrl & 0x01;
164 m_multicastDiagnostics = (ctrl >> 1) & 0x01;
165 m_locationTracking = (ctrl >> 2) & 0x01;
166 m_fms = (ctrl >> 3) & 0x01;
167 m_proxyArpService = (ctrl >> 4) & 0x01;
168 m_collocatedInterferenceReporting = (ctrl >> 5) & 0x01;
169 m_civicLocation = (ctrl >> 6) & 0x01;
170 m_geospatialLocation = (ctrl >> 7) & 0x01;
171}
172
173uint8_t
175{
176 uint8_t val = 0;
177 val |= m_diagnostics & 0x01;
178 val |= (m_multicastDiagnostics & 0x01) << 1;
179 val |= (m_locationTracking & 0x01) << 2;
180 val |= (m_fms & 0x01) << 3;
181 val |= (m_proxyArpService & 0x01) << 4;
182 val |= (m_collocatedInterferenceReporting & 0x01) << 5;
183 val |= (m_civicLocation & 0x01) << 6;
184 val |= (m_geospatialLocation & 0x01) << 7;
185 return val;
186}
187
188void
190{
191 m_tfs = ctrl & 0x01;
192 m_wnmSleepMode = (ctrl >> 1) & 0x01;
193 m_timBroadcast = (ctrl >> 2) & 0x01;
194 m_bssTransition = (ctrl >> 3) & 0x01;
195 m_qosTrafficCapability = (ctrl >> 4) & 0x01;
196 m_acStationCount = (ctrl >> 5) & 0x01;
197 m_multipleBssid = (ctrl >> 6) & 0x01;
198 m_timingMeasurement = (ctrl >> 7) & 0x01;
199}
200
201uint8_t
203{
204 uint8_t val = 0;
205 val |= m_tfs & 0x01;
206 val |= (m_wnmSleepMode & 0x01) << 1;
207 val |= (m_timBroadcast & 0x01) << 2;
208 val |= (m_bssTransition & 0x01) << 3;
209 val |= (m_qosTrafficCapability & 0x01) << 4;
210 val |= (m_acStationCount & 0x01) << 5;
211 val |= (m_multipleBssid & 0x01) << 6;
212 val |= (m_timingMeasurement & 0x01) << 7;
213 return val;
214}
215
216void
218{
219 m_channelUsage = ctrl & 0x01;
220 m_ssidList = (ctrl >> 1) & 0x01;
221 m_dms = (ctrl >> 2) & 0x01;
222 m_utcTsfOffset = (ctrl >> 3) & 0x01;
223 m_tpuBufferStaSupport = (ctrl >> 4) & 0x01;
224 m_tdlsPeerPsmSupport = (ctrl >> 5) & 0x01;
225 m_tdlsChannelSwitching = (ctrl >> 6) & 0x01;
226 m_interworking = (ctrl >> 7) & 0x01;
227}
228
229uint8_t
231{
232 uint8_t val = 0;
233 val |= m_channelUsage & 0x01;
234 val |= (m_ssidList & 0x01) << 1;
235 val |= (m_dms & 0x01) << 2;
236 val |= (m_utcTsfOffset & 0x01) << 3;
237 val |= (m_tpuBufferStaSupport & 0x01) << 4;
238 val |= (m_tdlsPeerPsmSupport & 0x01) << 5;
239 val |= (m_tdlsChannelSwitching & 0x01) << 6;
240 val |= (m_interworking & 0x01) << 7;
241 return val;
242}
243
244void
246{
247 m_qosMap = ctrl & 0x01;
248 m_ebr = (ctrl >> 1) & 0x01;
249 m_sspnInterface = (ctrl >> 2) & 0x01;
250 m_msgcfCapability = (ctrl >> 4) & 0x01;
251 m_tdlsSupport = (ctrl >> 5) & 0x01;
252 m_tdlsProhibited = (ctrl >> 6) & 0x01;
253 m_tdlsChannelSwitchingProhibited = (ctrl >> 7) & 0x01;
254}
255
256uint8_t
258{
259 uint8_t val = 0;
260 val |= m_qosMap & 0x01;
261 val |= (m_ebr & 0x01) << 1;
262 val |= (m_sspnInterface & 0x01) << 2;
263 val |= (m_msgcfCapability & 0x01) << 4;
264 val |= (m_tdlsSupport & 0x01) << 5;
265 val |= (m_tdlsProhibited & 0x01) << 6;
266 val |= (m_tdlsChannelSwitchingProhibited & 0x01) << 7;
267 return val;
268}
269
270void
272{
273 m_rejectUnadmittedFrame = ctrl & 0x01;
274 m_serviceIntervalGranularity = (ctrl >> 1) & 0x07;
275 m_identifierLocation = (ctrl >> 4) & 0x01;
276 m_uapsdCoexistence = (ctrl >> 5) & 0x01;
277 m_wnmNotification = (ctrl >> 6) & 0x01;
278 m_qabCapability = (ctrl >> 7) & 0x01;
279}
280
281uint8_t
283{
284 uint8_t val = 0;
285 val |= m_rejectUnadmittedFrame & 0x01;
286 val |= (m_serviceIntervalGranularity & 0x07) << 1;
287 val |= (m_identifierLocation & 0x01) << 4;
288 val |= (m_uapsdCoexistence & 0x01) << 5;
289 val |= (m_wnmNotification & 0x01) << 6;
290 val |= (m_qabCapability & 0x01) << 7;
291 return val;
292}
293
294void
296{
297 m_utf8Ssid = ctrl & 0x01;
298 m_qmfActivated = (ctrl >> 1) & 0x01;
299 m_qmfReconfigurationActivated = (ctrl >> 2) & 0x01;
300 m_robustAvStreaming = (ctrl >> 3) & 0x01;
301 m_advancedGcr = (ctrl >> 4) & 0x01;
302 m_meshGcr = (ctrl >> 5) & 0x01;
303 m_scs = (ctrl >> 6) & 0x01;
304 m_qloadReport = (ctrl >> 7) & 0x01;
305}
306
307uint8_t
309{
310 uint8_t val = 0;
311 val |= m_utf8Ssid & 0x01;
312 val |= (m_qmfActivated & 0x01) << 1;
313 val |= (m_qmfReconfigurationActivated & 0x01) << 2;
314 val |= (m_robustAvStreaming & 0x01) << 3;
315 val |= (m_advancedGcr & 0x01) << 4;
316 val |= (m_meshGcr & 0x01) << 5;
317 val |= (m_scs & 0x01) << 6;
318 val |= (m_qloadReport & 0x01) << 7;
319 return val;
320}
321
322void
324{
325 m_alternateEdca = ctrl & 0x01;
326 m_unprotectedTxopNegotiation = (ctrl >> 1) & 0x01;
327 m_protectedTxopNegotiation = (ctrl >> 2) & 0x01;
328 m_protectedQloadReport = (ctrl >> 3) & 0x01;
329 m_tdlsWiderBandwidth = (ctrl >> 4) & 0x01;
330 m_operatingModeNotification = (ctrl >> 5) & 0x01;
331 m_maxNumberOfMsdusInAmsdu = (ctrl >> 6) & 0x03;
332}
333
334uint8_t
336{
337 uint8_t val = 0;
338 val |= m_alternateEdca & 0x01;
339 val |= (m_unprotectedTxopNegotiation & 0x01) << 1;
340 val |= (m_protectedTxopNegotiation & 0x01) << 2;
341 val |= (m_protectedQloadReport & 0x01) << 3;
342 val |= (m_tdlsWiderBandwidth & 0x01) << 4;
343 val |= (m_operatingModeNotification & 0x01) << 5;
344 val |= (m_maxNumberOfMsdusInAmsdu & 0x03) << 6;
345 return val;
346}
347
348void
350{
351 if (m_htSupported > 0 && m_vhtSupported == 0)
352 {
353 //write the corresponding value for each bit
354 start.WriteU8 (GetExtendedCapabilitiesByte1 () & 0x7f);
355 }
356 else if (m_vhtSupported > 0)
357 {
358 //write the corresponding value for each bit
367 }
368}
369
370uint8_t
372{
374 uint8_t byte1 = i.ReadU8 ();
376 if (m_vhtSupported > 0)
377 {
378 uint8_t byte2 = i.ReadU8 ();
379 uint8_t byte3 = i.ReadU8 ();
380 uint8_t byte4 = i.ReadU8 ();
381 uint8_t byte5 = i.ReadU8 ();
382 uint8_t byte6 = i.ReadU8 ();
383 uint8_t byte7 = i.ReadU8 ();
384 uint8_t byte8 = i.ReadU8 ();
392 }
393 return length;
394}
395
396std::ostream &
397operator << (std::ostream &os, const ExtendedCapabilities &extendedCapabilities)
398{
399 os << +extendedCapabilities.GetExtendedCapabilitiesByte1 ();
400 return os;
401}
402
403} //namespace ns3
iterator in a Buffer instance
Definition: buffer.h:99
uint8_t ReadU8(void)
Definition: buffer.h:1021
The Extended Capabilities Information Element.
uint8_t DeserializeInformationField(Buffer::Iterator start, uint8_t length) override
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)
uint8_t m_tdlsWiderBandwidth
TDLS Wider Bandwidth.
uint8_t GetExtendedCapabilitiesByte4(void) const
Return the fourth 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 m_wnmNotification
WNM Notification.
uint8_t m_utcTsfOffset
UTC TSF Offset.
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 GetExtendedCapabilitiesByte8(void) const
Return the eighth byte in the Extended Capabilities information element.
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 GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
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.
void SetExtendedCapabilitiesByte1(uint8_t ctrl)
Set the first byte in the Extended Capabilities information element.
uint8_t m_proxyArpService
Proxy ARP Service.
uint16_t GetSerializedSize() const override
Get the size of the serialized IE including Element ID and length fields.
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
uint8_t m_timingMeasurement
Timing Measurement.
uint8_t m_tdlsProhibited
TDLS Prohibited.
uint8_t m_channelUsage
Channel Usage.
uint8_t m_qloadReport
QLoad Report.
uint8_t m_bssTransition
BSS Transition.
uint8_t m_multipleBssid
Multiple BSSID.
uint8_t GetExtendedCapabilitiesByte7(void) const
Return the seventh byte in the Extended Capabilities information element.
uint8_t m_tdlsPeerPsmSupport
TDLS Peer PSM Support.
uint8_t GetExtendedCapabilitiesByte1(void) const
Return the first byte in the Extended Capabilities information element.
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.
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...
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 GetExtendedCapabilitiesByte5(void) const
Return the fifth byte in the Extended Capabilities information element.
uint8_t GetExtendedCapabilitiesByte3(void) const
Return the third 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 GetExtendedCapabilitiesByte2(void) const
Return the second byte in the Extended Capabilities information element.
Buffer::Iterator Serialize(Buffer::Iterator start) const override
Serialize entire IE including Element ID and length fields.
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 GetExtendedCapabilitiesByte6(void) const
Return the sixth byte in the Extended Capabilities information element.
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.
virtual uint16_t GetSerializedSize() const
Get the size of the serialized IE including Element ID and length fields.
virtual Buffer::Iterator Serialize(Buffer::Iterator i) const
Serialize entire IE including Element ID and length fields.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
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:139
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
def start()
Definition: core.py:1853
#define IE_EXTENDED_CAPABILITIES