InformationElements.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Packets_80211Bundle_InformationElements_
18 #define HH_SENF_Packets_80211Bundle_InformationElements_ 1
19 
20 // Custom includes
21 #include <senf/Packets/Packets.hh>
22 
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 
25 namespace senf {
26 
28  : public PacketParserBase
29  {
30  # include SENF_PARSER()
34 
36  };
37 
39 
40 
42  : public WLANInfoElementParser
43  {
44  # include SENF_PARSER()
46  // the StringParser includes the length field so we have to go back
50 
52  type() = typeId;
53  length() = 0u;
54  }
55  static const type_t::value_type typeId = 0x00u;
56 
57  void dump(std::ostream & os) const;
58  };
59 
60 
62  : public WLANInfoElementParser
63  {
64  # include SENF_PARSER()
66  // we just skip the value here. If somebody needs the information he has to implement
67  // this strange information element himself.
68  SENF_PARSER_SKIP ( length(), 0 );
70 
72  type() = typeId;
73  }
74  static const type_t::value_type typeId = 0x01u;
75 
76  void dump(std::ostream & os) const;
77  };
78 
79 
81  : public WLANInfoElementParser
82  {
83  # include SENF_PARSER()
87 
89  type() = typeId;
90  length() = 1u;
91  }
92  static const type_t::value_type typeId = 0x20u;
93 
94  void dump(std::ostream & os) const;
95  };
96 
97 
99  : public WLANInfoElementParser
100  {
101  # include SENF_PARSER()
104  SENF_PARSER_SKIP ( length()-3, 0 );
106 
108  type() = typeId;
109  length() = 3u;
110  }
111  static const type_t::value_type typeId = 0xddu;
112 
113  void dump(std::ostream & os) const;
114  };
115 
116 
118  : public PacketParserBase
119  {
120  public:
121 # include SENF_FIXED_PARSER()
122  // re-ordering of the fields due to the byte order
123  SENF_PARSER_BITFIELD ( txSTBC, 1, bool );
124  SENF_PARSER_BITFIELD ( shortGIfor40MHz, 1, bool );
125  SENF_PARSER_BITFIELD ( shortGIfor20MHz, 1, bool );
126  SENF_PARSER_BITFIELD ( htGreenfield, 1, bool );
127  SENF_PARSER_BITFIELD ( smPowerSave, 2, unsigned );
128  SENF_PARSER_BITFIELD ( supportedChannelWidth, 1, bool );
129  SENF_PARSER_BITFIELD ( ldpcCodingCapability, 1, bool );
130  SENF_PARSER_BITFIELD ( lSIGTXOPProtectionSupport, 1, bool );
131  SENF_PARSER_BITFIELD ( fortyMHzIntolerant, 1, bool );
132  SENF_PARSER_SKIP_BITS( 1 ); // reserved
133  SENF_PARSER_BITFIELD ( dsss_cckModeIn40MHz, 1, bool );
134  SENF_PARSER_BITFIELD ( maxAMSDULength, 1, bool );
135  SENF_PARSER_BITFIELD ( delayedBlockAck, 1, bool );
136  SENF_PARSER_BITFIELD ( rxSTBC, 2, unsigned );
138  };
139 
141  : public PacketParserBase
142  {
143  public:
144 # include SENF_FIXED_PARSER()
145  // re-ordering of the fields due to the byte order
146  SENF_PARSER_SKIP_BITS( 3 ); // reserved
147  SENF_PARSER_BITFIELD ( minMPDUStartSpacing, 3, unsigned );
148  SENF_PARSER_BITFIELD ( maxAMPDULength, 2, unsigned );
150  };
151 
153  : public PacketParserBase
154  {
155  public:
156 # include SENF_FIXED_PARSER()
157  // re-ordering of the fields due to the byte order
159  SENF_PARSER_FIELD ( rxMCSBitmask, MCSBitmaskParser ); // the remaining 3 bits are already captured by the BitsetParser
160  SENF_PARSER_SKIP_BITS( 6 ); // reserved
161  SENF_PARSER_BITFIELD ( rxHighestSupoortedDataRate, 10, unsigned );
162  SENF_PARSER_SKIP_BITS( 3 ); // reserved
163  SENF_PARSER_BITFIELD ( txUnequalModulationSupported, 1, bool );
164  SENF_PARSER_BITFIELD ( txMaxStreamsSupported, 2, unsigned );
165  SENF_PARSER_BITFIELD ( txRxMCSSetNotEqual, 1, bool );
166  SENF_PARSER_BITFIELD ( txMCSSetDefined, 1, bool );
167  SENF_PARSER_SKIP ( 3 ); // reserved
169  };
170 
172  : public PacketParserBase
173  {
174  public:
175 # include SENF_FIXED_PARSER()
176  // re-ordering of the fields due to the byte order
177  SENF_PARSER_SKIP_BITS( 5 ); // reserved
178  SENF_PARSER_BITFIELD ( pcoTransitionTime, 2, unsigned );
179  SENF_PARSER_BITFIELD ( pco, 1, bool );
180  SENF_PARSER_SKIP_BITS( 4 ); // reserved
181  SENF_PARSER_BITFIELD ( rdResponder, 1, bool );
182  SENF_PARSER_BITFIELD ( htcSupport, 1, bool );
183  SENF_PARSER_BITFIELD ( mcsFeedback, 2, unsigned );
185  };
186 
188  : public PacketParserBase
189  {
190  public:
191 # include SENF_FIXED_PARSER()
192  // if somebody needs the information he has to implement this himself. sorry.
193  SENF_PARSER_SKIP( 4 );
195  };
196 
198  : public PacketParserBase
199  {
200  public:
201 # include SENF_FIXED_PARSER()
202  // if somebody needs the information he has to implement this himself. sorry.
203  SENF_PARSER_SKIP( 1 );
205  };
206 
208  : public WLANInfoElementParser
209  {
210  # include SENF_PARSER()
219 
221  type() = typeId;
222  length() = 26u;
223  }
224  static const type_t::value_type typeId = 0x2du;
225 
226  void dump(std::ostream & os) const;
227  };
228 
229 
231  : public PacketParserBase
232  {
233  public:
234 # include SENF_FIXED_PARSER()
235  // re-ordering of the fields due to the byte order
236  SENF_PARSER_SKIP_BITS( 4 ); // reserved
237  SENF_PARSER_BITFIELD ( rifsMode, 1, bool );
238  SENF_PARSER_BITFIELD ( channelWidth, 1, bool );
239  SENF_PARSER_BITFIELD ( secondaryChannelOffset, 2, unsigned );
240  SENF_PARSER_SKIP_BITS( 3 ); // reserved
241  SENF_PARSER_BITFIELD ( obssNonHTSTAsPresent, 1, bool );
242  SENF_PARSER_SKIP_BITS( 1 ); // reserved
243  SENF_PARSER_BITFIELD ( nonGreenfieldHTSTAsPresent, 1, bool );
244  SENF_PARSER_BITFIELD ( htProtection, 2, unsigned );
245  SENF_PARSER_SKIP_BITS( 8 ); // reserved
246  SENF_PARSER_BITFIELD ( dualCTSProtection, 1, bool );
247  SENF_PARSER_BITFIELD ( dualBeacon, 1, bool );
248  SENF_PARSER_SKIP_BITS( 6 ); // reserved
249  SENF_PARSER_SKIP_BITS( 4 ); // reserved
250  SENF_PARSER_BITFIELD ( pcoPhase, 1, bool );
251  SENF_PARSER_BITFIELD ( pcoActive, 1, bool );
252  SENF_PARSER_BITFIELD ( lsigTXOPProtectionSupport, 1, bool );
253  SENF_PARSER_BITFIELD ( stbcBeacon, 1, bool );
255  };
256 
258  : public WLANInfoElementParser
259  {
260  # include SENF_PARSER()
262  SENF_PARSER_FIELD ( primaryChannel, UInt8Parser );
266 
268  type() = typeId;
269  length() = 22u;
270  }
271  static const type_t::value_type typeId = 0x3du;
272 
273  void dump(std::ostream & os) const;
274  };
275 
276 
278  : public WLANInfoElementParser
279  {
280  # include SENF_PARSER()
282  // the StringParser includes the length field so we have to go back
286 
288  type() = typeId;
289  length() = 0u;
290  }
291  static const type_t::value_type typeId = 0x72u;
292 
293  void dump(std::ostream & os) const;
294  };
295 
296 
298  : public PacketParserBase
299  {
300  public:
301 # include SENF_FIXED_PARSER()
302  // re-ordering of the fields due to the byte order
303  SENF_PARSER_BITFIELD ( txSTBC, 1, bool );
304  SENF_PARSER_BITFIELD ( shortGIfor160_8080MHz, 1, bool );
305  SENF_PARSER_BITFIELD ( shortGIfor80MHz, 1, bool );
306  SENF_PARSER_BITFIELD ( rxLDPC, 1, bool );
307  SENF_PARSER_BITFIELD ( supportedChannelWidthSet, 2, unsigned );
308  SENF_PARSER_BITFIELD ( maxMPDULength, 2, unsigned );
309 
310  SENF_PARSER_BITFIELD ( compressedSteeringNrOfBFAntennas, 3, unsigned );
311  SENF_PARSER_BITFIELD ( suBeamformee, 1, bool );
312  SENF_PARSER_BITFIELD ( suBeamformer, 1, bool );
313  SENF_PARSER_BITFIELD ( rxSTBC, 3, unsigned );
314 
315  SENF_PARSER_PRIVATE_BITFIELD( maxAMPDULengthExponent_1, 1, unsigned );
316  SENF_PARSER_BITFIELD ( htc_vhtCapable, 1, bool );
317  SENF_PARSER_BITFIELD ( vhtTxOpPowerSave, 1, bool );
318  SENF_PARSER_BITFIELD ( muBeamformee, 1, bool );
319  SENF_PARSER_BITFIELD ( muBeamformer, 1, bool );
320  SENF_PARSER_BITFIELD ( nrOfSoundingDimensions, 3, unsigned );
321 
322  SENF_PARSER_SKIP_BITS( 2 ); // reserved
323  SENF_PARSER_BITFIELD ( txAntennaPatternConsistency, 1, bool );
324  SENF_PARSER_BITFIELD ( rxAntennaPatternConsistency, 1, bool );
325  SENF_PARSER_BITFIELD ( vhtLinkAdaptationCapable, 2, unsigned );
326  SENF_PARSER_PRIVATE_BITFIELD( maxAMPDULengthExponent_2, 2, unsigned );
327 
329 
330  boost::uint32_t maxAMPDULengthExponent() const {
331  return (maxAMPDULengthExponent_1().value() << 2) | maxAMPDULengthExponent_2().value();
332  }
333  void maxAMPDULengthExponent(boost::uint32_t v) const {
334  maxAMPDULengthExponent_1((v & 0x00000004) >> 2) ;
335  maxAMPDULengthExponent_2(v & 0x00000003);
336  }
337  };
338 
340  : public PacketParserBase
341  {
342  public:
343 # include SENF_FIXED_PARSER()
344  // re-ordering of the fields due to the byte order
345  SENF_PARSER_BITFIELD( maxMCS4SS, 2, unsigned );
346  SENF_PARSER_BITFIELD( maxMCS3SS, 2, unsigned );
347  SENF_PARSER_BITFIELD( maxMCS2SS, 2, unsigned );
348  SENF_PARSER_BITFIELD( maxMCS1SS, 2, unsigned );
349  SENF_PARSER_BITFIELD( maxMCS8SS, 2, unsigned );
350  SENF_PARSER_BITFIELD( maxMCS7SS, 2, unsigned );
351  SENF_PARSER_BITFIELD( maxMCS6SS, 2, unsigned );
352  SENF_PARSER_BITFIELD( maxMCS5SS, 2, unsigned );
354  };
355 
357  : public PacketParserBase
358  {
359  public:
360 # include SENF_FIXED_PARSER()
361  SENF_PARSER_PRIVATE_BITFIELD ( value_1, 8, unsigned );
363  SENF_PARSER_PRIVATE_BITFIELD ( value_2, 5, unsigned );
365 
366  boost::uint32_t value() const {
367  return (value_1().value() << 5) | value_2().value();
368  }
369  void value(boost::uint32_t v) const {
370  value_1((v & 0x00000004) >> 5) ;
371  value_2(v & 0x0000001f);
372  }
373  };
374 
376  : public PacketParserBase
377  {
378  public:
379 # include SENF_FIXED_PARSER()
385  };
386 
388  : public WLANInfoElementParser
389  {
390  # include SENF_PARSER()
395 
397  type() = typeId;
398  length() = 12u;
399  }
400  static const type_t::value_type typeId = 0xbf;
401 
402  void dump(std::ostream & os) const;
403  };
404 
405 
407  : public PacketParserBase
408  {
409  # include SENF_FIXED_PARSER()
410  SENF_PARSER_FIELD ( channelWidth, UInt8Parser );
411  SENF_PARSER_FIELD ( channelCenterFrequency0, UInt8Parser );
412  SENF_PARSER_FIELD ( channelCenterFrequency1, UInt8Parser );
414  };
415 
417  : public WLANInfoElementParser
418  {
419  # include SENF_PARSER()
424 
426  type() = typeId;
427  length() = 5u;
428  }
429  static const type_t::value_type typeId = 0xc0;
430 
431  void dump(std::ostream & os) const;
432  };
433 
434 }
435 
436 //-/////////////////////////////////////////////////////////////////////////////////////////////////
437 //#include "InformationElements.cci"
438 //#include "InformationElements.ct"
439 //#include "InformationElements.cti"
440 #endif
441 
442 
443 // Local Variables:
444 // mode: c++
445 // fill-column: 100
446 // comment-column: 40
447 // c-file-style: "senf"
448 // indent-tabs-mode: nil
449 // ispell-local-dictionary: "american"
450 // compile-command: "scons -u test"
451 // End:
#define SENF_PARSER_INHERIT(base)
Define parser inheritance.
#define SENF_PARSER_BITFIELD(name, bits, type)
Define bit-field.
Parse 8bit unsigned byte aligned integer.
Definition: IntParser.hh:91
TLV parser registration facility.
Definition: GenericTLV.hh:227
BitsetParser< 77, MSB0Endianness > MCSBitmaskParser
Packets public header.
Base class for generic TLV parsers.
Definition: GenericTLV.hh:124
#define SENF_PARSER_FIELD(name, type)
Define normal parser field.
#define SENF_PARSER_GOTO(name)
Change current offset.
void maxAMPDULengthExponent(boost::uint32_t v) const
#define SENF_PARSER_FINALIZE(name)
Generate parser control members.
UInt8Parser length() const
void dump(std::ostream &os, DirectoryNode &dir=root())
#define SENF_PARSER_INIT()
Define parser initialization routine.
boost::uint8_t value_type
Definition: IntParser.hh:99
#define SENF_PARSER_SKIP(skip)
Skip bytes.
UInt8Parser type() const
Parse 24bit unsigned byte aligned integer.
Definition: IntParser.hh:256
#define SENF_PARSER_SKIP_BITS(bits)
Skip bits within bitfield group.
Parser Base class.
#define SENF_PARSER_PRIVATE_BITFIELD(name, bits, type)
Define bit-field (private)
GenericTLVParserBase< WLANInfoElementParser > WLANGenericInfoElementParser
GenericTLVParserRegistry< WLANInfoElementParser > Registry