X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FDefaultBundle%2FIPv6ExtOptionType.ct;h=f498f28f96db83697f3b544f8b399f4be3f3951d;hb=0c032ed95aa957cdf6e2d173f8717874f26f45e3;hp=3aa4f2a89828509789868e06a72ea80998598060;hpb=25976ed67c66d30811fa0a01043e50347e9d1e69;p=senf.git diff --git a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct index 3aa4f2a..f498f28 100644 --- a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct +++ b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct @@ -30,8 +30,28 @@ template prefix_ void senf::GenericOptTypeTLVPacketParser::value(ForwardReadableRange const &range) { - safe_data_iterator si = resizeValueField( boost::size(range) ); - std::copy( boost::begin(range), boost::end(range), si); + unsigned int rangeSize = boost::size(range); + safe_data_iterator si( data(), boost::next(i(), 2 + optionLength() ) ); +// if ( rangeSize > optionLength() ){ +// std::cout << "rangeSize > optionLength()" << std::endl; +// data().insert(si, rangeSize - optionLength(),0 ); +// } +// if (rangeSize < optionLength() ){ +// std::cout << "rangeSize < optionLength()" << std::endl; +// data().erase(si, si + (optionLength() - rangeSize)); +// } + if ( (rangeSize-2) != optionLength() ) + resize(optionLength()+2, rangeSize); + + std::copy(boost::next(boost::begin(range), 2), boost::next(boost::end(range)), si); + 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)); } ///////////////////////////////ct.e////////////////////////////////////////