Packets: extended description of bad_cast exception in Packet.as()
[senf.git] / senf / Packets / 80221Bundle / MIHPacket.hh
index e051bfb..f99c588 100644 (file)
 // Custom includes
 #include <senf/Packets/Packets.hh>
 #include "TLVParser.hh"
+#include "MIHMessageRegistry.hh"
 
 //#include "MIHPacket.mpp"
-///////////////////////////////hh.p////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
 
 namespace senf {
 
-    struct MIHMessageRegistry {
-        // MIH messages registry
-        typedef boost::uint16_t key_t;
-    };
-
-#   define SENF_MIH_PACKET_REGISTRY_REGISTER( packet )                    \
-        SENF_PACKET_REGISTRY_REGISTER(                                    \
-            senf::MIHMessageRegistry, packet::type::MESSAGE_ID, packet )
-    
-     
     /** \brief Parse a MIH packet
 
         Parser implementing the MIH header. The fields implemented are:
@@ -70,13 +61,13 @@ namespace senf {
         SENF_PARSER_BITFIELD ( sid,     4,  unsigned   );
         SENF_PARSER_BITFIELD ( opcode,  2,  unsigned   );
         SENF_PARSER_BITFIELD ( aid,    10,  unsigned   );
-        
+
         SENF_PARSER_SKIP_BITS ( 4                           );
         SENF_PARSER_BITFIELD  ( transactionId, 12, unsigned );
         SENF_PARSER_FIELD_RO  ( payloadLength, UInt16Parser );
-        
+
         SENF_PARSER_GOTO_OFFSET( 8, 8); // just to limit the offset calculation
-        
+
         // Source MIHF Id
         SENF_PARSER_FIELD ( src_mihfId, MIHFSrcIdTLVParser );
         // Destination MIHF Id
@@ -106,9 +97,7 @@ namespace senf {
         : public PacketTypeBase,
           public PacketTypeMixin<MIHPacketType, MIHMessageRegistry>
     {
-#ifndef DOXYGEN
         typedef PacketTypeMixin<MIHPacketType, MIHMessageRegistry> mixin;
-#endif
         typedef ConcretePacket<MIHPacketType> packet; ///< MIH packet typedef
         typedef MIHPacketParser parser;               ///< typedef to the parser of MIH packet
 
@@ -117,9 +106,10 @@ namespace senf {
         using mixin::initSize;
 
         /** \brief Dump given MIH packet 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);
         static factory_t nextPacketType(packet p);
+        static void validate(packet p);
     };
 
     /** \brief MIH packet typedef
@@ -139,9 +129,7 @@ namespace senf {
         : public PacketTypeBase,
           public PacketTypeMixin<MIHGenericPayloadPacketType>
     {
-#ifndef DOXYGEN
         typedef PacketTypeMixin<MIHGenericPayloadPacketType> mixin;
-#endif
         typedef ConcretePacket<MIHGenericPayloadPacketType> packet; ///< MIH Payload packet typedef
         typedef MIHGenericPayloadPacketParser parser; ///< typedef to the parser of MIH Payload packet
 
@@ -150,7 +138,7 @@ namespace senf {
         using mixin::initSize;
 
         /** \brief Dump given MIHGenericPayload 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);
     };
 
@@ -161,7 +149,7 @@ namespace senf {
 }
 
 
-///////////////////////////////hh.e////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
 //#include "MIHPacket.cci"
 //#include "MIHPacket.ct"
 //#include "MIHPacket.cti"