A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
38 class NetDevice;
39 
46 {
47 public:
48  AthstatsHelper ();
49  void EnableAthstats (std::string filename, uint32_t nodeid, uint32_t deviceid);
50  void EnableAthstats (std::string filename, Ptr<NetDevice> nd);
51  void EnableAthstats (std::string filename, NetDeviceContainer d);
52  void EnableAthstats (std::string filename, NodeContainer n);
53 
54 private:
56 };
57 
58 
59 
60 
83 {
84 public:
85  static TypeId GetTypeId (void);
87  virtual ~AthstatsWifiTraceSink ();
88 
89 
96  void DevTxTrace (std::string context, Ptr<const Packet> p);
97 
104  void DevRxTrace (std::string context, Ptr<const Packet> p);
105 
113  void TxRtsFailedTrace (std::string context, Mac48Address address);
114 
122  void TxDataFailedTrace (std::string context, Mac48Address address);
123 
131  void TxFinalRtsFailedTrace (std::string context, Mac48Address address);
132 
140  void TxFinalDataFailedTrace (std::string context, Mac48Address address);
141 
152  void PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble);
153 
163  void PhyRxErrorTrace (std::string context, Ptr<const Packet> packet, double snr);
164 
175  void PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower);
176 
186  void PhyStateTrace (std::string context, Time start, Time duration, enum WifiPhy::State state);
187 
193  void Open (std::string const& name);
194 
195 private:
199  void WriteStats ();
200 
204  void ResetCounters ();
205 
206  uint32_t m_txCount;
207  uint32_t m_rxCount;
211  uint32_t m_phyRxOkCount;
213  uint32_t m_phyTxCount;
214 
215  std::ofstream *m_writer;
216 
218 
219 }; // class AthstatsWifiTraceSink
220 
221 
222 
223 
224 } // namespace ns3
225 
226 
227 
228 
229 #endif /* ATHSTATS_HELPER_H */
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
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:60
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...
State
The state of the PHY layer.
Definition: wifi-phy.h:123
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:91
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:29
holds a vector of ns3::NetDevice pointers
void Open(std::string const &name)
Open a file for output.
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:41
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:64
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...
a unique identifier for an interface.
Definition: type-id.h:49
void DevRxTrace(std::string context, Ptr< const Packet > p)
function to be called when the net device receives a packet
static TypeId GetTypeId(void)