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/socket.h"
50 .SetGroupName (
"Mesh")
52 .AddAttribute (
"BeaconInterval",
60 .AddAttribute (
"RandomStart",
61 "Window when beacon generating starts (uniform random) in seconds",
67 .AddAttribute (
"BeaconGeneration",
68 "Enable/Disable Beaconing.",
154 int64_t currentStream = stream;
158 currentStream += (*i)->AssignStreams (currentStream);
160 return (currentStream - stream);
237 for (PluginList::const_iterator i =
m_plugins.end () - 1; i !=
m_plugins.begin () - 1; i--)
239 bool drop = !((*i)->UpdateOutcomingFrame (packet, hdr, from, to));
275 m_edca[ac]->Queue (packet, hdr);
282 for (PluginList::const_iterator i =
m_plugins.end () - 1; i !=
m_plugins.begin () - 1; i--)
413 (*i)->UpdateBeacon (beacon);
464 bool drop = !((*i)->Receive (packet, *hdr));
526 "rxBeacons=\"" << recvBeacons <<
"\" "
527 "txFrames=\"" << sentFrames <<
"\" "
528 "txBytes=\"" << sentBytes <<
"\" "
529 "rxFrames=\"" << recvFrames <<
"\" "
530 "rxBytes=\"" << recvBytes <<
"\"/>" << std::endl;
538 "Address = \"" <<
GetAddress () <<
"\">" << std::endl;
540 os <<
"</Interface>" << std::endl;
void AddSupportedRate(uint32_t bs)
Add the given rate to the supported rates.
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 this RNG stream.
AttributeValue implementation for Boolean.
virtual bool GetGuardInterval(void) const
Return whether guard interval is being used.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time GetBeaconInterval() const
Ptr< UniformRandomVariable > m_coefficient
Add randomness to beacon generation.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
bool m_beaconEnable
whether beaconing is enabled
virtual ~MeshWifiInterfaceMac()
D-tor.
SupportedRates GetSupportedRates() const
WifiPhyStandard GetPhyStandard() const
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.
bool CheckSupportedRates(SupportedRates rates) const
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)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
#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 IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Ptr< WifiPhy > m_phy
Wifi PHY.
bool IsBrandNew(Mac48Address address) const
Return whether the station state is brand new.
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.
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.
void NotifyNavResetNow(Time duration)
void ScheduleNextBeacon()
Schedule next beacon.
virtual void DoInitialize()
Initialize() implementation.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
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.
virtual uint16_t GetChannelNumber(void) const
Return current channel number.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
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
Get an approximation of the time stored in this instance in the indicated unit.
AttributeValue implementation for Time.
Ptr< DcaTxop > m_dca
This holds a pointer to the DCF instance for this WifiMac - used for transmission of frames to non-Qo...
WifiMode GetBasicMode(uint32_t i) const
Return a basic mode from the set of basic modes.
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
indicates whether the socket has a priority set.
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
static Mac48Address GetBroadcast(void)
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
uint16_t GetFrequencyChannel() const
Current channel Id.
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.
virtual uint32_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
virtual void SetChannelNumber(uint16_t id)
Set channel number.
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
performs a COW copy of the packet.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Mac48Address m_mpAddress
Mesh point address.
virtual uint32_t GetChannelWidth(void) const
virtual 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)
DcfManager * m_dcfManager
DCF manager (access to channel)
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
Time m_beaconInterval
Beaconing interval.
uint64_t GetDataRate(uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
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.
uint8_t GetPriority(void) const
Get the tag's priority.
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
uint32_t GetNBasicModes(void) const
Return the number of basic modes we support.
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)
Use NS_LOG to output a message of level LOG_DEBUG.
virtual Mac48Address GetAddress(void) const
Time Seconds(double value)
Construct a Time in the indicated unit.
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.
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.)
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.
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 interface to work.
virtual WifiMode GetMode(uint32_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
virtual void FinishConfigureStandard(enum WifiPhyStandard standard)