34 <<
", available: " << std::distance(
i(),
data().end());
35 if (
type() != expectedType)
43 if (
length() != expectedLength)
45 <<
", expected length: " << expectedLength <<
" got " <<
length();
54 protect(), listSize_().capacity( maxl);
65 return length_field().value();
67 return parse<UInt8Parser>( 1 ).value() + (underflow_flag() ? 0 : 128u);
69 return parse<UInt16Parser>( 1 ).value() + (underflow_flag() ? 0 : 128u);
71 return parse<UInt24Parser>( 1 ).value() + (underflow_flag() ? 0 : 128u);
73 return parse<UInt32Parser>( 1 ).value() + (underflow_flag() ? 0 : 128u);
90 parse<UInt8Parser>(1) = v - (v>128 ? 128 : 0);
95 parse<UInt16Parser>(1) = v - (v>128 ? 128 : 0);
100 parse<UInt24Parser>(1) = v - (v>128 ? 128 : 0);
103 parse<UInt32Parser>(1) = v - (v>128 ? 128 : 0);
106 throw(
MIHLengthException(
"cannot set length to ") << v <<
": size of length field is greater than 5: " <<
bytes());
108 underflow_flag() = (v <= 128);
139 extended_length_flag() =
false;
147 if (b != 1) resize_(1);
151 if (b != 2) resize_(2);
155 if (b != 3) resize_(3);
159 if (b != 4) resize_(4);
162 if (b != 5) resize_(5);
171 if (b < 2) resize_(2);
175 if (b < 3) resize_(3);
179 if (b < 4) resize_(4);
182 if (b < 5) resize_(5);
190 extended_length_flag() =
true;
191 fixed_length_field() = size - 1;
193 extended_length_flag() =
false;
static value_type const max_value
void maxLength(MIHLengthParser::value_type maxl) const
set maximum value of TLV length field
void validateTypeLength(boost::uint8_t type, MIHLengthParser::value_type length) const
PacketParserBase::size_type bytes(Parser const &p)
Return raw size parsed by the given parser object.
boost::uint32_t value_type
void defaultInit() const
Default implementation.
void maxListSize(MIHLengthParser::value_type maxl=MIHLengthParser::max_value) const
data_iterator i() const
Return beginning of data to parse.
MIHLengthParser ::value_type length() const
MIHLengthParser const & operator=(value_type other)
detail::packet::size_type size_type
Unsigned integral type.
bool check(size_type size) const
Check size of data container.
TLVParserBase public header.
void resize(size_type oldSize, size_type newSize)
Resize data container.
PacketData & data() const
Access the packets raw data container.
static value_type const max_value
static value_type const max_value
ParserProtector protect() const
value_type capacity() const
static value_type const max_value
void validateType(boost::uint8_t type) const
MIHLengthParser length_() const