80221Bundle: added static const etherType member to MIHPacketType
[senf.git] / senf / Packets / 80221Bundle / TLVParser.hh
index 2c4fc7d..0fd0a71 100644 (file)
@@ -41,6 +41,12 @@ namespace senf {
           : senf::Exception("MIHTLVLengthException") {}
     };
 
+    struct InvalidMIHPacketException : public senf::Exception
+    {
+        InvalidMIHPacketException(std::string const & description)
+            : senf::Exception("Invalid MIH message: ") { append(description); }
+    };
+
 
     class MIHTLVLengthParser
         : public detail::packet::IntParserOps<MIHTLVLengthParser, boost::uint32_t>,
@@ -127,6 +133,9 @@ namespace senf {
             \param v maximum value of length field
          */
         void maxLength(MIHTLVLengthParser::value_type maxl) const;
+
+        void validateType(boost::uint8_t type) const;
+        void validateTypeLength(boost::uint8_t type, MIHTLVLengthParser::value_type length) const;
     };
 
 
@@ -292,6 +301,7 @@ namespace senf {
         }
         static type_t::value_type const typeId = 1;
         void dump(std::ostream & os) const;
+        void validate() const;
     };
 
     /** \brief Parser for 802.21 destination MIHF_ID TLV
@@ -306,6 +316,7 @@ namespace senf {
         }
         static type_t::value_type const typeId = 2;
         void dump(std::ostream & os) const;
+        void validate() const;
     };
 
     /** \brief Parser for 802.21 Status TLV
@@ -324,6 +335,7 @@ namespace senf {
         }
         static type_t::value_type const typeId = 3;
         void dump(std::ostream & os) const; ///< dump string representation to given stream
+        void validate() const;
 
         enum StatusCode {
             Success, UnspecifiedFailure, Rejected, AuthorizationFailure, NetworkError };
@@ -343,6 +355,7 @@ namespace senf {
         }
         static type_t::value_type const typeId = 11;
         void dump(std::ostream & os) const; ///< dump string representation to given stream
+        void validate() const;
 
         enum RequestCode { Registration, ReRegistration };
     };
@@ -361,6 +374,7 @@ namespace senf {
         }
         static type_t::value_type const typeId = 12;
         void dump(std::ostream & os) const; ///< dump string representation to given stream
+        void validate() const;
     };
 
 }