X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FDefaultBundle%2FIPv6ExtOptionType.ct;h=6c5a841212887a31eef5aa43594a6bc8a00231dd;hb=dc92fc89c7e2d5eedcaadaebef0a196acd39c07f;hp=3aa4f2a89828509789868e06a72ea80998598060;hpb=25976ed67c66d30811fa0a01043e50347e9d1e69;p=senf.git diff --git a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct index 3aa4f2a..6c5a841 100644 --- a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct +++ b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct @@ -30,8 +30,22 @@ 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); + optionType() = *(boost::begin(range)); + optionLength() = *(boost::next( boost::begin(range), 1)); } ///////////////////////////////ct.e////////////////////////////////////////