From f8ec434cdb49311bec37bcf4500c7984f55f5085 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 15 Apr 2008 15:29:43 -0700 Subject: [PATCH] code was dead. --- src/devices/wifi/wifi-trace.cc | 196 --------------------------------- src/devices/wifi/wifi-trace.h | 59 ---------- src/devices/wifi/wscript | 1 - 3 files changed, 256 deletions(-) delete mode 100644 src/devices/wifi/wifi-trace.cc delete mode 100644 src/devices/wifi/wifi-trace.h diff --git a/src/devices/wifi/wifi-trace.cc b/src/devices/wifi/wifi-trace.cc deleted file mode 100644 index 7a03784e1..000000000 --- a/src/devices/wifi/wifi-trace.cc +++ /dev/null @@ -1,196 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2007 INRIA - * - * 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: Federico Maguolo - */ -#include "wifi-trace.h" - -#include "ns3/trace-context.h" -#include "ns3/simulator.h" -#include "ns3/node.h" -#include "ns3/node-list.h" -#include "ns3/packet.h" -#include "ns3/queue.h" - -namespace ns3 { - -WifiTrace::WifiTrace (std::string filename) -{ - m_os.open (filename.c_str ()); -} - -WifiTrace::WifiTrace () -{} - -WifiTrace::~WifiTrace () -{ - if (m_os.is_open ()) - m_os.close (); -} - -void -WifiTrace::TraceAllNetDeviceRx (void) -{ - Packet::EnableMetadata (); - NodeList::ConnectWithoutContext ("/nodes/*/devices/*/rx", - MakeCallback (&WifiTrace::LogDevRx, this)); -} - -void -WifiTrace::TraceAllNetDeviceTx (void) -{ - Packet::EnableMetadata (); - NodeList::ConnectWithoutContext ("/nodes/*/devices/*/tx", - MakeCallback (&WifiTrace::LogDevTx, this)); -} - -void -WifiTrace::TraceAllPhy (void) -{ - Packet::EnableMetadata (); - NodeList::ConnectWithoutContext ("/nodes/*/devices/*/*/state", - MakeCallback (&WifiTrace::LogPhy, this)); -} - -void -WifiTrace::TraceAllErrors (void) -{ - Packet::EnableMetadata (); - NodeList::ConnectWithoutContext ("/nodes/*/devices/*/*/error", - MakeCallback (&WifiTrace::LogErrors, this)); -} - -void -WifiTrace::TraceAckTimeouts (void) -{ - Packet::EnableMetadata (); - NodeList::ConnectWithoutContext ("/nodes/*/devices/*/*/ackTimeout", - MakeCallback (&WifiTrace::LogAckTimeout, this)); -} - -void -WifiTrace::TraceCtsTimeouts (void) -{ - Packet::EnableMetadata (); - NodeList::ConnectWithoutContext ("/nodes/*/devices/*/*/ctsTimeout", - MakeCallback (&WifiTrace::LogCtsTimeout, this)); -} - -void -WifiTrace::LogDevRx (TraceContext const &context, Ptr p, Mac48Address addr) -{ - if (!m_os.is_open ()) - return; - m_os << "r " << Simulator::Now ().GetSeconds () << " "; - uint8_t buf[6]; - addr.CopyTo (buf); - for (uint8_t i = 0; i < 6; i++) { - m_os << (buf[i] + 0); - if (i < 5) - m_os << "."; - } - m_os << " "; - context.Print (m_os); - m_os << " pkt-uid=" << p->GetUid () << " "; - p->Print (m_os); - m_os << std::endl; -} - -void -WifiTrace::LogDevTx (TraceContext const &context, Ptr p, Mac48Address addr) -{ - if (!m_os.is_open ()) - return; - m_os << "s " << Simulator::Now ().GetSeconds () << " "; - uint8_t buf[6]; - addr.CopyTo (buf); - for (uint8_t i = 0; i < 6; i++) { - m_os << (buf[i] + 0); - if (i < 5) - m_os << "."; - } - m_os << " "; - context.Print (m_os); - m_os << " pkt-uid=" << p->GetUid () << " "; - p->Print (m_os); - m_os << std::endl; -} - -void -WifiTrace::LogErrors (TraceContext const &context, Ptr p) -{ - if (!m_os.is_open ()) - return; - m_os << "d " << Simulator::Now ().GetSeconds () << " "; - context.Print (m_os); - m_os << " pkt-uid=" << p->GetUid () << " "; - p->Print (m_os); - m_os << std::endl; -} - -void -WifiTrace::LogPhy (TraceContext const &context, Time s, Time d, WifiPhy::State state) -{ - if (!m_os.is_open ()) - return; - int prec = m_os.precision (); - m_os.precision (9); - m_os << "PHY " << Simulator::Now ().GetSeconds () << " "; - context.Print (m_os); - switch(state) - { - case WifiPhy::SYNC: - m_os << " SYNC"; - break; - case WifiPhy::TX: - m_os << " TX"; - break; - case WifiPhy::CCA_BUSY: - m_os << " CCA_BUSY"; - break; - case WifiPhy::IDLE: - m_os << " IDLE"; - break; - } - m_os << " t=" << s.GetSeconds () << " d=" << d.GetMicroSeconds (); - m_os << std::endl; - m_os.precision (prec); -} - -void -WifiTrace::LogAckTimeout (TraceContext const &context, uint32_t a) -{ - if (!m_os.is_open ()) - return; - m_os << "ACK timeout " << Simulator::Now ().GetSeconds () << " "; - context.Print (m_os); - m_os << " attemps=" << (a+0); - m_os << std::endl; -} - -void -WifiTrace::LogCtsTimeout (TraceContext const &context, uint32_t a) -{ - if (!m_os.is_open ()) - return; - m_os << "CTS timeout " << Simulator::Now ().GetSeconds () << " "; - context.Print (m_os); - m_os << " attemps=" << (a+0); - m_os << std::endl; -} - -}//namespace ns3 diff --git a/src/devices/wifi/wifi-trace.h b/src/devices/wifi/wifi-trace.h deleted file mode 100644 index ee9a3626e..000000000 --- a/src/devices/wifi/wifi-trace.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2007 INRIA - * - * 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: Federico Maguolo - */ -#ifndef WIFI_TRACE_H -#define WIFI_TRACE_H - -#include -#include -#include "ns3/wifi-phy.h" -#include "ns3/mac48-address.h" -//#include "ns3/ptr.h" - -namespace ns3 { - -class Packet; -class TraceContext; - -class WifiTrace -{ -public: - WifiTrace (std::string filename); - WifiTrace (); - virtual ~WifiTrace (); - void TraceAllNetDeviceRx (void); - void TraceAllNetDeviceTx (void); - void TraceAllPhy (void); - void TraceAllErrors (void); - void TraceAckTimeouts (void); - void TraceCtsTimeouts (void); -protected: - virtual void LogErrors (TraceContext const &context, Ptr p); - virtual void LogDevRx (TraceContext const &context, Ptr p, Mac48Address addr); - virtual void LogDevTx (TraceContext const &context, Ptr p, Mac48Address addr); - virtual void LogPhy (TraceContext const &context, Time s, Time d, WifiPhy::State state); - virtual void LogAckTimeout (TraceContext const &context, uint32_t a); - virtual void LogCtsTimeout (TraceContext const &context, uint32_t a); -private: - std::ofstream m_os; -}; - -}//namespace ns3 - -#endif /* ASCII_TRACE_H */ diff --git a/src/devices/wifi/wscript b/src/devices/wifi/wscript index e77fac629..89711a426 100644 --- a/src/devices/wifi/wscript +++ b/src/devices/wifi/wscript @@ -54,7 +54,6 @@ def build(bld): 'wifi-preamble.h', 'wifi-phy-standard.h', 'wifi-phy.h', - 'wifi-trace.h', 'wifi-remote-station-manager.h', 'arf-wifi-manager.h', 'aarf-wifi-manager.h',