X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FDefaultBundle%2FIPv6ExtOptionType.ct;h=f498f28f96db83697f3b544f8b399f4be3f3951d;hb=0c032ed95aa957cdf6e2d173f8717874f26f45e3;hp=cc5f9f2448c47f7720e6e9190476d16f5d29ea8f;hpb=17b707d5ed5741bcbeba233eeb1efacecd990176;p=senf.git diff --git a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct index cc5f9f2..f498f28 100644 --- a/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct +++ b/senf/Packets/DefaultBundle/IPv6ExtOptionType.ct @@ -30,22 +30,28 @@ 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); + 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////////////////////////////////////////