From: tho Date: Thu, 13 Jan 2011 14:24:39 +0000 (+0000) Subject: Packets/80221Bundle: fixed typo in MIH message validation :-/ X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=810482180f96e2eb5a3fae2ba35e8b8a180fa6a6;hp=92d091c2e5b387ca0c9930c7bc88d9b45630a845;p=senf.git Packets/80221Bundle: fixed typo in MIH message validation :-/ git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1763 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Packets/80221Bundle/TLVParser.cc b/senf/Packets/80221Bundle/TLVParser.cc index 373478b..729b1ec 100644 --- a/senf/Packets/80221Bundle/TLVParser.cc +++ b/senf/Packets/80221Bundle/TLVParser.cc @@ -29,7 +29,6 @@ // Custom includes #include #include -#include #define prefix_ //-///////////////////////////////////////////////////////////////////////////////////////////////// @@ -46,17 +45,17 @@ prefix_ void senf::MIHBaseTLVParser::validateType(boost::uint8_t expectedType) const { if (! check( 1 + senf::bytes(length_()) + length()) ) - throw InvalidMIHPacketException("truncated TLV.") << " Type: " << senf::str(type()); + throw InvalidMIHPacketException("truncated TLV.") << " Type: " << unsigned(type()); if (type() != expectedType) - throw InvalidMIHPacketException("invalid TLV type: ") << senf::str(type()); + throw InvalidMIHPacketException("wrong TLV type. expected ") << unsigned(expectedType) << " got " << unsigned(type()); } prefix_ void senf::MIHBaseTLVParser::validateTypeLength(boost::uint8_t expectedType, MIHTLVLengthParser::value_type expectedLength) const { - validateType( expectedLength); + validateType( expectedType); if (length() != expectedLength) - throw InvalidMIHPacketException("invalid length in TLV.") << " Type: " << senf::str(type()); + throw InvalidMIHPacketException("invalid length in TLV.") << " Type: " << unsigned(type()); } //-///////////////////////////////////////////////////////////////////////////////////////////////// @@ -190,10 +189,7 @@ prefix_ void senf::MIHFSrcIdTLVParser::dump(std::ostream & os) prefix_ void senf::MIHFSrcIdTLVParser::validate() const { - if (! check( 1 + senf::bytes(length_()) + length()) ) - throw InvalidMIHPacketException("truncated TLV.") << " Type: " << senf::str(type()); - if (type() != typeId) - throw InvalidMIHPacketException("invalid TLV type: ") << senf::str(type()); + validateType( typeId); } @@ -211,10 +207,7 @@ prefix_ void senf::MIHFDstIdTLVParser::dump(std::ostream & os) prefix_ void senf::MIHFDstIdTLVParser::validate() const { - if (! check( 1 + senf::bytes(length_()) + length()) ) - throw InvalidMIHPacketException("truncated TLV.") << " Type: " << senf::str(type()); - if (type() != typeId) - throw InvalidMIHPacketException("invalid TLV type: ") << senf::str(type()); + validateType( typeId); } //-///////////////////////////////////////////////////////////////////////////////////////////////// @@ -254,7 +247,7 @@ prefix_ void senf::MIHStatusTLVParser::validate() { validateTypeLength( typeId, 1); if (value() >= 4) - throw InvalidMIHPacketException("invalid value in MIHStatusTLV ") << senf::str(value()); + throw InvalidMIHPacketException("invalid value in MIHStatusTLV ") << unsigned( value()); } //-///////////////////////////////////////////////////////////////////////////////////////////////// @@ -285,7 +278,7 @@ prefix_ void senf::MIHRegisterReqCodeTLVParser::validate() { validateTypeLength( typeId, 1); if (value() >= 2) - throw InvalidMIHPacketException("invalid value in MIHRegisterReqCodeTLV ") << senf::str(value()); + throw InvalidMIHPacketException("invalid value in MIHRegisterReqCodeTLV ") << unsigned( value()); } //-/////////////////////////////////////////////////////////////////////////////////////////////////