call SetAddress during construction to assign MAC-level addresses.

This commit is contained in:
Mathieu Lacage
2008-03-19 11:19:29 -07:00
parent 10bbdc4176
commit a3ed490b7f
3 changed files with 4 additions and 0 deletions

View File

@@ -55,6 +55,7 @@ CsmaHelper::Build (const NodeContainer &c, Ptr<CsmaChannel> channel)
{
Ptr<Node> node = *i;
Ptr<CsmaNetDevice> device = m_deviceFactory.Create<CsmaNetDevice> ();
device->SetAddress (Mac48Address::Allocate ());
node->AddDevice (device);
Ptr<Queue> queue = m_queueFactory.Create<Queue> ();
device->AddQueue (queue);

View File

@@ -48,10 +48,12 @@ PointToPointHelper::Build (Ptr<Node> a, Ptr<Node> b)
NetDeviceContainer container;
Ptr<PointToPointNetDevice> devA = CreateObject<PointToPointNetDevice> ();
devA->SetAddress (Mac48Address::Allocate ());
a->AddDevice (devA);
Ptr<Queue> queueA = m_queueFactory.Create<Queue> ();
devA->AddQueue (queueA);
Ptr<PointToPointNetDevice> devB = CreateObject<PointToPointNetDevice> ();
devB->SetAddress (Mac48Address::Allocate ());
b->AddDevice (devB);
Ptr<Queue> queueB = m_queueFactory.Create<Queue> ();
devB->AddQueue (queueB);

View File

@@ -110,6 +110,7 @@ WifiHelper::Build (NodeContainer c, Ptr<WifiChannel> channel) const
Ptr<WifiRemoteStationManager> manager = m_stationManager.Create<WifiRemoteStationManager> ();
Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
Ptr<WifiPhy> phy = m_phy.Create<WifiPhy> ();
mac->SetAddress (Mac48Address::Allocate ());
device->SetMac (mac);
device->SetPhy (phy);
device->SetRemoteStationManager (manager);