A Discrete-Event Network Simulator
API
wifi-net-device.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #ifndef WIFI_NET_DEVICE_H
22 #define WIFI_NET_DEVICE_H
23 
24 #include "ns3/net-device.h"
25 #include "ns3/traced-callback.h"
26 
27 namespace ns3 {
28 
29 class WifiRemoteStationManager;
30 class WifiPhy;
31 class WifiMac;
32 class HtConfiguration;
33 class VhtConfiguration;
34 class HeConfiguration;
35 
37 static const uint16_t MAX_MSDU_SIZE = 2304;
38 
53 class WifiNetDevice : public NetDevice
54 {
55 public:
60  static TypeId GetTypeId (void);
61 
62  WifiNetDevice ();
63  virtual ~WifiNetDevice ();
64 
68  void SetMac (const Ptr<WifiMac> mac);
72  void SetPhy (const Ptr<WifiPhy> phy);
80  Ptr<WifiMac> GetMac (void) const;
84  Ptr<WifiPhy> GetPhy (void) const;
89 
93  void SetHtConfiguration (Ptr<HtConfiguration> htConfiguration);
101  void SetVhtConfiguration (Ptr<VhtConfiguration> vhtConfiguration);
109  void SetHeConfiguration (Ptr<HeConfiguration> heConfiguration);
114 
115  void SetIfIndex (const uint32_t index) override;
116  uint32_t GetIfIndex (void) const override;
117  Ptr<Channel> GetChannel (void) const override;
118  void SetAddress (Address address) override;
119  Address GetAddress (void) const override;
120  bool SetMtu (const uint16_t mtu) override;
121  uint16_t GetMtu (void) const override;
122  bool IsLinkUp (void) const override;
123  void AddLinkChangeCallback (Callback<void> callback) override;
124  bool IsBroadcast (void) const override;
125  Address GetBroadcast (void) const override;
126  bool IsMulticast (void) const override;
127  Address GetMulticast (Ipv4Address multicastGroup) const override;
128  bool IsPointToPoint (void) const override;
129  bool IsBridge (void) const override;
130  bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) override;
131  Ptr<Node> GetNode (void) const override;
132  void SetNode (const Ptr<Node> node) override;
133  bool NeedsArp (void) const override;
135  Address GetMulticast (Ipv6Address addr) const override;
136  bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber) override;
138  bool SupportsSendFrom (void) const override;
139 
140 
141 protected:
142  void DoDispose (void) override;
143  void DoInitialize (void) override;
152  void ForwardUp (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
153 
154 
155 private:
163 
172 
177  void LinkUp (void);
181  void LinkDown (void);
186  void CompleteConfig (void);
187 
197 
200 
201  uint32_t m_ifIndex;
202  bool m_linkUp;
204  mutable uint16_t m_mtu;
206 };
207 
208 } //namespace ns3
209 
210 #endif /* WIFI_NET_DEVICE_H */
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::WifiNetDevice::DoInitialize
void DoInitialize(void) override
Initialize() implementation.
Definition: wifi-net-device.cc:140
ns3::WifiNetDevice::SupportsSendFrom
bool SupportsSendFrom(void) const override
Definition: wifi-net-device.cc:444
ns3::WifiNetDevice::m_ifIndex
uint32_t m_ifIndex
IF index.
Definition: wifi-net-device.h:201
ns3::WifiNetDevice::GetHtConfiguration
Ptr< HtConfiguration > GetHtConfiguration(void) const
Definition: wifi-net-device.cc:456
ns3::WifiNetDevice::CompleteConfig
void CompleteConfig(void)
Complete the configuration of this Wi-Fi device by connecting all lower components (e....
Definition: wifi-net-device.cc:159
ns3::WifiNetDevice::AddLinkChangeCallback
void AddLinkChangeCallback(Callback< void > callback) override
Definition: wifi-net-device.cc:272
ns3::Callback< void >
ns3::WifiNetDevice::m_configComplete
bool m_configComplete
configuration complete
Definition: wifi-net-device.h:205
ns3::WifiNetDevice::GetPhy
Ptr< WifiPhy > GetPhy(void) const
Definition: wifi-net-device.cc:207
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiNetDevice::SetMac
void SetMac(const Ptr< WifiMac > mac)
Definition: wifi-net-device.cc:180
ns3::WifiNetDevice::LinkDown
void LinkDown(void)
Set that the link is down (i.e.
Definition: wifi-net-device.cc:410
ns3::WifiNetDevice::m_node
Ptr< Node > m_node
the node
Definition: wifi-net-device.h:188
ns3::WifiNetDevice::NeedsArp
bool NeedsArp(void) const override
Definition: wifi-net-device.cc:349
ns3::WifiNetDevice::SetHeConfiguration
void SetHeConfiguration(Ptr< HeConfiguration > heConfiguration)
Definition: wifi-net-device.cc:474
ns3::WifiNetDevice::WifiNetDevice
WifiNetDevice()
Definition: wifi-net-device.cc:90
ns3::WifiNetDevice::SetVhtConfiguration
void SetVhtConfiguration(Ptr< VhtConfiguration > vhtConfiguration)
Definition: wifi-net-device.cc:462
ns3::WifiNetDevice::m_phy
Ptr< WifiPhy > m_phy
the phy
Definition: wifi-net-device.h:189
ns3::WifiNetDevice::SetNode
void SetNode(const Ptr< Node > node) override
Definition: wifi-net-device.cc:342
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
ns3::Ipv6Address
Describes an IPv6 address.
Definition: ipv6-address.h:50
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::WifiNetDevice::IsPointToPoint
bool IsPointToPoint(void) const override
Return true if the net device is on a point-to-point link.
Definition: wifi-net-device.cc:307
ns3::WifiNetDevice::GetAddress
Address GetAddress(void) const override
Definition: wifi-net-device.cc:243
third.mac
mac
Definition: third.py:99
ns3::MAX_MSDU_SIZE
static const uint16_t MAX_MSDU_SIZE
This value conforms to the 802.11 specification.
Definition: wifi-net-device.h:37
ns3::WifiNetDevice::m_forwardUp
NetDevice::ReceiveCallback m_forwardUp
forward up callback
Definition: wifi-net-device.h:195
ns3::WifiNetDevice::m_txLogger
TracedCallback< Ptr< const Packet >, Mac48Address > m_txLogger
transmit trace callback
Definition: wifi-net-device.h:199
ns3::WifiNetDevice::m_vhtConfiguration
Ptr< VhtConfiguration > m_vhtConfiguration
the VhtConfiguration
Definition: wifi-net-device.h:193
ns3::WifiNetDevice::GetHeConfiguration
Ptr< HeConfiguration > GetHeConfiguration(void) const
Definition: wifi-net-device.cc:480
ns3::WifiNetDevice
Hold together all Wifi-related objects.
Definition: wifi-net-device.h:54
ns3::WifiNetDevice::SetHtConfiguration
void SetHtConfiguration(Ptr< HtConfiguration > htConfiguration)
Definition: wifi-net-device.cc:450
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::WifiNetDevice::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-net-device.cc:41
ns3::WifiNetDevice::IsBridge
bool IsBridge(void) const override
Return true if the net device is acting as a bridge.
Definition: wifi-net-device.cc:313
ns3::WifiNetDevice::SetPromiscReceiveCallback
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override
Definition: wifi-net-device.cc:437
ns3::WifiNetDevice::GetMulticast
Address GetMulticast(Ipv4Address multicastGroup) const override
Make and return a MAC multicast address using the provided multicast group.
Definition: wifi-net-device.cc:296
ns3::WifiNetDevice::Send
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
Definition: wifi-net-device.cc:319
ns3::WifiNetDevice::m_htConfiguration
Ptr< HtConfiguration > m_htConfiguration
the HtConfiguration
Definition: wifi-net-device.h:192
ns3::Address
a polymophic address class
Definition: address.h:91
ns3::WifiNetDevice::GetVhtConfiguration
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
Definition: wifi-net-device.cc:468
ns3::WifiNetDevice::ForwardUp
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Receive a packet from the lower layer and pass the packet up the stack.
Definition: wifi-net-device.cc:361
ns3::WifiNetDevice::GetNode
Ptr< Node > GetNode(void) const override
Definition: wifi-net-device.cc:336
ns3::WifiNetDevice::LinkUp
void LinkUp(void)
Set that the link is up.
Definition: wifi-net-device.cc:403
ns3::WifiNetDevice::DoDispose
void DoDispose(void) override
Destructor implementation.
Definition: wifi-net-device.cc:102
ns3::WifiNetDevice::GetRemoteStationManager
Ptr< WifiRemoteStationManager > GetRemoteStationManager(void) const
Definition: wifi-net-device.cc:213
ns3::WifiNetDevice::IsMulticast
bool IsMulticast(void) const override
Definition: wifi-net-device.cc:290
first.address
address
Definition: first.py:44
ns3::WifiNetDevice::WifiNetDevice
WifiNetDevice(const WifiNetDevice &o)
Copy constructor.
ns3::WifiNetDevice::IsLinkUp
bool IsLinkUp(void) const override
Definition: wifi-net-device.cc:266
ns3::WifiNetDevice::m_rxLogger
TracedCallback< Ptr< const Packet >, Mac48Address > m_rxLogger
receive trace callback
Definition: wifi-net-device.h:198
ns3::WifiNetDevice::m_stationManager
Ptr< WifiRemoteStationManager > m_stationManager
the station manager
Definition: wifi-net-device.h:191
ns3::WifiNetDevice::GetMtu
uint16_t GetMtu(void) const override
Definition: wifi-net-device.cc:260
ns3::WifiNetDevice::SetAddress
void SetAddress(Address address) override
Set the address of this interface.
Definition: wifi-net-device.cc:237
ns3::WifiNetDevice::m_promiscRx
NetDevice::PromiscReceiveCallback m_promiscRx
promiscuous receive callback
Definition: wifi-net-device.h:196
ns3::WifiNetDevice::GetIfIndex
uint32_t GetIfIndex(void) const override
Definition: wifi-net-device.cc:225
ns3::WifiNetDevice::operator=
WifiNetDevice & operator=(const WifiNetDevice &o)
Assignment operator.
ns3::WifiNetDevice::m_linkChanges
TracedCallback m_linkChanges
link change callback
Definition: wifi-net-device.h:203
ns3::WifiNetDevice::SetRemoteStationManager
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Definition: wifi-net-device.cc:194
ns3::WifiNetDevice::IsBroadcast
bool IsBroadcast(void) const override
Definition: wifi-net-device.cc:278
ns3::WifiNetDevice::~WifiNetDevice
virtual ~WifiNetDevice()
Definition: wifi-net-device.cc:96
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition: traced-callback.h:53
ns3::WifiNetDevice::SendFrom
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
Definition: wifi-net-device.cc:417
ns3::WifiNetDevice::m_linkUp
bool m_linkUp
link up
Definition: wifi-net-device.h:202
ns3::WifiNetDevice::m_mtu
uint16_t m_mtu
MTU.
Definition: wifi-net-device.h:204
ns3::WifiNetDevice::m_heConfiguration
Ptr< HeConfiguration > m_heConfiguration
the HeConfiguration
Definition: wifi-net-device.h:194
ns3::WifiNetDevice::GetBroadcast
Address GetBroadcast(void) const override
Definition: wifi-net-device.cc:284
ns3::WifiNetDevice::SetIfIndex
void SetIfIndex(const uint32_t index) override
Definition: wifi-net-device.cc:219
ns3::WifiNetDevice::SetPhy
void SetPhy(const Ptr< WifiPhy > phy)
Definition: wifi-net-device.cc:187
third.phy
phy
Definition: third.py:93
ns3::WifiNetDevice::SetReceiveCallback
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
Definition: wifi-net-device.cc:355
ns3::NetDevice
Network layer to device interface.
Definition: net-device.h:96
ns3::WifiNetDevice::m_mac
Ptr< WifiMac > m_mac
the MAC
Definition: wifi-net-device.h:190
ns3::WifiNetDevice::SetMtu
bool SetMtu(const uint16_t mtu) override
Definition: wifi-net-device.cc:249
ns3::WifiNetDevice::GetMac
Ptr< WifiMac > GetMac(void) const
Definition: wifi-net-device.cc:201
ns3::WifiNetDevice::GetChannel
Ptr< Channel > GetChannel(void) const override
Definition: wifi-net-device.cc:231