A Discrete-Event Network Simulator
API
ns3::AthstatsWifiTraceSink Class Reference

trace sink for wifi device that mimics madwifi's athstats tool. More...

#include "athstats-helper.h"

+ Inheritance diagram for ns3::AthstatsWifiTraceSink:
+ Collaboration diagram for ns3::AthstatsWifiTraceSink:

Public Member Functions

 AthstatsWifiTraceSink ()
 
 ~AthstatsWifiTraceSink () override
 
void DevRxTrace (std::string context, Ptr< const Packet > p)
 function to be called when the net device receives a packet More...
 
void DevTxTrace (std::string context, Ptr< const Packet > p)
 function to be called when the net device transmits a packet More...
 
void Open (const std::string &name)
 Open a file for output. More...
 
void PhyRxErrorTrace (std::string context, Ptr< const Packet > packet, double snr)
 Function to be called when a frame reception by the PHY layer of the considered device resulted in an error due to a failure in the CRC check of the frame. More...
 
void PhyRxOkTrace (std::string context, Ptr< const Packet > packet, double snr, WifiMode mode, WifiPreamble preamble)
 Function to be called when the PHY layer of the considered device receives a frame. More...
 
void PhyStateTrace (std::string context, Time start, Time duration, WifiPhyState state)
 Function to be called when the PHY layer of the considered device changes state. More...
 
void PhyTxTrace (std::string context, Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
 Function to be called when a frame is being transmitted by the PHY layer of the considered device. More...
 
void TxDataFailedTrace (std::string context, Mac48Address address)
 Function to be called when a data frame transmission by the considered device has failed. More...
 
void TxFinalDataFailedTrace (std::string context, Mac48Address address)
 Function to be called when the transmission of a data frame has exceeded the retry limit. More...
 
void TxFinalRtsFailedTrace (std::string context, Mac48Address address)
 Function to be called when the transmission of a RTS frame has exceeded the retry limit. More...
 
void TxRtsFailedTrace (std::string context, Mac48Address address)
 Function to be called when a RTS frame transmission by the considered device has failed. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
 ~Object () override
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose ()
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one. More...
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object. More...
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object. More...
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized () const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o[[maybe_unused]])
 Copy constructor. More...
 
uint32_t GetReferenceCount () const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o[[maybe_unused]])
 Assignment operator. More...
 
void Ref () const
 Increment the reference count. More...
 
void Unref () const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID. More...
 

Private Member Functions

void ResetCounters ()
 Reset counters function. More...
 
void WriteStats ()
 Write status function. More...
 

Private Attributes

uint32_t m_exceededRetryCount
 exceeded retry count More...
 
Time m_interval
 interval More...
 
uint32_t m_longRetryCount
 long retry count More...
 
uint32_t m_phyRxErrorCount
 PHY receive error count. More...
 
uint32_t m_phyRxOkCount
 PHY receive OK count. More...
 
uint32_t m_phyTxCount
 PHY transmit count. More...
 
uint32_t m_rxCount
 receive count More...
 
uint32_t m_shortRetryCount
 short retry count More...
 
uint32_t m_txCount
 transmit count More...
 
std::ofstream * m_writer
 output stream More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoDispose ()
 Destructor implementation. More...
 
virtual void DoInitialize ()
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed. More...
 

Detailed Description

trace sink for wifi device that mimics madwifi's athstats tool.

The AthstatsWifiTraceSink class is a trace sink to be connected to several of the traces available within a wifi device. The purpose of AthstatsWifiTraceSink is to mimic the behavior of the athstats tool distributed with the madwifi driver. In particular, the reproduced behavior is that obtained when executing athstats without parameters: a report written in text format is produced every fixed interval, based on the events observed by the wifi device.

Differences with the "real" athstats:

Definition at line 104 of file athstats-helper.h.

Constructor & Destructor Documentation

◆ AthstatsWifiTraceSink()

ns3::AthstatsWifiTraceSink::AthstatsWifiTraceSink ( )

Definition at line 130 of file athstats-helper.cc.

References ns3::Simulator::ScheduleNow(), and WriteStats().

+ Here is the call graph for this function:

◆ ~AthstatsWifiTraceSink()

ns3::AthstatsWifiTraceSink::~AthstatsWifiTraceSink ( )
override

Definition at line 144 of file athstats-helper.cc.

References m_writer, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Member Function Documentation

◆ DevRxTrace()

void ns3::AthstatsWifiTraceSink::DevRxTrace ( std::string  context,
Ptr< const Packet p 
)

function to be called when the net device receives a packet

Parameters
contextthe calling context
pthe packet being received

Definition at line 190 of file athstats-helper.cc.

References m_rxCount, and NS_LOG_FUNCTION.

Referenced by ns3::AthstatsHelper::EnableAthstats().

+ Here is the caller graph for this function:

◆ DevTxTrace()

void ns3::AthstatsWifiTraceSink::DevTxTrace ( std::string  context,
Ptr< const Packet p 
)

function to be called when the net device transmits a packet

Parameters
contextthe calling context
pthe packet being transmitted

Definition at line 183 of file athstats-helper.cc.

References m_txCount, and NS_LOG_FUNCTION.

Referenced by ns3::AthstatsHelper::EnableAthstats().

+ Here is the caller graph for this function:

◆ GetTypeId()

TypeId ns3::AthstatsWifiTraceSink::GetTypeId ( void  )
static

Get the type ID.

Returns
the object TypeId

Definition at line 116 of file athstats-helper.cc.

References m_interval, ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::Seconds(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ Open()

void ns3::AthstatsWifiTraceSink::Open ( const std::string &  name)

Open a file for output.

Parameters
namethe name of the file to be opened.

Definition at line 265 of file athstats-helper.cc.

References m_writer, NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_ASSERT_MSG, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

◆ PhyRxErrorTrace()

void ns3::AthstatsWifiTraceSink::PhyRxErrorTrace ( std::string  context,
Ptr< const Packet packet,
double  snr 
)

Function to be called when a frame reception by the PHY layer of the considered device resulted in an error due to a failure in the CRC check of the frame.

Parameters
contextthe calling context
packetthe packet
snrthe SNR in linear scale

Definition at line 237 of file athstats-helper.cc.

References m_phyRxErrorCount, and NS_LOG_FUNCTION.

Referenced by ns3::AthstatsHelper::EnableAthstats().

+ Here is the caller graph for this function:

◆ PhyRxOkTrace()

void ns3::AthstatsWifiTraceSink::PhyRxOkTrace ( std::string  context,
Ptr< const Packet packet,
double  snr,
WifiMode  mode,
WifiPreamble  preamble 
)

Function to be called when the PHY layer of the considered device receives a frame.

Parameters
contextthe calling context
packetthe packet
snrthe SNR in linear scale
modethe WifiMode
preamblethe wifi preamble

Definition at line 225 of file athstats-helper.cc.

References m_phyRxOkCount, and NS_LOG_FUNCTION.

Referenced by ns3::AthstatsHelper::EnableAthstats().

+ Here is the caller graph for this function:

◆ PhyStateTrace()

void ns3::AthstatsWifiTraceSink::PhyStateTrace ( std::string  context,
Time  start,
Time  duration,
WifiPhyState  state 
)

Function to be called when the PHY layer of the considered device changes state.

Parameters
contextthe calling context
startthe time at which the state changed
durationthe duration of the state
statethe PHY layer state

Definition at line 256 of file athstats-helper.cc.

References NS_LOG_FUNCTION, and two-ray-to-three-gpp-ch-calibration::start.

Referenced by ns3::AthstatsHelper::EnableAthstats().

+ Here is the caller graph for this function:

◆ PhyTxTrace()

void ns3::AthstatsWifiTraceSink::PhyTxTrace ( std::string  context,
Ptr< const Packet packet,
WifiMode  mode,
WifiPreamble  preamble,
uint8_t  txPower 
)

Function to be called when a frame is being transmitted by the PHY layer of the considered device.

Parameters
contextthe calling context
packetthe packet
modethe WifiMode
preamblethe wifi preamble
txPowerthe transmit power level

Definition at line 244 of file athstats-helper.cc.

References m_phyTxCount, and NS_LOG_FUNCTION.

Referenced by ns3::AthstatsHelper::EnableAthstats().

+ Here is the caller graph for this function:

◆ ResetCounters()

void ns3::AthstatsWifiTraceSink::ResetCounters ( )
private

Reset counters function.

Definition at line 170 of file athstats-helper.cc.

References m_exceededRetryCount, m_longRetryCount, m_phyRxErrorCount, m_phyRxOkCount, m_phyTxCount, m_rxCount, m_shortRetryCount, and m_txCount.

Referenced by WriteStats().

+ Here is the caller graph for this function:

◆ TxDataFailedTrace()

void ns3::AthstatsWifiTraceSink::TxDataFailedTrace ( std::string  context,
Mac48Address  address 
)

Function to be called when a data frame transmission by the considered device has failed.

Parameters
contextthe calling context
addressthe MAC address of the remote station

Definition at line 204 of file athstats-helper.cc.

References first::address, m_longRetryCount, and NS_LOG_FUNCTION.

Referenced by ns3::AthstatsHelper::EnableAthstats().

+ Here is the caller graph for this function:

◆ TxFinalDataFailedTrace()

void ns3::AthstatsWifiTraceSink::TxFinalDataFailedTrace ( std::string  context,
Mac48Address  address 
)

Function to be called when the transmission of a data frame has exceeded the retry limit.

Parameters
contextthe calling context
addressthe MAC address of the remote station

Definition at line 218 of file athstats-helper.cc.

References first::address, m_exceededRetryCount, and NS_LOG_FUNCTION.

Referenced by ns3::AthstatsHelper::EnableAthstats().

+ Here is the caller graph for this function:

◆ TxFinalRtsFailedTrace()

void ns3::AthstatsWifiTraceSink::TxFinalRtsFailedTrace ( std::string  context,
Mac48Address  address 
)

Function to be called when the transmission of a RTS frame has exceeded the retry limit.

Parameters
contextthe calling context
addressthe MAC address of the remote station

Definition at line 211 of file athstats-helper.cc.

References first::address, m_exceededRetryCount, and NS_LOG_FUNCTION.

Referenced by ns3::AthstatsHelper::EnableAthstats().

+ Here is the caller graph for this function:

◆ TxRtsFailedTrace()

void ns3::AthstatsWifiTraceSink::TxRtsFailedTrace ( std::string  context,
Mac48Address  address 
)

Function to be called when a RTS frame transmission by the considered device has failed.

Parameters
contextthe calling context
addressthe MAC address of the remote station

Definition at line 197 of file athstats-helper.cc.

References first::address, m_shortRetryCount, and NS_LOG_FUNCTION.

Referenced by ns3::AthstatsHelper::EnableAthstats().

+ Here is the caller graph for this function:

◆ WriteStats()

void ns3::AthstatsWifiTraceSink::WriteStats ( )
private

Write status function.

Definition at line 287 of file athstats-helper.cc.

References m_exceededRetryCount, m_interval, m_longRetryCount, m_phyRxErrorCount, m_rxCount, m_shortRetryCount, m_txCount, m_writer, NS_LOG_FUNCTION, ResetCounters(), and ns3::Simulator::Schedule().

Referenced by AthstatsWifiTraceSink().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_exceededRetryCount

uint32_t ns3::AthstatsWifiTraceSink::m_exceededRetryCount
private

exceeded retry count

Definition at line 238 of file athstats-helper.h.

Referenced by ResetCounters(), TxFinalDataFailedTrace(), TxFinalRtsFailedTrace(), and WriteStats().

◆ m_interval

Time ns3::AthstatsWifiTraceSink::m_interval
private

interval

Definition at line 245 of file athstats-helper.h.

Referenced by GetTypeId(), and WriteStats().

◆ m_longRetryCount

uint32_t ns3::AthstatsWifiTraceSink::m_longRetryCount
private

long retry count

Definition at line 237 of file athstats-helper.h.

Referenced by ResetCounters(), TxDataFailedTrace(), and WriteStats().

◆ m_phyRxErrorCount

uint32_t ns3::AthstatsWifiTraceSink::m_phyRxErrorCount
private

PHY receive error count.

Definition at line 240 of file athstats-helper.h.

Referenced by PhyRxErrorTrace(), ResetCounters(), and WriteStats().

◆ m_phyRxOkCount

uint32_t ns3::AthstatsWifiTraceSink::m_phyRxOkCount
private

PHY receive OK count.

Definition at line 239 of file athstats-helper.h.

Referenced by PhyRxOkTrace(), and ResetCounters().

◆ m_phyTxCount

uint32_t ns3::AthstatsWifiTraceSink::m_phyTxCount
private

PHY transmit count.

Definition at line 241 of file athstats-helper.h.

Referenced by PhyTxTrace(), and ResetCounters().

◆ m_rxCount

uint32_t ns3::AthstatsWifiTraceSink::m_rxCount
private

receive count

Definition at line 235 of file athstats-helper.h.

Referenced by DevRxTrace(), ResetCounters(), and WriteStats().

◆ m_shortRetryCount

uint32_t ns3::AthstatsWifiTraceSink::m_shortRetryCount
private

short retry count

Definition at line 236 of file athstats-helper.h.

Referenced by ResetCounters(), TxRtsFailedTrace(), and WriteStats().

◆ m_txCount

uint32_t ns3::AthstatsWifiTraceSink::m_txCount
private

transmit count

Definition at line 234 of file athstats-helper.h.

Referenced by DevTxTrace(), ResetCounters(), and WriteStats().

◆ m_writer

std::ofstream* ns3::AthstatsWifiTraceSink::m_writer
private

output stream

Definition at line 243 of file athstats-helper.h.

Referenced by ~AthstatsWifiTraceSink(), Open(), and WriteStats().


The documentation for this class was generated from the following files: