src/applications/packet-sink.cc
changeset 1456 7372ff049e61
parent 1427 736fb30be782
--- a/src/applications/packet-sink.cc	Tue Sep 11 15:09:00 2007 +0100
+++ b/src/applications/packet-sink.cc	Tue Sep 11 22:40:04 2007 -0700
@@ -1,20 +1,22 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-//
-// Copyright (c) 2006 Georgia Tech Research Corporation
-//
-// 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
-//
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright 2007 University of Washington
+ * 
+ * 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:  Tom Henderson (tomhend@u.washington.edu)
+ */
 #include "ns3/address.h"
 #include "ns3/debug.h"
 #include "ns3/inet-socket-address.h"
@@ -35,35 +37,26 @@
 
 PacketSink::PacketSink (Ptr<Node> n, 
                         const Address &local,
-                        std::string iid,
-                        bool quiet)
+                        std::string iid)
   :  Application(n)
 {
-  Construct (n, local, iid, quiet);
+  Construct (n, local, iid);
 }
 
 void
 PacketSink::Construct (Ptr<Node> n, 
                        const Address &local,
-                       std::string iid,
-                       bool quiet)
+                       std::string iid)
 {
   m_socket = 0;
   m_local = local;
   m_iid = iid;
-  m_quiet = quiet;
 }
 
 PacketSink::~PacketSink()
 {}
 
 void
-PacketSink::SetQuiet()
-{
-  m_quiet = true;
-}
-
-void
 PacketSink::DoDispose (void)
 {
   m_socket = 0;
@@ -99,19 +92,17 @@
     }
 }
 
-// This callback body suggested by Joe Kopena's wiki
+// This LOG output inspired by the application on Joseph Kopena's wiki
 void PacketSink::Receive(Ptr<Socket> socket, const Packet &packet,
                        const Address &from) 
 {
-  if (!m_quiet)
+  if (InetSocketAddress::IsMatchingType (from))
     {
-      if (InetSocketAddress::IsMatchingType (from))
-        {
-          InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
-          NS_DEBUG ( __PRETTY_FUNCTION__ << ": Received " << 
-            packet.GetSize() << " bytes from " << address.GetIpv4() << " [" 
-            << address << "]---'" << packet.PeekData() << "'");
-        }
+      InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
+      NS_DEBUG ( __PRETTY_FUNCTION__ << ": Received " << 
+        packet.GetSize() << " bytes from " << address.GetIpv4() << " [" 
+        << address << "]---'" << packet.PeekData() << "'");
+      // TODO:  Add a tracing source here
     }
 }