resize(optionLength()+2, rangeSize);
std::copy(boost::next(boost::begin(range), 2), boost::next(boost::end(range)), si);
- optionType() = *(boost::begin(range));
+ 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));
}
class OptTypeTLVPacketParser: public PacketParserBase {
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 (optionType, UInt8Parser);
+ SENF_PARSER_BITFIELD (altAction, 2, unsigned);
+ SENF_PARSER_BITFIELD (changeFlag, 1, unsigned);
+ SENF_PARSER_BITFIELD (optionType, 5, unsigned);
+// SENF_PARSER_FIELD (optionType, UInt8Parser);
SENF_PARSER_FIELD (optionLength, UInt8Parser);
SENF_PARSER_FINALIZE (OptTypeTLVPacketParser);
}
//==============================================================================================
-BOOST_AUTO_UNIT_TEST(ipv6Extensions_hopByHop)
+BOOST_AUTO_UNIT_TEST(ipv6Extensions_hopByHop_parse)
{
unsigned char HopByHop_packetData[] = {
0x60, 0x00, 0x00, 0x00, //IP version, class, flow label
pHop_extension.dump(oss);
senf::IPv6Extension_HopByHop::Parser::options_t::container optC(pHop_extension->options() );
senf::IPv6Extension_HopByHop::Parser::options_t::container::iterator listIter (optC.begin());
+
+ BOOST_CHECK_EQUAL( listIter->altAction(), 0u);
+ BOOST_CHECK_EQUAL( listIter->changeFlag(), 0u);
BOOST_CHECK_EQUAL( listIter->optionType(), 5u);
BOOST_CHECK_EQUAL( listIter->optionLength(), 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);
pHop_extension.dump(oss);
BOOST_CHECK_EQUAL( pICMPv6->checksum(), 0x50cc);
}
+
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
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[] = {0x05, 0x02, 0x40, 0x34};
+ unsigned char d[] = {0x65, 0x02, 0x40, 0x34};
unsigned char d1[] = {0x03, 0x01, 0x77};
unsigned char d2[] = {0x07, 0x01, 0x13};
BOOST_CHECK_EQUAL( c.size(), 3u );
OptionParser::list_t::container::iterator cIter (c.begin());
-
+ 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);