X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FDefaultBundle%2FIPv6ExtOptionType.ct;h=d816433f258a3fb77d778b962c7370faa21bbdb4;hb=9e03cf6e4f35e548a2c384f76da4a1d76fca3fc5;hp=6c5a841212887a31eef5aa43594a6bc8a00231dd;hpb=8c6873a925c79e6bb640f82895b31f4cbd84ef30;p=senf.git diff --git a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct index 6c5a841..d816433 100644 --- a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct +++ b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct @@ -20,7 +20,10 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -//#include "IPv6ExtOptionType.hh" +/** \file + \brief IPv6Extension-Options non-inline template implementation */ + +//#include "IPv6ExtOptionType.ih" // Custom includes @@ -44,10 +47,48 @@ prefix_ void senf::GenericOptTypeTLVPacketParser::value(ForwardReadableRange con 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)); } +template +prefix_ void senf::GenericOptTypeTLVPacketParser::setPayload(ForwardReadableRange const &range) +{ + unsigned int rangeSize = boost::size(range); + if ( rangeSize != optionLength() ) + resize( (optionLength() + 2), (rangeSize + 2) ); + safe_data_iterator si( data(), boost::next( i(), 2) ); + std::copy( boost::begin(range), boost::end(range), si); + optionLength() = rangeSize; +} + + +template +prefix_ Parser& senf::GenericOptTypeTLVPacketParser::init() +{ + size_type oldSize ( bytes() ); + safe_data_iterator j( data(), i() ); + resize( oldSize, senf::init_bytes::value); + std::advance(j, senf::init_bytes::value); + std::fill(safe_data_iterator(data(), i()) , j, 0u); + Parser::optionType() = typeCode; + return *(this); +} + +// template +// prefix_ Parser& senf::GenericOptTypeTLVPacketParser::get() +// { +// SENF_ASSERT (optionType() == typeCode); +// return *(this); +// } + + ///////////////////////////////ct.e//////////////////////////////////////// #undef prefix_