View | Details | Raw Unified | Return to bug 654
Collapse All | Expand All

(-)a/src/devices/wifi/wifi-mode.cc (-11 / +15 lines)
 Lines 88-98    Link Here 
88
WifiMode::GetUniqueName (void) const
88
WifiMode::GetUniqueName (void) const
89
{
89
{
90
  // needed for ostream printing of the invalid mode
90
  // needed for ostream printing of the invalid mode
91
  if (m_uid == 0)
92
    {
93
      return "Invalid-WifiMode";
94
    }
95
96
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
91
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
97
  return item->uniqueUid;
92
  return item->uniqueUid;
98
}
93
}
 Lines 220-226    Link Here 
220
bool 
215
bool 
221
WifiModeFactory::Search (std::string name, WifiMode *mode)
216
WifiModeFactory::Search (std::string name, WifiMode *mode)
222
{
217
{
223
  uint32_t j = 1;
218
  uint32_t j = 0;
224
  for (WifiModeItemList::const_iterator i = m_itemList.begin ();
219
  for (WifiModeItemList::const_iterator i = m_itemList.begin ();
225
       i != m_itemList.end (); i++)
220
       i != m_itemList.end (); i++)
226
    {
221
    {
 Lines 238-244    Link Here 
238
uint32_t
233
uint32_t
239
WifiModeFactory::AllocateUid (std::string uniqueUid)
234
WifiModeFactory::AllocateUid (std::string uniqueUid)
240
{
235
{
241
  uint32_t j = 1;
236
  uint32_t j = 0;
242
  for (WifiModeItemList::const_iterator i = m_itemList.begin ();
237
  for (WifiModeItemList::const_iterator i = m_itemList.begin ();
243
       i != m_itemList.end (); i++)
238
       i != m_itemList.end (); i++)
244
    {
239
    {
 Lines 248-263    Link Here 
248
	}
243
	}
249
      j++;
244
      j++;
250
    }
245
    }
246
  uint32_t uid = m_itemList.size ();
251
  m_itemList.push_back (WifiModeItem ());
247
  m_itemList.push_back (WifiModeItem ());
252
  uint32_t uid = m_itemList.size ();
253
  return uid;
248
  return uid;
254
}
249
}
255
250
256
struct WifiModeFactory::WifiModeItem *
251
struct WifiModeFactory::WifiModeItem *
257
WifiModeFactory::Get (uint32_t uid)
252
WifiModeFactory::Get (uint32_t uid)
258
{
253
{
259
  NS_ASSERT (uid > 0 && uid <= m_itemList.size ());
254
  NS_ASSERT (uid < m_itemList.size ());
260
  return &m_itemList[uid - 1];
255
  return &m_itemList[uid];
261
}
256
}
262
257
263
WifiModeFactory *
258
WifiModeFactory *
 Lines 267-273    Link Here 
267
  static WifiModeFactory factory;
262
  static WifiModeFactory factory;
268
  if (isFirstTime)
263
  if (isFirstTime)
269
    {
264
    {
270
      factory.AllocateUid ("Invalid-WifiMode");
265
      uint32_t uid = factory.AllocateUid ("Invalid-WifiMode");
266
      WifiModeItem *item = factory.Get (uid);
267
      item->uniqueUid = "Invalid-WifiMode";
268
      item->bandwidth = 0;
269
      item->dataRate = 0;
270
      item->phyRate = 0;
271
      item->modulation = WifiMode::UNKNOWN;
272
      item->constellationSize = 0;
273
      item->isMandatory = false;
274
      item->standard = WIFI_PHY_UNKNOWN;
271
      isFirstTime = false;
275
      isFirstTime = false;
272
    }
276
    }
273
  return &factory;
277
  return &factory;
(-)a/src/devices/wifi/wifi-mode.h (-1 / +2 lines)
 Lines 44-50    Link Here 
44
    BPSK,
44
    BPSK,
45
    DBPSK,
45
    DBPSK,
46
    DQPSK,
46
    DQPSK,
47
    QAM
47
    QAM,
48
    UNKNOWN
48
  };
49
  };
49
  
50
  
50
  /**
51
  /**
(-)a/src/devices/wifi/wifi-phy-standard.h (-1 / +2 lines)
 Lines 27-33    Link Here 
27
  WIFI_PHY_STANDARD_80211b,
27
  WIFI_PHY_STANDARD_80211b,
28
  WIFI_PHY_STANDARD_80211_10Mhz,
28
  WIFI_PHY_STANDARD_80211_10Mhz,
29
  WIFI_PHY_STANDARD_80211_5Mhz,
29
  WIFI_PHY_STANDARD_80211_5Mhz,
30
  WIFI_PHY_STANDARD_holland
30
  WIFI_PHY_STANDARD_holland,
31
  WIFI_PHY_UNKNOWN
31
};
32
};
32
33
33
} // namespace ns3
34
} // namespace ns3

Return to bug 654