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/node-container.h"
25 #include "ns3/net-device-container.h"
26 #include "ns3/wifi-phy.h"
27 
28 namespace ns3 {
29 
30 class NetDevice;
31 
38 {
39 public:
40  AthstatsHelper ();
47  void EnableAthstats (std::string filename, uint32_t nodeid, uint32_t deviceid);
53  void EnableAthstats (std::string filename, Ptr<NetDevice> nd);
59  void EnableAthstats (std::string filename, NetDeviceContainer d);
65  void EnableAthstats (std::string filename, NodeContainer n);
66 
67 private:
69 };
70 
71 
94 {
95 public:
100  static TypeId GetTypeId (void);
102  virtual ~AthstatsWifiTraceSink ();
103 
110  void DevTxTrace (std::string context, Ptr<const Packet> p);
111 
118  void DevRxTrace (std::string context, Ptr<const Packet> p);
119 
127  void TxRtsFailedTrace (std::string context, Mac48Address address);
128 
136  void TxDataFailedTrace (std::string context, Mac48Address address);
137 
145  void TxFinalRtsFailedTrace (std::string context, Mac48Address address);
146 
154  void TxFinalDataFailedTrace (std::string context, Mac48Address address);
155 
166  void PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble);
167 
177  void PhyRxErrorTrace (std::string context, Ptr<const Packet> packet, double snr);
178 
189  void PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower);
190 
200  void PhyStateTrace (std::string context, Time start, Time duration, enum WifiPhy::State state);
201 
207  void Open (std::string const& name);
208 
209 
210 private:
212  void WriteStats ();
214  void ResetCounters ();
215 
216  uint32_t m_txCount;
217  uint32_t m_rxCount;
218  uint32_t m_shortRetryCount;
219  uint32_t m_longRetryCount;
221  uint32_t m_phyRxOkCount;
222  uint32_t m_phyRxErrorCount;
223  uint32_t m_phyTxCount;
224 
225  std::ofstream *m_writer;
226 
228 
229 }; //class AthstatsWifiTraceSink
230 
231 } // namespace ns3
232 
233 #endif /* ATHSTATS_HELPER_H */
Time m_interval
interval
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
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...
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
void DevTxTrace(std::string context, Ptr< const Packet > p)
function to be called when the net device transmits a packet
uint32_t m_rxCount
receive count
void PhyStateTrace(std::string context, Time start, Time duration, enum WifiPhy::State state)
Function to be called when the PHY layer of the considered device changes state.
void TxFinalRtsFailedTrace(std::string context, Mac48Address address)
Function to be called when the transmission of a RTS frame has exceeded the retry limit...
def start()
Definition: core.py:1790
uint32_t m_phyRxOkCount
phy receive ok count
void TxRtsFailedTrace(std::string context, Mac48Address address)
Function to be called when a RTS frame transmission by the considered device has failed.
uint32_t m_shortRetryCount
short retry count
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
trace sink for wifi device that mimics madwifi's athstats tool.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:30
std::ofstream * m_writer
output stream
uint32_t m_txCount
transmit count
holds a vector of ns3::NetDevice pointers
void Open(std::string const &name)
Open a file for output.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
create AthstatsWifiTraceSink instances and connect them to wifi devices
uint32_t m_exceededRetryCount
exceeded 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...
an EUI-48 address
Definition: mac48-address.h:43
uint32_t m_longRetryCount
long retry count
void EnableAthstats(std::string filename, uint32_t nodeid, uint32_t deviceid)
Enable athstats.
uint32_t m_phyRxErrorCount
phy receive error count
uint32_t m_phyTxCount
phy transmit count
void WriteStats()
Write status function.
void PhyRxOkTrace(std::string context, Ptr< const Packet > packet, double snr, WifiMode mode, enum WifiPreamble preamble)
Function to be called when the PHY layer of the considered device receives a frame.
void TxFinalDataFailedTrace(std::string context, Mac48Address address)
Function to be called when the transmission of a data frame has exceeded the retry limit...
A base class which provides memory management and object aggregation.
Definition: object.h:87
tuple address
Definition: first.py:37
void TxDataFailedTrace(std::string context, Mac48Address address)
Function to be called when a data frame transmission by the considered device has failed...
void ResetCounters()
Reset counters function.
State
The state of the PHY layer.
Definition: wifi-phy.h:171
a unique identifier for an interface.
Definition: type-id.h:58
void DevRxTrace(std::string context, Ptr< const Packet > p)
function to be called when the net device receives a packet
static TypeId GetTypeId(void)
Get the type ID.