Packets/80221Bundle: removed MIHFId::None
tho [Fri, 22 Oct 2010 13:44:36 +0000 (13:44 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1739 270642c3-0616-0410-b53a-bc976706d245

senf/Packets/80221Bundle/MIHPacket.test.cc
senf/Packets/80221Bundle/MIHTypes.cc
senf/Packets/80221Bundle/MIHTypes.hh
senf/Packets/80221Bundle/TLVParser.cc

index fbfdd18..d777bd3 100644 (file)
@@ -327,6 +327,21 @@ SENF_AUTO_UNIT_TEST(MIHPayload_create)
             mihPacket.data().begin(), mihPacket.data().end() );
 }
 
+SENF_AUTO_UNIT_TEST(Test_MIHFIdTLV)
+{
+    unsigned char data[] = {
+            // MIH header
+            0x10, 0x54, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00,
+            // source MIHF_ID TLV:
+            0x01, 0x00, // type, length
+            // destination MIHF_ID TLV:
+            0x02, 0x00, // type, length
+            0x0c        // value-length
+    };
+
+    MIHPacket mihPacket (MIHPacket::create(data));
+    BOOST_CHECK( mihPacket->src_mihfId().valueEquals( MIHFId::Multicast) );
+}
 
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
index 4c9e363..bd0259f 100644 (file)
@@ -32,7 +32,6 @@
 ///////////////////////////////cc.p////////////////////////////////////////
 
 senf::MIHFId const senf::MIHFId::Multicast;
-senf::MIHFId const senf::MIHFId::None;
 
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
index bd8d174..ea901bf 100644 (file)
@@ -47,10 +47,9 @@ namespace senf {
     {
     public:
         static MIHFId const Multicast; ///< The multicast (empty) MIHF Id
-        static MIHFId const None; ///< The multicast (empty) MIHF Id
-        enum Type { Empty, MACAddress, INet4Address, INet6Address, String, EUI64 };
+        enum Type { MulticastType, MACAddress, INet4Address, INet6Address, String, EUI64 };
 
-        MIHFId();                                   ///< Create empty instance.
+        MIHFId();                                   ///< Create multicast id.
         MIHFId(senf::MACAddress const & addr);      ///< Construct id with given MACAddress
         MIHFId(senf::INet4Address const & addr);    ///< Construct id with given INet4Address
         MIHFId(senf::INet6Address const & addr);    ///< Construct id with given INet6Address
@@ -63,7 +62,7 @@ namespace senf {
 
     private:
         struct GetTypeVisitor : public boost::static_visitor<Type> {
-            Type operator()(boost::blank const &) const { return Empty; }
+            Type operator()(boost::blank const &) const { return MulticastType; }
             Type operator()(senf::MACAddress const &) const { return MACAddress; }
             Type operator()(senf::INet4Address const &) const { return INet4Address; }
             Type operator()(senf::INet6Address const &) const { return INet6Address; }
index b5c70ec..78c43c0 100644 (file)
@@ -139,7 +139,7 @@ prefix_ senf::MIHFId senf::MIHFIdTLVParser::valueAs(MIHFId::Type type)
 {
     if (length() == 0) return MIHFId();
     switch (type) {
-    case MIHFId::Empty:
+    case MIHFId::MulticastType:
         return MIHFId();
     case MIHFId::MACAddress:
         return MIHFId( valueAsMACAddress());