A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-net-device.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 */
19
20#ifndef WIFI_NET_DEVICE_H
21#define WIFI_NET_DEVICE_H
22
23#include "wifi-standards.h"
24
25#include "ns3/net-device.h"
26#include "ns3/traced-callback.h"
27
28#include <vector>
29
30namespace ns3
31{
32
33class WifiRemoteStationManager;
34class WifiPhy;
35class WifiMac;
36class HtConfiguration;
37class VhtConfiguration;
38class HeConfiguration;
39class EhtConfiguration;
40
42static const uint16_t MAX_MSDU_SIZE = 2304;
43
59{
60 public:
65 static TypeId GetTypeId();
66
68 ~WifiNetDevice() override;
69
70 // Delete copy constructor and assignment operator to avoid misuse
71 WifiNetDevice(const WifiNetDevice& o) = delete;
73
79 void SetStandard(WifiStandard standard);
86
90 void SetMac(const Ptr<WifiMac> mac);
94 void SetPhy(const Ptr<WifiPhy> phy);
98 void SetPhys(const std::vector<Ptr<WifiPhy>>& phys);
106 void SetRemoteStationManagers(const std::vector<Ptr<WifiRemoteStationManager>>& managers);
110 Ptr<WifiMac> GetMac() const;
116 Ptr<WifiPhy> GetPhy() const;
121 virtual Ptr<WifiPhy> GetPhy(uint8_t i) const;
125 virtual const std::vector<Ptr<WifiPhy>>& GetPhys() const;
129 uint8_t GetNPhys() const;
146 virtual const std::vector<Ptr<WifiRemoteStationManager>>& GetRemoteStationManagers() const;
150 uint8_t GetNRemoteStationManagers() const;
151
155 void SetHtConfiguration(Ptr<HtConfiguration> htConfiguration);
163 void SetVhtConfiguration(Ptr<VhtConfiguration> vhtConfiguration);
171 void SetHeConfiguration(Ptr<HeConfiguration> heConfiguration);
179 void SetEhtConfiguration(Ptr<EhtConfiguration> ehtConfiguration);
184
185 void SetIfIndex(const uint32_t index) override;
186 uint32_t GetIfIndex() const override;
187 Ptr<Channel> GetChannel() const override;
188 void SetAddress(Address address) override;
189 Address GetAddress() const override;
190 bool SetMtu(const uint16_t mtu) override;
191 uint16_t GetMtu() const override;
192 bool IsLinkUp() const override;
193 void AddLinkChangeCallback(Callback<void> callback) override;
194 bool IsBroadcast() const override;
195 Address GetBroadcast() const override;
196 bool IsMulticast() const override;
197 Address GetMulticast(Ipv4Address multicastGroup) const override;
198 bool IsPointToPoint() const override;
199 bool IsBridge() const override;
200 bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) override;
201 Ptr<Node> GetNode() const override;
202 void SetNode(const Ptr<Node> node) override;
203 bool NeedsArp() const override;
205 Address GetMulticast(Ipv6Address addr) const override;
206 bool SendFrom(Ptr<Packet> packet,
207 const Address& source,
208 const Address& dest,
209 uint16_t protocolNumber) override;
211 bool SupportsSendFrom() const override;
212
213 protected:
214 void DoDispose() override;
215 void DoInitialize() override;
225
226 private:
231 void LinkUp();
235 void LinkDown();
240 void CompleteConfig();
241
243 std::vector<Ptr<WifiPhy>> m_phys;
245 std::vector<Ptr<WifiRemoteStationManager>> m_stationManagers;
252
255
258 bool m_linkUp;
260 mutable uint16_t m_mtu;
262};
263
264} // namespace ns3
265
266#endif /* WIFI_NET_DEVICE_H */
a polymophic address class
Definition: address.h:100
Callback template class.
Definition: callback.h:438
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Describes an IPv6 address.
Definition: ipv6-address.h:49
an EUI-48 address
Definition: mac48-address.h:46
Network layer to device interface.
Definition: net-device.h:98
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
Hold together all Wifi-related objects.
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Receive a packet from the lower layer and pass the packet up the stack.
static TypeId GetTypeId()
Get the type ID.
bool NeedsArp() const override
bool SupportsSendFrom() const override
void SetMac(const Ptr< WifiMac > mac)
Ptr< HtConfiguration > m_htConfiguration
the HtConfiguration
bool IsBroadcast() const override
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
void LinkDown()
Set that the link is down (i.e.
Ptr< EhtConfiguration > m_ehtConfiguration
the EhtConfiguration
virtual const std::vector< Ptr< WifiPhy > > & GetPhys() const
void SetPhys(const std::vector< Ptr< WifiPhy > > &phys)
void SetHeConfiguration(Ptr< HeConfiguration > heConfiguration)
void SetHtConfiguration(Ptr< HtConfiguration > htConfiguration)
Address GetBroadcast() const override
std::vector< Ptr< WifiPhy > > m_phys
the phy objects
bool SetMtu(const uint16_t mtu) override
virtual const std::vector< Ptr< WifiRemoteStationManager > > & GetRemoteStationManagers() const
bool IsBridge() const override
Return true if the net device is acting as a bridge.
Ptr< WifiMac > GetMac() const
uint32_t m_ifIndex
IF index.
Ptr< VhtConfiguration > m_vhtConfiguration
the VhtConfiguration
Ptr< VhtConfiguration > GetVhtConfiguration() const
bool m_configComplete
configuration complete
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override
void SetIfIndex(const uint32_t index) override
TracedCallback< Ptr< const Packet >, Mac48Address > m_txLogger
transmit trace callback
NetDevice::ReceiveCallback m_forwardUp
forward up callback
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
Ptr< HeConfiguration > m_heConfiguration
the HeConfiguration
Ptr< EhtConfiguration > GetEhtConfiguration() const
bool IsMulticast() const override
void DoDispose() override
Destructor implementation.
uint8_t GetNRemoteStationManagers() const
void SetVhtConfiguration(Ptr< VhtConfiguration > vhtConfiguration)
void DoInitialize() override
Initialize() implementation.
NetDevice::PromiscReceiveCallback m_promiscRx
promiscuous receive callback
WifiNetDevice & operator=(const WifiNetDevice &)=delete
TracedCallback m_linkChanges
link change callback
Ptr< HtConfiguration > GetHtConfiguration() const
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Ptr< Channel > GetChannel() const override
WifiStandard GetStandard() const
Get the Wifi standard.
void SetNode(const Ptr< Node > node) override
void SetRemoteStationManagers(const std::vector< Ptr< WifiRemoteStationManager > > &managers)
bool IsPointToPoint() const override
Return true if the net device is on a point-to-point link.
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
uint8_t GetNPhys() const
bool IsLinkUp() const override
std::vector< Ptr< WifiRemoteStationManager > > m_stationManagers
the station managers
Ptr< HeConfiguration > GetHeConfiguration() const
void SetAddress(Address address) override
Set the address of this interface.
Ptr< WifiRemoteStationManager > GetRemoteStationManager() const
void SetStandard(WifiStandard standard)
Set the Wifi standard.
Address GetMulticast(Ipv4Address multicastGroup) const override
Make and return a MAC multicast address using the provided multicast group.
WifiNetDevice(const WifiNetDevice &o)=delete
Ptr< Node > m_node
the node
void SetEhtConfiguration(Ptr< EhtConfiguration > ehtConfiguration)
WifiStandard m_standard
Wifi standard.
Ptr< WifiPhy > GetPhy() const
uint32_t GetIfIndex() const override
void SetPhy(const Ptr< WifiPhy > phy)
Ptr< WifiMac > m_mac
the MAC
void CompleteConfig()
Complete the configuration of this Wi-Fi device by connecting all lower components (e....
TracedCallback< Ptr< const Packet >, Mac48Address > m_rxLogger
receive trace callback
Address GetAddress() const override
void AddLinkChangeCallback(Callback< void > callback) override
uint16_t GetMtu() const override
void LinkUp()
Set that the link is up.
Ptr< Node > GetNode() const override
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const uint16_t MAX_MSDU_SIZE
This value conforms to the 802.11 specification.