src/devices/wifi/wifi-trace.h
changeset 2984 27b183b18d4d
parent 2983 e3a416fe9dd5
child 2985 fa0747c4ad5e
equal deleted inserted replaced
2983:e3a416fe9dd5 2984:27b183b18d4d
     1 /* -*-	Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2007 INRIA
       
     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: Federico Maguolo <maguolof@dei.unipd.it>
       
    19  */
       
    20 #ifndef WIFI_TRACE_H
       
    21 #define WIFI_TRACE_H
       
    22 
       
    23 #include <string>
       
    24 #include <fstream>
       
    25 #include "ns3/wifi-phy.h"
       
    26 #include "ns3/mac48-address.h"
       
    27 //#include "ns3/ptr.h"
       
    28 
       
    29 namespace ns3 {
       
    30 
       
    31 class Packet;
       
    32 class TraceContext;
       
    33 
       
    34 class WifiTrace 
       
    35 {
       
    36 public:
       
    37   WifiTrace (std::string filename);
       
    38   WifiTrace ();
       
    39   virtual ~WifiTrace ();
       
    40   void TraceAllNetDeviceRx (void);
       
    41   void TraceAllNetDeviceTx (void);
       
    42   void TraceAllPhy (void);
       
    43   void TraceAllErrors (void);
       
    44   void TraceAckTimeouts (void);
       
    45   void TraceCtsTimeouts (void);
       
    46 protected:
       
    47   virtual void LogErrors (TraceContext const &context, Ptr<const Packet> p);
       
    48   virtual void LogDevRx (TraceContext const &context, Ptr<const Packet> p, Mac48Address addr);
       
    49   virtual void LogDevTx (TraceContext const &context, Ptr<const Packet> p, Mac48Address addr);
       
    50   virtual void LogPhy (TraceContext const &context, Time s, Time d, WifiPhy::State state);
       
    51   virtual void LogAckTimeout (TraceContext const &context, uint32_t a);
       
    52   virtual void LogCtsTimeout (TraceContext const &context, uint32_t a);
       
    53 private:
       
    54   std::ofstream m_os;
       
    55 };
       
    56 
       
    57 }//namespace ns3
       
    58 
       
    59 #endif /* ASCII_TRACE_H */