Bug 1395 - AODV DeferredRouteOutputTag missing constructor
authorTommaso Pecorella <tommaso.pecorella@unifi.it>
Sun, 25 Mar 2012 13:45:55 +0200
changeset 7792 e3d19bee62e8
parent 7791 21c3495394b4
child 7793 1c81a8a91b1e
Bug 1395 - AODV DeferredRouteOutputTag missing constructor
RELEASE_NOTES
src/aodv/model/aodv-routing-protocol.cc
--- a/RELEASE_NOTES	Sat Mar 17 23:23:56 2012 +0100
+++ b/RELEASE_NOTES	Sun Mar 25 13:45:55 2012 +0200
@@ -36,7 +36,8 @@
  - bug 1378 - UdpEchoClient::SetFill () does not set packet size correctly
  - bug 1351 and 1333 - TCP not able to take RTT samples on long delay network
  - bug 1362 - ICMPv6 does not forward ICMPs to upper layers (and minor fixes to ICMPv6)
-
+ - bug 1395 - AODV DeferredRouteOutputTag missing constructor
+ 
 Known issues
 ------------
 In general, known issues are tracked on the project tracker available
--- a/src/aodv/model/aodv-routing-protocol.cc	Sat Mar 17 23:23:56 2012 +0100
+++ b/src/aodv/model/aodv-routing-protocol.cc	Sun Mar 25 13:45:55 2012 +0200
@@ -53,16 +53,19 @@
 
 //-----------------------------------------------------------------------------
 /// Tag used by AODV implementation
-struct DeferredRouteOutputTag : public Tag
+
+class DeferredRouteOutputTag : public Tag
 {
-  /// Positive if output device is fixed in RouteOutput
-  int32_t oif;
 
-  DeferredRouteOutputTag (int32_t o = -1) : Tag (), oif (o) {}
+public:
+  DeferredRouteOutputTag (int32_t o = -1) : Tag (), m_oif (o) {}
 
   static TypeId GetTypeId ()
   {
-    static TypeId tid = TypeId ("ns3::aodv::DeferredRouteOutputTag").SetParent<Tag> ();
+    static TypeId tid = TypeId ("ns3::aodv::DeferredRouteOutputTag").SetParent<Tag> ()
+      .SetParent<Tag> ()
+      .AddConstructor<DeferredRouteOutputTag> ()
+    ;
     return tid;
   }
 
@@ -71,6 +74,16 @@
     return GetTypeId ();
   }
 
+  int32_t GetInterface() const
+  {
+    return m_oif;
+  }
+
+  void SetInterface(int32_t oif)
+  {
+    m_oif = oif;
+  }
+
   uint32_t GetSerializedSize () const
   {
     return sizeof(int32_t);
@@ -78,20 +91,27 @@
 
   void  Serialize (TagBuffer i) const
   {
-    i.WriteU32 (oif);
+    i.WriteU32 (m_oif);
   }
 
   void  Deserialize (TagBuffer i)
   {
-    oif = i.ReadU32 ();
+    m_oif = i.ReadU32 ();
   }
 
   void  Print (std::ostream &os) const
   {
-    os << "DeferredRouteOutputTag: output interface = " << oif;
+    os << "DeferredRouteOutputTag: output interface = " << m_oif;
   }
+
+private:
+  /// Positive if output device is fixed in RouteOutput
+  int32_t m_oif;
 };
 
+NS_OBJECT_ENSURE_REGISTERED (DeferredRouteOutputTag);
+
+
 //-----------------------------------------------------------------------------
 RoutingProtocol::RoutingProtocol () :
   RreqRetries (2),
@@ -1577,8 +1597,8 @@
       DeferredRouteOutputTag tag;
       Ptr<Packet> p = ConstCast<Packet> (queueEntry.GetPacket ());
       if (p->RemovePacketTag (tag) && 
-          tag.oif != -1 && 
-          tag.oif != m_ipv4->GetInterfaceForDevice (route->GetOutputDevice ()))
+          tag.GetInterface() != -1 &&
+          tag.GetInterface() != m_ipv4->GetInterfaceForDevice (route->GetOutputDevice ()))
         {
           NS_LOG_DEBUG ("Output device doesn't match. Dropped.");
           return;