src/devices/wifi/wifi-trace.h
changeset 2350 0b54480c4fd1
child 2834 1aab57845b07
equal deleted inserted replaced
2349:b1df486516a4 2350:0b54480c4fd1
       
     1 /* -*-	Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2007 INRIA
       
     4  * All rights reserved.
       
     5  *
       
     6  * This program is free software; you can redistribute it and/or modify
       
     7  * it under the terms of the GNU General Public License version 2 as
       
     8  * published by the Free Software Foundation;
       
     9  *
       
    10  * This program is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    13  * GNU General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License
       
    16  * along with this program; if not, write to the Free Software
       
    17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    18  *
       
    19  * Author: Federico Maguolo <maguolof@dei.unipd.it>
       
    20  */
       
    21 #ifndef WIFI_TRACE_H
       
    22 #define WIFI_TRACE_H
       
    23 
       
    24 #include <string>
       
    25 #include <fstream>
       
    26 #include "ns3/wifi-phy.h"
       
    27 #include "ns3/mac48-address.h"
       
    28 //#include "ns3/ptr.h"
       
    29 
       
    30 namespace ns3 {
       
    31 
       
    32 class Packet;
       
    33 class TraceContext;
       
    34 
       
    35 class WifiTrace 
       
    36 {
       
    37 public:
       
    38   WifiTrace (std::string filename);
       
    39   WifiTrace ();
       
    40   virtual ~WifiTrace ();
       
    41   void TraceAllNetDeviceRx (void);
       
    42   void TraceAllNetDeviceTx (void);
       
    43   void TraceAllPhy (void);
       
    44   void TraceAllErrors (void);
       
    45   void TraceAckTimeouts (void);
       
    46   void TraceCtsTimeouts (void);
       
    47 protected:
       
    48   virtual void LogErrors (TraceContext const &context, Ptr<const Packet> p);
       
    49   virtual void LogDevRx (TraceContext const &context, Ptr<const Packet> p, Mac48Address addr);
       
    50   virtual void LogDevTx (TraceContext const &context, Ptr<const Packet> p, Mac48Address addr);
       
    51   virtual void LogPhy (TraceContext const &context, Time s, Time d, WifiPhy::State state);
       
    52   virtual void LogAckTimeout (TraceContext const &context, uint32_t a);
       
    53   virtual void LogCtsTimeout (TraceContext const &context, uint32_t a);
       
    54 private:
       
    55   std::ofstream m_os;
       
    56 };
       
    57 
       
    58 }//namespace ns3
       
    59 
       
    60 #endif /* ASCII_TRACE_H */