#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-SENF_PACKET_TLV_REGISTRY_REGISTER( senf::WLANInfoElementParser, senf::WLANSSIDInfoElementParser);
-SENF_PACKET_TLV_REGISTRY_REGISTER( senf::WLANInfoElementParser, senf::WLANPowerConstraintInfoElementParser);
-SENF_PACKET_TLV_REGISTRY_REGISTER( senf::WLANInfoElementParser, senf::WLANSupportedRatesInfoElementParser);
+SENF_PACKET_TLV_REGISTRY_REGISTER( senf::WLANSSIDInfoElementParser );
+SENF_PACKET_TLV_REGISTRY_REGISTER( senf::WLANPowerConstraintInfoElementParser );
+SENF_PACKET_TLV_REGISTRY_REGISTER( senf::WLANSupportedRatesInfoElementParser );
prefix_ void senf::WLANPowerConstraintInfoElementParser::dump(std::ostream & os)
SENF_PARSER_FIELD ( type, UInt8Parser );
SENF_PARSER_FIELD ( length, UInt8Parser );
SENF_PARSER_FINALIZE ( WLANInfoElementParser );
+
+ typedef GenericTLVParserRegistry<WLANInfoElementParser> Registry;
};
typedef GenericTLVParserBase<WLANInfoElementParser> WLANGenericInfoElementParser;
SENF_CHECK_EQUAL_COLLECTIONS( value, value+sizeof(value),
boost::begin(i->value()), boost::end(i->value()) );
- p.dump(std::cout);
+ std::ostringstream oss (std::ostringstream::out);
+ SENF_CHECK_NO_THROW( p.dump( oss ));
}
BOOST_AUTO_UNIT_TEST(WLANBeaconPacket_create)
/** \file
\brief IPv6Extension-Options public header */
-#ifndef HH_SENF_Packets_DefaultBundle_IPv6ExtOptionType_HH_
-#define HH_SENF_Packets_DefaultBundle_IPv6ExtOptionType_HH_ 1
+#ifndef HH_SENF_Packets_DefaultBundle_IPv6ExtOptions_HH_
+#define HH_SENF_Packets_DefaultBundle_IPv6ExtOptions_HH_ 1
// Custom includes
#include <senf/Packets/Packets.hh>
-//#include "IPv6ExtOptionType.mpp"
+//#include "IPv6ExtOptions.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
- class IPv6OptionTLVParser : public PacketParserBase
+ class IPv6OptionParser : public PacketParserBase
{
public:
# include SENF_PARSER()
- SENF_PARSER_FIELD ( type, UInt8Parser );
- SENF_PARSER_GOTO ( type );
+ 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 );
+ SENF_PARSER_FIELD ( length, UInt8Parser );
+ SENF_PARSER_FINALIZE ( IPv6OptionParser );
+
+ typedef GenericTLVParserRegistry<IPv6OptionParser> Registry;
};
- typedef GenericTLVParserBase<IPv6OptionTLVParser> IPv6GenericOptionTLVParser;
+ typedef GenericTLVParserBase<IPv6OptionParser> IPv6GenericOptionParser;
}
///////////////////////////////hh.e////////////////////////////////////////
-//#include "IPv6ExtOptionType.cci"
-//#include "IPv6ExtOptionType.ct"
-//#include "IPv6ExtOptionType.cti"
+//#include "IPv6ExtOptions.cci"
+//#include "IPv6ExtOptions.ct"
+//#include "IPv6ExtOptions.cti"
#endif
\f
#define HH_SENF_Packets_DefaultBundle_IPv6Extensions_ 1
// Custom includes
-#include <senf/Packets/Packets.hh>
-#include "IPv6ExtOptionType.hh"
+#include "IPv6ExtOptions.hh"
#include "ListOptionTypeParser.hh"
#include "IPv6Packet.hh"
typedef detail::FixedAuxParserPolicy<UInt8Parser, 1u> ListOptionTypeAuxPolicy;
typedef detail::ListOptionTypeParser_Policy<
- IPv6GenericOptionTLVParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy;
+ IPv6GenericOptionParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy;
typedef ListParser<ListOptionTypePolicy> ListOptionTypeParser;
SENF_PARSER_FIELD ( options, ListOptionTypeParser);
{
senf::IPv6HopByHopOptionsPacket::Parser::options_t::container optC(pext->options() );
{
- senf::IPv6GenericOptionTLVParser opt ( optC.push_back_space().init<senf::IPv6GenericOptionTLVParser>());
+ senf::IPv6GenericOptionParser opt (
+ optC.push_back_space().init<senf::IPv6GenericOptionParser>());
opt.altAction() = 0u;
opt.changeFlag() = 0u;
opt.optionType() = 5u;
namespace {
- struct IPv6ChecksumOptionTLVParser : public senf::IPv6OptionTLVParser
+ struct IPv6ChecksumOptionParser : public senf::IPv6OptionParser
{
# include SENF_PARSER()
- SENF_PARSER_INHERIT ( IPv6OptionTLVParser );
- SENF_PARSER_FIELD ( slfNetType, senf::UInt8Parser );
- SENF_PARSER_FIELD ( checksum, senf::UInt32Parser );
+ SENF_PARSER_INHERIT ( IPv6OptionParser );
+ SENF_PARSER_FIELD ( extendedType, senf::UInt8Parser );
+ SENF_PARSER_FIELD ( checksum, senf::UInt32Parser );
+ SENF_PARSER_FINALIZE ( IPv6ChecksumOptionParser );
SENF_PARSER_INIT() {
- optionType() = typeCode;
- length() = senf::init_bytes<IPv6ChecksumOptionTLVParser>::value -senf::init_bytes<IPv6OptionTLVParser>::value;
- slfNetType() = SN_typeCode;
+ optionType() = typeId;
+ length() = 5u;
+ extendedType() = extendedTypeId;
}
- SENF_PARSER_FINALIZE ( IPv6ChecksumOptionTLVParser );
- static const boost::uint8_t typeCode = 0x0d;
- static const boost::uint8_t SN_typeCode = 0x4d;
+
+ static const boost::uint8_t typeId = 0x0d;
+ static const boost::uint8_t extendedTypeId = 0x4d;
};
}
{
senf::IPv6HopByHopOptionsPacket::Parser::options_t::container optC (p->options() );
{
- IPv6ChecksumOptionTLVParser opt (
- optC.push_back_space().init<IPv6ChecksumOptionTLVParser>());
- SENF_CHECK_NO_THROW( opt.slfNetType() = 1u) ;
+ IPv6ChecksumOptionParser opt (
+ optC.push_back_space().init<IPv6ChecksumOptionParser>());
opt.checksum() = 0x01234567u;
}
}
unsigned char data[] = {
0x3a, 0x01, // Hop-By-Hop Header (nextHeader, length)
0x0d, 0x05, // option type, length
- // option value: slfNetType, checksum
- 0x01, 0x01, 0x23, 0x45, 0x67,
+ // option value: extendedType, checksum
+ 0x4d, 0x01, 0x23, 0x45, 0x67,
// padding (PadN option: type, length, 0-padding)
0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00
};
0x3a, 0x01, // Hop-By-Hop Header (nextHeader, length)
0x0d, 0x05, // option type, length
// option value: slfNetType, checksum
- 0x01, 0x01, 0x23, 0x45, 0x67,
+ 0x4d, 0x01, 0x23, 0x45, 0x67,
// padding (PadN option: type, length, 0-padding)
0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00
};
optContainer_t::iterator listIter (optC.begin());
BOOST_CHECK_EQUAL( listIter->optionType(), 0x0d);
- IPv6ChecksumOptionTLVParser opt ( listIter->as<IPv6ChecksumOptionTLVParser>());
- BOOST_CHECK_EQUAL( opt.slfNetType(), 0x01);
+ BOOST_CHECK( listIter->is<IPv6ChecksumOptionParser>());
+ IPv6ChecksumOptionParser opt ( listIter->as<IPv6ChecksumOptionParser>());
+ BOOST_CHECK_EQUAL( opt.extendedType(), 0x4d);
BOOST_CHECK_EQUAL( opt.checksum(), 0x01234567);
}
// Custom includes
#include <senf/Packets/Packets.hh>
-#include "IPv6ExtOptionType.hh"
+#include "IPv6ExtOptions.hh"
#include "ListOptionTypeParser.hh"
#include <senf/Utils/auto_unit_test.hh>
SENF_PARSER_FIELD( size, senf::UInt8Parser );
typedef senf::detail::FixedAuxParserPolicy<senf::UInt8Parser, 1u> ListOptionTypeAuxPolicy;
typedef senf::detail::ListOptionTypeParser_Policy<
- senf::IPv6GenericOptionTLVParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy;
+ senf::IPv6GenericOptionParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy;
typedef senf::ListParser<ListOptionTypePolicy> ListOptionTypeParser;
SENF_PARSER_FIELD ( list, ListOptionTypeParser);
void dump(GenericTLVParserBase<BaseParser> const & parser, std::ostream & os);
};
-# define SENF_PACKET_TLV_REGISTRY_REGISTER( BaseTLVParser, ConreteTLVParser ) \
- namespace { \
- senf::GenericTLVParserRegistry<BaseTLVParser> \
- ::RegistrationProxy<ConreteTLVParser> \
- BOOST_PP_CAT(tlvparserRegistration_, __LINE__); \
+# define SENF_PACKET_TLV_REGISTRY_REGISTER( ConreteTLVParser ) \
+ namespace { \
+ ConreteTLVParser::Registry::RegistrationProxy<ConreteTLVParser> \
+ BOOST_PP_CAT(tlvparserRegistration_, __LINE__); \
}
}