X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FDefaultBundle%2FIPv6ExtOptionType.ct;fp=senf%2FPackets%2FDefaultBundle%2FIPv6ExtOptionType.ct;h=6c5a841212887a31eef5aa43594a6bc8a00231dd;hb=8c6873a925c79e6bb640f82895b31f4cbd84ef30;hp=cc5f9f2448c47f7720e6e9190476d16f5d29ea8f;hpb=b71a70ffe7cfce2d558ab881c741a0a97758b55b;p=senf.git diff --git a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct index cc5f9f2..6c5a841 100644 --- a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct +++ b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct @@ -30,22 +30,22 @@ template prefix_ void senf::GenericOptTypeTLVPacketParser::value(ForwardReadableRange const &range) { - safe_data_iterator si( data(), boost::next(data().begin()+2) ); unsigned int rangeSize = boost::size(range); -// std::cout << "tmpl. method - optLength =" << (unsigned) optionLength() -// << ", rangeSize: " << rangeSize -// << ", optionType: " << (unsigned) optionType() << std::endl; - if ( rangeSize > optionLength() ){ + 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() ){ +// data().insert(si, rangeSize - optionLength(),0 ); +// } +// if (rangeSize < optionLength() ){ // std::cout << "rangeSize < optionLength()" << std::endl; - data().erase(si, si + (optionLength() - rangeSize)); - } - std::copy(( boost::begin(range)), boost::end(range), si); - optionLength() = 2u; -// std::cout << "optLength AFTER =" << (unsigned) optionLength() << ", rangeSize: " << rangeSize << 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////////////////////////////////////////