--- a/src/devices/mesh/dot11s-parameters.cc Thu Mar 26 20:25:40 2009 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2008,2009 IITP RAS
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Authors: Aleksey Kovalenko <kovalenko@iitp.ru>
- * Kirill Andreev <andreev@iitp.ru>
- */
-
-
-#include "ns3/dot11s-parameters.h"
-
-namespace ns3 {
-
-uint8_t dot11sParameters::dot11MeshMaxRetries = 4;
-Time dot11sParameters::dot11MeshRetryTimeout = TU_TO_TIME (40);
-Time dot11sParameters::dot11MeshHoldingTimeout = TU_TO_TIME (40);
-Time dot11sParameters::dot11MeshConfirmTimeout = TU_TO_TIME (40);
-
-
-uint8_t dot11sParameters::dot11MeshHWMPmaxPREQretries = 3;
-Time dot11sParameters::dot11MeshHWMPnetDiameterTraversalTime = TU_TO_TIME (10);
-Time dot11sParameters::dot11MeshHWMPpreqMinInterval = TU_TO_TIME (100);
-Time dot11sParameters::dot11MeshHWMPperrMinInterval = TU_TO_TIME (100);
-Time dot11sParameters::dot11MeshHWMPactiveRootTimeout = TU_TO_TIME (5000);
-Time dot11sParameters::dot11MeshHWMPactivePathTimeout = TU_TO_TIME (5000);
-Time dot11sParameters::dot11MeshHWMPpathToRootInterval = TU_TO_TIME (5000);
-Time dot11sParameters::dot11MeshHWMPrannInterval = TU_TO_TIME (1000);
-
-}
--- a/src/devices/mesh/dot11s-parameters.h Thu Mar 26 20:25:40 2009 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2008,2009 IITP RAS
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Authors: Aleksey Kovalenko <kovalenko@iitp.ru>
- * Kirill Andreev <andreev@iitp.ru>
- */
-
-
-#ifndef DOT11S_PARAMETERS_H
-#define DOT11S_PARAMETERS_H
-#include "ns3/uinteger.h"
-#include "ns3/nstime.h"
-
-namespace ns3 {
-
-#define TU_TO_TIME(x) (MicroSeconds((x)*1024))
-#define TIME_TO_TU(x) ((x).GetMicroSeconds()/1024)
-
-/**
- * \ingroup mesh
-*/
-struct dot11sParameters
-{
- /** Peer Link */
- static uint8_t dot11MeshMaxRetries;
- static Time dot11MeshRetryTimeout;
- static Time dot11MeshHoldingTimeout;
- static Time dot11MeshConfirmTimeout;
- /** HWMP */
- static uint8_t dot11MeshHWMPmaxPREQretries;
- static Time dot11MeshHWMPnetDiameterTraversalTime;
- static Time dot11MeshHWMPpreqMinInterval;
- static Time dot11MeshHWMPperrMinInterval;
- static Time dot11MeshHWMPactiveRootTimeout;
- static Time dot11MeshHWMPactivePathTimeout;
- static Time dot11MeshHWMPpathToRootInterval;
- static Time dot11MeshHWMPrannInterval;
-};
-
-};
-#endif
--- a/src/devices/mesh/dot11s/hwmp-mac-plugin.h Thu Mar 26 20:25:40 2009 +0300
+++ b/src/devices/mesh/dot11s/hwmp-mac-plugin.h Thu Mar 26 21:11:29 2009 +0300
@@ -51,9 +51,9 @@
private:
friend class HwmpProtocol;
///\brief Interaction with protocol:
- void SendPreq(Ptr<IePreq> preq);
- void SendPrep(Ptr<IePreq> prep);
- void SendPerr(Ptr<IePreq> perr);
+ void SendPreq(Ptr<IePreq> preq, std::vector<Mac48Address> receivers);
+ void SendPrep(Ptr<IePreq> prep, std::vector<Mac48Address> receivers);
+ void SendPerr(Ptr<IePreq> perr, std::vector<Mac48Address> receivers);
private:
Ptr<MeshWifiInterfaceMac> m_parent;
uint32_t m_ifIndex;
--- a/src/devices/mesh/dot11s/hwmp-protocol.cc Thu Mar 26 20:25:40 2009 +0300
+++ b/src/devices/mesh/dot11s/hwmp-protocol.cc Thu Mar 26 21:11:29 2009 +0300
@@ -41,8 +41,62 @@
HwmpProtocol::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::HwmpProtocol")
- .SetParent<MeshL2RoutingProtocol> ()
- .AddConstructor<HwmpProtocol> ();
+ .SetParent<MeshL2RoutingProtocol> ()
+ .AddConstructor<HwmpProtocol> ()
+ .AddAttribute ("dot11MeshHWMPmaxPREQretries",
+ "Maximum number of retries before we suppose the destination to be unreachable",
+ UintegerValue (3),
+ MakeUintegerAccessor (&HwmpProtocol::m_dot11MeshHWMPmaxPREQretries),
+ MakeUintegerChecker<uint8_t> (1)
+ )
+ .AddAttribute ("dot11MeshHWMPnetDiameterTraversalTime",
+ "Time we suppose the packet to go from one edge of the network to another",
+ TimeValue (MicroSeconds (1024*10)),
+ MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPnetDiameterTraversalTime),
+ MakeTimeChecker ()
+ )
+ .AddAttribute ("dot11MeshHWMPpreqMinInterva",
+ "Minimal interval between to successive PREQs",
+ TimeValue (MicroSeconds (1024*100)),
+ MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPpreqMinInterval),
+ MakeTimeChecker ()
+ )
+ .AddAttribute ("dot11MeshHWMPperrMinInterval",
+ "Minimal interval between to successive PREQs",
+ TimeValue (MicroSeconds (1024*100)),
+ MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPperrMinInterval),
+ MakeTimeChecker ()
+ )
+ .AddAttribute ("dot11MeshHWMPactiveRootTimeout",
+ "Lifetime of poractive routing information",
+ TimeValue (MicroSeconds (1024*5000)),
+ MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPactiveRootTimeout),
+ MakeTimeChecker ()
+ )
+ .AddAttribute ("dot11MeshHWMPactiveRootTimeout",
+ "Lifetime of poractive routing information",
+ TimeValue (MicroSeconds (1024*5000)),
+ MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPactiveRootTimeout),
+ MakeTimeChecker ()
+ )
+ .AddAttribute ("dot11MeshHWMPactivePathTimeout",
+ "Lifetime of reactive routing information",
+ TimeValue (MicroSeconds (1024*5000)),
+ MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPactivePathTimeout),
+ MakeTimeChecker ()
+ )
+ .AddAttribute ("dot11MeshHWMPpathToRootInterval",
+ "Interval between two successive proactive PREQs",
+ TimeValue (MicroSeconds (1024*5000)),
+ MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPpathToRootInterval),
+ MakeTimeChecker ()
+ )
+ .AddAttribute ("dot11MeshHWMPrannInterval",
+ "Lifetime of poractive routing information",
+ TimeValue (MicroSeconds (1024*5000)),
+ MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPrannInterval),
+ MakeTimeChecker ()
+ );
return tid;
}
HwmpProtocol::HwmpProtocol ():
@@ -61,9 +115,9 @@
HwmpProtocol::DoDispose ()
{
#if 0
- for (std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.begin (); i != m_timeoutDatabase.end(); i ++)
+ for (std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.begin (); i != m_preqTimeouts.end(); i ++)
i->second.Cancel ();
- m_timeoutDatabase.clear ();
+ m_preqTimeouts.clear ();
m_seqnoDatabase.clear ();
m_rtable = 0;
@@ -531,16 +585,15 @@
}
#endif
}
-#if 0
bool
HwmpProtocol::ShouldSendPreq (Mac48Address dst)
{
- std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find (dst);
- if (i == m_timeoutDatabase.end ())
+ std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.find (dst);
+ if (i == m_preqTimeouts.end ())
{
- m_timeoutDatabase[dst] = Simulator::Schedule (
- MilliSeconds (2*(dot11sParameters::dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())),
- &HwmpProtocol::RetryPathDiscovery, this, dst, 0);
+ m_preqTimeouts[dst] = Simulator::Schedule (
+ MilliSeconds (2*(m_dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())),
+ &HwmpProtocol::RetryPathDiscovery, this, dst, 0);
return true;
}
return false;
@@ -548,12 +601,13 @@
void
HwmpProtocol::RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry)
{
+#if 0
HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst);
if (result.retransmitter != Mac48Address::GetBroadcast ())
{
- std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find (dst);
- NS_ASSERT (i != m_timeoutDatabase.end());
- m_timeoutDatabase.erase (i);
+ std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.find (dst);
+ NS_ASSERT (i != m_preqTimeouts.end());
+ m_preqTimeouts.erase (i);
return;
}
numOfRetry++;
@@ -568,18 +622,20 @@
break;
packet.reply (false, packet.pkt, packet.src, packet.dst, packet.protocol, HwmpRtable::MAX_METRIC);
}
- std::map<Mac48Address, EventId>::iterator i = m_timeoutDatabase.find (dst);
- NS_ASSERT (i != m_timeoutDatabase.end());
- m_timeoutDatabase.erase (i);
+ std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.find (dst);
+ NS_ASSERT (i != m_preqTimeouts.end());
+ m_preqTimeouts.erase (i);
return;
}
+#if 0
for (unsigned int i = 0; i < m_requestCallback.size (); i++)
if ((m_modes[i] == REACTIVE) || (m_modes[i] == ROOT))
m_requestCallback[i] (dst);
- m_timeoutDatabase[dst] = Simulator::Schedule (
+#endif
+ m_preqTimeouts[dst] = Simulator::Schedule (
MilliSeconds (2*(dot11sParameters::dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())),
&HwmpProtocol::RetryPathDiscovery, this, dst, numOfRetry);
+#endif
}
-#endif
} //namespace dot11s
} //namespace ns3
--- a/src/devices/mesh/dot11s/hwmp-protocol.h Thu Mar 26 20:25:40 2009 +0300
+++ b/src/devices/mesh/dot11s/hwmp-protocol.h Thu Mar 26 21:11:29 2009 +0300
@@ -23,12 +23,14 @@
#define HWMP_PROTOCOL_H
#include "ns3/mesh-l2-routing-protocol.h"
+#include "ns3/nstime.h"
#include <map>
namespace ns3 {
class MeshPointDevice;
class Packet;
class Mac48Address;
+class EventId;
namespace dot11s {
class HwmpMacPlugin;
class HwmpRtable;
@@ -112,9 +114,9 @@
private:
friend class HwmpMacPlugin;
///\brief interaction with HWMP MAC plugin
- void ReceivePreq(Ptr<IePreq> preq);
- void ReceivePrep(Ptr<IePreq> prep);
- void ReceivePerr(Ptr<IePreq> perr);
+ void ReceivePreq(Ptr<IePreq> preq, Mac48Address from);
+ void ReceivePrep(Ptr<IePreq> prep, Mac48Address from);
+ void ReceivePerr(Ptr<IePreq> perr, Mac48Address from);
///\brief MAC-plugin asks wether the frame can be dropeed. Protocol
//automatically updates seqno.
//\returns true if frame can be dropped
@@ -127,6 +129,17 @@
bool QueuePacket (MeshL2RoutingProtocol::QueuedPacket packet);
MeshL2RoutingProtocol::QueuedPacket DequeuePacket (Mac48Address dst);
void SendAllPossiblePackets (Mac48Address dst);
+ ///\name Methods responsible for Path discovery retry procedure:
+ //\{
+ //\brief checks when the last path discovery procedure was started
+ //for a given destination. If the retry counter has not achieved the
+ //maximum level - preq should not be sent
+ bool ShouldSendPreq (Mac48Address dst);
+ //\brief Generates PREQ retry when retry timeout has expired and
+ //route is still unresolved. When PREQ retry has achieved the
+ //maximum level - retry mechanish should be cancelled
+ void RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry);
+ ///\}
private:
//fields:
std::map<uint32_t, Ptr<HwmpMacPlugin> > m_interfaces;
@@ -138,24 +151,31 @@
std::map<Mac48Address, uint32_t,std::less<Mac48Address> > m_lastHwmpSeqno;
///\brief Routing table
Ptr<HwmpRtable> m_rtable;
-
+ ///\name Timers:
+ //\{
+ std::map<Mac48Address, EventId> m_preqTimeouts;
+ //\}
+private:
+ ///\name HWMP-protocol parameters
+ ///\{
+ uint8_t m_dot11MeshHWMPmaxPREQretries;
+ Time m_dot11MeshHWMPnetDiameterTraversalTime;
+ Time m_dot11MeshHWMPpreqMinInterval;
+ Time m_dot11MeshHWMPperrMinInterval;
+ Time m_dot11MeshHWMPactiveRootTimeout;
+ Time m_dot11MeshHWMPactivePathTimeout;
+ Time m_dot11MeshHWMPpathToRootInterval;
+ Time m_dot11MeshHWMPrannInterval;
+ ///\}
#if 0
std::map<Mac48Address, std::queue<QueuedPacket> > m_rqueue;
//devices and HWMP states:
- enum DeviceState {
- ENABLED,
- DISABLED
- };
enum DeviceMode {
REACTIVE,
PROACTIVE,
ROOT
};
- std::vector<enum DeviceState> m_states;
std::vector<enum DeviceMode> m_modes;
- std::vector<Ptr<HwmpProtocolState> > m_hwmpStates;
- //Routing table:
- Ptr<HwmpRtable> m_rtable;
//Proactive routines:
/**
* \brief Set port state as proactive.
@@ -170,27 +190,7 @@
* port
*/
bool IsRoot (uint32_t port);
- /**
- * \brief Interaction with HwmpProtocolState class -
- * request for starting routing discover
- * procedure (reactive route discovery!)
- * \param Mac48Address is destination to be
- * resolved
- */
- std::vector< Callback<void, Mac48Address> > m_requestCallback;
- /**
- * \brief Callback that shall be executed when
- * need to send Path error
- * \param std::vector<Mac48Address> is the
- * list of unreachable destinations
- * \param std::vector<Mac48Address> is
- * receivers of PERR
- */
- std::vector<Callback<void,std::vector<HwmpRtable::FailedDestination> > > m_pathErrorCallback;
- void StartPathErrorProcedure (
- std::vector<HwmpRtable::FailedDestination> destinations,
- uint32_t port);
- /**
+ /**
* \brief HwmpProtocolState need to know where to
* retransmit PERR, only HWMP knows how to
* retransmit it (broadcast/unicast) and only
@@ -231,11 +231,10 @@
* Keeps PREQ retry timers for every
* destination
*/
- std::map<Mac48Address, EventId> m_timeoutDatabase;
+ std::map<Mac48Address, EventId> m_preqTimeouts;
/**
* Configurable parameters:
*/
- uint8_t m_maxTtl;
bool m_broadcastPerr;
#endif
};
--- a/src/devices/mesh/dot11s/peer-link.cc Thu Mar 26 20:25:40 2009 +0300
+++ b/src/devices/mesh/dot11s/peer-link.cc Thu Mar 26 21:11:29 2009 +0300
@@ -40,22 +40,22 @@
.AddConstructor<PeerLink> ()
.AddAttribute ("RetryTimeout", "Retry timeout",
TimeValue (TimeValue (MicroSeconds (40 * 1024))),
- MakeTimeAccessor (&PeerLink::m_retryTimeout),
+ MakeTimeAccessor (&PeerLink::m_dot11MeshRetryTimeout),
MakeTimeChecker ()
)
.AddAttribute ("HoldingTimeout", "Holding timeout",
TimeValue (TimeValue (MicroSeconds (40 * 1024))),
- MakeTimeAccessor (&PeerLink::m_holdingTimeout),
+ MakeTimeAccessor (&PeerLink::m_dot11MeshHoldingTimeout),
MakeTimeChecker ()
)
.AddAttribute ("ConfirmTimeout", "Confirm timeout",
TimeValue (TimeValue (MicroSeconds (40 * 1024))),
- MakeTimeAccessor (&PeerLink::m_confirmTimeout),
+ MakeTimeAccessor (&PeerLink::m_dot11MeshConfirmTimeout),
MakeTimeChecker ()
)
.AddAttribute ("MaxRetries", "Maximum number of retries",
UintegerValue (4),
- MakeUintegerAccessor (&PeerLink::m_maxRetries),
+ MakeUintegerAccessor (&PeerLink::m_dot11MeshMaxRetries),
MakeUintegerChecker<uint16_t> ()
)
.AddAttribute ("MaxBeaconLoss", "Maximum number of lost beacons before link will be closed",
@@ -530,8 +530,8 @@
void PeerLink::SetHoldingTimer ()
{
- NS_ASSERT(m_holdingTimeout.GetMicroSeconds() !=0);
- m_holdingTimer = Simulator::Schedule (m_holdingTimeout, &PeerLink::HoldingTimeout, this);
+ NS_ASSERT(m_dot11MeshHoldingTimeout.GetMicroSeconds() !=0);
+ m_holdingTimer = Simulator::Schedule (m_dot11MeshHoldingTimeout, &PeerLink::HoldingTimeout, this);
}
void PeerLink::HoldingTimeout ()
@@ -541,13 +541,13 @@
void PeerLink::SetRetryTimer ()
{
- NS_ASSERT(m_retryTimeout.GetMicroSeconds() !=0);
- m_retryTimer = Simulator::Schedule (m_retryTimeout, &PeerLink::RetryTimeout, this);
+ NS_ASSERT(m_dot11MeshRetryTimeout.GetMicroSeconds() !=0);
+ m_retryTimer = Simulator::Schedule (m_dot11MeshRetryTimeout, &PeerLink::RetryTimeout, this);
}
void PeerLink::RetryTimeout ()
{
- if ( m_retryCounter < m_maxRetries)
+ if ( m_retryCounter < m_dot11MeshMaxRetries)
StateMachine (TOR1);
else
StateMachine (TOR2);
@@ -555,8 +555,8 @@
void PeerLink::SetConfirmTimer ()
{
- NS_ASSERT(m_confirmTimeout.GetMicroSeconds() !=0);
- m_confirmTimer = Simulator::Schedule (m_confirmTimeout, &PeerLink::ConfirmTimeout, this);
+ NS_ASSERT(m_dot11MeshConfirmTimeout.GetMicroSeconds() !=0);
+ m_confirmTimer = Simulator::Schedule (m_dot11MeshConfirmTimeout, &PeerLink::ConfirmTimeout, this);
}
void PeerLink::ConfirmTimeout ()
--- a/src/devices/mesh/dot11s/peer-link.h Thu Mar 26 20:25:40 2009 +0300
+++ b/src/devices/mesh/dot11s/peer-link.h Thu Mar 26 21:11:29 2009 +0300
@@ -231,13 +231,14 @@
* \name Timers & counters used for internal state transitions
* \{
*/
- Time m_retryTimeout;
+ uint16_t m_dot11MeshMaxRetries;
+ Time m_dot11MeshRetryTimeout;
+ Time m_dot11MeshHoldingTimeout;
+ Time m_dot11MeshConfirmTimeout;
+
EventId m_retryTimer;
- Time m_holdingTimeout;
EventId m_holdingTimer;
- Time m_confirmTimeout;
EventId m_confirmTimer;
- uint16_t m_maxRetries;
uint16_t m_retryCounter;
EventId m_beaconLossTimer;
uint16_t m_maxBeaconLoss;
--- a/src/devices/mesh/dot11s/peer-management-plugin.cc Thu Mar 26 20:25:40 2009 +0300
+++ b/src/devices/mesh/dot11s/peer-management-plugin.cc Thu Mar 26 21:11:29 2009 +0300
@@ -87,7 +87,6 @@
if(multihopHdr.GetCategory () != WifiMeshMultihopActionHeader::MESH_PEER_LINK_MGT)
return true;
NS_ASSERT(meshHdr.GetMeshTtl () == 1);
- NS_LOG_UNCOND("ext = "<<(uint32_t)meshHdr.GetAddressExt());
NS_ASSERT(meshHdr.GetAddressExt () == 1);
NS_ASSERT(meshHdr.GetAddr4 () == header.GetAddr2 ());
@@ -210,7 +209,6 @@
meshHdr.SetMeshTtl (1);
meshHdr.SetMeshSeqno (0);
meshHdr.SetAddressExt(1);
- NS_LOG_UNCOND("Address ext = "<<(uint32_t)meshHdr.GetAddressExt ());
meshHdr.SetAddr4(m_parent->GetAddress ());
packet->AddHeader (meshHdr);
//Wifi Mac header:
--- a/src/devices/mesh/wscript Thu Mar 26 20:25:40 2009 +0300
+++ b/src/devices/mesh/wscript Thu Mar 26 21:11:29 2009 +0300
@@ -13,7 +13,7 @@
'mesh-wifi-mac-header.cc',
'tx-statistics.cc',
#'hwmp-rtable.cc',
- 'dot11s-parameters.cc',
+ #'dot11s-parameters.cc',
#'hwmp.cc',
#'mesh-wifi-mac.cc',
#'hwmp-state.cc',
@@ -33,7 +33,7 @@
# Dirty
'dot11s-codes.h',
#'hwmp-state.h',
- 'dot11s-parameters.h',
+ #'dot11s-parameters.h',
#'mesh-mgt-headers.h',
#'hwmp.h',
'tx-statistics.h',