A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
95ExtendedCapabilities::Print(std::ostream& os) const
96{
97 os << "Extended Capabilities=" << +GetExtendedCapabilitiesByte1();
98}
99
100void
102{
103 m_htSupported = htSupported;
104}
105
106void
108{
109 m_vhtSupported = vhtSupported;
110}
111
112uint16_t
114{
115 // we should not be here if it is not supported
117 if (!m_vhtSupported)
118 {
119 return 1;
120 }
121 return 8;
122}
123
124void
126{
128 m_extendedChannelSwitching = (ctrl >> 2) & 0x01;
129 m_psmpCapability = (ctrl >> 4) & 0x01;
130 m_spsmpSupport = (ctrl >> 6) & 0x01;
131 m_event = (ctrl >> 7) & 0x01;
132}
133
134uint8_t
136{
137 uint8_t val = 0;
139 val |= (m_extendedChannelSwitching & 0x01) << 2;
140 val |= (m_psmpCapability & 0x01) << 4;
141 val |= (m_spsmpSupport & 0x01) << 6;
142 val |= (m_event & 0x01) << 7;
143 return val;
144}
145
146void
148{
149 m_diagnostics = ctrl & 0x01;
150 m_multicastDiagnostics = (ctrl >> 1) & 0x01;
151 m_locationTracking = (ctrl >> 2) & 0x01;
152 m_fms = (ctrl >> 3) & 0x01;
153 m_proxyArpService = (ctrl >> 4) & 0x01;
154 m_collocatedInterferenceReporting = (ctrl >> 5) & 0x01;
155 m_civicLocation = (ctrl >> 6) & 0x01;
156 m_geospatialLocation = (ctrl >> 7) & 0x01;
157}
158
159uint8_t
161{
162 uint8_t val = 0;
163 val |= m_diagnostics & 0x01;
164 val |= (m_multicastDiagnostics & 0x01) << 1;
165 val |= (m_locationTracking & 0x01) << 2;
166 val |= (m_fms & 0x01) << 3;
167 val |= (m_proxyArpService & 0x01) << 4;
168 val |= (m_collocatedInterferenceReporting & 0x01) << 5;
169 val |= (m_civicLocation & 0x01) << 6;
170 val |= (m_geospatialLocation & 0x01) << 7;
171 return val;
172}
173
174void
176{
177 m_tfs = ctrl & 0x01;
178 m_wnmSleepMode = (ctrl >> 1) & 0x01;
179 m_timBroadcast = (ctrl >> 2) & 0x01;
180 m_bssTransition = (ctrl >> 3) & 0x01;
181 m_qosTrafficCapability = (ctrl >> 4) & 0x01;
182 m_acStationCount = (ctrl >> 5) & 0x01;
183 m_multipleBssid = (ctrl >> 6) & 0x01;
184 m_timingMeasurement = (ctrl >> 7) & 0x01;
185}
186
187uint8_t
189{
190 uint8_t val = 0;
191 val |= m_tfs & 0x01;
192 val |= (m_wnmSleepMode & 0x01) << 1;
193 val |= (m_timBroadcast & 0x01) << 2;
194 val |= (m_bssTransition & 0x01) << 3;
195 val |= (m_qosTrafficCapability & 0x01) << 4;
196 val |= (m_acStationCount & 0x01) << 5;
197 val |= (m_multipleBssid & 0x01) << 6;
198 val |= (m_timingMeasurement & 0x01) << 7;
199 return val;
200}
201
202void
204{
205 m_channelUsage = ctrl & 0x01;
206 m_ssidList = (ctrl >> 1) & 0x01;
207 m_dms = (ctrl >> 2) & 0x01;
208 m_utcTsfOffset = (ctrl >> 3) & 0x01;
209 m_tpuBufferStaSupport = (ctrl >> 4) & 0x01;
210 m_tdlsPeerPsmSupport = (ctrl >> 5) & 0x01;
211 m_tdlsChannelSwitching = (ctrl >> 6) & 0x01;
212 m_interworking = (ctrl >> 7) & 0x01;
213}
214
215uint8_t
217{
218 uint8_t val = 0;
219 val |= m_channelUsage & 0x01;
220 val |= (m_ssidList & 0x01) << 1;
221 val |= (m_dms & 0x01) << 2;
222 val |= (m_utcTsfOffset & 0x01) << 3;
223 val |= (m_tpuBufferStaSupport & 0x01) << 4;
224 val |= (m_tdlsPeerPsmSupport & 0x01) << 5;
225 val |= (m_tdlsChannelSwitching & 0x01) << 6;
226 val |= (m_interworking & 0x01) << 7;
227 return val;
228}
229
230void
232{
233 m_qosMap = ctrl & 0x01;
234 m_ebr = (ctrl >> 1) & 0x01;
235 m_sspnInterface = (ctrl >> 2) & 0x01;
236 m_msgcfCapability = (ctrl >> 4) & 0x01;
237 m_tdlsSupport = (ctrl >> 5) & 0x01;
238 m_tdlsProhibited = (ctrl >> 6) & 0x01;
239 m_tdlsChannelSwitchingProhibited = (ctrl >> 7) & 0x01;
240}
241
242uint8_t
244{
245 uint8_t val = 0;
246 val |= m_qosMap & 0x01;
247 val |= (m_ebr & 0x01) << 1;
248 val |= (m_sspnInterface & 0x01) << 2;
249 val |= (m_msgcfCapability & 0x01) << 4;
250 val |= (m_tdlsSupport & 0x01) << 5;
251 val |= (m_tdlsProhibited & 0x01) << 6;
252 val |= (m_tdlsChannelSwitchingProhibited & 0x01) << 7;
253 return val;
254}
255
256void
258{
259 m_rejectUnadmittedFrame = ctrl & 0x01;
260 m_serviceIntervalGranularity = (ctrl >> 1) & 0x07;
261 m_identifierLocation = (ctrl >> 4) & 0x01;
262 m_uapsdCoexistence = (ctrl >> 5) & 0x01;
263 m_wnmNotification = (ctrl >> 6) & 0x01;
264 m_qabCapability = (ctrl >> 7) & 0x01;
265}
266
267uint8_t
269{
270 uint8_t val = 0;
271 val |= m_rejectUnadmittedFrame & 0x01;
272 val |= (m_serviceIntervalGranularity & 0x07) << 1;
273 val |= (m_identifierLocation & 0x01) << 4;
274 val |= (m_uapsdCoexistence & 0x01) << 5;
275 val |= (m_wnmNotification & 0x01) << 6;
276 val |= (m_qabCapability & 0x01) << 7;
277 return val;
278}
279
280void
282{
283 m_utf8Ssid = ctrl & 0x01;
284 m_qmfActivated = (ctrl >> 1) & 0x01;
285 m_qmfReconfigurationActivated = (ctrl >> 2) & 0x01;
286 m_robustAvStreaming = (ctrl >> 3) & 0x01;
287 m_advancedGcr = (ctrl >> 4) & 0x01;
288 m_meshGcr = (ctrl >> 5) & 0x01;
289 m_scs = (ctrl >> 6) & 0x01;
290 m_qloadReport = (ctrl >> 7) & 0x01;
291}
292
293uint8_t
295{
296 uint8_t val = 0;
297 val |= m_utf8Ssid & 0x01;
298 val |= (m_qmfActivated & 0x01) << 1;
299 val |= (m_qmfReconfigurationActivated & 0x01) << 2;
300 val |= (m_robustAvStreaming & 0x01) << 3;
301 val |= (m_advancedGcr & 0x01) << 4;
302 val |= (m_meshGcr & 0x01) << 5;
303 val |= (m_scs & 0x01) << 6;
304 val |= (m_qloadReport & 0x01) << 7;
305 return val;
306}
307
308void
310{
311 m_alternateEdca = ctrl & 0x01;
312 m_unprotectedTxopNegotiation = (ctrl >> 1) & 0x01;
313 m_protectedTxopNegotiation = (ctrl >> 2) & 0x01;
314 m_protectedQloadReport = (ctrl >> 3) & 0x01;
315 m_tdlsWiderBandwidth = (ctrl >> 4) & 0x01;
316 m_operatingModeNotification = (ctrl >> 5) & 0x01;
317 m_maxNumberOfMsdusInAmsdu = (ctrl >> 6) & 0x03;
318}
319
320uint8_t
322{
323 uint8_t val = 0;
324 val |= m_alternateEdca & 0x01;
325 val |= (m_unprotectedTxopNegotiation & 0x01) << 1;
326 val |= (m_protectedTxopNegotiation & 0x01) << 2;
327 val |= (m_protectedQloadReport & 0x01) << 3;
328 val |= (m_tdlsWiderBandwidth & 0x01) << 4;
329 val |= (m_operatingModeNotification & 0x01) << 5;
330 val |= (m_maxNumberOfMsdusInAmsdu & 0x03) << 6;
331 return val;
332}
333
334void
336{
337 if (m_htSupported > 0 && m_vhtSupported == 0)
338 {
339 // write the corresponding value for each bit
340 start.WriteU8(GetExtendedCapabilitiesByte1() & 0x7f);
341 }
342 else if (m_vhtSupported > 0)
343 {
344 // write the corresponding value for each bit
345 start.WriteU8(GetExtendedCapabilitiesByte1());
346 start.WriteU8(GetExtendedCapabilitiesByte2());
347 start.WriteU8(GetExtendedCapabilitiesByte3());
348 start.WriteU8(GetExtendedCapabilitiesByte4());
349 start.WriteU8(GetExtendedCapabilitiesByte5());
350 start.WriteU8(GetExtendedCapabilitiesByte6());
351 start.WriteU8(GetExtendedCapabilitiesByte7());
352 start.WriteU8(GetExtendedCapabilitiesByte8());
353 }
354}
355
356uint16_t
358{
359 Buffer::Iterator i = start;
360 uint8_t byte1 = i.ReadU8();
362 if (m_vhtSupported > 0)
363 {
364 uint8_t byte2 = i.ReadU8();
365 uint8_t byte3 = i.ReadU8();
366 uint8_t byte4 = i.ReadU8();
367 uint8_t byte5 = i.ReadU8();
368 uint8_t byte6 = i.ReadU8();
369 uint8_t byte7 = i.ReadU8();
370 uint8_t byte8 = i.ReadU8();
378 }
379 return length;
380}
381
382} // namespace ns3
iterator in a Buffer instance
Definition: buffer.h:100
uint8_t ReadU8()
Definition: buffer.h:1027
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.
void Print(std::ostream &os) const override
Generate human-readable form of IE.
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.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
#define IE_EXTENDED_CAPABILITIES