22 #include "ns3/mesh-wifi-interface-mac.h" 23 #include "ns3/mesh-wifi-beacon.h" 25 #include "ns3/boolean.h" 26 #include "ns3/random-variable-stream.h" 27 #include "ns3/simulator.h" 28 #include "ns3/yans-wifi-phy.h" 29 #include "ns3/wifi-utils.h" 30 #include "ns3/pointer.h" 31 #include "ns3/double.h" 32 #include "ns3/trace-source-accessor.h" 33 #include "ns3/socket.h" 34 #include "ns3/wifi-net-device.h" 35 #include "ns3/channel-access-manager.h" 48 .SetGroupName (
"Mesh")
50 .AddAttribute (
"BeaconInterval",
58 .AddAttribute (
"RandomStart",
59 "Window when beacon generating starts (uniform random) in seconds",
65 .AddAttribute (
"BeaconGeneration",
66 "Enable/Disable Beaconing.",
152 int64_t currentStream = stream;
156 currentStream += (*i)->AssignStreams (currentStream);
158 return (currentStream - stream);
224 for (PluginList::const_iterator i =
m_plugins.end () - 1; i !=
m_plugins.begin () - 1; i--)
226 bool drop = !((*i)->UpdateOutcomingFrame (packet, hdr, from, to));
262 m_edca[ac]->Queue (packet, hdr);
269 for (PluginList::const_iterator i =
m_plugins.end () - 1; i !=
m_plugins.begin () - 1; i--)
402 (*i)->UpdateBeacon (beacon);
456 bool drop = !((*i)->Receive (packet, *hdr));
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;
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
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 SetLinkUpCallback(Callback< void > linkUp) override
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
Beaconing interval.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
virtual ~MeshWifiInterfaceMac()
D-tor.
bool IsSupportedRate(uint64_t bs) const
Check if the given rate is supported.
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.
std::list< WifiMode > GetModeList(void) const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
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 SetLinkMetricCallback(Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > cb)
Set the link metric callback.
#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...
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from)
bool IsBasicRate(uint64_t bs) const
Check if the given rate is a basic rate.
Ptr< WifiPhy > m_phy
Wifi PHY.
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...
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 function.
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.
void Report(std::ostream &os) const
Report statistics.
uint16_t GetChannelWidth(void) const
void ScheduleNextBeacon()
Schedule next beacon.
virtual void DoInitialize()
Initialize() implementation.
base class for all MAC-level wifi objects.
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Mac48Address GetMeshPointAddress() const
Get the mesh point address.
AttributeValue implementation for Time.
virtual bool SupportsSendFrom() const
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr< WifiNetDevice > device)
Convert the guard interval to nanoseconds based on the WifiMode.
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
void DoDispose() override
Destructor implementation.
static Mac48Address GetBroadcast(void)
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
void ForwardDown(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Send frame.
uint32_t GetLinkMetric(Mac48Address peerAddress)
Get the link metric.
PluginList m_plugins
List of all installed plugins.
uint32_t sentBytes
sent bytes
uint32_t recvFrames
receive frames
WifiStandard m_standard
Current standard: needed to configure metric.
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
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
Mac48Address m_mpAddress
Mesh point address.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiStandard
Identifies the allowed configurations that a Wifi device is configured to use.
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...
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.
virtual void SetChannelNumber(uint8_t id)
Set channel number.
void SetTypeOfStation(TypeOfStation type) override
This method is invoked by a subclass to specify what type of station it is implementing.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
uint8_t GetChannelNumber(void) const
Return current channel number.
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
Statistics m_stats
statistics
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
uint16_t GetFrequencyChannel() const
Current channel Id.
Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > m_linkMetricCallback
linkMetricCallback
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.
virtual void ConfigureStandard(enum WifiStandard standard)
Finish configuration based on the WifiStandard being provided.
void SetMeshPointAddress(Mac48Address addr)
Set the mesh point address.
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.
Ssid GetSsid(void) const override
Ptr< const AttributeChecker > MakeBooleanChecker(void)
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.
void ConfigureStandard(WifiStandard standard) override
void Receive(Ptr< WifiMacQueueItem > mpdu)
Frame receive handler.
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
bool CheckSupportedRates(SupportedRates rates) const
Check supported rates.
void SetBeaconGeneration(bool enable)
Enable/disable beacons.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
Mac48Address GetAddress(void) const override
EventId m_beaconSendEvent
"Timer" for the next beacon
void SetBeaconInterval(Time interval)
Set interval between two successive beacons.
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.
virtual void Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
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.
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