X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FDefaultBundle%2FIPv6Extensions.hh;h=f2f3a47834cc596d4eb3bd42193223fc50109ae3;hb=7661548b20e6c7627f54bff87e0758396fd523ef;hp=7d1aab69ec6ee18cf1f4378ecfe65436ccf3b025;hpb=328a72eb2f360d08f2d618ef6aae2ac6b42d76ab;p=senf.git diff --git a/senf/Packets/DefaultBundle/IPv6Extensions.hh b/senf/Packets/DefaultBundle/IPv6Extensions.hh index 7d1aab6..f2f3a47 100644 --- a/senf/Packets/DefaultBundle/IPv6Extensions.hh +++ b/senf/Packets/DefaultBundle/IPv6Extensions.hh @@ -28,21 +28,19 @@ #define HH_SENF_Packets_DefaultBundle_IPv6Extensions_ 1 // Custom includes -#include -#include -#include +#include "IPv6ExtOptions.hh" #include "ListOptionTypeParser.hh" #include "IPv6Packet.hh" //#include "IPv6Extensions.mpp" -///////////////////////////////hh.p//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// namespace senf { /** \brief Parse in IPv6 fragment extension header - + Parser implementing the IPv6 fragment extension. The fields implemented are: - \image html IPv6Extensions_Fragment.png + \image html IPv6FragmentPacket.png \see IPv6ExtensionType_Fragment \n RFC 2460 @@ -68,10 +66,10 @@ namespace senf { \par Fields: \ref IPv6FragmentPacketParser - + \par Associated registries: \ref IpTypes - + \par Finalize action: Set \a nextHeader from type of next packet if found in \ref IpTypes @@ -94,17 +92,18 @@ namespace senf { using mixin::initSize; using mixin::init; - static key_t nextPacketKey(packet p) + static key_t nextPacketKey(packet p) { return p->nextHeader(); } - + /** \brief Dump given IPv6FragmentPacket in readable form to given output stream */ - static void dump(packet p, std::ostream & os); + 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 fragment extension packet typedef */ + /** \brief IPv6 fragment extension packet typedef + \ingroup protocolbundle_default + */ typedef ConcretePacket IPv6FragmentPacket; // ===================================================================================================== @@ -113,12 +112,12 @@ namespace senf { Parser implementing the IPv6 routing Header extension (type 0 only). The fields implemented are: - \image html IPv6Extensions_Routing.png + \image html IPv6RoutingPacket.png \see IPv6ExtensionType_Routing \n RFC 2460 */ - struct IPv6PRoutingPacketParser : public PacketParserBase + struct IPv6RoutingPacketParser : public PacketParserBase { /* The Type 0 Routing header has the following format: (RFC 2460) @@ -129,11 +128,11 @@ namespace senf { | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | - + + + + | | - + Address[1] + + + Address[1] | | - + + + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . @@ -141,43 +140,43 @@ namespace senf { . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | - + + + + | | - + Address[n] + + + Address[n] | | - + + + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ # include SENF_PARSER() - + SENF_PARSER_FIELD ( nextHeader, UInt8Parser ); SENF_PARSER_FIELD ( headerLength, UInt8Parser ); SENF_PARSER_FIELD ( routingType, UInt8Parser ); //set to Zero for minimal implementation SENF_PARSER_FIELD_RO ( segmentsLeft, UInt8Parser ); SENF_PARSER_FIELD ( reserved, UInt32Parser ); //set to zero by RFC SENF_PARSER_VECTOR ( hopAddresses, segmentsLeft, INet6AddressParser ); - - SENF_PARSER_FINALIZE ( IPv6PRoutingPacketParser ); - + + SENF_PARSER_FINALIZE ( IPv6RoutingPacketParser ); + //provisionary, since only type 0 is implemented - SENF_PARSER_INIT() { + SENF_PARSER_INIT() { routingType() = 0u; - reserved() = 0u; + reserved() = 0u; } }; - + /** \brief IPv6 routing extension \par Packet type (typedef): \ref IPv6RoutingPacket \par Fields: - \ref IPv6PRoutingPacketParser - + \ref IPv6RoutingPacketParser + \par Associated registries: \ref IpTypes - + \par Finalize action: Set \a nextHeader from type of next packet if found in \ref IpTypes @@ -193,52 +192,55 @@ namespace senf { /** \brief IPv6 routing extension packet typedef */ typedef ConcretePacket packet; /** \brief typedef to the parser of IPv6 routing extension packet */ - typedef IPv6PRoutingPacketParser parser; - + typedef IPv6RoutingPacketParser parser; + using mixin::nextPacketRange; using mixin::nextPacketType; using mixin::init; using mixin::initSize; - - static key_t nextPacketKey(packet p) + + static key_t nextPacketKey(packet p) { return p->nextHeader(); } + /** \brief Dump given IPv6RoutingPacket 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 dump(packet p, std::ostream & os); + + static void finalize(packet p); }; - - /** \brief IPv6 routing extension packet typedef */ + + /** \brief IPv6 routing extension packet typedef + \ingroup protocolbundle_default + */ typedef ConcretePacket IPv6RoutingPacket; - + // ===================================================================================================== - + /** \brief Parse in IPv6 Hop-By-Hop extension header Parser implementing the IPv6 routing Header extension. The fields implemented are: - \image html IPv6Extensions_HopByHop.png + \image html IPv6HopByHopOptionsPacket.png \see IPv6ExtensionType_HopByHop \n RFC 2460 */ - struct IPv6HopByHopOptionsPacketParser : public PacketParserBase { + struct IPv6HopByHopOptionsPacketParser : public PacketParserBase + { # include SENF_PARSER() - - SENF_PARSER_FIELD ( nextHeader, UInt8Parser ); - SENF_PARSER_FIELD ( headerLength, UInt8Parser ); + + SENF_PARSER_FIELD ( nextHeader, UInt8Parser ); + SENF_PARSER_FIELD_RO ( headerLength, UInt8Parser ); typedef detail::FixedAuxParserPolicy ListOptionTypeAuxPolicy; typedef detail::ListOptionTypeParser_Policy< - IPv6GenericOptionTLVParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy; + IPv6GenericOptionParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy; typedef ListParser ListOptionTypeParser; SENF_PARSER_FIELD ( options, ListOptionTypeParser); SENF_PARSER_FINALIZE ( IPv6HopByHopOptionsPacketParser ); }; - + /** \brief IPv6 Hop-By-Hop extension \par Packet type (typedef): @@ -246,10 +248,10 @@ namespace senf { \par Fields: \ref IPv6HopByHopOptionsPacketParser - + \par Associated registries: \ref IpTypes - + \par Finalize action: Set \a nextHeader from type of next packet if found in \ref IpTypes @@ -266,45 +268,52 @@ namespace senf { typedef ConcretePacket packet; /** \brief typedef to the parser of IPv6 Hop-By-Hop extension packet */ typedef IPv6HopByHopOptionsPacketParser parser; - + using mixin::nextPacketRange; using mixin::nextPacketType; using mixin::init; using mixin::initSize; - - static key_t nextPacketKey(packet p) - { return p->nextHeader(); } - + + static key_t nextPacketKey(packet p) { + return p->nextHeader(); } + /** \brief Dump given IPv6HopByHopOptionsPacket 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 dump(packet p, std::ostream & os); + + static void finalize(packet p); }; - - /** \brief IPv6 routing Hop-By-Hop packet typedef */ + + /** \brief IPv6 routing Hop-By-Hop packet typedef + \ingroup protocolbundle_default + */ typedef ConcretePacket IPv6HopByHopOptionsPacket; - + // ===================================================================================================== - + /** \brief Parse in IPv6 Destination Options extension header - Parser implementing the IPv6 Destination Options Header extension. + Parser implementing the IPv6 Destination Options Header extension. The fields implemented are: - \image html IPv6Extensions_Destination.png + \image html IPv6DestinationOptionsPacket.png \see IPv6ExtensionType_Destination \n RFC 2460 - */ - struct IPv6DestinationOptionsPacketParser : public PacketParserBase + */ + struct IPv6DestinationOptionsPacketParser : public PacketParserBase { # include SENF_PARSER() SENF_PARSER_FIELD ( nextHeader, UInt8Parser ); - SENF_PARSER_FIELD ( headerLength, UInt8Parser ); - + SENF_PARSER_FIELD_RO ( headerLength, UInt8Parser ); + typedef detail::FixedAuxParserPolicy ListOptionTypeAuxPolicy; + typedef detail::ListOptionTypeParser_Policy< + IPv6GenericOptionParser, ListOptionTypeAuxPolicy> ListOptionTypePolicy; + typedef ListParser ListOptionTypeParser; + + SENF_PARSER_FIELD ( options, ListOptionTypeParser); + SENF_PARSER_FINALIZE ( IPv6DestinationOptionsPacketParser ); }; - + /** \brief IPv6 Destination Options extension \par Packet type (typedef): @@ -312,10 +321,10 @@ namespace senf { \par Fields: \ref IPv6DestinationOptionsPacketParser - + \par Associated registries: \ref IpTypes - + \par Finalize action: Set \a nextHeader from type of next packet if found in \ref IpTypes @@ -332,27 +341,28 @@ namespace senf { typedef ConcretePacket packet; /** \brief typedef to the parser of IPv6 Destination Options extension packet */ typedef IPv6DestinationOptionsPacketParser parser; - + using mixin::nextPacketRange; using mixin::nextPacketType; using mixin::init; using mixin::initSize; - - static key_t nextPacketKey(packet p) + + static key_t nextPacketKey(packet p) { return p->nextHeader(); } /** \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 dump(packet p, std::ostream & os); + + static void finalize(packet p); }; - - /** \brief IPv6 routing Destination Options packet typedef */ + + /** \brief IPv6 routing Destination Options packet typedef + \ingroup protocolbundle_default + */ typedef ConcretePacket IPv6DestinationOptionsPacket; - + } -///////////////////////////////hh.e//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// //#include "IPv6Extensions.cci" //#include "IPv6Extensions.ct" //#include "IPv6Extensions.cti"