src/devices/wifi/mac-stations.cc
changeset 1893 d72388b06b22
child 1906 c0901f40bd7e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/wifi/mac-stations.cc	Wed Oct 03 13:10:44 2007 +0200
@@ -0,0 +1,54 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2005,2006 INRIA
+ * All rights reserved.
+ *
+ * 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
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+
+#include "mac-stations.h"
+#include "mac-station.h"
+
+namespace ns3 {
+
+MacStations::MacStations ()
+{}
+
+MacStations::~MacStations ()
+{
+  for (StationsI i = m_stations.begin (); i != m_stations.end (); i++) 
+    {
+      delete (*i).second;
+    }
+  m_stations.erase (m_stations.begin (), m_stations.end ());
+}
+
+MacStation *
+MacStations::Lookup (Mac48Address address)
+{
+  for (StationsI i = m_stations.begin (); i != m_stations.end (); i++) 
+    {
+      if ((*i).first == address)
+        {
+          return (*i).second;
+        }
+    }
+  MacStation *station = CreateStation ();
+  m_stations.push_back (std::make_pair (address, station));
+  return station;
+}
+
+}; // namespace ns3