call SetAddress during construction to assign MAC-level addresses.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user