- IPv6 Dest Ext option added
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1549
270642c3-0616-0410-b53a-bc976706d245
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
+ /** \brief IPv6 Extension Option parser
+
+ Definition of parser fields in RFC2460 and assignments of <b>type</b> field at <a href="http://www.iana.org/assignments/ipv6-parameters">IANA</a>
+
+ Used in \ref IPv6HopByHopOptionsPacketParser and \ref IPv6DestinationOptionsPacketParser.
+
+ \see <a href="http://www.iana.org/assignments/ipv6-parameters">IANA IPv6 Parameters</a>\n
+ \ref IPv6GenericOptionParser
+
+ \ingroup protocolbundle_default
+ */
+
class IPv6OptionParser : public PacketParserBase
{
public:
os << "Internet protocol Version 6 Destination Options extension:\n"
<< senf::fieldName("next header") << unsigned (p->nextHeader()) << "\n"
<< senf::fieldName("header length") << unsigned (p->headerLength()) << "\n";
+ os << " OptionTypes:\n";
+ typedef IPv6DestinationOptionsPacket::Parser::options_t::container optContainer_t;
+ optContainer_t options (p->options());
+ for (optContainer_t::const_iterator i = options.begin(); i != options.end(); ++i)
+ i->dump( os);
+}
+
+prefix_ void senf::IPv6DestinationOptionsPacketType::finalize(packet p)
+{
+ try {
+ p->nextHeader() << key(p.next());
+ }
+ catch (InvalidPacketChainException & ex) {
+ p->nextHeader() << 59; // No next header
+ }
}
+
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
//#include "IPv6Extensions.mpp"
{
# include SENF_PARSER()
SENF_PARSER_FIELD ( nextHeader, UInt8Parser );
- SENF_PARSER_FIELD ( headerLength, UInt8Parser );
-
+ SENF_PARSER_FIELD_RO ( headerLength, UInt8Parser );
+ typedef detail::FixedAuxParserPolicy<UInt8Parser, 1u> ListOptionTypeAuxPolicy;
+ typedef detail::ListOptionTypeParser_Policy<
+ IPv6GenericOptionParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy;
+ typedef ListParser<ListOptionTypePolicy> ListOptionTypeParser;
+
+ SENF_PARSER_FIELD ( options, ListOptionTypeParser);
+
SENF_PARSER_FINALIZE ( IPv6DestinationOptionsPacketParser );
};
/** \brief Dump given IPv6DestinationOptionsPacket in readable form to given output stream */
static void dump(packet p, std::ostream & os);
- static void finalize(packet p) {
- p->nextHeader() << key(p.next(nothrow)); }
+ static void finalize(packet p);
};
/** \brief IPv6 routing Destination Options packet typedef