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 
26 namespace ns3 {
27 
28 class NetDevice;
29 class NodeContainer;
30 class NetDeviceContainer;
31 class Packet;
32 class Mac48Address;
33 
40 {
41 public:
42  AthstatsHelper ();
49  void EnableAthstats (std::string filename, uint32_t nodeid, uint32_t deviceid);
55  void EnableAthstats (std::string filename, Ptr<NetDevice> nd);
61  void EnableAthstats (std::string filename, NetDeviceContainer d);
67  void EnableAthstats (std::string filename, NodeContainer n);
68 
69 private:
71 };
72 
73 
96 {
97 public:
102  static TypeId GetTypeId (void);
104  virtual ~AthstatsWifiTraceSink ();
105 
112  void DevTxTrace (std::string context, Ptr<const Packet> p);
113 
120  void DevRxTrace (std::string context, Ptr<const Packet> p);
121 
129  void TxRtsFailedTrace (std::string context, Mac48Address address);
130 
138  void TxDataFailedTrace (std::string context, Mac48Address address);
139 
147  void TxFinalRtsFailedTrace (std::string context, Mac48Address address);
148 
156  void TxFinalDataFailedTrace (std::string context, Mac48Address address);
157 
168  void PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, WifiPreamble preamble);
169 
179  void PhyRxErrorTrace (std::string context, Ptr<const Packet> packet, double snr);
180 
191  void PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower);
192 
202  void PhyStateTrace (std::string context, Time start, Time duration, WifiPhyState state);
203 
209  void Open (std::string const& name);
210 
211 
212 private:
214  void WriteStats ();
216  void ResetCounters ();
217 
218  uint32_t m_txCount;
219  uint32_t m_rxCount;
220  uint32_t m_shortRetryCount;
221  uint32_t m_longRetryCount;
223  uint32_t m_phyRxOkCount;
224  uint32_t m_phyRxErrorCount;
225  uint32_t m_phyTxCount;
226 
227  std::ofstream *m_writer;
228 
230 
231 }; //class AthstatsWifiTraceSink
232 
233 } // namespace ns3
234 
235 #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 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:1844
uint32_t m_phyRxOkCount
phy receive ok count
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.
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&#39;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.
address
Definition: first.py:37
create AthstatsWifiTraceSink instances and connect them to wifi devices
WifiPhyState
The state of the PHY layer.
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 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
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.
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.
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.