21#include "ns3/object-vector.h"
22#include "ns3/llc-snap-header.h"
23#include "ns3/channel.h"
24#include "ns3/pointer.h"
27#include "ns3/uinteger.h"
31#include "ns3/ht-configuration.h"
32#include "ns3/vht-configuration.h"
33#include "ns3/he-configuration.h"
34#include "ns3/eht-configuration.h"
47 .AddConstructor<WifiNetDevice> ()
48 .SetGroupName (
"Wifi")
49 .AddAttribute (
"Mtu",
"The MAC-level Maximum Transmission Unit",
54 .AddAttribute (
"Channel",
"The channel attached to this device",
57 MakePointerChecker<Channel> (),
59 "Use the Channel attribute of WifiPhy")
60 .AddAttribute (
"Phy",
"The PHY layer attached to this device.",
64 MakePointerChecker<WifiPhy> ())
65 .AddAttribute (
"Phys",
"The PHY layers attached to this device (11be multi-link devices only).",
69 MakeObjectVectorChecker<WifiPhy> ())
70 .AddAttribute (
"Mac",
"The MAC layer attached to this device.",
74 MakePointerChecker<WifiMac> ())
75 .AddAttribute (
"RemoteStationManager",
"The station manager attached to this device.",
79 MakePointerChecker<WifiRemoteStationManager> ())
80 .AddAttribute (
"RemoteStationManagers",
81 "The remote station managers attached to this device (11be multi-link devices only).",
85 MakeObjectVectorChecker<WifiPhy> ())
86 .AddAttribute (
"HtConfiguration",
87 "The HtConfiguration object.",
90 MakePointerChecker<HtConfiguration> ())
91 .AddAttribute (
"VhtConfiguration",
92 "The VhtConfiguration object.",
95 MakePointerChecker<VhtConfiguration> ())
96 .AddAttribute (
"HeConfiguration",
97 "The HeConfiguration object.",
100 MakePointerChecker<HeConfiguration> ())
101 .AddAttribute (
"EhtConfiguration",
102 "The EhtConfiguration object.",
105 MakePointerChecker<EhtConfiguration> ())
112 m_configComplete (false)
143 if (stationManager !=
nullptr)
145 stationManager->Dispose ();
146 stationManager =
nullptr;
187 m_mac->Initialize ();
193 stationManager->Initialize ();
257 "Multiple PHYs only allowed for 11be multi-link devices");
275 "Multiple remote station managers only allowed for 11be multi-link devices");
299const std::vector<Ptr<WifiPhy>>&
324const std::vector<Ptr<WifiRemoteStationManager>>&
351 for (uint8_t i = 1; i <
GetNPhys (); i++)
355 NS_ABORT_MSG (
"Do not call WifiNetDevice::GetChannel() when using multiple channels");
371 return m_mac->GetAddress ();
456 m_mac->NotifyTx (packet);
457 m_mac->Enqueue (packet, realTo);
500 else if (to ==
m_mac->GetAddress ())
512 m_mac->NotifyRx (packet);
523 m_mac->NotifyPromiscRx (copy);
556 m_mac->NotifyTx (packet);
557 m_mac->Enqueue (packet, realTo, realFrom);
566 m_mac->SetPromisc ();
572 return m_mac->SupportsSendFrom ();
a polymophic address class
bool IsNull(void) const
Check for null implementation.
Ipv4 addresses are stored in host order in this class.
Describes an IPv6 address.
static Mac48Address GetMulticast(Ipv4Address address)
static Mac48Address GetBroadcast(void)
static bool IsMatchingType(const Address &address)
bool IsBroadcast(void) const
static Mac48Address ConvertFrom(const Address &address)
Network layer to device interface.
PacketType
Packet types are used as they are in Linux.
@ PACKET_HOST
Packet addressed oo us.
@ PACKET_OTHERHOST
Packet addressed to someone else.
@ PACKET_BROADCAST
Packet addressed to all.
@ PACKET_MULTICAST
Packet addressed to multicast group.
virtual void DoDispose(void)
Destructor implementation.
virtual void DoInitialize(void)
Initialize() implementation.
void Dispose(void)
Dispose of this Object.
Container for a set of ns3::Object pointers.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void AddHeader(const Header &header)
Add header to this packet.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Hold objects of type Ptr<T>.
void ConnectWithoutContext(const CallbackBase &callback)
Append a Callback to the chain (without a context).
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
@ DEPRECATED
Attribute or trace source is deprecated; user is warned.
Hold an unsigned integer type.
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.
bool NeedsArp(void) const override
void LinkUp(void)
Set that the link is up.
void SetMac(const Ptr< WifiMac > mac)
Ptr< HtConfiguration > m_htConfiguration
the HtConfiguration
uint16_t GetMtu(void) const override
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
Ptr< HtConfiguration > GetHtConfiguration(void) const
Ptr< EhtConfiguration > m_ehtConfiguration
the EhtConfiguration
bool IsMulticast(void) const override
void SetPhys(const std::vector< Ptr< WifiPhy > > &phys)
void DoInitialize(void) override
Initialize() implementation.
void SetHeConfiguration(Ptr< HeConfiguration > heConfiguration)
bool IsBroadcast(void) const override
void LinkDown(void)
Set that the link is down (i.e.
void SetHtConfiguration(Ptr< HtConfiguration > htConfiguration)
Ptr< WifiMac > GetMac(void) const
std::vector< Ptr< WifiPhy > > m_phys
the phy objects
bool SetMtu(const uint16_t mtu) override
bool IsPointToPoint(void) const override
Return true if the net device is on a point-to-point link.
virtual const std::vector< Ptr< WifiPhy > > & GetPhys(void) const
uint32_t m_ifIndex
IF index.
Ptr< VhtConfiguration > m_vhtConfiguration
the VhtConfiguration
bool m_configComplete
configuration complete
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override
void SetIfIndex(const uint32_t index) override
Ptr< Channel > GetChannel(void) const override
NetDevice::ReceiveCallback m_forwardUp
forward up callback
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
Address GetAddress(void) const override
bool SupportsSendFrom(void) const override
bool IsLinkUp(void) const override
Ptr< HeConfiguration > m_heConfiguration
the HeConfiguration
uint8_t GetNPhys(void) const
WifiStandard GetStandard(void) const
Get the Wifi standard.
Address GetBroadcast(void) const override
void SetVhtConfiguration(Ptr< VhtConfiguration > vhtConfiguration)
NetDevice::PromiscReceiveCallback m_promiscRx
promiscuous receive callback
Ptr< WifiPhy > GetPhy(void) const
TracedCallback m_linkChanges
link change callback
void CompleteConfig(void)
Complete the configuration of this Wi-Fi device by connecting all lower components (e....
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
static TypeId GetTypeId(void)
Get the type ID.
void SetNode(const Ptr< Node > node) override
void SetRemoteStationManagers(const std::vector< Ptr< WifiRemoteStationManager > > &managers)
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
virtual const std::vector< Ptr< WifiRemoteStationManager > > & GetRemoteStationManagers(void) const
std::vector< Ptr< WifiRemoteStationManager > > m_stationManagers
the station managers
uint32_t GetIfIndex(void) const override
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
void SetAddress(Address address) override
Set the address of this interface.
Ptr< EhtConfiguration > GetEhtConfiguration(void) 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.
bool IsBridge(void) const override
Return true if the net device is acting as a bridge.
Ptr< WifiRemoteStationManager > GetRemoteStationManager(void) const
Ptr< Node > m_node
the node
void SetEhtConfiguration(Ptr< EhtConfiguration > ehtConfiguration)
WifiStandard m_standard
Wifi standard.
void SetPhy(const Ptr< WifiPhy > phy)
Ptr< WifiMac > m_mac
the MAC
uint8_t GetNRemoteStationManagers(void) const
void AddLinkChangeCallback(Callback< void > callback) override
void DoDispose(void) override
Destructor implementation.
Ptr< HeConfiguration > GetHeConfiguration(void) const
Ptr< Node > GetNode(void) const override
virtual Ptr< Channel > GetChannel(void) const =0
Return the Channel this WifiPhy is connected to.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
@ WIFI_STANDARD_UNSPECIFIED
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static constexpr uint8_t SINGLE_LINK_OP_ID
Link ID for single link operations (helps tracking places where correct link ID is to be used to supp...
static const uint16_t MAX_MSDU_SIZE
This value conforms to the 802.11 specification.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static const uint16_t LLC_SNAP_HEADER_LENGTH
The length in octects of the LLC/SNAP header.