|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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;
a unique identifier for an interface.
virtual void SetLinkUpCallback(Callback< void > linkUp)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void SetLinkMetricCallback(Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > cb)
Set the link metric callback.
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
AttributeValue implementation for Boolean.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
static TypeId GetTypeId()
Get the type ID.
Ssid GetSsid(void) const override
static Time Now(void)
Return the current simulation virtual time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
SupportedRates GetSupportedRates() const
virtual void ConfigureStandard(enum WifiStandard standard)
Finish configuration based on the WifiStandard being provided.
void SendManagementFrame(Ptr< Packet > frame, const WifiMacHeader &hdr)
To be used by plugins sending management frames.
void SendBeacon()
Send beacon.
void SetBeaconInterval(Time interval)
Set interval between two successive beacons.
WifiMacHeader CreateHeader(Mac48Address address, Mac48Address mpAddress)
Create Wifi header for beacon frame.
uint8_t GetChannelNumber(void) const
Return current channel number.
WifiStandard m_standard
Current standard: needed to configure metric.
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
Mac48Address GetMeshPointAddress() const
Get the mesh point address.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
uint32_t sentFrames
sent frames
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
void SetLinkUpCallback(Callback< void > linkUp) override
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
base class for all MAC-level wifi objects.
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
void SetBasicRate(uint64_t bs)
Set the given rate to basic rates.
Time m_beaconInterval
Beaconing interval.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
virtual bool SupportsSendFrom() const
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > m_linkMetricCallback
linkMetricCallback
Statistics m_stats
statistics
void ResetStats()
Reset statistics function.
Beacon is beacon header + list of arbitrary information elements.
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Mac48Address GetAddress(void) const override
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 SetPriority(uint8_t priority)
Set the tag's priority.
bool IsSupportedRate(uint64_t bs) const
Check if the given rate is supported.
The Supported Rates Information Element.
Time GetBeaconInterval() const
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
static Mac48Address GetBroadcast(void)
uint16_t recvBeacons
receive beacons
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
represent a single transmission mode
void Print(std::ostream &os) const
Print statistics.
uint8_t GetPriority(void) const
Get the tag's priority.
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
virtual ~MeshWifiInterfaceMac()
D-tor.
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...
uint32_t recvFrames
receive frames
uint32_t sentBytes
sent bytes
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
void DoDispose() override
Destructor implementation.
MeshWifiInterfaceMac()
C-tor.
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr< WifiNetDevice > device)
Convert the guard interval to nanoseconds based on the WifiMode.
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
bool IsEqual(const Ssid &o) const
Check if the two SSIDs are equal.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Ptr< Txop > m_txop
This holds a pointer to the TXOP instance for this WifiMac - used for transmission of frames to non-Q...
virtual void DoDispose()
Real d-tor.
Ptr< WifiRemoteStationManager > m_stationManager
Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Ptr< Packet > CreatePacket()
Create frame = { beacon header + all information elements sorted by ElementId () }.
uint32_t recvBytes
receive bytes
bool IsBrandNew(Mac48Address address) const
Return whether the station state is brand new.
Simulation virtual time values and global simulation resolution.
bool IsBasicRate(uint64_t bs) const
Check if the given rate is a basic rate.
void SetTypeOfStation(TypeOfStation type) override
This method is invoked by a subclass to specify what type of station it is implementing.
uint16_t GetFrequencyChannel() const
Current channel Id.
virtual void DoInitialize()
Initialize() implementation.
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
void SetBeaconGeneration(bool enable)
Enable/disable beacons.
Time m_randomStart
Maximum delay before first beacon.
EventId m_beaconSendEvent
"Timer" for the next beacon
virtual void SetQosSupported(bool enable)
Enable or disable QoS support for the device.
void RecordDisassociated(Mac48Address address)
Records that the STA was disassociated.
indicates whether the socket has a priority set.
void ConfigureStandard(WifiStandard standard) override
void SwitchFrequencyChannel(uint16_t new_id)
Switch frequency channel.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void ShiftTbtt(Time shift)
Shift TBTT.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
bool m_beaconEnable
Beaconing interval.
uint32_t GetLinkMetric(Mac48Address peerAddress)
Get the link metric.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
AttributeValue implementation for Time.
Ptr< UniformRandomVariable > m_coefficient
Add randomness to beacon generation.
uint16_t GetChannelWidth(void) const
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
void ScheduleNextBeacon()
Schedule next beacon.
std::list< WifiMode > GetModeList(void) const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Ptr< ChannelAccessManager > m_channelAccessManager
channel access manager
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Time m_tbtt
Time for the next frame.
void InstallPlugin(Ptr< MeshWifiInterfaceMacPlugin > plugin)
Install plugin.
void ForwardDown(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Send frame.
void AddSupportedRate(uint64_t bs)
Add the given rate to the supported rates.
Ptr< WifiPhy > m_phy
Wifi PHY.
void SetMeshPointAddress(Mac48Address addr)
Set the mesh point address.
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
WifiStandard
Identifies the allowed configurations that a Wifi device is configured to use.
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
virtual void SetChannelNumber(uint8_t id)
Set channel number.
void Receive(Ptr< WifiMacQueueItem > mpdu)
Frame receive handler.
void SetRandomStartDelay(Time interval)
Set maximum initial random delay before first beacon.
void Report(std::ostream &os) const
Report statistics.
virtual void SetParent(Ptr< MeshWifiInterfaceMac > parent)=0
Each plugin must be installed on an interface to work.
virtual void Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from)
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Time GetTbtt() const
Next beacon frame time.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Mac48Address m_mpAddress
Mesh point address.
bool CheckSupportedRates(SupportedRates rates) const
Check supported rates.
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
bool GetBeaconGeneration() const
Get current beaconing status.
Basic MAC of mesh point Wi-Fi interface.
PluginList m_plugins
List of all installed plugins.