Debug messages fixed
authorKirill Andreev <andreev@iitp.ru>
Sun, 22 Mar 2009 21:28:44 +0300
changeset 4869 bf6f699d4e03
parent 4868 35f396f9ff22
child 4870 79f9c2b6dffc
Debug messages fixed
examples/mesh.cc
src/devices/mesh/802.11s/peer-link.cc
src/devices/mesh/802.11s/peer-link.h
src/devices/mesh/802.11s/peer-manager-plugin.cc
src/devices/mesh/802.11s/peer-manager-plugin.h
src/devices/mesh/802.11s/peer-manager-protocol.cc
src/devices/mesh/mesh-wifi-interface-mac.cc
--- a/examples/mesh.cc	Sun Mar 22 20:54:04 2009 +0300
+++ b/examples/mesh.cc	Sun Mar 22 21:28:44 2009 +0300
@@ -38,8 +38,8 @@
 main (int argc, char *argv[])
 {
   // Creating square topology with nNodes x nNodes grid:
-  int      xSize       = 1;
-  int      ySize       = 2;
+  int      xSize       = 3;
+  int      ySize       = 3;
   double   step        = 100.0; //Grid with one-hop edge
   double   randomStart = 0.1; //One beacon interval
   NodeContainer      nodes;
--- a/src/devices/mesh/802.11s/peer-link.cc	Sun Mar 22 20:54:04 2009 +0300
+++ b/src/devices/mesh/802.11s/peer-link.cc	Sun Mar 22 21:28:44 2009 +0300
@@ -82,6 +82,11 @@
 }
 
 void
