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
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
15 \brief RadiotapPacket inline non-template implementation */
17 //#include "RadiotapPacket.ih"
21 #define prefix_ inline
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 // senf::RadiotapPacketParser
27 prefix_ senf::RadiotapPacketParser::RadiotapPacketParser(data_iterator i, state_type s)
28 : RadiotapPacket_HeaderParser(i,s)
31 if (SENF_LIKELY(presentFlags() & EXTENDED_BITMASK_FLAG)) {
33 if (SENF_LIKELY(presentFlags_ext1() & EXTENDED_BITMASK_FLAG)) {
37 OffsetTable & table (offsetMap_[boost::hash_range(
38 data().begin() + presentFlags_offset,
39 data().begin() + presentFlags_offset + bytes)]);
40 if (SENF_UNLIKELY(! table[MAX_INDEX+1]))
41 parseOffsetTable(&(*data().begin()), data().size(), table);
42 currentTable_ = &table;
45 prefix_ senf::RadiotapPacketParser::size_type senf::RadiotapPacketParser::bytes()
51 prefix_ senf::UInt32Parser senf::RadiotapPacketParser::fcs()
53 validate(RadiotapPacket_HeaderParser::fixed_bytes+4);
54 return parse<senf::UInt32Parser>(data().end()-4);
57 prefix_ bool senf::RadiotapPacketParser::has_fcs()
59 return flagsPresent() && flags().fcsAtEnd();
62 prefix_ unsigned senf::RadiotapPacketParser::frameType()
64 return parse<RadiotapPacket_FrameTypeParser>(length()).frameType();
67 //-/////////////////////////////////////////////////////////////////////////////////////////////////
70 prefix_ void senf::RadiotapPacketParser::initField(unsigned index)
72 updatePresentFlags( presentFlags() | (1<<index) );
75 prefix_ void senf::RadiotapPacketParser::disableField(unsigned index)
77 updatePresentFlags( presentFlags() & ~(1<<index) );
80 prefix_ senf::RadiotapPacketParser::size_type senf::RadiotapPacketParser::calculateSize()
83 return currentTable()[MAX_INDEX+1];
86 prefix_ senf::RadiotapPacketParser::OffsetTable const &
87 senf::RadiotapPacketParser::currentTable()
90 return *currentTable_;
93 //-/////////////////////////////////////////////////////////////////////////////////////////////////
100 // comment-column: 40
101 // c-file-style: "senf"
102 // indent-tabs-mode: nil
103 // ispell-local-dictionary: "american"
104 // compile-command: "scons -u test"