template <class ForwardReadableRange>
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////////////////////////////////////////