Data frames can go
authorKirill Andreev <andreev@iitp.ru>
Tue, 31 Mar 2009 18:50:12 +0400
changeset 4906 80966b2163ee
parent 4905 cd7eb4fd3829
child 4918 00c83f6ae8b7
Data frames can go
examples/mesh.cc
src/devices/mesh/dot11s/hwmp-mac-plugin.cc
src/devices/mesh/dot11s/hwmp-protocol.cc
src/devices/mesh/mesh-point-device.cc
src/devices/mesh/mesh-wifi-interface-mac.cc
--- a/examples/mesh.cc	Tue Mar 31 18:04:54 2009 +0400
+++ b/examples/mesh.cc	Tue Mar 31 18:50:12 2009 +0400
@@ -39,8 +39,8 @@
 main (int argc, char *argv[])
 {
   // Creating square topology with nNodes x nNodes grid:
-  int      xSize       = 4;
-  int      ySize       = 4;
+  int      xSize       =5;
+  int      ySize       = 5;
   double   step        = 100.0; //Grid with one-hop edge
   double   randomStart = 0.1; //One beacon interval
   NodeContainer      nodes;
--- a/src/devices/mesh/dot11s/hwmp-mac-plugin.cc	Tue Mar 31 18:04:54 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-mac-plugin.cc	Tue Mar 31 18:50:12 2009 +0400
@@ -59,7 +59,6 @@
     HwmpTag tag;
     packet->RemoveHeader(meshHdr);
     //TODO: address extension
-    NS_LOG_UNCOND("Received Data frame");
     Mac48Address destination;
     switch (meshHdr.GetAddressExt ())
     {
@@ -69,7 +68,8 @@
       default:
         NS_ASSERT(false);
     };
-    tag.SetSeqno (2);//meshHdr.GetMeshSeqno ());
+    NS_LOG_UNCOND("Received Data frame to "<<destination);
+    tag.SetSeqno (meshHdr.GetMeshSeqno ());
     if(meshHdr.GetMeshTtl () == 0)
       return false;
     tag.SetTtl (meshHdr.GetMeshTtl () - 1);
@@ -134,6 +134,7 @@
   //TODO: add a mesh header and remove a TAG
   NS_ASSERT(header.IsData ());
   HwmpTag tag;
+  NS_LOG_UNCOND("sending packet to "<<to);
   NS_ASSERT(packet->FindFirstMatchingTag(tag));
   WifiMeshHeader meshHdr;
   meshHdr.SetMeshSeqno(tag.GetSeqno());
--- a/src/devices/mesh/dot11s/hwmp-protocol.cc	Tue Mar 31 18:04:54 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-protocol.cc	Tue Mar 31 18:50:12 2009 +0400
@@ -159,7 +159,6 @@
   MeshL2RoutingProtocol::RouteReplyCallback routeReply
 )
 {
-  NS_LOG_UNCOND("Packet has come!");
   HwmpTag tag;
   if (sourceIface == GetMeshPoint ()->GetIfIndex())
     // packet from level 3
@@ -186,11 +185,19 @@
 {
   NS_ASSERT(destination != Mac48Address::GetBroadcast ());
   HwmpRtable::LookupResult result = m_rtable->LookupReactive(destination);
+  NS_LOG_UNCOND("FORWARD UNICAST");
   if(result.retransmitter == Mac48Address::GetBroadcast ())
     result = m_rtable->LookupProactive ();
   if(result.retransmitter != Mac48Address::GetBroadcast ())
   {
+    NS_LOG_UNCOND("Reply now:");
     //reply immediately:
+    packet->RemoveAllTags ();
+    //Add a proper HWMP-tag:
+    HwmpTag tag;
+    tag.SetAddress (result.retransmitter);
+    //seqno and metric is not used;
+    packet->AddTag(tag);
     routeReply (true, packet, source, destination, protocolType, result.ifIndex);
     return true;
   }
--- a/src/devices/mesh/mesh-point-device.cc	Tue Mar 31 18:04:54 2009 +0400
+++ b/src/devices/mesh/mesh-point-device.cc	Tue Mar 31 18:50:12 2009 +0400
@@ -77,6 +77,7 @@
   NS_LOG_DEBUG ("UID is " << packet->GetUid ());
   const Mac48Address src48 = Mac48Address::ConvertFrom (src);
   const Mac48Address dst48 = Mac48Address::ConvertFrom (dst);
+  NS_LOG_UNCOND("SRC="<<src48<<", DST = "<<dst48<<", I am: "<<m_address);
   if (!m_promiscRxCallback.IsNull ())
     m_promiscRxCallback (this, packet, protocol, src, dst, packetType);
   switch (packetType)
--- a/src/devices/mesh/mesh-wifi-interface-mac.cc	Tue Mar 31 18:04:54 2009 +0400
+++ b/src/devices/mesh/mesh-wifi-interface-mac.cc	Tue Mar 31 18:50:12 2009 +0400
@@ -327,7 +327,6 @@
   hdr.SetAddr4 (from);
   hdr.SetDsFrom ();
   hdr.SetDsTo ();
-  
   // Address 1 is unknwon here. Routing plugin is responsible to correctly set it.
   hdr.SetAddr1 (Mac48Address ());