Moving apps back to apps/ folder. Finally worked out the problem with headers
WAF building system copies all headers to one directory. As a result,
all #include directives in all NS3 modules should be either in form
"ns3/header-file.h" or just "header-file.h", disregarding the actual
directory structure.
diff --git a/model/content-object-header.cc b/model/content-object-header.cc
index 79b5ed0..4399afd 100644
--- a/model/content-object-header.cc
+++ b/model/content-object-header.cc
@@ -18,7 +18,6 @@
* Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
*/
-
#include "content-object-header.h"
namespace ns3
diff --git a/model/content-object-header.h b/model/content-object-header.h
index 454f8e2..ff2ae26 100644
--- a/model/content-object-header.h
+++ b/model/content-object-header.h
@@ -22,8 +22,8 @@
#ifndef _CONTENT_OBJECT_HEADER_H_
#define _CONTENT_OBJECT_HEADER_H_
-#include <ns3/integer.h>
-#include <ns3/header.h>
+#include "ns3/integer.h"
+#include "ns3/header.h"
#include <string>
#include <vector>
diff --git a/model/interest-header.cc b/model/interest-header.cc
index ef974a9..f9300c4 100644
--- a/model/interest-header.cc
+++ b/model/interest-header.cc
@@ -22,7 +22,6 @@
///< #CCN_PR_SCOPE1 (0x40) this host,
///< #CCN_PR_SCOPE2 (0x80) immediate neighborhood
-
#include "interest-header.h"
namespace ns3
diff --git a/model/interest-header.h b/model/interest-header.h
index 4f2b948..9d9ba4a 100644
--- a/model/interest-header.h
+++ b/model/interest-header.h
@@ -22,8 +22,8 @@
#ifndef _INTEREST_HEADER_H_
#define _INTEREST_HEADER_H_
-#include <ns3/integer.h>
-#include <ns3/header.h>
+#include "ns3/integer.h"
+#include "ns3/header.h"
#include <string>
#include <vector>
@@ -35,7 +35,7 @@
{
namespace NDNabstraction
{
-
+
/**
* CCNx XML definition of Interest
*
diff --git a/model/name-components.cc b/model/name-components.cc
index f356a3b..a6aae87 100644
--- a/model/name-components.cc
+++ b/model/name-components.cc
@@ -19,7 +19,10 @@
*/
#include "name-components.h"
-#include "ccn/ccn.h"
+
+#include "ns3/ccn.h"
+#include "ns3/ccn_charbuf.h"
+
#include <iostream>
using namespace std;
diff --git a/model/name-components.h b/model/name-components.h
index 5c06bd9..2cdfd99 100644
--- a/model/name-components.h
+++ b/model/name-components.h
@@ -21,11 +21,11 @@
#ifndef _NDN_NAME_COMPONENTS_H_
#define _NDN_NAME_COMPONENTS_H_
+#include "ns3/simple-ref-count.h"
+
#include <string>
#include <list>
-#include <ns3/simple-ref-count.h>
-
namespace ns3 {
namespace NDNabstraction {
namespace Name {
diff --git a/model/ndn_contentpacket.cc b/model/ndn_contentpacket.cc
deleted file mode 100644
index 60b4963..0000000
--- a/model/ndn_contentpacket.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * 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: Ilya Moiseenko <iliamo@cs.ucla.edu>
- */
-
-#include "ndn_contentpacket.h"
-
-namespace ns3
-{
-namespace NDNabstraction
-{
- ContentPacket::ContentPacket(const struct ccn_charbuf *Name,const void *data,size_t size)
- : Packet()
- {
- ccn_charbuf *output = ccn_charbuf_create();
- int result = ccn_encode_ContentObject(output,Name,data,size);
-
- if(result>=0)
- {
- Ptr<Packet> p = Create<Packet> (output->buf, (uint32_t)output->length);
- this->AddAtEnd (p);
- }
- }
-}
-}
diff --git a/model/ndn_contentpacket.h b/model/ndn_contentpacket.h
deleted file mode 100644
index bd8abd0..0000000
--- a/model/ndn_contentpacket.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * 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: Ilya Moiseenko <iliamo@cs.ucla.edu>
- */
-
-#ifndef ndn_contentpacket_h
-#define ndn_contentpacket_h
-
-#include "ns3/header.h"
-#include <ns3/packet.h>
-#include "ccn/ccn.h"
-
-namespace ns3
-{
-namespace NDNabstraction
-{
- class ContentPacket : public Packet
- {
- public:
- ContentPacket(const struct ccn_charbuf *Name,const void *data,size_t size);
-
-
- };
-}
-}
-
-#endif
diff --git a/model/ndn_face.cc b/model/ndn_face.cc
deleted file mode 100644
index 14abd6e..0000000
--- a/model/ndn_face.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * 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: Ilya Moiseenko <iliamo@cs.ucla.edu>
- */
-
-#include "ndn_face.h"
-
-namespace ns3
-{
-
-}
diff --git a/model/ndn_face.h b/model/ndn_face.h
deleted file mode 100644
index 857d88f..0000000
--- a/model/ndn_face.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * 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: Ilya Moiseenko <iliamo@cs.ucla.edu>
- */
-
-#ifndef ndn_face_h
-#define ndn_face_h
-
-#include "ns3/header.h"
-
-namespace ns3
-{
- // see http://www.ccnx.org/releases/latest/doc/ccode/html/structface.html
- class NdnFace
- {
- public:
- NdnFace(int faceID);
- virtual ~NdnFace();
-
- private:
- int m_faceID;
-
- };
-
-}
-
-#endif
diff --git a/model/ndn_nonceheader.cc b/model/ndn_nonceheader.cc
deleted file mode 100644
index 419b5ab..0000000
--- a/model/ndn_nonceheader.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * 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: Ilya Moiseenko <iliamo@cs.ucla.edu>
- */
-
-#include "ndn_nonceheader.h"
-
-
-namespace ns3
-{
- namespace NDNabstraction
- {
- NS_OBJECT_ENSURE_REGISTERED (NonceHeader);
-
- NonceHeader::NonceHeader()
- {
- m_value = 0;
- }
-
- NonceHeader::NonceHeader (uint32_t nonce)
- {
- m_value = nonce;
- }
-
- TypeId
- NonceHeader::GetTypeId ()
- {
- static TypeId tid = TypeId ("ns3::NDNabstraction::NonceHeader")
- .SetParent<Header> ()
- .AddConstructor<NonceHeader> ()
- ;
- return tid;
- }
-
- TypeId
- NonceHeader::GetInstanceTypeId () const
- {
- return GetTypeId ();
- }
-
- uint32_t
- NonceHeader::GetSerializedSize () const
- {
- return 4;
- }
-
- void
- NonceHeader::Serialize (Buffer::Iterator i) const
- {
- i.WriteU32 ((uint32_t) m_value);
- }
-
- uint32_t
- NonceHeader::Deserialize (Buffer::Iterator start)
- {
- Buffer::Iterator i = start;
- m_value = i.ReadU32 ();
-
- uint32_t dist = i.GetDistanceFrom (start);
- NS_ASSERT (dist == GetSerializedSize ());
- return dist;
- }
-
- void
- NonceHeader::Print (std::ostream &os) const
- {
- os << m_value;
- }
-
- uint32_t
- NonceHeader::GetValue()
- {
- return m_value;
- }
- }
-}
diff --git a/model/ndn_nonceheader.h b/model/ndn_nonceheader.h
deleted file mode 100644
index ff4b916..0000000
--- a/model/ndn_nonceheader.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * 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: Ilya Moiseenko <iliamo@cs.ucla.edu>
- */
-
-#include "ns3/header.h"
-#include <iostream>
-
-namespace ns3
-{
- namespace NDNabstraction
- {
- class NonceHeader: public Header
- {
- public:
- NonceHeader();
- NonceHeader(uint32_t nonce);
- uint32_t GetValue();
-
-
- // Header serialization/deserialization
- static TypeId GetTypeId ();
- TypeId GetInstanceTypeId () const;
- uint32_t GetSerializedSize () const;
- void Serialize (Buffer::Iterator start) const;
- uint32_t Deserialize (Buffer::Iterator start);
- void Print (std::ostream &os) const;
-
- private:
- uint32_t m_value;
- };
- }
-}
diff --git a/model/ndn_timeoutheader.cc b/model/ndn_timeoutheader.cc
deleted file mode 100644
index 1094a99..0000000
--- a/model/ndn_timeoutheader.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * 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: Ilya Moiseenko <iliamo@cs.ucla.edu>
- */
-
-#include "ndn_timeoutheader.h"
-
-namespace ns3
-{
-namespace NDNabstraction
-{
- NS_OBJECT_ENSURE_REGISTERED (TimeoutHeader);
-
- TimeoutHeader::TimeoutHeader()
- {
- m_value = 4000;
- }
-
- TimeoutHeader::TimeoutHeader (uint32_t timeout)
- {
- m_value = timeout;
- }
-
- TypeId
- TimeoutHeader::GetTypeId ()
- {
- static TypeId tid = TypeId ("ns3::NDNabstraction::TimeoutHeader")
- .SetParent<Header> ()
- .AddConstructor<TimeoutHeader> ()
- ;
- return tid;
- }
-
- TypeId
- TimeoutHeader::GetInstanceTypeId () const
- {
- return GetTypeId ();
- }
-
- uint32_t
- TimeoutHeader::GetSerializedSize () const
- {
- return 4;
- }
-
- void
- TimeoutHeader::Serialize (Buffer::Iterator i) const
- {
- i.WriteU32 ((uint32_t) m_value);
- }
-
- uint32_t
- TimeoutHeader::Deserialize (Buffer::Iterator start)
- {
- Buffer::Iterator i = start;
- m_value = i.ReadU32 ();
-
- uint32_t dist = i.GetDistanceFrom (start);
- NS_ASSERT (dist == GetSerializedSize ());
- return dist;
- }
-
- void
- TimeoutHeader::Print (std::ostream &os) const
- {
- os << m_value;
- }
-
- uint32_t
- TimeoutHeader::GetValue()
- {
- return m_value;
- }
-}
-}
diff --git a/model/ndn_timeoutheader.h b/model/ndn_timeoutheader.h
deleted file mode 100644
index 32e492e..0000000
--- a/model/ndn_timeoutheader.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * 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: Ilya Moiseenko <iliamo@cs.ucla.edu>
- */
-
-#include "ns3/header.h"
-#include <iostream>
-
-namespace ns3
-{
-namespace NDNabstraction
-{
-
- class TimeoutHeader: public Header
- {
- public:
- TimeoutHeader();
- TimeoutHeader(uint32_t timeout);
- uint32_t GetValue();
-
-
- // Header serialization/deserialization
- static TypeId GetTypeId ();
- TypeId GetInstanceTypeId () const;
- uint32_t GetSerializedSize () const;
- void Serialize (Buffer::Iterator start) const;
- uint32_t Deserialize (Buffer::Iterator start);
- void Print (std::ostream &os) const;
-
- private:
- uint32_t m_value;
- };
-}
-}
diff --git a/model/ndnabstraction-header.cc b/model/ndnabstraction-header.cc
index 1b70e9b..a7ea402 100644
--- a/model/ndnabstraction-header.cc
+++ b/model/ndnabstraction-header.cc
@@ -19,4 +19,5 @@
*/
#include "ndnabstraction-header.h"
+
#include "ns3/assert.h"
diff --git a/model/ndnabstraction-header.h b/model/ndnabstraction-header.h
index 7d652ff..2cbd4a3 100644
--- a/model/ndnabstraction-header.h
+++ b/model/ndnabstraction-header.h
@@ -23,6 +23,7 @@
#include <stdint.h>
#include <vector>
+
#include "ns3/header.h"
#include "ns3/ipv4-address.h"
#include "ns3/nstime.h"
diff --git a/model/stupid-interest-generator.cc b/model/stupid-interest-generator.cc
deleted file mode 100644
index bd2cb6d..0000000
--- a/model/stupid-interest-generator.cc
+++ /dev/null
@@ -1,181 +0,0 @@
-//
-// ndn_stupidinterestgenerator.cpp
-// Abstraction
-//
-// Created by Ilya Moiseenko on 05.08.11.
-// Copyright 2011 UCLA. All rights reserved.
-//
-
-#include "stupid-interest-generator.h"
-
-#include "ns3/socket.h"
-#include "ns3/socket-factory.h"
-#include "ns3/simulator.h"
-
-#include "interest-header.h"
-#include "content-object-header.h"
-
-NS_LOG_COMPONENT_DEFINE ("StupidInterestGenerator");
-
-namespace ns3
-{
-//namespace NDNabstraction
-//{
- using namespace NDNabstraction;
-
- NS_OBJECT_ENSURE_REGISTERED (StupidInterestGenerator);
-
- TypeId
- StupidInterestGenerator::GetTypeId (void)
- {
- static TypeId tid = TypeId ("ns3::StupidInterestGenerator")
- .SetParent<Application> ()
- .AddConstructor<StupidInterestGenerator> ()
- .AddAttribute ("Remote", "The address of the destination",
- AddressValue (),
- MakeAddressAccessor (&StupidInterestGenerator::m_peer),
- MakeAddressChecker ())
- .AddAttribute ("OffTime", "Time interval between packets",
- TimeValue (Seconds (0.1)),
- MakeTimeAccessor (&StupidInterestGenerator::m_offTime),
- MakeTimeChecker ())
- .AddAttribute ("Protocol", "The type of protocol to use.",
- TypeIdValue (UdpSocketFactory::GetTypeId ()),
- MakeTypeIdAccessor (&StupidInterestGenerator::m_tid),
- MakeTypeIdChecker ())
- ;
- return tid;
- }
-
- StupidInterestGenerator::StupidInterestGenerator ()
- {
- NS_LOG_FUNCTION_NOARGS ();
- m_socket = 0;
- //m_connected = false;
- //m_residualBits = 0;
- //m_lastStartTime = Seconds (0);
- //m_totBytes = 0;
- }
-
- StupidInterestGenerator::~StupidInterestGenerator()
- {
- NS_LOG_FUNCTION_NOARGS ();
- }
-
- void
- StupidInterestGenerator::DoDispose (void)
- {
- NS_LOG_FUNCTION_NOARGS ();
-
- m_socket = 0;
- // chain up
- Application::DoDispose ();
- }
-
- // Application Methods
- void StupidInterestGenerator::StartApplication () // Called at time specified by Start
- {
- NS_LOG_FUNCTION_NOARGS ();
-
- // Create the socket if not already
- if (!m_socket)
- {
- m_socket = Socket::CreateSocket (GetNode (), m_tid);
- m_socket->Bind ();
- m_socket->Connect (m_peer);
- m_socket->SetAllowBroadcast (true);
- m_socket->ShutdownRecv ();
- }
- // Insure no pending event
- CancelEvents ();
- // If we are not yet connected, there is nothing to do here
- // The ConnectionComplete upcall will start timers at that time
- //if (!m_connected) return;
- ScheduleStartEvent ();
- }
-
- void StupidInterestGenerator::StopApplication () // Called at time specified by Stop
- {
- NS_LOG_FUNCTION_NOARGS ();
-
- CancelEvents ();
- if(m_socket != 0)
- {
- m_socket->Close ();
- }
- else
- {
- NS_LOG_WARN ("OnOffApplication found null socket to close in StopApplication");
- }
- }
-
- void StupidInterestGenerator::CancelEvents ()
- {
- NS_LOG_FUNCTION_NOARGS ();
-
- Simulator::Cancel (m_sendEvent);
- Simulator::Cancel (m_startStopEvent);
- }
-
- void StupidInterestGenerator::ScheduleStartEvent ()
- { // Schedules the event to start sending data (switch to the "On" state)
- NS_LOG_FUNCTION_NOARGS ();
-
- Time offInterval = Seconds (m_offTime);
- NS_LOG_LOGIC ("start at " << offInterval);
- m_startStopEvent = Simulator::Schedule (offInterval, &StupidInterestGenerator::StartSending, this);
- }
-
- // Event handlers
- void StupidInterestGenerator::StartSending ()
- {
- NS_LOG_FUNCTION_NOARGS ();
- //m_lastStartTime = Simulator::Now ();
- ScheduleNextTx (); // Schedule the send packet event
- //ScheduleStopEvent ();
- }
-
- void StupidInterestGenerator::StopSending ()
- {
- NS_LOG_FUNCTION_NOARGS ();
- CancelEvents ();
-
- ScheduleStartEvent ();
- }
-
- // Private helpers
- void StupidInterestGenerator::ScheduleNextTx ()
- {
- NS_LOG_FUNCTION_NOARGS ();
-
-
- Time nextTime = Seconds(0.); //send now
- m_sendEvent = Simulator::Schedule (nextTime,
- &StupidInterestGenerator::SendPacket, this);
- }
-
-
- void StupidInterestGenerator::SendPacket ()
- {
- // NS_LOG_FUNCTION_NOARGS ();
- // NS_LOG_LOGIC ("sending packet at " << Simulator::Now ());
- // NS_ASSERT (m_sendEvent.IsExpired ());
-
- // NameBuilder name;
- // name("prefix1")("prefix2")("filename");
- InterestHeader ();
-
- ContentObjectHeader ();
-
- // const ccn_charbuf *output = name.GetName();
- // Ptr<InterestPacket> packet = Create<InterestPacket>(name,(uint32_t)output->length);
- // packet->AddTimeout(4000);
- // UniformVariable var;
- // packet->AddNonce(var.GetInteger(1,10000));
- // m_socket->Send(packet);
-
- // ScheduleStartEvent();
- }
-
-//}
-}
diff --git a/model/stupid-interest-generator.h b/model/stupid-interest-generator.h
deleted file mode 100644
index 8d927cd..0000000
--- a/model/stupid-interest-generator.h
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// ndn_stupidinterestgenerator.h
-// Abstraction
-//
-// Created by Ilya Moiseenko on 05.08.11.
-// Copyright 2011 UCLA. All rights reserved.
-//
-
-#include <ns3/application.h>
-#include <ns3/log.h>
-#include <ns3/address.h>
-#include <ns3/random-variable.h>
-#include <ns3/nstime.h>
-#include <ns3/event-id.h>
-#include <ns3/ptr.h>
-#include <ns3/udp-socket-factory.h>
-
-#include "ccn/ccn.h"
-
-namespace ns3
-{
-
-
-//namespace NDNabstraction
-//{
- class Socket; //dynamic linking works in a somehow strange way
-
- class StupidInterestGenerator: public Application
- {
- public:
- static TypeId GetTypeId (void);
-
- StupidInterestGenerator ();
-
- virtual ~StupidInterestGenerator();
-
-
- protected:
- virtual void DoDispose (void);
- private:
- // inherited from Application base class.
- virtual void StartApplication (void); // Called at time specified by Start
- virtual void StopApplication (void); // Called at time specified by Stop
-
- //Time m_onTime;
- Time m_offTime;
-
- Address m_peer; // Peer address
- Ptr<Socket> m_socket;
- EventId m_startStopEvent; // Event id for next start or stop event
- EventId m_sendEvent; // Eventid of pending "send packet" event
- TypeId m_tid;
-
- //helpers
- void CancelEvents ();
-
- void Construct (Ptr<Node> n,
- const Address &remote,
- std::string tid,
- const RandomVariable& ontime,
- const RandomVariable& offtime,
- uint32_t size);
-
- // Event handlers
- void StartSending ();
- void StopSending ();
- void SendPacket ();
-
- private:
- void ScheduleNextTx ();
- void ScheduleStartEvent ();
- void ScheduleStopEvent ();
- void ConnectionSucceeded (Ptr<Socket>);
- void ConnectionFailed (Ptr<Socket>);
- void Ignore (Ptr<Socket>);
-
- };
-//}
-}
diff --git a/model/stupid-interest-sink.cc b/model/stupid-interest-sink.cc
deleted file mode 100644
index 757d154..0000000
--- a/model/stupid-interest-sink.cc
+++ /dev/null
@@ -1,187 +0,0 @@
-//
-// stupid-interest-sink.cpp
-// Abstraction
-//
-// Created by Ilya Moiseenko on 10.08.11.
-// Copyright 2011 UCLA. All rights reserved.
-//
-
-#include "stupid-interest-sink.h"
-#include "ns3/address.h"
-#include "ns3/address-utils.h"
-#include "ns3/log.h"
-#include "ns3/inet-socket-address.h"
-#include "ns3/node.h"
-#include "ns3/socket.h"
-#include "ns3/udp-socket.h"
-#include "ns3/simulator.h"
-#include "ns3/socket-factory.h"
-#include "ns3/packet.h"
-#include "ns3/trace-source-accessor.h"
-#include "ns3/udp-socket-factory.h"
-
-using namespace std;
-
-namespace ns3 {
-
- NS_LOG_COMPONENT_DEFINE ("StupidInterestSink");
- NS_OBJECT_ENSURE_REGISTERED (StupidInterestSink);
-
- TypeId
- StupidInterestSink::GetTypeId (void)
- {
- static TypeId tid = TypeId ("ns3::StupidInterestSink")
- .SetParent<Application> ()
- .AddConstructor<StupidInterestSink> ()
- .AddAttribute ("Local", "The Address on which to Bind the rx socket.",
- AddressValue (),
- MakeAddressAccessor (&StupidInterestSink::m_local),
- MakeAddressChecker ())
- .AddAttribute ("Protocol", "The type id of the protocol to use for the rx socket.",
- TypeIdValue (UdpSocketFactory::GetTypeId ()),
- MakeTypeIdAccessor (&StupidInterestSink::m_tid),
- MakeTypeIdChecker ())
- .AddTraceSource ("Rx", "A packet has been received",
- MakeTraceSourceAccessor (&StupidInterestSink::m_rxTrace))
- ;
- return tid;
- }
-
- StupidInterestSink::StupidInterestSink ()
- {
- NS_LOG_FUNCTION (this);
- m_socket = 0;
- m_totalRx = 0;
- }
-
- StupidInterestSink::~StupidInterestSink()
- {
- NS_LOG_FUNCTION (this);
- }
-
- uint32_t StupidInterestSink::GetTotalRx () const
- {
- return m_totalRx;
- }
-
- Ptr<Socket>
- StupidInterestSink::GetListeningSocket (void) const
- {
- NS_LOG_FUNCTION (this);
- return m_socket;
- }
-
- std::list<Ptr<Socket> >
- StupidInterestSink::GetAcceptedSockets (void) const
- {
- NS_LOG_FUNCTION (this);
- return m_socketList;
- }
-
- void StupidInterestSink::DoDispose (void)
- {
- NS_LOG_FUNCTION (this);
- m_socket = 0;
- m_socketList.clear ();
-
- // chain up
- Application::DoDispose ();
- }
-
-
- // Application Methods
- void StupidInterestSink::StartApplication () // Called at time specified by Start
- {
- NS_LOG_FUNCTION (this);
- // Create the socket if not already
- if (!m_socket)
- {
- m_socket = Socket::CreateSocket (GetNode (), m_tid);
- m_socket->Bind (m_local);
- m_socket->Listen ();
- m_socket->ShutdownSend ();
- if (addressUtils::IsMulticast (m_local))
- {
- Ptr<UdpSocket> udpSocket = DynamicCast<UdpSocket> (m_socket);
- if (udpSocket)
- {
- // equivalent to setsockopt (MCAST_JOIN_GROUP)
- udpSocket->MulticastJoinGroup (0, m_local);
- }
- else
- {
- NS_FATAL_ERROR ("Error: joining multicast on a non-UDP socket");
- }
- }
- }
-
- m_socket->SetRecvCallback (MakeCallback (&StupidInterestSink::HandleRead, this));
- m_socket->SetAcceptCallback (
- MakeNullCallback<bool, Ptr<Socket>, const Address &> (),
- MakeCallback (&StupidInterestSink::HandleAccept, this));
- m_socket->SetCloseCallbacks (
- MakeCallback (&StupidInterestSink::HandlePeerClose, this),
- MakeCallback (&StupidInterestSink::HandlePeerError, this));
- }
-
- void StupidInterestSink::StopApplication () // Called at time specified by Stop
- {
- NS_LOG_FUNCTION (this);
- while(!m_socketList.empty ()) //these are accepted sockets, close them
- {
- Ptr<Socket> acceptedSocket = m_socketList.front ();
- m_socketList.pop_front ();
- acceptedSocket->Close ();
- }
- if (m_socket)
- {
- m_socket->Close ();
- m_socket->SetRecvCallback (MakeNullCallback<void, Ptr<Socket> > ());
- }
- }
-
- void StupidInterestSink::HandleRead (Ptr<Socket> socket)
- {
- NS_LOG_FUNCTION (this << socket);
- Ptr<Packet> packet;
- Address from;
- while (packet = socket->RecvFrom (from))
- {
- if (packet->GetSize () == 0)
- { //EOF
- break;
- }
- if (InetSocketAddress::IsMatchingType (from))
- {
- m_totalRx += packet->GetSize ();
- InetSocketAddress address = InetSocketAddress::ConvertFrom (from);
- NS_LOG_INFO ("Received " << packet->GetSize () << " bytes from " <<
- address.GetIpv4 () << " [" << address << "]"
- << " total Rx " << m_totalRx);
- //cast address to void , to suppress 'address' set but not used
- //compiler warning in optimized builds
- (void) address;
- }
- m_rxTrace (packet, from);
- }
- }
-
- void StupidInterestSink::HandlePeerClose (Ptr<Socket> socket)
- {
- NS_LOG_INFO ("PktSink, peerClose");
- }
-
- void StupidInterestSink::HandlePeerError (Ptr<Socket> socket)
- {
- NS_LOG_INFO ("PktSink, peerError");
- }
-
-
- void StupidInterestSink::HandleAccept (Ptr<Socket> s, const Address& from)
- {
- NS_LOG_FUNCTION (this << s << from);
- s->SetRecvCallback (MakeCallback (&StupidInterestSink::HandleRead, this));
- m_socketList.push_back (s);
- }
-
-} // Namespace ns3
diff --git a/model/stupid-interest-sink.h b/model/stupid-interest-sink.h
deleted file mode 100644
index 66cedd9..0000000
--- a/model/stupid-interest-sink.h
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// stupid-interest-sink.h
-// Abstraction
-//
-// Created by Ilya Moiseenko on 10.08.11.
-// Copyright 2011 UCLA. All rights reserved.
-//
-
-#include "ns3/application.h"
-#include "ns3/event-id.h"
-#include "ns3/ptr.h"
-#include "ns3/traced-callback.h"
-#include "ns3/address.h"
-
-namespace ns3
-{
-
- class Address;
- class Socket;
- class Packet;
-
- class StupidInterestSink : public Application
- {
- public:
- static TypeId GetTypeId (void);
- StupidInterestSink ();
-
- virtual ~StupidInterestSink ();
-
- /**
- * \return the total bytes received in this sink app
- */
- uint32_t GetTotalRx () const;
-
- /**
- * \return pointer to listening socket
- */
- Ptr<Socket> GetListeningSocket (void) const;
-
- /**
- * \return list of pointers to accepted sockets
- */
- std::list<Ptr<Socket> > GetAcceptedSockets (void) const;
-
- protected:
- virtual void DoDispose (void);
- private:
- // inherited from Application base class.
- virtual void StartApplication (void); // Called at time specified by Start
- virtual void StopApplication (void); // Called at time specified by Stop
-
- void HandleRead (Ptr<Socket>);
- void HandleAccept (Ptr<Socket>, const Address& from);
- void HandlePeerClose (Ptr<Socket>);
- void HandlePeerError (Ptr<Socket>);
-
- // In the case of TCP, each socket accept returns a new socket, so the
- // listening socket is stored seperately from the accepted sockets
- Ptr<Socket> m_socket; // Listening socket
- std::list<Ptr<Socket> > m_socketList; //the accepted sockets
-
- Address m_local; // Local address to bind to
- uint32_t m_totalRx; // Total bytes received
- TypeId m_tid; // Protocol TypeId
- TracedCallback<Ptr<const Packet>, const Address &> m_rxTrace;
- };
-}
\ No newline at end of file