Packets/80211Bundle: RadiotapPacketParser create and field update
[senf.git] / senf / Packets / 80211Bundle / RadiotapPacket.cci
diff --git a/senf/Packets/80211Bundle/RadiotapPacket.cci b/senf/Packets/80211Bundle/RadiotapPacket.cci
new file mode 100644 (file)
index 0000000..2164b40
--- /dev/null
@@ -0,0 +1,92 @@
+// $Id$
+//
+// Copyright (C) 2010
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+//     Stefan Bund <g0dil@berlios.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+/** \file
+    \brief RadiotapPacket inline non-template implementation */
+
+//#include "RadiotapPacket.ih"
+
+// Custom includes
+
+#define prefix_ inline
+///////////////////////////////cci.p///////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////
+// senf::RadiotapPacketParser
+
+prefix_ senf::RadiotapPacketParser::RadiotapPacketParser(data_iterator i, state_type s)
+    : RadiotapPacketParser_Header(i,s)
+{}
+
+prefix_ senf::RadiotapPacketParser::size_type senf::RadiotapPacketParser::bytes()
+    const
+{
+    return calculateSize();
+}
+
+prefix_ senf::UInt32Parser senf::RadiotapPacketParser::fcs()
+{
+    validate(RadiotapPacketParser_Header::fixed_bytes+4);
+    return parse<senf::UInt32Parser>(data().end()-4);
+}
+
+prefix_ bool senf::RadiotapPacketParser::has_fcs()
+{
+    return flagsPresent() && flags().fcsAtEnd();
+}
+
+prefix_ unsigned senf::RadiotapPacketParser::frameType()
+{
+    return parse<RadiotapPacketParser_FrameType>(length()).frameType();
+}
+////////////////////////////////////////
+// private members
+
+prefix_ void senf::RadiotapPacketParser::initField(unsigned index)
+{
+    updatePresentFlags( presentFlags() | (1<<index) );
+}
+
+prefix_ void senf::RadiotapPacketParser::disableField(unsigned index)
+{
+    updatePresentFlags( presentFlags() & ~(1<<index) );
+}
+
+prefix_ senf::RadiotapPacketParser::size_type senf::RadiotapPacketParser::calculateSize()
+    const
+{
+    return currentTable()[MAX_INDEX+1];
+}
+
+///////////////////////////////cci.e///////////////////////////////////////
+#undef prefix_
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End: