A Discrete-Event Network Simulator
API
athstats-helper.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 CTTC
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 #ifndef ATHSTATS_HELPER_H
22 #define ATHSTATS_HELPER_H
23 
24 #include "ns3/wifi-phy-state.h"
25 #include "ns3/wifi-phy-common.h"
26 
27 namespace ns3 {
28 
29 class NetDevice;
30 class NodeContainer;
31 class NetDeviceContainer;
32 class Packet;
33 class Mac48Address;
34 class WifiMode;
35 
42 {
43 public:
44  AthstatsHelper ();
51  void EnableAthstats (std::string filename, uint32_t nodeid, uint32_t deviceid);
57  void EnableAthstats (std::string filename, Ptr<NetDevice> nd);
63  void EnableAthstats (std::string filename, NetDeviceContainer d);
69  void EnableAthstats (std::string filename, NodeContainer n);
70 
71 private:
73 };
74 
75 
98 {
99 public:
104  static TypeId GetTypeId (void);
106  virtual ~AthstatsWifiTraceSink ();
107 
114  void DevTxTrace (std::string context, Ptr<const Packet> p);
115 
122  void DevRxTrace (std::string context, Ptr<const Packet> p);
123 
131  void TxRtsFailedTrace (std::string context, Mac48Address address);
132 
140  void TxDataFailedTrace (std::string context, Mac48Address address);
141 
149  void TxFinalRtsFailedTrace (std::string context, Mac48Address address);
150 
158  void TxFinalDataFailedTrace (std::string context, Mac48Address address);
159 
170  void PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, WifiPreamble preamble);
171 
181  void PhyRxErrorTrace (std::string context, Ptr<const Packet> packet, double snr);
182 
193  void PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower);
194 
204  void PhyStateTrace (std::string context, Time start, Time duration, WifiPhyState state);
205 
211  void Open (std::string const& name);
212 
213 
214 private:
216  void WriteStats ();
218  void ResetCounters ();
219 
220  uint32_t m_txCount;
221  uint32_t m_rxCount;
222  uint32_t m_shortRetryCount;
223  uint32_t m_longRetryCount;
225  uint32_t m_phyRxOkCount;
226  uint32_t m_phyRxErrorCount;
227  uint32_t m_phyTxCount;
228 
229  std::ofstream *m_writer;
230 
232 
233 }; //class AthstatsWifiTraceSink
234 
235 } // namespace ns3
236 
237 #endif /* ATHSTATS_HELPER_H */
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition: net-device-container.h:42
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::AthstatsWifiTraceSink::m_rxCount
uint32_t m_rxCount
receive count
Definition: athstats-helper.h:221
ns3::AthstatsWifiTraceSink
trace sink for wifi device that mimics madwifi's athstats tool.
Definition: athstats-helper.h:98
ns3::AthstatsWifiTraceSink::TxRtsFailedTrace
void TxRtsFailedTrace(std::string context, Mac48Address address)
Function to be called when a RTS frame transmission by the considered device has failed.
Definition: athstats-helper.cc:186
ns3::AthstatsWifiTraceSink::TxDataFailedTrace
void TxDataFailedTrace(std::string context, Mac48Address address)
Function to be called when a data frame transmission by the considered device has failed.
Definition: athstats-helper.cc:193
ns3::AthstatsHelper::EnableAthstats
void EnableAthstats(std::string filename, uint32_t nodeid, uint32_t deviceid)
Enable athstats.
Definition: athstats-helper.cc:43
ns3::AthstatsWifiTraceSink::PhyTxTrace
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.
Definition: athstats-helper.cc:228
ns3::AthstatsWifiTraceSink::m_phyRxErrorCount
uint32_t m_phyRxErrorCount
PHY receive error count.
Definition: athstats-helper.h:226
ns3::AthstatsWifiTraceSink::AthstatsWifiTraceSink
AthstatsWifiTraceSink()
Definition: athstats-helper.cc:119
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::AthstatsWifiTraceSink::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: athstats-helper.cc:104
ns3::AthstatsHelper::m_interval
Time m_interval
interval
Definition: athstats-helper.h:72
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::AthstatsWifiTraceSink::WriteStats
void WriteStats()
Write status function.
Definition: athstats-helper.cc:260
ns3::AthstatsWifiTraceSink::m_shortRetryCount
uint32_t m_shortRetryCount
short retry count
Definition: athstats-helper.h:222
ns3::AthstatsWifiTraceSink::m_longRetryCount
uint32_t m_longRetryCount
long retry count
Definition: athstats-helper.h:223
ns3::AthstatsWifiTraceSink::DevRxTrace
void DevRxTrace(std::string context, Ptr< const Packet > p)
function to be called when the net device receives a packet
Definition: athstats-helper.cc:179
ns3::Ptr< NetDevice >
visualizer.core.start
def start()
Definition: core.py:1855
ns3::WifiMode
represent a single transmission mode
Definition: wifi-mode.h:48
ns3::Object
A base class which provides memory management and object aggregation.
Definition: object.h:88
ns3::AthstatsWifiTraceSink::m_interval
Time m_interval
interval
Definition: athstats-helper.h:231
ns3::AthstatsWifiTraceSink::m_txCount
uint32_t m_txCount
transmit count
Definition: athstats-helper.h:220
ns3::AthstatsWifiTraceSink::TxFinalRtsFailedTrace
void TxFinalRtsFailedTrace(std::string context, Mac48Address address)
Function to be called when the transmission of a RTS frame has exceeded the retry limit.
Definition: athstats-helper.cc:200
first.address
address
Definition: first.py:44
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
WifiPhyState
WifiPhyState
The state of the PHY layer.
Definition: wifi-phy-state.h:32
ns3::WifiPreamble
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-phy-common.h:68
ns3::AthstatsWifiTraceSink::PhyStateTrace
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.
Definition: athstats-helper.cc:235
ns3::AthstatsWifiTraceSink::m_exceededRetryCount
uint32_t m_exceededRetryCount
exceeded retry count
Definition: athstats-helper.h:224
ns3::AthstatsHelper::AthstatsHelper
AthstatsHelper()
Definition: athstats-helper.cc:37
ns3::AthstatsWifiTraceSink::PhyRxErrorTrace
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...
Definition: athstats-helper.cc:221
ns3::AthstatsWifiTraceSink::m_writer
std::ofstream * m_writer
output stream
Definition: athstats-helper.h:229
ns3::AthstatsWifiTraceSink::TxFinalDataFailedTrace
void TxFinalDataFailedTrace(std::string context, Mac48Address address)
Function to be called when the transmission of a data frame has exceeded the retry limit.
Definition: athstats-helper.cc:207
ns3::NodeContainer
keep track of a set of node pointers.
Definition: node-container.h:39
ns3::AthstatsWifiTraceSink::~AthstatsWifiTraceSink
virtual ~AthstatsWifiTraceSink()
Definition: athstats-helper.cc:133
ns3::AthstatsWifiTraceSink::PhyRxOkTrace
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.
Definition: athstats-helper.cc:214
ns3::AthstatsWifiTraceSink::ResetCounters
void ResetCounters()
Reset counters function.
Definition: athstats-helper.cc:159
ns3::AthstatsWifiTraceSink::Open
void Open(std::string const &name)
Open a file for output.
Definition: athstats-helper.cc:241
ns3::AthstatsHelper
create AthstatsWifiTraceSink instances and connect them to wifi devices
Definition: athstats-helper.h:42
ns3::AthstatsWifiTraceSink::DevTxTrace
void DevTxTrace(std::string context, Ptr< const Packet > p)
function to be called when the net device transmits a packet
Definition: athstats-helper.cc:172
ns3::AthstatsWifiTraceSink::m_phyTxCount
uint32_t m_phyTxCount
PHY transmit count.
Definition: athstats-helper.h:227
sample-rng-plot.n
n
Definition: sample-rng-plot.py:37
ns3::AthstatsWifiTraceSink::m_phyRxOkCount
uint32_t m_phyRxOkCount
PHY receive OK count.
Definition: athstats-helper.h:225