24 #include "ns3/assert.h"
26 #include "ns3/simulator.h"
27 #include "ns3/string.h"
28 #include "ns3/pointer.h"
29 #include "ns3/boolean.h"
53 .AddConstructor<ApWifiMac> ()
54 .AddAttribute (
"BeaconInterval",
"Delay between two beacons",
59 .AddAttribute (
"BeaconJitter",
"A uniform random variable to cause the initial beacon starting time (after simulation time 0) to be distributed between 0 and the BeaconInterval.",
62 MakePointerChecker<UniformRandomVariable> ())
63 .AddAttribute (
"EnableBeaconJitter",
"If beacons are enabled, whether to jitter the initial send event.",
66 MakeBooleanChecker ())
67 .AddAttribute (
"BeaconGeneration",
"Whether or not beacons are generated.",
71 MakeBooleanChecker ())
150 m_beaconDca->SetWifiRemoteStationManager (stationManager);
172 NS_LOG_WARN (
"beacon interval should be multiple of 1024us, see IEEE Std. 802.11-2007, section 11.1.1.1");
222 NS_LOG_FUNCTION (
this << packet << from << to << static_cast<uint32_t> (tid));
263 m_dca->Queue (packet, hdr);
367 m_dca->Queue (packet, hdr);
393 assoc.SetStatusCode (code);
406 m_dca->Queue (packet, hdr);
505 NS_LOG_DEBUG (
"forwarding frame from=" << from <<
", to=" << to);
541 else if (hdr->
IsMgt ())
558 bool problem =
false;
643 i != packets.end (); ++i)
645 if ((*i).second.GetDestinationAddr () ==
GetAddress ())
647 ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
648 (*i).second.GetDestinationAddr ());
654 NS_LOG_DEBUG (
"forwarding QoS frame from=" << from <<
", to=" << to);
671 NS_LOG_DEBUG (
"Scheduling initial beacon for access point " <<
GetAddress() <<
" at time " << jitter <<
" microseconds");
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void SetBeaconInterval(Time interval)
void AddSupportedRate(uint32_t bs)
Add the given rate to the supported rates.
keep track of time values and allow control of global simulation resolution
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
HtCapabilities GetHtCapabilities(void) const
Return the HT capability of the current AP.
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
void SetGreenfield(uint8_t greenfield)
virtual void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)
hold variables of type string
void SetHtSupported(uint8_t htsupported)
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
virtual uint32_t GetNModes(void) const =0
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
void SetRxMcsBitmask(uint8_t index)
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
virtual uint8_t GetNMcs(void) const =0
The WifiPhy::GetNMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of t...
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
The Ht Capabilities Information ElementThis class knows how to serialise and deserialise the Ht Capab...
uint32_t GetSize(void) const
std::list< std::pair< Ptr< Packet >, AmsduSubframeHeader > >::const_iterator DeaggregatedMsdusCI
bool IsBroadcast(void) const
static DeaggregatedMsdus Deaggregate(Ptr< Packet > aggregatedPacket)
void NotifyRxDrop(Ptr< const Packet > packet)
virtual bool GetLdpc(void) const =0
virtual uint8_t GetMcs(uint8_t mcs) const =0
The WifiPhy::GetMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of tr...
void SendAssocResp(Mac48Address to, bool success)
Forward an association response packet to the DCF.
virtual bool SupportsSendFrom(void) const
Ptr< WifiPhy > m_phy
Wifi PHY.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
Ptr< DcaTxop > m_beaconDca
Dedicated DcaTxop for beacons.
virtual Ssid GetSsid(void) const
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
virtual void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
uint8_t QosUtilsGetTidForPacket(Ptr< const Packet > packet)
If a qos tag is attached to the packet, returns a value < 8.
bool m_enableBeaconGeneration
Flag if beacons are being generated.
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to)
virtual void SetBssid(Mac48Address bssid)
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
virtual void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)
base class for all MAC-level wifi objects.
void SetSuccess(void)
Set success bit to 0 (success).
bool m_qosSupported
This Boolean is set true iff this WifiMac is to model 802.11e/WMM style Quality of Service...
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
int64_t GetMicroSeconds(void) const
void SetShortGuardInterval20(uint8_t shortguardinterval)
hold objects of type ns3::Time
Ptr< DcaTxop > m_dca
This holds a pointer to the DCF instance for this WifiMac - used for transmission of frames to non-Qo...
static TypeId GetTypeId(void)
void ForwardDown(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet down to DCF/EDCAF (enqueue the packet).
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
virtual void SetAddress(Mac48Address address)
static Mac48Address GetBroadcast(void)
bool IsSupportedMcs(uint8_t mcs)
EventId m_beaconEvent
Event to generate one beacon.
virtual bool GetGuardInterval(void) const =0
virtual uint32_t GetNBssMembershipSelectors(void) const =0
The WifiPhy::NBssMembershipSelectors() method is used (e.g., by a WifiRemoteStationManager) to determ...
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
void SetBasicRate(uint32_t bs)
Set the given rate to basic rates.
virtual void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
virtual void DeaggregateAmsduAndForward(Ptr< Packet > aggregatedPacket, const WifiMacHeader *hdr)
This method is called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
Ptr< Packet > Copy(void) const
Status code for association response.
virtual void SetLinkUpCallback(Callback< void > linkUp)
virtual void SetLinkUpCallback(Callback< void > linkUp)
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
std::list< std::pair< Ptr< Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
virtual uint32_t GetBssMembershipSelector(uint32_t selector) const =0
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
DcfManager * m_dcfManager
DCF manager (access to channel)
virtual WifiMode GetMode(uint32_t mode) const =0
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
bool GetBeaconGeneration(void) const
Return whether the AP is generating beacons.
bool m_htSupported
This Boolean is set true iff this WifiMac is to model 802.11n.
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates...
virtual void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
void SendOneBeacon(void)
Forward a beacon packet to the beacon special DCF.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
virtual void SetAddress(Mac48Address address)
#define NS_LOG_DEBUG(msg)
virtual Mac48Address GetAddress(void) const
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Time m_beaconInterval
Interval between beacons.
virtual void DoInitialize()
This method is called only once by Object::Initialize.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::cancel method.
void SetLdpc(uint8_t ldpc)
bool IsSupportedRate(uint32_t bs) const
Check if the given rate is supported.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
bool m_enableBeaconJitter
Flag if the first beacon should be generated at random time.
Time GetBeaconInterval(void) const
NS_LOG_COMPONENT_DEFINE("ApWifiMac")
virtual void TxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
virtual void TxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Ptr< WifiRemoteStationManager > m_stationManager
Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
void SetFailure(void)
Set success bit to 1 (failure.
a unique identifier for an interface.
uint64_t GetDataRate(void) const
TypeId SetParent(TypeId tid)
void StartBeaconing(void)
Start beacon transmission immediately.
virtual bool GetGreenfield(void) const =0
void AddHeader(const Header &header)
Add header to this packet.
void SetBeaconGeneration(bool enable)
Enable or disable beacon generation of the AP.
virtual void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.