SENF_PARSER_PRIVATE_BITFIELD ( fixed_length_field, 6, unsigned );
void finalize();
- void maxValue(value_type v);
- value_type maxValue() const;
+ void capacity(value_type v);
+ value_type capacity() const;
private:
void resize_(size_type size);
};
\endcode
- You have to adjust the maximum length value with the \ref maxLengthValue function
+ You have to adjust the maximum length value with the \ref maxLength function
before the length value is set. The default maximum value is 128. So, in the above
example adding more than 21 MACAddresses to the vector will throw a TLVLengthException
- if you don't call \c maxLengthValue( \e some_value) before.
+ if you don't call \c maxLength( \e some_value) before.
\see MIHTLVLengthParser \n
MIHGenericTLVParser \n
SENF_PARSER_FIELD_RO ( length, MIHTLVLengthParser );
SENF_PARSER_FINALIZE ( MIHBaseTLVParser );
- /** \brief set maximum value of length field
-
- The size of the length field will be increased if necessary.
- \param v maximum value of length field
- */
- void maxLengthValue(MIHTLVLengthParser::value_type v) const {
- protect(), length_().maxValue(v);
- }
-
- /** \brief shrink size of length field to minimum
+ /** \brief shrink size of the TLV length field to minimum
The size of the length field will be decreased to minimum necessary to hold
the current length value.
*/
- void finalize() {
- protect(), length_().finalize();
- };
+ void finalize();
typedef GenericTLVParserRegistry<MIHBaseTLVParser> Registry;
+
+ protected:
+ /** \brief set maximum value of TLV length field
+
+ The size of the length field will be increased if necessary.
+ \param v maximum value of length field
+ */
+ void maxLength(MIHTLVLengthParser::value_type maxl) const;
};
void init() const {
defaultInit();
- maxLengthValue( MIHTLVLengthParser::max_value);
+ maxLength( MIHTLVLengthParser::max_value);
}
using base::init;
+ using base::maxLength;
+ };
+
+
+ /** \brief Base class for list TLV parser
+ */
+ struct MIHBaseListTLVParser
+ : public MIHBaseTLVParser
+ {
+ # include SENF_PARSER()
+ SENF_PARSER_INHERIT ( MIHBaseTLVParser );
+ SENF_PARSER_FIELD_RO ( listSize, MIHTLVLengthParser );
+ SENF_PARSER_FINALIZE ( MIHBaseListTLVParser );
+
+ void maxListSize(MIHTLVLengthParser::value_type maxl) const;
+ };
+
+ template <class Self>
+ struct MIHListTLVParserMixin
+ {
+ void finalize();
};
+
/** \brief Parse a MIHF_ID
Note that the maximum length of a MIHF_ID is 253 octets (see F.3.11 in 802.21)
- We could set maxLengthValue in init(), but for the most MIHF_IDs the default
+ We could set maxLength in init(), but for the most MIHF_IDs the default
maximum length of 128 should be enough.
\note you must call maxIdLength( 253) *before* setting MIHF_IDs values longer
///@}
void dump(std::ostream & os) const;
- void maxIdLength(boost::uint8_t maxLength);
+ void maxIdLength(boost::uint8_t maxl) const;
void finalize();
private:
MIHFIdTLVParser const & parser;
ValueEqualsVisitor( MIHFIdTLVParser const & p) : parser(p) {}
bool operator()( boost::blank ) const {
- return parser.length() == 0;
+ return parser.idLength() == 0;
}
template <typename MIHFIdType>
bool operator()( MIHFIdType const & id ) const {
///////////////////////////////hh.e////////////////////////////////////////
#include "TLVParser.cci"
-//#include "TLVParser.ct"
+#include "TLVParser.ct"
#include "TLVParser.cti"
#endif