// Definition of non-inline non-template functions
-// Custom includes
#include "WLANPacket.hh"
+//#include "WLANPacket.ih"
+
+// Custom includes
#include <senf/Packets/Packets.hh>
#include <boost/io/ios_state.hpp>
#define prefix_
+///////////////////////////////cc.p///////////////////////////////////////
namespace {
-
void dumpBase(senf::WLANPacketParser const & p, std::ostream & os)
{
os << " version : " << unsigned(p.version()) <<"\n"
{
switch (dsBits()) {
case 0 :
- case 2 : return addr1();
- default: return addr3();
+ case 2 :
+ return addr1();
+ default:
+ return addr3();
}
}
prefix_ senf::MACAddressParser senf::WLANPacket_DataFrameParser::sourceAddress()
const
{
- switch (dsBits())
- {
+ switch (dsBits()) {
case 0 :
- case 1 : return addr2();
+ case 1 :
+ return addr2();
// TODO wds frames
// case 3 : return addr4();
- default: return addr3();
+ default:
+ return addr3();
}
}
prefix_ senf::MACAddressParser senf::WLANPacket_DataFrameParser::bssid()
const
{
- switch (dsBits())
- {
- case 0 : return addr3();
- case 1 : return addr1();
- default: return addr2();
+ switch (dsBits()) {
+ case 0 :
+ return addr3();
+ case 1 :
+ return addr1();
+ default:
+ return addr2();
}
}
os << senf::fieldName("QOS data") << p->qosField() << "\n";
}
+///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
\f
#include <senf/Packets/DefaultBundle/EthernetPacket.hh>
#include <senf/Packets/DefaultBundle/LlcSnapPacket.hh>
+///////////////////////////////hh.p////////////////////////////////////////
+
namespace senf
{
SENF_PARSER_INHERIT(WLANPacketParser);
- SENF_PARSER_FIELD ( receiverAddress, MACAddressParser );
+ SENF_PARSER_FIELD ( receiverAddress, MACAddressParser );
//only RTS frame contains a source address field
//variant is also needed to set correct subtype value
typedef WLANPacket_DataFrameType::packet WLANPacket_DataFrame;
}
-#endif /* HH_SENF_Packets_80211Bundle_WLANPacket_ */
+///////////////////////////////hh.e////////////////////////////////////////
+//#include "WLANPacket.cci"
+//#include "WLANPacket.ct"
+//#include "WLANPacket.cti"
+#endif
\f
// Local Variables:
};
- /** \brief GenericTLV packet typedef */
+ /** \brief GenericTLV packet typedef
+ \ingroup protocolbundle_80221
+ */
typedef ConcretePacket<GenericTLVPacketType> GenericTLVPacket;
}
static void finalize(packet p);
};
- /** \brief Ethernet VLAN tag typedef */
+ /** \brief Ethernet VLAN tag typedef
+ \ingroup protocolbundle_default
+ */
typedef ConcretePacket<EthVLanPacketType> EthVLanPacket;
}
}
};
+ /** \brief ICMPv6 packet typedef
+ \ingroup protocolbundle_default
+ */
typedef ConcretePacket<ICMPv6PacketType> ICMPv6Packet;
}
\ref IPv4PacketParser::checksum() "checksum" */
};
- /** \brief IPv4 packet typedef */
+ /** \brief IPv4 packet typedef
+ \ingroup protocolbundle_default
+ */
typedef ConcretePacket<IPv4PacketType> IPv4Packet;
}
+++ /dev/null
-// $Id: IPv6ExtOptionType.cc 869 2008-06-09 13:57:27Z pug $
-//
-// Copyright (C) 2009
-// Fraunhofer Institute for Open Communication Systems (FOKUS)
-// Competence Center NETwork research (NET), St. Augustin, GERMANY
-// Philipp.Batroff@fokus.fraunhofer.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 IPv6Extension-Options non-inline non-template implementation */
-
-#include "IPv6ExtOptionType.hh"
-// Custom includes
-
-#define prefix_
-///////////////////////////////cc.p////////////////////////////////////////
-
-prefix_ senf::PacketInterpreterBase::range senf::IPv6GenericOptionTLVParser::value()
- const
-{
- senf::PacketData::iterator begin (boost::next(i(), 2 ));
- return PacketInterpreterBase::range(begin, boost::next( begin, optionLength()) );
-}
-
-///////////////////////////////cc.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:
+++ /dev/null
-// $Id: IPv6ExtOptionType.ct 869 2008-06-09 13:57:27Z pug $
-//
-// Copyright (C) 2009
-// Fraunhofer Institute for Open Communication Systems (FOKUS)
-// Competence Center NETwork research (NET), St. Augustin, GERMANY
-// Philipp.Batroff@fokus.fraunhofer.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 IPv6Extension-Options non-inline template implementation */
-
-//#include "IPv6ExtOptionType.ih"
-
-// Custom includes
-
-#define prefix_
-///////////////////////////////ct.p////////////////////////////////////////
-
-template <class ForwardReadableRange>
-prefix_ void senf::IPv6GenericOptionTLVParser::value(ForwardReadableRange const &range)
-{
- unsigned int rangeSize = boost::size(range);
-
- if ( (rangeSize-2) != optionLength() )
- resize(optionLength()+2, rangeSize);
- std::copy(boost::next(boost::begin(range), 2), boost::next(boost::end(range)),
- boost::next(i(), 2 + optionLength() ));
- unsigned int val = *(boost::begin(range));
- unsigned int mask = 192u;
- altAction() = (val & mask) >> 6;
- mask = 32u;
- changeFlag() = (val & mask) >> 5;
- mask = 31u;
- optionType() = (val & mask);
- optionLength() = *(boost::next( boost::begin(range), 1));
-}
-
-template <class ForwardReadableRange>
-prefix_ void senf::IPv6GenericOptionTLVParser::setPayload(ForwardReadableRange const &range)
-{
- unsigned int rangeSize = boost::size(range);
- if ( rangeSize != optionLength() )
- resize( (optionLength() + 2), (rangeSize + 2) );
- std::copy( boost::begin(range), boost::end(range), boost::next( i(), 2));
- optionLength() = rangeSize;
-}
-
-template <class Parser>
-prefix_ Parser senf::IPv6GenericOptionTLVParser::init()
-{
- size_type oldSize (bytes() );
- size_type newParserSize ( senf::init_bytes<Parser>::value );
- resize( oldSize, newParserSize);
- std::fill(i(),boost::next(i(), newParserSize), 0u);
- Parser concreteParser = Parser(i(), state() );
- concreteParser.init();
- concreteParser.optionLength() = (newParserSize-2);
- return concreteParser;
-}
-
-template <class Parser>
-prefix_ Parser senf::IPv6GenericOptionTLVParser::as()
-{
- return Parser(i(), state() );
-}
-
-
-///////////////////////////////ct.e////////////////////////////////////////
-#undef prefix_
-
-\f
-// Local Variables:
-// mode: c++
-// fill-column: 100
-// c-file-style: "senf"
-// indent-tabs-mode: nil
-// ispell-local-dictionary: "american"
-// compile-command: "scons -u test"
-// comment-column: 40
-// End:
{
public:
# include SENF_PARSER()
- SENF_PARSER_BITFIELD (altAction, 2, unsigned);
- SENF_PARSER_BITFIELD (changeFlag, 1, unsigned);
- SENF_PARSER_BITFIELD (optionType, 5, unsigned);
- SENF_PARSER_FIELD (optionLength, UInt8Parser);
- SENF_PARSER_FINALIZE (IPv6OptionTLVParser);
+ SENF_PARSER_FIELD ( type, UInt8Parser );
+ SENF_PARSER_GOTO ( type );
+ SENF_PARSER_BITFIELD ( altAction, 2, unsigned );
+ SENF_PARSER_BITFIELD ( changeFlag, 1, unsigned );
+ SENF_PARSER_BITFIELD ( optionType, 5, unsigned );
+ SENF_PARSER_FIELD (length, UInt8Parser );
+ SENF_PARSER_FINALIZE (IPv6OptionTLVParser );
};
-
- struct IPv6GenericOptionTLVParser : public IPv6OptionTLVParser
- {
-# include SENF_PARSER()
- SENF_PARSER_INHERIT ( IPv6OptionTLVParser );
- SENF_PARSER_SKIP ( optionLength(), 0 );
- SENF_PARSER_FINALIZE ( IPv6GenericOptionTLVParser );
-
- senf::PacketInterpreterBase::range value() const;
-
- template <class Parser>
- Parser init();
-
- template <class Parser>
- Parser as();
-
- static const unsigned int typeCode = 7u;
-
- template<class ForwardReadableRange>
- void value(ForwardReadableRange const &range);
-
- template<class ForwardReadableRange>
- void setPayload(ForwardReadableRange const &range);
- };
+ typedef GenericTLVParserBase<IPv6OptionTLVParser> IPv6GenericOptionTLVParser;
}
///////////////////////////////hh.e////////////////////////////////////////
//#include "IPv6ExtOptionType.cci"
-#include "IPv6ExtOptionType.ct"
+//#include "IPv6ExtOptionType.ct"
//#include "IPv6ExtOptionType.cti"
#endif
#include "IPv6Extensions.hh"
//#include "IPv6Extensions.ih"
-#include <senf/Utils/hexdump.hh>
+
// Custom includes
+#include <senf/Utils/hexdump.hh>
//#include "IPv6Extensions.mpp"
#define prefix_
os << senf::fieldName(" AltAction") << unsigned(optIter->altAction()) << "\n"
<< senf::fieldName(" ChangeFlag") << unsigned(optIter->changeFlag()) << "\n"
<< senf::fieldName(" Option Type") << unsigned(optIter->optionType()) << "\n"
- << senf::fieldName(" OptionLength") << unsigned(optIter->optionLength()) <<"\n";
+ << senf::fieldName(" length") << unsigned(optIter->length()) <<"\n";
senf::hexdump(boost::begin(optIter->value()) , boost::end(optIter->value()), os );
}
}
p->nextHeader() << key(p.next(nothrow)); }
};
- /** \brief IPv6 fragment extension packet typedef */
+ /** \brief IPv6 fragment extension packet typedef
+ \ingroup protocolbundle_default
+ */
typedef ConcretePacket<IPv6FragmentPacketType> IPv6FragmentPacket;
// =====================================================================================================
p->nextHeader() << key(p.next(nothrow)); }
};
- /** \brief IPv6 routing extension packet typedef */
+ /** \brief IPv6 routing extension packet typedef
+ \ingroup protocolbundle_default
+ */
typedef ConcretePacket<IPv6RoutingPacketType> IPv6RoutingPacket;
p->nextHeader() << key(p.next(nothrow)); }
};
- /** \brief IPv6 routing Hop-By-Hop packet typedef */
+ /** \brief IPv6 routing Hop-By-Hop packet typedef
+ \ingroup protocolbundle_default
+ */
typedef ConcretePacket<IPv6HopByHopOptionsPacketType> IPv6HopByHopOptionsPacket;
// =====================================================================================================
p->nextHeader() << key(p.next(nothrow)); }
};
- /** \brief IPv6 routing Destination Options packet typedef */
+ /** \brief IPv6 routing Destination Options packet typedef
+ \ingroup protocolbundle_default
+ */
typedef ConcretePacket<IPv6DestinationOptionsPacketType> IPv6DestinationOptionsPacket;
}
BOOST_CHECK_EQUAL( listIter->altAction(), 0u);
BOOST_CHECK_EQUAL( listIter->changeFlag(), 0u);
BOOST_CHECK_EQUAL( listIter->optionType(), 5u);
- BOOST_CHECK_EQUAL( listIter->optionLength(), 2u);
+ BOOST_CHECK_EQUAL( listIter->length(), 2u);
++listIter;
BOOST_CHECK_EQUAL( listIter->altAction(), 0u);
BOOST_CHECK_EQUAL( listIter->changeFlag(), 0u);
BOOST_CHECK_EQUAL( listIter->optionType(), 2u);
- BOOST_CHECK_EQUAL( listIter->optionLength(), 0);
+ BOOST_CHECK_EQUAL( listIter->length(), 0);
BOOST_REQUIRE( pHop_extension.next().is<senf::ICMPv6Packet>() );
senf::ICMPv6Packet pICMPv6 (pHop_extension.next().as<senf::ICMPv6Packet>());
opt.changeFlag() = 0u;
opt.optionType() = 5u;
unsigned char val[] = {0x00, 0x00};
- opt.setPayload(val);
+ opt.value(val);
}
}
SENF_PARSER_INIT() {
optionType() = typeCode;
- optionLength() = senf::init_bytes<IPv6ChecksumOptionTLVParser>::value -senf::init_bytes<IPv6OptionTLVParser>::value;
+ length() = senf::init_bytes<IPv6ChecksumOptionTLVParser>::value -senf::init_bytes<IPv6OptionTLVParser>::value;
slfNetType() = SN_typeCode;
}
SENF_PARSER_FINALIZE ( IPv6ChecksumOptionTLVParser );
in \ref IpTypes */
};
- /** \brief IPv6 packet typedef */
+ /** \brief IPv6 packet typedef
+ \ingroup protocolbundle_default
+ */
typedef ConcretePacket<IPv6PacketType> IPv6Packet;
-
- ///@}
}
///////////////////////////////hh.e////////////////////////////////////////
BOOST_CHECK_EQUAL( c.bytes(), 0u ); // padding bytes wont be in here, added/removed automatically in destructor
BOOST_CHECK( c.begin() == c.end() );
- unsigned char d[] = {0x65, 0x02, 0x40, 0x34};
- unsigned char d1[] = {0x03, 0x01, 0x77};
- unsigned char d2[] = {0x07, 0x01, 0x13};
+ std::vector<unsigned char> d (2, 0xab);
+ std::vector<unsigned char> d1 (1, 0x77);
+ std::vector<unsigned char> d2 (1, 0x13);
- SENF_CHECK_NO_THROW( c.push_back( d ) );
+ SENF_CHECK_NO_THROW( c.push_back( std::make_pair(0x65, d) ));
BOOST_CHECK_EQUAL( c.bytes(), 4u );
BOOST_CHECK_EQUAL( c.size(), 1u );
- SENF_CHECK_NO_THROW( c.push_back( d1 ) );
+ SENF_CHECK_NO_THROW( c.push_back( std::make_pair(0x03, d1) ));
BOOST_CHECK_EQUAL( c.bytes(), 7u );
BOOST_CHECK_EQUAL( c.size(), 2u );
- SENF_CHECK_NO_THROW( c.push_back( d2 ) );
+ SENF_CHECK_NO_THROW( c.push_back( std::make_pair(0x07, d2) ));
BOOST_CHECK_EQUAL( c.bytes(), 10u );
BOOST_CHECK_EQUAL( c.size(), 3u );
BOOST_CHECK_EQUAL( cIter->altAction(), 1u);
BOOST_CHECK_EQUAL( cIter->changeFlag(), 1u);
BOOST_CHECK_EQUAL( cIter->optionType(), 5u);
- BOOST_CHECK_EQUAL( cIter->optionLength(), 2u);
- BOOST_CHECK_EQUAL( *(boost::begin(cIter->value()) ), 0x40);
- BOOST_CHECK_EQUAL( *(boost::next(boost::begin(cIter->value()) )), 0x34);
+ BOOST_CHECK_EQUAL( cIter->length(), 2u);
+ BOOST_CHECK_EQUAL( *(boost::begin(cIter->value()) ), 0xab);
+ BOOST_CHECK_EQUAL( *(boost::next(boost::begin(cIter->value()) )), 0xab);
cIter++;
BOOST_CHECK_EQUAL( cIter->optionType(), 3u);
- BOOST_CHECK_EQUAL( cIter->optionLength(), 1u);
+ BOOST_CHECK_EQUAL( cIter->length(), 1u);
BOOST_CHECK_EQUAL( *(boost::begin(cIter->value() )), 0x77);
cIter++;
BOOST_CHECK_EQUAL( cIter->optionType(), 7u);
- BOOST_CHECK_EQUAL( cIter->optionLength(), 1u);
+ BOOST_CHECK_EQUAL( cIter->length(), 1u);
BOOST_CHECK_EQUAL( *(boost::begin(cIter->value())), 0x13);
//deletes first element
static void finalize(packet p);
};
- /** \brief LLC/SNAP packet typedef */
+ /** \brief LLC/SNAP packet typedef
+ \ingroup protocolbundle_default
+ */
typedef ConcretePacket<LlcSnapPacketType> LlcSnapPacket;
}
"checksum" */
};
- /** \brief TCP packet typedef */
+ /** \brief TCP packet typedef
+ \ingroup protocolbundle_default
+ */
typedef ConcretePacket<TCPPacketType> TCPPacket;
}
"checksum" */
};
- /** \brief UDP packet typedef */
+ /** \brief UDP packet typedef
+ \ingroup protocolbundle_default
+ */
typedef ConcretePacket<UDPPacketType> UDPPacket;
}
#include "ParseHelpers.hh"
#include "DataPacket.hh"
#include "DumpFormat.hh"
+#include "GenericTLV.hh"
#undef HH_SENF_Packets_Packets__decls_
#include "ParseHelpers.hh"
#include "DataPacket.hh"
#include "DumpFormat.hh"
+#include "GenericTLV.hh"
#endif