/usr/include/ns3.27/ns3/athstats-helper.h is in libns3-dev 3.27+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 CTTC
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicola Baldo <nbaldo@cttc.es>
*/
#ifndef ATHSTATS_HELPER_H
#define ATHSTATS_HELPER_H
#include "ns3/node-container.h"
#include "ns3/net-device-container.h"
#include "ns3/wifi-phy.h"
namespace ns3 {
class NetDevice;
/**
* @brief create AthstatsWifiTraceSink instances and connect them to wifi devices
*
*
*/
class AthstatsHelper
{
public:
AthstatsHelper ();
/**
* Enable athstats
* \param filename the file name
* \param nodeid the node ID
* \param deviceid the device ID
*/
void EnableAthstats (std::string filename, uint32_t nodeid, uint32_t deviceid);
/**
* Enable athstats
* \param filename the file name
* \param nd the device
*/
void EnableAthstats (std::string filename, Ptr<NetDevice> nd);
/**
* Enable athstats
* \param filename the file name
* \param d the collection of devices
*/
void EnableAthstats (std::string filename, NetDeviceContainer d);
/**
* Enable athstats
* \param filename the file name
* \param n the collection of nodes
*/
void EnableAthstats (std::string filename, NodeContainer n);
private:
Time m_interval; ///< interval
};
/**
* @brief trace sink for wifi device that mimics madwifi's athstats tool.
*
* The AthstatsWifiTraceSink class is a trace sink to be connected to several of the traces
* available within a wifi device. The purpose of AthstatsWifiTraceSink is to
* mimic the behavior of the athstats tool distributed wih the madwifi
* driver. In particular, the reproduced behavior is that obtained
* when executing athstats without parameters: a report written in
* text format is produced every fixed interval, based on the events
* observed by the wifi device.
*
* Differences with the "real" athstats:
*
* - AthstatsWifiTraceSink is expected to write its output to a file
* (not to stdout).
*
* - only a subset of the metrics supported by athstats is supported
* by AthstatsWifiTraceSink
*
* - AthstatsWifiTraceSink does never produce a cumulative report.
*/
class AthstatsWifiTraceSink : public Object
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
AthstatsWifiTraceSink ();
virtual ~AthstatsWifiTraceSink ();
/**
* function to be called when the net device transmits a packet
*
* @param context
* @param p the packet being transmitted
*/
void DevTxTrace (std::string context, Ptr<const Packet> p);
/**
* function to be called when the net device receives a packet
*
* @param context
* @param p the packet being received
*/
void DevRxTrace (std::string context, Ptr<const Packet> p);
/**
* Function to be called when a RTS frame transmission by the considered
* device has failed
*
* @param context
* @param address the MAC address of the remote station
*/
void TxRtsFailedTrace (std::string context, Mac48Address address);
/**
* Function to be called when a data frame transmission by the considered
* device has failed
*
* @param context
* @param address the MAC address of the remote station
*/
void TxDataFailedTrace (std::string context, Mac48Address address);
/**
* Function to be called when the transmission of a RTS frame has
* exceeded the retry limit
*
* @param context
* @param address the MAC address of the remote station
*/
void TxFinalRtsFailedTrace (std::string context, Mac48Address address);
/**
* Function to be called when the transmission of a data frame has
* exceeded the retry limit
*
* @param context
* @param address the MAC address of the remote station
*/
void TxFinalDataFailedTrace (std::string context, Mac48Address address);
/**
* Function to be called when the PHY layer of the considered
* device receives a frame
*
* @param context
* @param packet
* @param snr
* @param mode
* @param preamble
*/
void PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble);
/**
* Function to be called when a frame reception by the PHY
* layer of the considered device resulted in an error due to a failure in the CRC check of
* the frame
*
* @param context
* @param packet
* @param snr
*/
void PhyRxErrorTrace (std::string context, Ptr<const Packet> packet, double snr);
/**
* Function to be called when a frame is being transmitted by the
* PHY layer of the considered device
*
* @param context
* @param packet
* @param mode
* @param preamble
* @param txPower
*/
void PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower);
/**
* Function to be called when the PHY layer of the considered device
* changes state
*
* @param context
* @param start
* @param duration
* @param state
*/
void PhyStateTrace (std::string context, Time start, Time duration, enum WifiPhy::State state);
/**
* Open a file for output
*
* @param name the name of the file to be opened.
*/
void Open (std::string const& name);
private:
/// Write status function
void WriteStats ();
/// Reset counters function
void ResetCounters ();
uint32_t m_txCount; ///< transmit count
uint32_t m_rxCount; ///< receive count
uint32_t m_shortRetryCount; ///< short retry count
uint32_t m_longRetryCount; ///< long retry count
uint32_t m_exceededRetryCount; ///< exceeded retry count
uint32_t m_phyRxOkCount; ///< phy receive ok count
uint32_t m_phyRxErrorCount; ///< phy receive error count
uint32_t m_phyTxCount; ///< phy transmit count
std::ofstream *m_writer; ///< output stream
Time m_interval; ///< interval
}; //class AthstatsWifiTraceSink
} // namespace ns3
#endif /* ATHSTATS_HELPER_H */
|