+PeerLink::SetInterface (uint32_t interface)
+{
+  m_interface = interface;
+}
+void
 PeerLink::SetLocalLinkId (uint16_t id)
 {
   m_localLinkId = id;
@@ -255,7 +260,6 @@
 void
 PeerLink::StateMachine (PeerEvent event,dot11sReasonCode reasoncode)
 {
-  NS_LOG_UNCOND("state = "<<m_state<<", event = "<<event);
   switch (m_state)
     {
     case IDLE:
--- a/src/devices/mesh/802.11s/peer-link.h	Sun Mar 22 20:54:04 2009 +0300
+++ b/src/devices/mesh/802.11s/peer-link.h	Sun Mar 22 21:28:44 2009 +0300
@@ -59,6 +59,7 @@
    * \{
    */
   void  SetPeerAddress (Mac48Address macaddr);
+  void  SetInterface (uint32_t interface);
   void  SetLocalLinkId (uint16_t id);
   void  SetPeerLinkId (uint16_t id);
   void  SetLocalAid (uint16_t aid);
--- a/src/devices/mesh/802.11s/peer-manager-plugin.cc	Sun Mar 22 20:54:04 2009 +0300
+++ b/src/devices/mesh/802.11s/peer-manager-plugin.cc	Sun Mar 22 21:28:44 2009 +0300
@@ -44,26 +44,25 @@
 void
 Dot11sPeerManagerMacPlugin::SetParent (Ptr<MeshWifiInterfaceMac> parent)
 {
-  NS_LOG_UNCOND("ADD PARENT");
   m_parent = parent;
 }
 
 bool
-Dot11sPeerManagerMacPlugin::Receive (Ptr<Packet> packet, const WifiMacHeader & header)
+Dot11sPeerManagerMacPlugin::Receive (Ptr<Packet> const_packet, const WifiMacHeader & header)
 {
-  NS_LOG_UNCOND("received a frame");
+  Ptr<Packet> packet = const_packet->Copy();
   if(header.IsBeacon())
   {
-    NS_LOG_UNCOND("Beacon recevied by PM from"<<header.GetAddr2 ());
     IeDot11sBeaconTiming beaconTiming;
     Ptr<Packet> myBeacon = packet->Copy();
     MgtBeaconHeader beacon_hdr;
     myBeacon->RemoveHeader(beacon_hdr);
-    if(myBeacon->GetSize () == 0)
-      NS_LOG_UNCOND("Empty");
     bool meshBeacon = false;
     if(beaconTiming.FindMyInformationElement(myBeacon))
+    {
+      NS_LOG_DEBUG("Beacon timing:"<<beaconTiming);
       meshBeacon = true;
+    }
     m_protocol->ReceiveBeacon(
         m_ifIndex,
         meshBeacon,
@@ -142,10 +141,6 @@
 void
 Dot11sPeerManagerMacPlugin::UpdateBeacon (MeshWifiBeacon & beacon) const
 {
-#if 0
-  NS_LOG_UNCOND("I am sending a beacon");
-  Ptr<IeDot11sPrep>  prep = Create<IeDot11sPrep> ();
-#endif
   Ptr<IeDot11sBeaconTiming>  beaconTiming = 
     m_protocol->SendBeacon(
         m_ifIndex,
@@ -211,4 +206,11 @@
   hdr.SetDsNotTo ();
   m_parent->SendManagementFrame(packet, hdr);
 }
+Mac48Address
+Dot11sPeerManagerMacPlugin::GetAddress () const
+{
+  if(m_parent !=  0)
+    return m_parent->GetAddress ();
+  else return Mac48Address::Mac48Address();
+}
 }//namespace ns3
--- a/src/devices/mesh/802.11s/peer-manager-plugin.h	Sun Mar 22 20:54:04 2009 +0300
+++ b/src/devices/mesh/802.11s/peer-manager-plugin.h	Sun Mar 22 21:28:44 2009 +0300
@@ -62,7 +62,11 @@
       IeDot11sPeerManagement peerElement,
       IeDot11sConfiguration meshConfig
       );
-  IeDot11sConfiguration AskPeerLinkManagementElement();
+  //IeDot11sConfiguration AskPeerLinkManagementElement();
+  /**
+   * \brief DUBUG only
+   */
+  Mac48Address GetAddress () const;
 private:
   /**
    * Information about MAC and protocol:
--- a/src/devices/mesh/802.11s/peer-manager-protocol.cc	Sun Mar 22 20:54:04 2009 +0300
+++ b/src/devices/mesh/802.11s/peer-manager-protocol.cc	Sun Mar 22 21:28:44 2009 +0300
@@ -192,7 +192,6 @@
           return;
         }
     }
-   NS_LOG_UNCOND("NOT found"<<__LINE__);
    PeerManagerPluginMap::iterator plugin = m_plugins.find (interface);
    NS_ASSERT(plugin != m_plugins.end());
    Ptr<PeerLink> new_link = InitiateLink (interface, peerAddress, receivingTime, beaconInterval);
@@ -230,7 +229,6 @@
           (*i)->OpenReject (peerManagementElement.GetLocalLinkId(), meshConfig, reasonCode);
         return;
       }
-   NS_LOG_UNCOND("NOT found"<<__LINE__);
     Ptr<PeerLink> new_link = InitiateLink (
         interface,
         peerAddress,
@@ -240,7 +238,6 @@
     if(!reject)
     {
       //Drop from INIT state:
-      NS_LOG_UNCOND("new link with "<<peerAddress<<", port = "<<interface);
       new_link->MLMEPassivePeerLinkOpen ();
       new_link->OpenAccept (peerManagementElement.GetLocalLinkId(), meshConfig);
     }
@@ -340,12 +337,12 @@
   NS_ASSERT(plugin != m_plugins.end ());
 
   new_link->SetLocalAid (beacon->second.aid);
+  new_link->SetInterface (interface);
   new_link->SetLocalLinkId (m_lastLocalLinkId++);
   new_link->SetPeerAddress (peerAddress);
   new_link->SetBeaconInformation (lastBeacon, beaconInterval);
   new_link->SetMacPlugin (plugin->second);
   new_link->MLMESetSignalStatusCallback (MakeCallback(&Dot11sPeerManagerProtocol::PeerLinkStatus, this));
-  NS_LOG_UNCOND("pushed");
   iface->second.push_back (new_link);  
   return new_link;
 }
@@ -501,8 +498,13 @@
 void
 Dot11sPeerManagerProtocol::PeerLinkStatus (uint32_t interface, Mac48Address peerAddress, bool status)
 {
-  if(status)
-    NS_LOG_UNCOND("LINK established");
-  NS_ASSERT(false);
+   PeerManagerPluginMap::iterator plugin = m_plugins.find (interface);
+   NS_LOG_UNCOND(interface);
+   NS_ASSERT(plugin != m_plugins.end());
+   NS_LOG_UNCOND("LINK between me:"<<plugin->second->GetAddress() <<" and peer:"<<peerAddress<<", at interface "<<interface);
+   if(status)
+     NS_LOG_UNCOND("Established");
+   else
+     NS_LOG_UNCOND("Closed");
 }
 } //namespace NS3
--- a/src/devices/mesh/mesh-wifi-interface-mac.cc	Sun Mar 22 20:54:04 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-interface-mac.cc	Sun Mar 22 21:28:44 2009 +0300
@@ -533,8 +533,8 @@
       
       packet->PeekHeader (beacon_hdr);
       
-      NS_LOG_UNCOND ("Beacon received from "<<hdr->GetAddr2()<<
-                   " to "<<GetAddress ()<<
+      NS_LOG_DEBUG ("Beacon received from "<<hdr->GetAddr2()<<
+                   " I am "<<GetAddress ()<<
                    " at "<<Simulator::Now ().GetMicroSeconds ()<<
                    " microseconds");