--- a/src/devices/wifi/wifi-mode.cc Thu Aug 13 09:47:53 2009 +0200
+++ b/src/devices/wifi/wifi-mode.cc Thu Aug 13 13:12:16 2009 +0200
@@ -88,11 +88,6 @@
WifiMode::GetUniqueName (void) const
{
// needed for ostream printing of the invalid mode
- if (m_uid == 0)
- {
- return "Invalid-WifiMode";
- }
-
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->uniqueUid;
}
@@ -220,7 +215,7 @@
bool
WifiModeFactory::Search (std::string name, WifiMode *mode)
{
- uint32_t j = 1;
+ uint32_t j = 0;
for (WifiModeItemList::const_iterator i = m_itemList.begin ();
i != m_itemList.end (); i++)
{
@@ -238,7 +233,7 @@
uint32_t
WifiModeFactory::AllocateUid (std::string uniqueUid)
{
- uint32_t j = 1;
+ uint32_t j = 0;
for (WifiModeItemList::const_iterator i = m_itemList.begin ();
i != m_itemList.end (); i++)
{
@@ -248,16 +243,16 @@
}
j++;
}
+ uint32_t uid = m_itemList.size ();
m_itemList.push_back (WifiModeItem ());
- uint32_t uid = m_itemList.size ();
return uid;
}
struct WifiModeFactory::WifiModeItem *
WifiModeFactory::Get (uint32_t uid)
{
- NS_ASSERT (uid > 0 && uid <= m_itemList.size ());
- return &m_itemList[uid - 1];
+ NS_ASSERT (uid < m_itemList.size ());
+ return &m_itemList[uid];
}
WifiModeFactory *
@@ -267,7 +262,16 @@
static WifiModeFactory factory;
if (isFirstTime)
{
- factory.AllocateUid ("Invalid-WifiMode");
+ uint32_t uid = factory.AllocateUid ("Invalid-WifiMode");
+ WifiModeItem *item = factory.Get (uid);
+ item->uniqueUid = "Invalid-WifiMode";
+ item->bandwidth = 0;
+ item->dataRate = 0;
+ item->phyRate = 0;
+ item->modulation = WifiMode::UNKNOWN;
+ item->constellationSize = 0;
+ item->isMandatory = false;
+ item->standard = WIFI_PHY_UNKNOWN;
isFirstTime = false;
}
return &factory;
--- a/src/devices/wifi/wifi-mode.h Thu Aug 13 09:47:53 2009 +0200
+++ b/src/devices/wifi/wifi-mode.h Thu Aug 13 13:12:16 2009 +0200
@@ -44,7 +44,8 @@
BPSK,
DBPSK,
DQPSK,
- QAM
+ QAM,
+ UNKNOWN
};
/**
--- a/src/devices/wifi/wifi-phy-standard.h Thu Aug 13 09:47:53 2009 +0200
+++ b/src/devices/wifi/wifi-phy-standard.h Thu Aug 13 13:12:16 2009 +0200
@@ -27,7 +27,8 @@
WIFI_PHY_STANDARD_80211b,
WIFI_PHY_STANDARD_80211_10Mhz,
WIFI_PHY_STANDARD_80211_5Mhz,
- WIFI_PHY_STANDARD_holland
+ WIFI_PHY_STANDARD_holland,
+ WIFI_PHY_UNKNOWN
};
} // namespace ns3