///////////////////////////////cc.p////////////////////////////////////////
namespace {
- senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::MIHPacket>
- registerMIHPacket (0x86dd);
-
+ SENF_PACKET_REGISTRY_REGISTER( senf::EtherTypes, 0x86dd, senf::MIHPacket);
}
///////////////////////////////////////////////////////////////////////////
///////////////////////////////cc.p////////////////////////////////////////
namespace {
- senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::EthVLanPacket>
- registerEthVLanPacket(0x8100);
+ SENF_PACKET_REGISTRY_REGISTER( senf::EtherTypes, 0x8100, senf::EthVLanPacket);
}
///////////////////////////////////////////////////////////////////////////
///////////////////////////////cc.p////////////////////////////////////////
namespace {
- senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::ICMPv6Packet>
- registerICMPv6Packet (58);
+ SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 58, senf::ICMPv6Packet);
}
prefix_ boost::uint16_t senf::ICMPv6PacketParser::calcChecksum()
#ifndef DOXYGEN
namespace {
-//Implementing the ICMPv6 Type registry
- senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::ICMPv6ErrDestUnreachable>
- registerICMPv6ErrDestUnreachable (1);
- senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::ICMPv6ErrTooBig>
- registerICMPv6ErrTooBig (2);
- senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::ICMPv6ErrTimeExceeded>
- registerICMPv6ErrTimeExceeded (3);
- senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::ICMPv6ErrParamProblem>
- registerICMPv6ErrParamProblem (4);
- senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::ICMPv6EchoRequest>
- registerICMPv6EchoRequest (128);
- senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::ICMPv6EchoReply>
- registerICMPv6EchoReply (129);
- senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::MLDv2ListenerQuery>
- registerMLDv2ListenerQuery (130);
- senf::PacketRegistry<senf::ICMPTypes>::RegistrationProxy<senf::MLDv2ListenerReport>
- registerMLDv2ListenerReport (143);
+ SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 1, senf::ICMPv6ErrDestUnreachable );
+ SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 2, senf::ICMPv6ErrTooBig );
+ SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 3, senf::ICMPv6ErrTimeExceeded );
+ SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 4, senf::ICMPv6ErrParamProblem );
+ SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 128, senf::ICMPv6EchoRequest );
+ SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 129, senf::ICMPv6EchoReply );
+ SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 130, senf::MLDv2ListenerQuery );
+ SENF_PACKET_REGISTRY_REGISTER( senf::ICMPTypes, 143, senf::MLDv2ListenerReport );
}
#endif
///////////////////////////////cc.p////////////////////////////////////////
namespace {
- senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::IPv4Packet>
- registerIPv4Packet (0x0800);
-
- senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv4Packet>
- regsiterIPv4Packet2 (4); // IP-in-IP encapsulation
+ SENF_PACKET_REGISTRY_REGISTER( senf::EtherTypes, 0x0800, senf::IPv4Packet);
+ SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 4, senf::IPv4Packet); // IP-in-IP encapsulation
}
///////////////////////////////////////////////////////////////////////////
///////////////////////////////cc.p////////////////////////////////////////
namespace {
- senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv6FragmentPacket>
- registerIPv6FragmentPacketType (44);
- senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv6RoutingPacket>
- registerIPv6RoutingPacketType (43);
- senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv6HopByHopOptionsPacket>
- registerIPv6HopByHopOptionsPacketType (0u);
- senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv6DestinationOptionsPacket>
- registerIPv6DestinationOptionsPacketType (60u);
+ SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 44, senf::IPv6FragmentPacket );
+ SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 43, senf::IPv6RoutingPacket );
+ SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 0u, senf::IPv6HopByHopOptionsPacket );
+ SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 60u, senf::IPv6DestinationOptionsPacket );
}
prefix_ void senf::IPv6FragmentPacketType::dump(packet p, std::ostream & os)
/** \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
<a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
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
<a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
*/
- struct IPv6PRoutingPacketParser : public PacketParserBase
+ struct IPv6RoutingPacketParser : public PacketParserBase
{
/*
The Type 0 Routing header has the following format: (RFC 2460)
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() {
/** \brief IPv6 routing extension packet typedef */
typedef ConcretePacket<IPv6RoutingPacketType> packet;
/** \brief typedef to the parser of IPv6 routing extension packet */
- typedef IPv6PRoutingPacketParser parser;
+ typedef IPv6RoutingPacketParser parser;
using mixin::nextPacketRange;
using mixin::nextPacketType;
/** \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
<a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
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
<a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>
///////////////////////////////cc.p////////////////////////////////////////
namespace {
- senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::IPv6Packet>
- registerIPv6Packet (0x86dd);
-
- senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv6Packet>
- registerIPv6Packet2 (41); // IP6-in-IP(6) encapsulation
+ SENF_PACKET_REGISTRY_REGISTER( senf::EtherTypes, 0x86dd, senf::IPv6Packet);
+ SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 41, senf::IPv6Packet); // IP6-in-IP(6) encapsulation
}
prefix_ void senf::IPv6PacketType::dump(packet p, std::ostream & os)
///////////////////////////////cc.p////////////////////////////////////////
namespace {
- senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::TCPPacket>
- registerTCPPacket (6);
+ SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 6, senf::TCPPacket);
}
///////////////////////////////////////////////////////////////////////////
///////////////////////////////cc.p////////////////////////////////////////
namespace {
- senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::UDPPacket>
- registerUDPPacket (17);
+ SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 17, senf::UDPPacket);
}
///////////////////////////////////////////////////////////////////////////
static registration only works when the symbol is included into the final binary. To force
this inclusion, you should not put packet registrations into a library but into an object
file.
+
+ To simplify static registration the SENF_PACKET_REGISTRY_REGISTER macro can be used:
+ \code
+ SENF_PACKET_REGISTRY_REGISTER(SomeTag, SomePacket, key_of_somePacket);
+ \endcode
\ingroup packet_module
*/
This macro will declare an anonymous global variable in such a way, that constructing this
variable will add a registration to the given packet registry.
+ \ingroup packet_module
\hideinitializer
*/
# define SENF_PACKET_REGISTRY_REGISTER( registry, value, type ) \
env.PkgDraw("DefaultBundle/LlcSnapPacket.hh"),
env.PkgDraw("DefaultBundle/UDPPacket.hh"),
env.PkgDraw("DefaultBundle/TCPPacket.hh"),
- env.PkgDraw("DefaultBundle/IPv6Extensions_Fragment.png", "DefaultBundle/IPv6Extensions.hh",
- PKGDRAWPACKETS = "IPv6PacketParserExtension_Fragment"),
- env.PkgDraw("DefaultBundle/IPv6Extensions_Routing.png", "DefaultBundle/IPv6Extensions.hh",
- PKGDRAWPACKETS = "IPv6PacketParserExtension_Routing"),
- env.PkgDraw("DefaultBundle/IPv6Extensions_HopByHop.png", "DefaultBundle/IPv6Extensions.hh",
- PKGDRAWPACKETS = "IPv6PacketParserExtension_HopByHop"),
- env.PkgDraw("DefaultBundle/IPv6Extensions_Destination.png", "DefaultBundle/IPv6Extensions.hh",
- PKGDRAWPACKETS = "IPv6PacketParserExtension_Destination"),
+ env.PkgDraw("DefaultBundle/IPv6FragmentPacket.png", "DefaultBundle/IPv6Extensions.hh",
+ PKGDRAWPACKETS = "IPv6FragmentPacketParser"),
+ env.PkgDraw("DefaultBundle/IPv6RoutingPacket.png", "DefaultBundle/IPv6Extensions.hh",
+ PKGDRAWPACKETS = "IPv6RoutingPacketParser"),
+ env.PkgDraw("DefaultBundle/IPv6HopByHopOptionsPacket.png", "DefaultBundle/IPv6Extensions.hh",
+ PKGDRAWPACKETS = "IPv6HopByHopOptionsPacketParser"),
+ env.PkgDraw("DefaultBundle/IPv6DestinationOptionsPacket.png", "DefaultBundle/IPv6Extensions.hh",
+ PKGDRAWPACKETS = "IPv6DestinationOptionsPacketParser"),
env.PkgDraw("DefaultBundle/ICMPv6Packet.hh"),
env.PkgDraw("DefaultBundle/ICMPv6EchoRequest.png", "DefaultBundle/ICMPv6TypePacket.hh",
PKGDRAWPACKETS = "ICMPv6EchoRequestParser"),