22 #include "ns3/mesh-wifi-interface-mac.h"
23 #include "ns3/mesh-wifi-beacon.h"
25 #include "ns3/boolean.h"
26 #include "ns3/wifi-phy.h"
27 #include "ns3/dcf-manager.h"
28 #include "ns3/mac-rx-middle.h"
29 #include "ns3/mac-low.h"
30 #include "ns3/dca-txop.h"
31 #include "ns3/random-variable-stream.h"
32 #include "ns3/simulator.h"
33 #include "ns3/yans-wifi-phy.h"
34 #include "ns3/pointer.h"
35 #include "ns3/double.h"
36 #include "ns3/trace-source-accessor.h"
37 #include "ns3/qos-tag.h"
51 .AddConstructor<MeshWifiInterfaceMac> ()
52 .AddAttribute (
"BeaconInterval",
60 .AddAttribute (
"RandomStart",
61 "Window when beacon generating starts (uniform random) in seconds",
67 .AddAttribute (
"BeaconGeneration",
68 "Enable/Disable Beaconing.",
153 int64_t currentStream = stream;
157 currentStream += (*i)->AssignStreams (currentStream);
159 return (currentStream - stream);
236 for (PluginList::const_iterator i =
m_plugins.end () - 1; i !=
m_plugins.begin () - 1; i--)
238 bool drop = !((*i)->UpdateOutcomingFrame (packet, hdr, from, to));
273 m_edca[ac]->Queue (packet, hdr);
280 for (PluginList::const_iterator i =
m_plugins.end () - 1; i !=
m_plugins.begin () - 1; i--)
411 (*i)->UpdateBeacon (beacon);
462 bool drop = !((*i)->Receive (packet, *hdr));
510 recvBeacons (0), sentFrames (0), sentBytes (0), recvFrames (0), recvBytes (0)
518 "rxBeacons=\"" << recvBeacons <<
"\" "
519 "txFrames=\"" << sentFrames <<
"\" "
520 "txBytes=\"" << sentBytes <<
"\" "
521 "rxFrames=\"" << recvFrames <<
"\" "
522 "rxBytes=\"" << recvBytes <<
"\"/>" << std::endl;
530 "Address = \"" <<
GetAddress () <<
"\">" << std::endl;
532 os <<
"</Interface>" << std::endl;
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
MeshWifiInterfaceMac()
C-tor.
#define NS_LOG_FUNCTION(parameters)
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
Time GetBeaconInterval() const
Ptr< UniformRandomVariable > m_coefficient
Add randomness to beacon generation.
bool m_beaconEnable
whether beaconing is enabled
virtual ~MeshWifiInterfaceMac()
D-tor.
virtual uint32_t GetNModes(void) const =0
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
SupportedRates GetSupportedRates() const
WifiPhyStandard GetPhyStandard() const
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
bool CheckSupportedRates(SupportedRates rates) const
virtual void DoDispose()
Real d-tor.
#define NS_ASSERT(condition)
void SetLinkMetricCallback(Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > cb)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
uint32_t GetSize(void) const
uint16_t GetChannelNumber() const
Return the current channel number.
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
void SetChannelNumber(uint16_t id)
Set the current channel number.
bool IsRunning(void) const
This method is syntactic sugar for the ns3::Simulator::isExpired method.
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.
void SwitchFrequencyChannel(uint16_t new_id)
Switch channel.
bool IsEqual(const Ssid &o) const
Check if the two SSIDs are equal.
void SendBeacon()
Send beacon.
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...
WifiPhyStandard m_standard
Current PHY standard: needed to configure metric.
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to, Mac48Address from)
Time GetTbtt() const
Next beacon frame time.
#define NS_FATAL_ERROR(msg)
fatal error handling
void SendManagementFrame(Ptr< Packet > frame, const WifiMacHeader &hdr)
To be used by plugins sending management frames.
NS_LOG_COMPONENT_DEFINE("MeshWifiInterfaceMac")
void NotifyNavResetNow(Time duration)
void ScheduleNextBeacon()
Schedule next beacon.
virtual void DoInitialize()
This method is called only once by Object::Initialize.
double GetSeconds(void) const
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
base class for all MAC-level wifi objects.
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
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...
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
static Mac48Address GetBroadcast(void)
uint16_t GetFrequencyChannel() const
Current channel Id.
The aim of the QosTag is to provide means for an Application to specify the TID which will be used by...
virtual void FinishConfigureStandard(enum WifiPhyStandard standard)
bool GetBeaconGeneration() const
Get current beaconing status.
uint32_t GetLinkMetric(Mac48Address peerAddress)
PluginList m_plugins
List of all installed plugins.
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
void SetBasicRate(uint32_t bs)
Set the given rate to basic rates.
Mac48Address GetMeshPointAddress() const
bool IsBasicRate(uint32_t bs) const
Check if the given rate is a basic rate.
virtual bool SupportsSendFrom() const
Ptr< Packet > Copy(void) const
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Mac48Address m_mpAddress
Mesh point address.
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...
OFDM PHY for the 5 GHz band (Clause 17)
802.11 PHY layer modelThis PHY implements a model of 802.11a.
DcfManager * m_dcfManager
DCF manager (access to channel)
Time m_beaconInterval
Beaconing interval.
virtual WifiMode GetMode(uint32_t mode) const =0
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
void Receive(Ptr< Packet > packet, WifiMacHeader const *hdr)
Frame receive handler.
static Time Now(void)
Return the "current simulation time".
Time m_randomStart
Maximum delay before first beacon.
Beacon is beacon header + list of arbitrary information elements.
static TypeId GetTypeId()
Never forget to support typeid.
virtual void SetLinkUpCallback(Callback< void > linkUp)
Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > m_linkMetricCallback
void ForwardDown(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Send frame.
void SetRandomStartDelay(Time interval)
Set maximum initial random delay before first beacon.
void InstallPlugin(Ptr< MeshWifiInterfaceMacPlugin > plugin)
Install plugin.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
#define NS_LOG_DEBUG(msg)
virtual Mac48Address GetAddress(void) const
void Report(std::ostream &) const
Statistics:
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::cancel method.
void SetBeaconGeneration(bool enable)
Enable/disable beacons.
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.
EventId m_beaconSendEvent
"Timer" for the next beacon
void SetBeaconInterval(Time interval)
Set interval between two successive beacons.
void Print(std::ostream &os) const
void SetMeshPointAddress(Mac48Address)
Time m_tbtt
Time for the next frame.
void ShiftTbtt(Time shift)
Shift TBTT.
Ptr< WifiRemoteStationManager > m_stationManager
Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
Hold a floating point type.
void SetAttribute(std::string name, const AttributeValue &value)
Ptr< T > GetObject(void) const
a unique identifier for an interface.
uint64_t GetDataRate(void) const
TypeId SetParent(TypeId tid)
uint8_t GetTid(void) const
Return the Type ID.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
virtual void SetParent(Ptr< MeshWifiInterfaceMac > parent)=0
Each plugin must be installed on interface to work.
virtual void FinishConfigureStandard(enum WifiPhyStandard standard)