diff --git a/src/devices/wifi/wifi-net-device.cc b/src/devices/wifi/wifi-net-device.cc index e403288e1..63e03080e 100644 --- a/src/devices/wifi/wifi-net-device.cc +++ b/src/devices/wifi/wifi-net-device.cc @@ -159,8 +159,12 @@ private: WifiNetDevice::WifiNetDevice (Ptr node) : NetDevice (node, Mac48Address::Allocate ()) { - SetMtu (2300); - EnableBroadcast (Mac48Address ("ff:ff:ff:ff:ff:ff")); + Construct (); +} + +WifiNetDevice::WifiNetDevice (Ptr node, Mac48Address self) + : NetDevice (node, self) +{ Construct (); } @@ -170,6 +174,9 @@ WifiNetDevice::~WifiNetDevice () void WifiNetDevice::Construct (void) { + SetMtu (2300); + EnableBroadcast (Mac48Address ("ff:ff:ff:ff:ff:ff")); + // the physical layer. m_phy = Create (this); @@ -364,6 +371,16 @@ WifiNetDevice::DoDispose (void) AdhocWifiNetDevice::AdhocWifiNetDevice (Ptr node) : WifiNetDevice (node) +{ + DoConstruct (); +} +AdhocWifiNetDevice::AdhocWifiNetDevice (Ptr node, Mac48Address self) + : WifiNetDevice (node, self) +{ + DoConstruct (); +} +void +AdhocWifiNetDevice::DoConstruct (void) { m_ssid = WifiDefaultParameters::GetSsid (); m_dca = CreateDca (15, 1023, 2); @@ -378,6 +395,7 @@ AdhocWifiNetDevice::AdhocWifiNetDevice (Ptr node) m_rxMiddle->SetForwardCallback (MakeCallback (&MacHighAdhoc::Receive, high)); m_high = high; } + AdhocWifiNetDevice::~AdhocWifiNetDevice () {} Mac48Address @@ -426,6 +444,16 @@ AdhocWifiNetDevice::DoDispose (void) NqstaWifiNetDevice::NqstaWifiNetDevice (Ptr node) : WifiNetDevice (node) +{ + DoConstruct (); +} +NqstaWifiNetDevice::NqstaWifiNetDevice (Ptr node, Mac48Address self) + : WifiNetDevice (node, self) +{ + DoConstruct (); +} +void +NqstaWifiNetDevice::DoConstruct (void) { m_ssid = WifiDefaultParameters::GetSsid (); m_dca = CreateDca (15, 1023, 2); @@ -444,6 +472,7 @@ NqstaWifiNetDevice::NqstaWifiNetDevice (Ptr node) m_rxMiddle->SetForwardCallback (MakeCallback (&MacHighNqsta::Receive, high)); m_high = high; } + NqstaWifiNetDevice::~NqstaWifiNetDevice () {} Mac48Address @@ -505,6 +534,17 @@ NqstaWifiNetDevice::DoDispose (void) NqapWifiNetDevice::NqapWifiNetDevice (Ptr node) : WifiNetDevice (node) +{ + DoConstruct (); +} +NqapWifiNetDevice::NqapWifiNetDevice (Ptr node, Mac48Address self) + : WifiNetDevice (node, self) +{ + DoConstruct (); + +} +void +NqapWifiNetDevice::DoConstruct (void) { m_ssid = WifiDefaultParameters::GetSsid (); diff --git a/src/devices/wifi/wifi-net-device.h b/src/devices/wifi/wifi-net-device.h index 727b72167..78fa93332 100644 --- a/src/devices/wifi/wifi-net-device.h +++ b/src/devices/wifi/wifi-net-device.h @@ -118,6 +118,7 @@ private: CallbackTraceSource m_txLogger; protected: WifiNetDevice (Ptr node); + WifiNetDevice (Ptr node, Mac48Address self); void DoForwardUp (Packet packet, const Mac48Address &from); virtual void DoDispose (void); DcaTxop *CreateDca (uint32_t minCw, uint32_t maxCw, uint32_t aifsn) const; @@ -143,6 +144,7 @@ protected: class AdhocWifiNetDevice : public WifiNetDevice { public: AdhocWifiNetDevice (Ptr node); + AdhocWifiNetDevice (Ptr node, Mac48Address self); virtual ~AdhocWifiNetDevice (); virtual Mac48Address GetBssid (void) const; @@ -152,6 +154,7 @@ public: protected: virtual void DoDispose (void); private: + void DoConstruct (void); void ForwardUp (void); virtual bool DoSendTo (const Packet &packet, Mac48Address const & to); virtual void NotifyConnected (void); @@ -178,6 +181,7 @@ public: * The ssid is initialized from \valueref{WifiSsid}. */ NqstaWifiNetDevice (Ptr node); + NqstaWifiNetDevice (Ptr node, Mac48Address self); virtual ~NqstaWifiNetDevice (); virtual Mac48Address GetBssid (void) const; @@ -193,6 +197,7 @@ public: protected: virtual void DoDispose (void); private: + void DoConstruct (void); void Associated (void); void DisAssociated (void); virtual bool DoSendTo (const Packet &packet, Mac48Address const & to); @@ -218,6 +223,7 @@ public: * The ssid is initialized from \valueref{WifiSsid}. */ NqapWifiNetDevice (Ptr node); + NqapWifiNetDevice (Ptr node, Mac48Address self); virtual ~NqapWifiNetDevice (); virtual Mac48Address GetBssid (void) const; @@ -227,6 +233,7 @@ public: protected: virtual void DoDispose (void); private: + void DoConstruct (void); virtual bool DoSendTo (const Packet &packet, Mac48Address const & to); virtual void NotifyConnected (void); friend class WifiNetDeviceFactory;