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 <string>
25 #include "ns3/object.h"
26 #include "ns3/attribute.h"
27 #include "ns3/object-factory.h"
28 #include "ns3/node-container.h"
29 #include "ns3/net-device-container.h"
30 #include "ns3/nstime.h"
31 #include "ns3/wifi-phy.h"
32 #include "ns3/double.h"
33 #include "ns3/mac48-address.h"
34 
35 namespace ns3 {
36 
37 class NetDevice;
38 
45 {
46 public:
47  AthstatsHelper ();
48  void EnableAthstats (std::string filename, uint32_t nodeid, uint32_t deviceid);
49  void EnableAthstats (std::string filename, Ptr<NetDevice> nd);
50  void EnableAthstats (std::string filename, NetDeviceContainer d);
51  void EnableAthstats (std::string filename, NodeContainer n);
52 
53 private:
55 };
56 
57 
80 {
81 public:
82  static TypeId GetTypeId (void);
84  virtual ~AthstatsWifiTraceSink ();
85 
92  void DevTxTrace (std::string context, Ptr<const Packet> p);
93 
100  void DevRxTrace (std::string context, Ptr<const Packet> p);
101 
109  void TxRtsFailedTrace (std::string context, Mac48Address address);
110 
118  void TxDataFailedTrace (std::string context, Mac48Address address);
119 
127  void TxFinalRtsFailedTrace (std::string context, Mac48Address address);
128 
136  void TxFinalDataFailedTrace (std::string context, Mac48Address address);
137 
148  void PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble);
149 
159  void PhyRxErrorTrace (std::string context, Ptr<const Packet> packet, double snr);
160 
171  void PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower);
172 
182  void PhyStateTrace (std::string context, Time start, Time duration, enum WifiPhy::State state);
183 
189  void Open (std::string const& name);
190 
191 
192 private:
193  void WriteStats ();
194  void ResetCounters ();
195 
196  uint32_t m_txCount;
197  uint32_t m_rxCount;
201  uint32_t m_phyRxOkCount;
203  uint32_t m_phyTxCount;
204 
205  std::ofstream *m_writer;
206 
208 
209 }; //class AthstatsWifiTraceSink
210 
211 } // namespace ns3
212 
213 #endif /* ATHSTATS_HELPER_H */
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
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:1482
void TxRtsFailedTrace(std::string context, Mac48Address address)
Function to be called when a RTS frame transmission by the considered device has failed.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:99
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
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
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
void EnableAthstats(std::string filename, uint32_t nodeid, uint32_t deviceid)
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...
State
The state of the PHY layer.
Definition: wifi-phy.h:168
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)