22 #include "ns3/mesh-wifi-interface-mac.h" 23 #include "ns3/mesh-wifi-beacon.h" 25 #include "ns3/boolean.h" 26 #include "ns3/mac-low.h" 27 #include "ns3/random-variable-stream.h" 28 #include "ns3/simulator.h" 29 #include "ns3/yans-wifi-phy.h" 30 #include "ns3/wifi-utils.h" 31 #include "ns3/pointer.h" 32 #include "ns3/double.h" 33 #include "ns3/trace-source-accessor.h" 34 #include "ns3/socket.h" 47 .SetGroupName (
"Mesh")
49 .AddAttribute (
"BeaconInterval",
57 .AddAttribute (
"RandomStart",
58 "Window when beacon generating starts (uniform random) in seconds",
64 .AddAttribute (
"BeaconGeneration",
65 "Enable/Disable Beaconing.",
151 int64_t currentStream = stream;
155 currentStream += (*i)->AssignStreams (currentStream);
157 return (currentStream - stream);
183 return phy->GetChannelNumber ();
207 phy->SetChannelNumber (new_id);
234 for (PluginList::const_iterator i =
m_plugins.end () - 1; i !=
m_plugins.begin () - 1; i--)
236 bool drop = !((*i)->UpdateOutcomingFrame (packet, hdr, from, to));
272 m_edca[ac]->Queue (packet, hdr);
279 for (PluginList::const_iterator i =
m_plugins.end () - 1; i !=
m_plugins.begin () - 1; i--)
413 (*i)->UpdateBeacon (beacon);
466 bool drop = !((*i)->Receive (packet, *hdr));
528 "rxBeacons=\"" << recvBeacons <<
"\" " 529 "txFrames=\"" << sentFrames <<
"\" " 530 "txBytes=\"" << sentBytes <<
"\" " 531 "rxFrames=\"" << recvFrames <<
"\" " 532 "rxBytes=\"" << recvBytes <<
"\"/>" << std::endl;
540 "Address = \"" <<
GetAddress () <<
"\">" << std::endl;
542 os <<
"</Interface>" << std::endl;
Simulation virtual time values and global simulation resolution.
MeshWifiInterfaceMac()
C-tor.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
AttributeValue implementation for Boolean.
bool GetBeaconGeneration() const
Get current beaconing status.
Ptr< Txop > m_txop
This holds a pointer to the TXOP instance for this WifiMac - used for transmission of frames to non-Q...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Ptr< UniformRandomVariable > m_coefficient
Add randomness to beacon generation.
bool m_beaconEnable
whether beaconing is enabled
bool GetShortGuardInterval(void) const
Return whether short guard interval is supported.
virtual ~MeshWifiInterfaceMac()
D-tor.
bool IsSupportedRate(uint64_t bs) const
Check if the given rate is supported.
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, bool htShortGuardInterval, Time heGuardInterval)
Convert the guard interval to nanoseconds based on the wifimode.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
void SetBasicRate(uint64_t bs)
Set the given rate to basic rates.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
uint8_t GetPriority(void) const
Get the tag's priority.
virtual void DoDispose()
Real d-tor.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
void Report(std::ostream &) const
Statistics:
void SetLinkMetricCallback(Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > cb)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time GetTbtt() const
Next beacon frame time.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
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...
bool IsBasicRate(uint64_t bs) const
Check if the given rate is a basic rate.
Ptr< WifiPhy > m_phy
Wifi PHY.
WifiPhyStandard GetPhyStandard() const
Get phy standard in use.
Ptr< ChannelAccessManager > m_channelAccessManager
channel access manager
void SwitchFrequencyChannel(uint16_t new_id)
Switch frequency channel.
void SendBeacon()
Send beacon.
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)
void AddSupportedRate(uint64_t bs)
Add the given rate to the supported rates.
void Print(std::ostream &os) const
Print statistics.
void ResetStats()
Reset statistics.
void SendManagementFrame(Ptr< Packet > frame, const WifiMacHeader &hdr)
To be used by plugins sending management frames.
void RecordDisassociated(Mac48Address address)
Records that the STA was disassociated.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
uint16_t GetChannelWidth(void) const
void ScheduleNextBeacon()
Schedule next beacon.
virtual void DoInitialize()
Initialize() implementation.
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.
Mac48Address GetMeshPointAddress() const
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
AttributeValue implementation for Time.
void FinishConfigureStandard(WifiPhyStandard standard)
virtual bool SupportsSendFrom() const
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
indicates whether the socket has a priority set.
uint16_t recvBeacons
receive beacons
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
uint32_t sentFrames
sent frames
static Mac48Address GetBroadcast(void)
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
virtual void FinishConfigureStandard(enum WifiPhyStandard standard)
Finish configuration based on the WifiPhyStandard being provided.
uint32_t GetLinkMetric(Mac48Address peerAddress)
PluginList m_plugins
List of all installed plugins.
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
void NotifyNavResetNow(Time duration)
uint32_t sentBytes
sent bytes
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
uint32_t recvFrames
receive frames
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Time GetBeaconInterval() const
SupportedRates GetSupportedRates() const
Mac48Address m_mpAddress
Mesh point address.
void SetLinkUpCallback(Callback< void > linkUp)
virtual void DoDispose()
Destructor implementation.
OFDM PHY for the 5 GHz band (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
802.11 PHY layer modelThis PHY implements a model of 802.11a.
void AddSupportedMode(Mac48Address address, WifiMode mode)
Invoked in a STA or AP to store the set of modes supported by a destination which is also supported l...
Ptr< const AttributeChecker > MakeBooleanChecker(void)
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Time m_beaconInterval
Beaconing interval.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
void Receive(Ptr< Packet > packet, WifiMacHeader const *hdr)
Frame receive handler.
static Time Now(void)
Return the current simulation virtual time.
Time m_randomStart
Maximum delay before first beacon.
Beacon is beacon header + list of arbitrary information elements.
static TypeId GetTypeId()
Get the type ID.
virtual void SetLinkUpCallback(Callback< void > linkUp)
uint32_t recvBytes
receive bytes
Mac48Address GetAddress(void) const
uint8_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Statistics m_stats
statistics
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
uint16_t GetFrequencyChannel() const
Current channel Id.
WifiMode GetMode(uint8_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > m_linkMetricCallback
linkMetricCallback
virtual void Queue(Ptr< const Packet > packet, const WifiMacHeader &hdr)
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.
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
bool IsEqual(const Ssid &o) const
Check if the two SSIDs are equal.
bool CheckSupportedRates(SupportedRates rates) const
Check supported rates.
void SetBeaconGeneration(bool enable)
Enable/disable beacons.
EventId m_beaconSendEvent
"Timer" for the next beacon
void SetBeaconInterval(Time interval)
Set interval between two successive beacons.
void SetMeshPointAddress(Mac48Address)
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
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.)
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
void SetPriority(uint8_t priority)
Set the tag's priority.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
bool IsBrandNew(Mac48Address address) const
Return whether the station state is brand new.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Basic MAC of mesh point Wi-Fi interface.
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 an interface to work.
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Time GetGuardInterval(void) const