25 #include "ns3/llc-snap-header.h"
26 #include "ns3/socket.h"
27 #include "ns3/pointer.h"
29 #include "ns3/net-device-queue-interface.h"
42 .AddConstructor<WifiNetDevice> ()
43 .SetGroupName (
"Wifi")
44 .AddAttribute (
"Mtu",
"The MAC-level Maximum Transmission Unit",
49 .AddAttribute (
"Channel",
"The channel attached to this device",
52 MakePointerChecker<Channel> ())
53 .AddAttribute (
"Phy",
"The PHY layer attached to this device.",
57 MakePointerChecker<WifiPhy> ())
58 .AddAttribute (
"Mac",
"The MAC layer attached to this device.",
62 MakePointerChecker<WifiMac> ())
63 .AddAttribute (
"RemoteStationManager",
"The station manager attached to this device.",
67 MakePointerChecker<WifiRemoteStationManager> ())
73 : m_configComplete (false)
102 m_mac->Initialize ();
160 NS_LOG_WARN (
"Flow control is only supported by RegularWifiMac");
165 mac->GetAttributeFailSafe (
"QosSupported", qosSupported);
168 if (qosSupported.
Get ())
173 mac->GetAttributeFailSafe (
"BE_EdcaTxopN", ptr);
177 mac->GetAttributeFailSafe (
"BK_EdcaTxopN", ptr);
181 mac->GetAttributeFailSafe (
"VI_EdcaTxopN", ptr);
185 mac->GetAttributeFailSafe (
"VO_EdcaTxopN", ptr);
193 mac->GetAttributeFailSafe (
"DcaTxop", ptr);
272 return m_mac->GetAddress ();
357 m_mac->NotifyTx (packet);
358 m_mac->Enqueue (packet, realTo);
401 else if (to ==
m_mac->GetAddress ())
412 m_mac->NotifyRx (packet);
423 m_mac->NotifyPromiscRx (packet);
456 m_mac->NotifyTx (packet);
457 m_mac->Enqueue (packet, realTo, realFrom);
466 m_mac->SetPromisc ();
472 return m_mac->SupportsSendFrom ();
487 uint8_t dscp, priority = 0;
493 priority = dscp >> 5;
499 item->GetPacket ()->ReplacePacketTag (priorityTag);
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void Dispose(void)
Dispose of this Object.
bool IsBridge(void) const
Return true if the net device is acting as a bridge.
static bool IsMatchingType(const Address &address)
virtual void DoInitialize(void)
Initialize() implementation.
uint8_t SelectQueue(Ptr< QueueItem > item) const
Determine the tx queue for a given packet.
bool SetMtu(const uint16_t mtu)
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
AttributeValue implementation for Boolean.
void LinkUp(void)
Set that the link is up.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
uint16_t GetMtu(void) const
Address GetAddress(void) const
Ptr< WifiRemoteStationManager > m_stationManager
the station manager
bool IsNull(void) const
Check for null implementation.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
PacketType
Packet types are used as they are in Linux.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
bool IsBroadcast(void) const
Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group.
Packet addressed to multicast group.
virtual void DoDispose(void)
Destructor implementation.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Receive a packet from the lower layer and pass the packet up the stack.
Ptr< Channel > GetChannel(void) const
bool IsBroadcast(void) const
a polymophic address class
virtual Ptr< Channel > GetChannel(void) const =0
Return the Channel this WifiPhy is connected to.
bool IsMulticast(void) const
Ptr< WifiPhy > GetPhy(void) const
This queue contains packets for a particular access class.
WifiMacQueueItem stores (const) packets along with their Wifi MAC headers and the time when they were...
void DoDispose(void)
Destructor implementation.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Ptr< WifiRemoteStationManager > GetRemoteStationManager(void) const
static Mac48Address GetMulticast(Ipv4Address address)
void SetMac(const Ptr< WifiMac > mac)
Hold an unsigned integer type.
Ptr< WifiMac > m_mac
the MAC
bool SupportsSendFrom(void) const
indicates whether the socket has a priority set.
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Ptr< WifiPhy > m_phy
the phy
static Mac48Address GetBroadcast(void)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
virtual void SetupPhy(const Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
static Mac48Address ConvertFrom(const Address &address)
static const uint16_t LLC_SNAP_HEADER_LENGTH
The length in octects of the LLC/SNAP header.
Ptr< Node > GetNode(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
TracedCallback m_linkChanges
link change callback
Hold objects of type Ptr.
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
Packet addressed to someone else.
Ptr< Node > m_node
the node
uint32_t GetIfIndex(void) const
static const uint16_t MAX_MSDU_SIZE
This value conforms to the 802.11 specification.
void FlowControlConfig(void)
Perform the actions needed to support flow control and dynamic queue limits.
void DoInitialize(void)
Initialize() implementation.
bool NeedsArp(void) const
uint32_t m_ifIndex
IF index.
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
Address GetBroadcast(void) const
Describes an IPv6 address.
void SetPhy(const Ptr< WifiPhy > phy)
virtual void SetupMac(const Ptr< WifiMac > mac)
Set up MAC associated with this device since it is the object that knows the full set of timing param...
Ipv4 addresses are stored in host order in this class.
void SetIfIndex(const uint32_t index)
NetDevice::ReceiveCallback m_forwardUp
forward up callback
void ConnectWithoutContext(const CallbackBase &callback)
Append a Callback to the chain (without a context).
Ptr< Channel > DoGetChannel(void) const
Return the Channel this device is connected to.
Network layer to device interface.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
bool IsLinkUp(void) const
void AddLinkChangeCallback(Callback< void > callback)
void CompleteConfig(void)
Complete the configuration of this Wi-Fi device by connecting all lower components (e...
Ptr< WifiMac > GetMac(void) const
void NotifyNewAggregate(void)
Notify all Objects aggregated to this one of a new Object being aggregated.
void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
virtual void NotifyNewAggregate(void)
Notify all Objects aggregated to this one of a new Object being aggregated.
void LinkDown(void)
Set that the link is down (i.e.
handle packet fragmentation and retransmissions.
void SetPriority(uint8_t priority)
Set the tag's priority.
Ptr< NetDeviceQueueInterface > m_queueInterface
NetDevice queue interface.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void SetReceiveCallback(NetDevice::ReceiveCallback cb)
static TypeId GetTypeId(void)
Get the type ID.
NetDevice::PromiscReceiveCallback m_promiscRx
promiscious receive callback
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
bool m_configComplete
configuration complete
void AddHeader(const Header &header)
Add header to this packet.
void SetNode(const Ptr< Node > node)
void SetAddress(Address address)
Set the address of this interface.
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)