26#include "ns3/channel.h"
27#include "ns3/eht-configuration.h"
28#include "ns3/he-configuration.h"
29#include "ns3/ht-configuration.h"
30#include "ns3/llc-snap-header.h"
33#include "ns3/object-vector.h"
34#include "ns3/pointer.h"
35#include "ns3/uinteger.h"
36#include "ns3/vht-configuration.h"
49 TypeId(
"ns3::WifiNetDevice")
51 .AddConstructor<WifiNetDevice>()
54 "The MAC-level Maximum Transmission Unit",
58 .AddAttribute(
"Channel",
59 "The channel attached to this device",
62 MakePointerChecker<Channel>(),
64 "class WifiNetDevice; use the Channel "
65 "attribute of WifiPhy")
67 "The PHY layer attached to this device.",
72 MakePointerChecker<WifiPhy>())
75 "The PHY layers attached to this device (11be multi-link devices only).",
78 MakeObjectVectorChecker<WifiPhy>())
80 "The MAC layer attached to this device.",
83 MakePointerChecker<WifiMac>())
85 "RemoteStationManager",
86 "The station manager attached to this device.",
91 MakePointerChecker<WifiRemoteStationManager>())
92 .AddAttribute(
"RemoteStationManagers",
93 "The remote station managers attached to this device (11be multi-link "
98 MakeObjectVectorChecker<WifiRemoteStationManager>())
99 .AddAttribute(
"HtConfiguration",
100 "The HtConfiguration object.",
103 MakePointerChecker<HtConfiguration>())
104 .AddAttribute(
"VhtConfiguration",
105 "The VhtConfiguration object.",
108 MakePointerChecker<VhtConfiguration>())
109 .AddAttribute(
"HeConfiguration",
110 "The HeConfiguration object.",
113 MakePointerChecker<HeConfiguration>())
114 .AddAttribute(
"EhtConfiguration",
115 "The EhtConfiguration object.",
118 MakePointerChecker<EhtConfiguration>());
124 m_configComplete(false)
157 stationManager->Dispose();
158 stationManager =
nullptr;
190 for (
const auto& phy :
m_phys)
205 stationManager->Initialize();
265 "Multiple PHYs only allowed for 11be multi-link devices");
283 "Multiple remote station managers only allowed for 11be multi-link devices");
307const std::vector<Ptr<WifiPhy>>&
332const std::vector<Ptr<WifiRemoteStationManager>>&
359 for (uint8_t i = 1; i <
GetNPhys(); i++)
363 NS_ABORT_MSG(
"Do not call WifiNetDevice::GetChannel() when using multiple channels");
380 std::set<uint8_t> linkIds;
396 (linkIds = staMac->GetSetupLinkIds()).size() == 1 &&
487 packet->AddHeader(llc);
546 copy->RemoveHeader(llc);
551 copy->RemoveHeader(llc);
579 uint16_t protocolNumber)
590 packet->AddHeader(llc);
a polymophic address class
bool IsNull() 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 bool IsMatchingType(const Address &address)
static Mac48Address ConvertFrom(const Address &address)
static Mac48Address GetBroadcast()
Network layer to device interface.
PacketType
Packet types are used as they are in Linux.
@ PACKET_HOST
Packet addressed to us.
@ PACKET_OTHERHOST
Packet addressed to someone else.
@ PACKET_BROADCAST
Packet addressed to all.
@ PACKET_MULTICAST
Packet addressed to multicast group.
void Initialize()
Invoke DoInitialize on all Objects aggregated to this one.
virtual void DoInitialize()
Initialize() implementation.
void Dispose()
Dispose of this Object.
virtual void DoDispose()
Destructor implementation.
Hold objects of type Ptr<T>.
Smart pointer class similar to boost::intrusive_ptr.
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.
Ptr< FrameExchangeManager > GetFrameExchangeManager(uint8_t linkId=SINGLE_LINK_OP_ID) const
Get the Frame Exchange Manager associated with the given link.
Mac48Address GetBssid(uint8_t linkId) const
TypeOfStation GetTypeOfStation() const
Return the type of station.
virtual void SetAddress(Mac48Address address)
uint8_t GetNLinks() const
Get the number of links (can be greater than 1 for 11be devices only).
void SetWifiRemoteStationManagers(const std::vector< Ptr< WifiRemoteStationManager > > &stationManagers)
void NotifyPromiscRx(Ptr< const Packet > packet)
void NotifyTx(Ptr< const Packet > packet)
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from)
void NotifyRx(Ptr< const Packet > packet)
void SetForwardUpCallback(ForwardUpCallback upCallback)
virtual bool SupportsSendFrom() const
void SetLinkDownCallback(Callback< void > linkDown)
void SetPromisc()
Sets the interface in promiscuous mode.
virtual void SetLinkUpCallback(Callback< void > linkUp)
Mac48Address GetAddress() const
virtual void SetWifiPhys(const std::vector< Ptr< WifiPhy > > &phys)
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
~WifiNetDevice() override
Ptr< VhtConfiguration > GetVhtConfiguration() const
bool m_configComplete
configuration complete
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override
void SetIfIndex(const uint32_t index) override
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
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
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.
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....
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
virtual Ptr< Channel > GetChannel() const =0
Return the Channel this WifiPhy is connected to.
std::optional< Mac48Address > GetMldAddress(const Mac48Address &address) const
Get the address of the MLD the given station is affiliated with, if any.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
ObjectPtrContainerValue ObjectVectorValue
ObjectVectorValue is an alias for ObjectPtrContainerValue.
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
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
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.
static const uint16_t LLC_SNAP_HEADER_LENGTH
The length in octets of the LLC/SNAP header.