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 <stdint.h>
25 #include <iosfwd>
26 #include <string>
27 #include "ns3/nstime.h"
28 #include "ns3/object.h"
29 #include "ns3/ptr.h"
30 #include "ns3/type-id.h"
31 #include "ns3/wifi-phy-state.h"
32 #include "ns3/wifi-phy-common.h"
33 
34 namespace ns3 {
35 
36 class NetDevice;
37 class NodeContainer;
38 class NetDeviceContainer;
39 class Packet;
40 class Mac48Address;
41 class WifiMode;
42 
49 {
50 public:
51  AthstatsHelper ();
58  void EnableAthstats (std::string filename, uint32_t nodeid, uint32_t deviceid);
64  void EnableAthstats (std::string filename, Ptr<NetDevice> nd);
70  void EnableAthstats (std::string filename, NetDeviceContainer d);
76  void EnableAthstats (std::string filename, NodeContainer n);
77 
78 private:
80 };
81 
82 
105 {
106 public:
111  static TypeId GetTypeId (void);
113  virtual ~AthstatsWifiTraceSink ();
114 
121  void DevTxTrace (std::string context, Ptr<const Packet> p);
122 
129  void DevRxTrace (std::string context, Ptr<const Packet> p);
130 
138  void TxRtsFailedTrace (std::string context, Mac48Address address);
139 
147  void TxDataFailedTrace (std::string context, Mac48Address address);
148 
156  void TxFinalRtsFailedTrace (std::string context, Mac48Address address);
157 
165  void TxFinalDataFailedTrace (std::string context, Mac48Address address);
166 
177  void PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, WifiPreamble preamble);
178 
188  void PhyRxErrorTrace (std::string context, Ptr<const Packet> packet, double snr);
189 
200  void PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower);
201 
211  void PhyStateTrace (std::string context, Time start, Time duration, WifiPhyState state);
212 
218  void Open (std::string const& name);
219 
220 
221 private:
223  void WriteStats ();
225  void ResetCounters ();
226 
227  uint32_t m_txCount;
228  uint32_t m_rxCount;
229  uint32_t m_shortRetryCount;
230  uint32_t m_longRetryCount;
232  uint32_t m_phyRxOkCount;
233  uint32_t m_phyRxErrorCount;
234  uint32_t m_phyTxCount;
235 
236  std::ofstream *m_writer;
237 
239 
240 }; //class AthstatsWifiTraceSink
241 
242 } // namespace ns3
243 
244 #endif /* ATHSTATS_HELPER_H */
create AthstatsWifiTraceSink instances and connect them to wifi devices
Time m_interval
interval
void EnableAthstats(std::string filename, uint32_t nodeid, uint32_t deviceid)
Enable athstats.
trace sink for wifi device that mimics madwifi's athstats tool.
void TxFinalRtsFailedTrace(std::string context, Mac48Address address)
Function to be called when the transmission of a RTS frame has exceeded the retry limit.
void TxFinalDataFailedTrace(std::string context, Mac48Address address)
Function to be called when the transmission of a data frame has exceeded the retry limit.
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.
uint32_t m_txCount
transmit count
void DevRxTrace(std::string context, Ptr< const Packet > p)
function to be called when the net device receives a packet
std::ofstream * m_writer
output stream
uint32_t m_rxCount
receive count
uint32_t m_shortRetryCount
short retry count
void WriteStats()
Write status function.
void TxRtsFailedTrace(std::string context, Mac48Address address)
Function to be called when a RTS frame transmission by the considered device has failed.
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.
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...
static TypeId GetTypeId(void)
Get the type ID.
void DevTxTrace(std::string context, Ptr< const Packet > p)
function to be called when the net device transmits a packet
uint32_t m_longRetryCount
long retry count
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.
uint32_t m_phyTxCount
PHY transmit count.
void TxDataFailedTrace(std::string context, Mac48Address address)
Function to be called when a data frame transmission by the considered device has failed.
uint32_t m_phyRxOkCount
PHY receive OK count.
uint32_t m_phyRxErrorCount
PHY receive error count.
void ResetCounters()
Reset counters function.
void Open(std::string const &name)
Open a file for output.
uint32_t m_exceededRetryCount
exceeded retry count
an EUI-48 address
Definition: mac48-address.h:44
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
A base class which provides memory management and object aggregation.
Definition: object.h:88
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
a unique identifier for an interface.
Definition: type-id.h:59
represent a single transmission mode
Definition: wifi-mode.h:48
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
address
Definition: first.py:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.
def start()
Definition: core.py:1853
WifiPhyState
The state of the PHY layer.