First approximation of CCNx protocol stack
diff --git a/model/ccnx-content-object-header.cc b/model/ccnx-content-object-header.cc
new file mode 100644
index 0000000..f66bf3c
--- /dev/null
+++ b/model/ccnx-content-object-header.cc
@@ -0,0 +1,88 @@
+/* -*- 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>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ccnx-content-object-header.h"
+
+NS_LOG_COMPONENT_DEFINE ("CcnxContentObjectHeader");
+
+namespace ns3
+{
+
+NS_OBJECT_ENSURE_REGISTERED (CcnxContentObjectHeader);
+
+TypeId
+CcnxContentObjectHeader::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::CcnxContentObjectHeader")
+ .SetParent<Header> ()
+ .AddConstructor<CcnxContentObjectHeader> ()
+ ;
+ return tid;
+}
+
+CcnxContentObjectHeader::CcnxContentObjectHeader ()
+{
+}
+
+void
+CcnxContentObjectHeader::SetName (const Ptr<Name::Components> &name)
+{
+ m_name = name;
+}
+
+const Name::Components&
+CcnxContentObjectHeader::GetName () const
+{
+ return *m_name;
+}
+
+uint32_t
+CcnxContentObjectHeader::GetSerializedSize (void) const
+{
+ return 0;
+}
+
+void
+CcnxContentObjectHeader::Serialize (Buffer::Iterator start) const
+{
+ return;
+}
+
+uint32_t
+CcnxContentObjectHeader::Deserialize (Buffer::Iterator start)
+{
+ return 0;
+}
+
+TypeId
+CcnxContentObjectHeader::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
+
+void
+CcnxContentObjectHeader::Print (std::ostream &os) const
+{
+ os << "ContentObject: " << *m_name;
+}
+
+} // namespace ns3
+
diff --git a/model/content-object-header.h b/model/ccnx-content-object-header.h
similarity index 92%
rename from model/content-object-header.h
rename to model/ccnx-content-object-header.h
index ff2ae26..86bcc59 100644
--- a/model/content-object-header.h
+++ b/model/ccnx-content-object-header.h
@@ -19,8 +19,8 @@
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#ifndef _CONTENT_OBJECT_HEADER_H_
-#define _CONTENT_OBJECT_HEADER_H_
+#ifndef _CCNX_CONTENT_OBJECT_HEADER_H_
+#define _CCNX_CONTENT_OBJECT_HEADER_H_
#include "ns3/integer.h"
#include "ns3/header.h"
@@ -33,8 +33,6 @@
namespace ns3
{
-namespace NDNabstraction
-{
/**
* CCNx XML definition of ContentObject
@@ -47,7 +45,7 @@
* Simplifications:
*/
-class ContentObjectHeader : public Header
+class CcnxContentObjectHeader : public Header
{
public:
/**
@@ -55,7 +53,7 @@
*
* Creates a null header
**/
- ContentObjectHeader ();
+ CcnxContentObjectHeader ();
/**
* \brief Set interest name
@@ -105,4 +103,4 @@
} // namespace NDNabstraction
} // namespace ns3
-#endif // _CONTENT_OBJECT_HEADER_H_
+#endif // _CCNX_CONTENT_OBJECT_HEADER_H_
diff --git a/model/ccnx-interest-header.cc b/model/ccnx-interest-header.cc
new file mode 100644
index 0000000..a7f2feb
--- /dev/null
+++ b/model/ccnx-interest-header.cc
@@ -0,0 +1,195 @@
+/* -*- 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>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+///< #CCN_PR_SCOPE0 (0x20) local scope,
+///< #CCN_PR_SCOPE1 (0x40) this host,
+///< #CCN_PR_SCOPE2 (0x80) immediate neighborhood
+
+#include "ccnx-interest-header.h"
+
+NS_LOG_COMPONENT_DEFINE ("CcnxInterestHeader");
+
+namespace ns3
+{
+
+NS_OBJECT_ENSURE_REGISTERED (CcnxInterestHeader);
+
+TypeId
+CcnxInterestHeader::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::CcnxInterestHeader")
+ .SetParent<Header> ()
+ .AddConstructor<CcnxInterestHeader> ()
+ ;
+ return tid;
+}
+
+
+CcnxInterestHeader::CcnxInterestHeader ()
+ : m_minSuffixComponents (-1)
+ , m_maxSuffixComponents (-1)
+ , m_childSelector (false)
+ , m_answerOriginKind (false)
+ , m_scope (-1)
+ , m_interestLifetime (-1)
+ , m_nonce (0)
+{
+}
+
+void
+CcnxInterestHeader::SetName (const Ptr<Name::Components> &name)
+{
+ m_name = name;
+}
+
+const Name::Components&
+CcnxInterestHeader::GetName () const
+{
+ return *m_name;
+}
+
+void
+CcnxInterestHeader::SetMinSuffixComponents (int32_t value)
+{
+ m_minSuffixComponents = value;
+}
+
+int32_t
+CcnxInterestHeader::GetMinSuffixComponents () const
+{
+ return m_minSuffixComponents;
+}
+
+void
+CcnxInterestHeader::SetMaxSuffixComponents (int32_t value)
+{
+ m_maxSuffixComponents = value;
+}
+
+int32_t
+CcnxInterestHeader::GetMaxSuffixComponents () const
+{
+ return m_maxSuffixComponents;
+}
+
+void
+CcnxInterestHeader::SetExclude (const Ptr<Name::Components> &exclude)
+{
+ m_exclude = exclude;
+}
+
+const Name::Components&
+CcnxInterestHeader::GetExclude () const
+{
+ return *m_exclude;
+}
+
+void
+CcnxInterestHeader::EnableChildSelector ()
+{
+ m_childSelector = true;
+}
+
+bool
+CcnxInterestHeader::IsEnabledChildSelector () const
+{
+ return m_childSelector;
+}
+
+void
+CcnxInterestHeader::EnableAnswerOriginKind ()
+{
+ m_answerOriginKind = true;
+}
+
+bool
+CcnxInterestHeader::IsEnabledAnswerOriginKind () const
+{
+ return m_answerOriginKind;
+}
+
+void
+CcnxInterestHeader::SetScope (int8_t scope)
+{
+ m_scope = scope;
+}
+
+int8_t
+CcnxInterestHeader::GetScope () const
+{
+ return m_scope;
+}
+
+void
+CcnxInterestHeader::SetInterestLifetime (intmax_t lifetime)
+{
+ m_interestLifetime = lifetime;
+}
+
+intmax_t
+CcnxInterestHeader::GetInterestLifetime () const
+{
+ return m_interestLifetime;
+}
+
+void
+CcnxInterestHeader::SetNonce (uint32_t nonce)
+{
+ m_nonce = nonce;
+}
+
+uint32_t
+CcnxInterestHeader::GetNonce () const
+{
+ return m_nonce;
+}
+
+uint32_t
+CcnxInterestHeader::GetSerializedSize (void) const
+{
+ return 0;
+}
+
+void
+CcnxInterestHeader::Serialize (Buffer::Iterator start) const
+{
+ return;
+}
+
+uint32_t
+CcnxInterestHeader::Deserialize (Buffer::Iterator start)
+{
+ return 0;
+}
+
+TypeId
+CcnxInterestHeader::GetInstanceTypeId (void) const
+{
+ return GetTypeId ();
+}
+
+void
+CcnxInterestHeader::Print (std::ostream &os) const
+{
+ os << "Interest: " << *m_name;
+}
+
+}
diff --git a/model/interest-header.h b/model/ccnx-interest-header.h
similarity index 97%
rename from model/interest-header.h
rename to model/ccnx-interest-header.h
index 9d9ba4a..4b505ea 100644
--- a/model/interest-header.h
+++ b/model/ccnx-interest-header.h
@@ -19,8 +19,8 @@
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#ifndef _INTEREST_HEADER_H_
-#define _INTEREST_HEADER_H_
+#ifndef _CCNX_INTEREST_HEADER_H_
+#define _CCNX_INTEREST_HEADER_H_
#include "ns3/integer.h"
#include "ns3/header.h"
@@ -33,8 +33,6 @@
namespace ns3
{
-namespace NDNabstraction
-{
/**
* CCNx XML definition of Interest
@@ -126,7 +124,7 @@
- InterestLifetime: not used if negative
- Nonce: 32 bit random integer. If value is 0, will not be serialized
*/
-class InterestHeader : public Header
+class CcnxInterestHeader : public Header
{
public:
/**
@@ -221,7 +219,6 @@
uint32_t m_nonce; ///< Nonce. not used if zero
};
-} // namespace NDNabstraction
} // namespace ns3
-#endif // _INTEREST_HEADER_H_
+#endif // _CCNX_INTEREST_HEADER_H_
diff --git a/model/ccnx-interface.cc b/model/ccnx-interface.cc
new file mode 100644
index 0000000..aca2dcd
--- /dev/null
+++ b/model/ccnx-interface.cc
@@ -0,0 +1,165 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2005,2006,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:
+ *
+ */
+
+#include "ccnx-interface.h"
+
+#include "ns3/ccnx-address.h"
+#include "ns3/ccnx-l3-protocol.h"
+#include "ns3/net-device.h"
+#include "ns3/log.h"
+#include "ns3/packet.h"
+#include "ns3/node.h"
+#include "ns3/pointer.h"
+
+NS_LOG_COMPONENT_DEFINE ("CcnxInterface");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (CcnxInterface);
+
+TypeId
+CcnxInterface::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::CcnxInterface")
+ .SetParent<Object> ()
+ ;
+ return tid;
+}
+
+/**
+ * By default, Ccnx interface are created in the "down" state
+ * with no IP addresses. Before becoming useable, the user must
+ * invoke SetUp on them once an Ccnx address and mask have been set.
+ */
+CcnxInterface::CcnxInterface ()
+ : m_ifup (false),
+ m_metric (1),
+ m_node (0),
+ m_device (0),
+{
+ NS_LOG_FUNCTION (this);
+}
+
+CcnxInterface::~CcnxInterface ()
+{
+ NS_LOG_FUNCTION_NOARGS ();
+}
+
+void
+CcnxInterface::DoDispose (void)
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ m_node = 0;
+ m_device = 0;
+ Object::DoDispose ();
+}
+
+void
+CcnxInterface::SetNode (Ptr<Node> node)
+{
+ m_node = node;
+}
+
+void
+CcnxInterface::SetDevice (Ptr<NetDevice> device)
+{
+ m_device = device;
+}
+
+Ptr<NetDevice>
+CcnxInterface::GetDevice (void) const
+{
+ return m_device;
+}
+
+void
+CcnxInterface::SetMetric (uint16_t metric)
+{
+ NS_LOG_FUNCTION (metric);
+ m_metric = metric;
+}
+
+uint16_t
+CcnxInterface::GetMetric (void) const
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ return m_metric;
+}
+
+/**
+ * These are interface states and may be distinct from
+ * NetDevice states, such as found in real implementations
+ * (where the device may be down but interface state is still up).
+ */
+bool
+CcnxInterface::IsUp (void) const
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ return m_ifup;
+}
+
+bool
+CcnxInterface::IsDown (void) const
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ return !m_ifup;
+}
+
+void
+CcnxInterface::SetUp (void)
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ m_ifup = true;
+}
+
+void
+CcnxInterface::SetDown (void)
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ m_ifup = false;
+}
+
+void
+CcnxInterface::Send (Ptr<Packet> p)
+{
+ NS_LOG_FUNCTION (*p);
+ if (!IsUp ())
+ {
+ return;
+ }
+
+ // Check if Local Delivery
+ // if (DynamicCast<LoopbackNetDevice> (m_device))
+ // {
+ // // XXX additional checks needed here (such as whether multicast
+ // // goes to loopback)?
+ // m_device->Send (p, m_device->GetBroadcast (),
+ // CcnxL3Protocol::PROT_NUMBER);
+ // return;
+ // }
+
+ NS_LOG_LOGIC ("Doesn't need ARP");
+ m_device->Send (p, m_device->GetBroadcast (),
+ CcnxL3Protocol::PROT_NUMBER);
+}
+
+}; // namespace ns3
+
diff --git a/model/ccnx-interface.h b/model/ccnx-interface.h
new file mode 100644
index 0000000..f82c3d5
--- /dev/null
+++ b/model/ccnx-interface.h
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2005,2006,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
+ *
+ * Authors:
+ */
+#ifndef CCNX_INTERFACE_H
+#define CCNX_INTERFACE_H
+
+#include <list>
+#include "ns3/ptr.h"
+#include "ns3/object.h"
+
+namespace ns3 {
+
+class NetDevice;
+class Packet;
+class Node;
+
+/**
+ * \brief The Ccnx representation of a network interface
+ *
+ * This class roughly corresponds to the struct in_device
+ * of Linux; the main purpose is to provide address-family
+ * specific information (addresses) about an interface.
+ *
+ * By default, Ccnx interface are created in the "down" state
+ * no IP addresses. Before becoming useable, the user must
+ * add an address of some type and invoke Setup on them.
+ */
+class CcnxInterface : public Object
+{
+public:
+ static TypeId GetTypeId (void);
+
+ CcnxInterface ();
+ virtual ~CcnxInterface();
+
+ void SetNode (Ptr<Node> node);
+ void SetDevice (Ptr<NetDevice> device);
+
+ /**
+ * \returns the underlying NetDevice. This method cannot return zero.
+ */
+ Ptr<NetDevice> GetDevice (void) const;
+
+ /**
+ * \param metric configured routing metric (cost) of this interface
+ *
+ * Note: This is synonymous to the Metric value that ifconfig prints
+ * out. It is used by ns-3 global routing, but other routing daemons
+ * choose to ignore it.
+ */
+ void SetMetric (uint16_t metric);
+
+ /**
+ * \returns configured routing metric (cost) of this interface
+ *
+ * Note: This is synonymous to the Metric value that ifconfig prints
+ * out. It is used by ns-3 global routing, but other routing daemons
+ * may choose to ignore it.
+ */
+ uint16_t GetMetric (void) const;
+
+ /**
+ * These are IP interface states and may be distinct from
+ * NetDevice states, such as found in real implementations
+ * (where the device may be down but IP interface state is still up).
+ */
+ /**
+ * \returns true if this interface is enabled, false otherwise.
+ */
+ bool IsUp (void) const;
+
+ /**
+ * \returns true if this interface is disabled, false otherwise.
+ */
+ bool IsDown (void) const;
+
+ /**
+ * Enable this interface
+ */
+ void SetUp (void);
+
+ /**
+ * Disable this interface
+ */
+ void SetDown (void);
+
+ /**
+ * \param p packet to send
+ */
+ void Send (Ptr<Packet> p);
+
+protected:
+ virtual void DoDispose (void);
+
+private:
+ bool m_ifup;
+ uint16_t m_metric;
+ Ptr<Node> m_node;
+ Ptr<NetDevice> m_device;
+};
+
+} // namespace ns3
+
+#endif
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
new file mode 100644
index 0000000..bf1230c
--- /dev/null
+++ b/model/ccnx-l3-protocol.cc
@@ -0,0 +1,617 @@
+// -*- 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
+//
+// Author: George F. Riley<riley@ece.gatech.edu>
+//
+
+#include "ns3/packet.h"
+#include "ns3/log.h"
+#include "ns3/callback.h"
+#include "ns3/ccnx-address.h"
+#include "ns3/ccnx-route.h"
+#include "ns3/node.h"
+#include "ns3/socket.h"
+#include "ns3/net-device.h"
+#include "ns3/uinteger.h"
+#include "ns3/trace-source-accessor.h"
+#include "ns3/object-vector.h"
+#include "ns3/ccnx-header.h"
+#include "ns3/boolean.h"
+//#include "ns3/ccnx-routing-table-entry.h"
+
+#include "arp-l3-protocol.h"
+#include "ccnx-l3-protocol.h"
+#include "ccnx-interface.h"
+
+NS_LOG_COMPONENT_DEFINE ("CcnxL3Protocol");
+
+namespace ns3 {
+
+const uint16_t CcnxL3Protocol::PROT_NUMBER = 0x7777;
+
+NS_OBJECT_ENSURE_REGISTERED (CcnxL3Protocol);
+
+TypeId
+CcnxL3Protocol::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::CcnxL3Protocol")
+ .SetParent<Ccnx> ()
+ .AddConstructor<CcnxL3Protocol> ()
+ .AddTraceSource ("Tx", "Send ccnx packet to outgoing interface.",
+ MakeTraceSourceAccessor (&CcnxL3Protocol::m_txTrace))
+ .AddTraceSource ("Rx", "Receive ccnx packet from incoming interface.",
+ MakeTraceSourceAccessor (&CcnxL3Protocol::m_rxTrace))
+ .AddTraceSource ("Drop", "Drop ccnx packet",
+ MakeTraceSourceAccessor (&CcnxL3Protocol::m_dropTrace))
+ .AddAttribute ("InterfaceList", "The set of Ccnx interfaces associated to this Ccnx stack.",
+ ObjectVectorValue (),
+ MakeObjectVectorAccessor (&CcnxL3Protocol::m_interfaces),
+ MakeObjectVectorChecker<CcnxInterface> ())
+
+ .AddTraceSource ("SendOutgoing", "A newly-generated packet by this node is about to be queued for transmission",
+ MakeTraceSourceAccessor (&CcnxL3Protocol::m_sendOutgoingTrace))
+
+ ;
+ return tid;
+}
+
+CcnxL3Protocol::CcnxL3Protocol()
+ : m_identification (0)
+{
+ NS_LOG_FUNCTION (this);
+}
+
+CcnxL3Protocol::~CcnxL3Protocol ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+void
+CcnxL3Protocol::SetNode (Ptr<Node> node)
+{
+ m_node = node;
+ // Add a LoopbackNetDevice if needed, and an CcnxInterface on top of it
+ SetupLoopback ();
+}
+
+/*
+ * This method is called by AddAgregate and completes the aggregation
+ * by setting the node in the ccnx stack
+ */
+void
+CcnxL3Protocol::NotifyNewAggregate ()
+{
+ if (m_node == 0)
+ {
+ Ptr<Node>node = this->GetObject<Node>();
+ // verify that it's a valid node and that
+ // the node has not been set before
+ if (node != 0)
+ {
+ this->SetNode (node);
+ }
+ }
+ Object::NotifyNewAggregate ();
+}
+
+// void
+// CcnxL3Protocol::SetRoutingProtocol (Ptr<CcnxRoutingProtocol> routingProtocol)
+// {
+// NS_LOG_FUNCTION (this);
+// m_routingProtocol = routingProtocol;
+// m_routingProtocol->SetCcnx (this);
+// }
+
+
+// Ptr<CcnxRoutingProtocol>
+// CcnxL3Protocol::GetRoutingProtocol (void) const
+// {
+// return m_routingProtocol;
+// }
+
+void
+CcnxL3Protocol::DoDispose (void)
+{
+ NS_LOG_FUNCTION (this);
+
+ for (CcnxInterfaceList::iterator i = m_interfaces.begin (); i != m_interfaces.end (); ++i)
+ {
+ *i = 0;
+ }
+ m_interfaces.clear ();
+ m_node = 0;
+ // m_routingProtocol = 0;
+ Object::DoDispose ();
+}
+
+uint32_t
+CcnxL3Protocol::AddInterface (Ptr<NetDevice> device)
+{
+ NS_LOG_FUNCTION (this << &device);
+
+ Ptr<Node> node = GetObject<Node> ();
+ node->RegisterProtocolHandler (MakeCallback (&CcnxL3Protocol::Receive, this),
+ CcnxL3Protocol::PROT_NUMBER, device, true);
+
+ // ccnx doesn't need arp protocol to run. Everything is broadcast!
+ // node->RegisterProtocolHandler (MakeCallback (&ArpL3Protocol::Receive, PeekPointer (GetObject<ArpL3Protocol> ())),
+ // ArpL3Protocol::PROT_NUMBER, device, true);
+
+ Ptr<CcnxInterface> interface = CreateObject<CcnxInterface> ();
+ interface->SetNode (m_node);
+ interface->SetDevice (device);
+ // interface->SetForwarding (m_ipForward);
+ return AddCcnxInterface (interface);
+}
+
+uint32_t
+CcnxL3Protocol::AddCcnxInterface (Ptr<CcnxInterface>interface)
+{
+ NS_LOG_FUNCTION (this << interface);
+ uint32_t index = m_interfaces.size ();
+ m_interfaces.push_back (interface);
+ return index;
+}
+
+Ptr<CcnxInterface>
+CcnxL3Protocol::GetInterface (uint32_t index) const
+{
+ if (index < m_interfaces.size ())
+ {
+ return m_interfaces[index];
+ }
+ return 0;
+}
+
+uint32_t
+CcnxL3Protocol::GetNInterfaces (void) const
+{
+ return m_interfaces.size ();
+}
+
+int32_t
+CcnxL3Protocol::GetInterfaceForDevice (
+ Ptr<const NetDevice> device) const
+{
+ int32_t interface = 0;
+ for (CcnxInterfaceList::const_iterator i = m_interfaces.begin ();
+ i != m_interfaces.end ();
+ i++, interface++)
+ {
+ if ((*i)->GetDevice () == device)
+ {
+ return interface;
+ }
+ }
+
+ return -1;
+}
+
+void
+CcnxL3Protocol::Receive ( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from,
+ const Address &to, NetDevice::PacketType packetType)
+{
+ NS_LOG_FUNCTION (this << &device << p << protocol << from);
+
+ NS_LOG_LOGIC ("Packet from " << from << " received on node " <<
+ m_node->GetId ());
+
+ uint32_t interface = 0;
+ Ptr<Packet> packet = p->Copy ();
+
+ Ptr<CcnxInterface> ccnxInterface;
+ for (CcnxInterfaceList::const_iterator i = m_interfaces.begin ();
+ i != m_interfaces.end ();
+ i++, interface++)
+ {
+ ccnxInterface = *i;
+ if (ccnxInterface->GetDevice () == device)
+ {
+ if (ccnxInterface->IsUp ())
+ {
+ m_rxTrace (packet, m_node->GetObject<Ccnx> (), interface);
+ break;
+ }
+ else
+ {
+ NS_LOG_LOGIC ("Dropping received packet -- interface is down");
+ CcnxHeader ipHeader;
+ packet->RemoveHeader (ipHeader);
+ m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ccnx> (), interface);
+ return;
+ }
+ }
+ }
+
+ CcnxHeader ipHeader;
+ if (Node::ChecksumEnabled ())
+ {
+ ipHeader.EnableChecksum ();
+ }
+ packet->RemoveHeader (ipHeader);
+
+ // Trim any residual frame padding from underlying devices
+ if (ipHeader.GetPayloadSize () < packet->GetSize ())
+ {
+ packet->RemoveAtEnd (packet->GetSize () - ipHeader.GetPayloadSize ());
+ }
+
+ if (!ipHeader.IsChecksumOk ())
+ {
+ NS_LOG_LOGIC ("Dropping received packet -- checksum not ok");
+ m_dropTrace (ipHeader, packet, DROP_BAD_CHECKSUM, m_node->GetObject<Ccnx> (), interface);
+ return;
+ }
+
+ for (SocketList::iterator i = m_sockets.begin (); i != m_sockets.end (); ++i)
+ {
+ NS_LOG_LOGIC ("Forwarding to raw socket");
+ Ptr<CcnxRawSocketImpl> socket = *i;
+ socket->ForwardUp (packet, ipHeader, ccnxInterface);
+ }
+
+ NS_ASSERT_MSG (m_routingProtocol != 0, "Need a routing protocol object to process packets");
+ if (!m_routingProtocol->RouteInput (packet, ipHeader, device,
+ MakeCallback (&CcnxL3Protocol::IpForward, this),
+ MakeCallback (&CcnxL3Protocol::IpMulticastForward, this),
+ MakeCallback (&CcnxL3Protocol::LocalDeliver, this),
+ MakeCallback (&CcnxL3Protocol::RouteInputError, this)
+ ))
+ {
+ NS_LOG_WARN ("No route found for forwarding packet. Drop.");
+ m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, m_node->GetObject<Ccnx> (), interface);
+ }
+
+
+}
+
+// void
+// CcnxL3Protocol::SendWithHeader (Ptr<Packet> packet,
+// CcnxHeader ipHeader,
+// Ptr<CcnxRoute> route)
+// {
+// NS_LOG_FUNCTION (this << packet << ipHeader << route);
+// SendRealOut (route, packet, ipHeader);
+// }
+
+void
+CcnxL3Protocol::Send (Ptr<Packet> packet,
+ Ptr<CcnxRoute> route)
+{
+ NS_LOG_FUNCTION (this << packet << route);
+
+ // CcnxHeader ipHeader;
+ // bool mayFragment = true;
+ // uint8_t ttl = m_defaultTtl;
+ // SocketIpTtlTag tag;
+ // bool found = packet->RemovePacketTag (tag);
+ // if (found)
+ // {
+ // ttl = tag.GetTtl ();
+ // }
+
+ // // Handle a few cases:
+ // // 1) packet is destined to limited broadcast address
+ // // 2) packet is destined to a subnet-directed broadcast address
+ // // 3) packet is not broadcast, and is passed in with a route entry
+ // // 4) packet is not broadcast, and is passed in with a route entry but route->GetGateway is not set (e.g., on-demand)
+ // // 5) packet is not broadcast, and route is NULL (e.g., a raw socket call, or ICMP)
+
+ // // 1) packet is destined to limited broadcast address or link-local multicast address
+ // if (destination.IsBroadcast () || destination.IsLocalMulticast ())
+ // {
+ // NS_LOG_LOGIC ("CcnxL3Protocol::Send case 1: limited broadcast");
+ // ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
+ // uint32_t ifaceIndex = 0;
+ // for (CcnxInterfaceList::iterator ifaceIter = m_interfaces.begin ();
+ // ifaceIter != m_interfaces.end (); ifaceIter++, ifaceIndex++)
+ // {
+ // Ptr<CcnxInterface> outInterface = *ifaceIter;
+ // Ptr<Packet> packetCopy = packet->Copy ();
+
+ // NS_ASSERT (packetCopy->GetSize () <= outInterface->GetDevice ()->GetMtu ());
+
+ // m_sendOutgoingTrace (ipHeader, packetCopy, ifaceIndex);
+ // packetCopy->AddHeader (ipHeader);
+ // m_txTrace (packetCopy, m_node->GetObject<Ccnx> (), ifaceIndex);
+ // outInterface->Send (packetCopy, destination);
+ // }
+ // return;
+ // }
+
+ // // 2) check: packet is destined to a subnet-directed broadcast address
+ // uint32_t ifaceIndex = 0;
+ // for (CcnxInterfaceList::iterator ifaceIter = m_interfaces.begin ();
+ // ifaceIter != m_interfaces.end (); ifaceIter++, ifaceIndex++)
+ // {
+ // Ptr<CcnxInterface> outInterface = *ifaceIter;
+ // for (uint32_t j = 0; j < GetNAddresses (ifaceIndex); j++)
+ // {
+ // CcnxInterfaceAddress ifAddr = GetAddress (ifaceIndex, j);
+ // NS_LOG_LOGIC ("Testing address " << ifAddr.GetLocal () << " with mask " << ifAddr.GetMask ());
+ // if (destination.IsSubnetDirectedBroadcast (ifAddr.GetMask ()) &&
+ // destination.CombineMask (ifAddr.GetMask ()) == ifAddr.GetLocal ().CombineMask (ifAddr.GetMask ()) )
+ // {
+ // NS_LOG_LOGIC ("CcnxL3Protocol::Send case 2: subnet directed bcast to " << ifAddr.GetLocal ());
+ // ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
+ // Ptr<Packet> packetCopy = packet->Copy ();
+ // m_sendOutgoingTrace (ipHeader, packetCopy, ifaceIndex);
+ // packetCopy->AddHeader (ipHeader);
+ // m_txTrace (packetCopy, m_node->GetObject<Ccnx> (), ifaceIndex);
+ // outInterface->Send (packetCopy, destination);
+ // return;
+ // }
+ // }
+ // }
+
+ // // 3) packet is not broadcast, and is passed in with a route entry
+ // // with a valid CcnxAddress as the gateway
+ // if (route && route->GetGateway () != CcnxAddress ())
+ // {
+ // NS_LOG_LOGIC ("CcnxL3Protocol::Send case 3: passed in with route");
+ // ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
+ // int32_t interface = GetInterfaceForDevice (route->GetOutputDevice ());
+ // m_sendOutgoingTrace (ipHeader, packet, interface);
+ // SendRealOut (route, packet->Copy (), ipHeader);
+ // return;
+ // }
+ // // 4) packet is not broadcast, and is passed in with a route entry but route->GetGateway is not set (e.g., on-demand)
+ // if (route && route->GetGateway () == CcnxAddress ())
+ // {
+ // // This could arise because the synchronous RouteOutput() call
+ // // returned to the transport protocol with a source address but
+ // // there was no next hop available yet (since a route may need
+ // // to be queried).
+ // NS_FATAL_ERROR ("CcnxL3Protocol::Send case 4: This case not yet implemented");
+ // }
+ // // 5) packet is not broadcast, and route is NULL (e.g., a raw socket call)
+ // NS_LOG_LOGIC ("CcnxL3Protocol::Send case 5: passed in with no route " << destination);
+ // Socket::SocketErrno errno_;
+ // Ptr<NetDevice> oif (0); // unused for now
+ // ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
+ // Ptr<CcnxRoute> newRoute;
+ // if (m_routingProtocol != 0)
+ // {
+ // newRoute = m_routingProtocol->RouteOutput (packet, ipHeader, oif, errno_);
+ // }
+ // else
+ // {
+ // NS_LOG_ERROR ("CcnxL3Protocol::Send: m_routingProtocol == 0");
+ // }
+ // if (newRoute)
+ // {
+ // int32_t interface = GetInterfaceForDevice (newRoute->GetOutputDevice ());
+ // m_sendOutgoingTrace (ipHeader, packet, interface);
+ // SendRealOut (newRoute, packet->Copy (), ipHeader);
+ // }
+ // else
+ // {
+ // NS_LOG_WARN ("No route to host. Drop.");
+ // m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, m_node->GetObject<Ccnx> (), 0);
+ // }
+}
+
+
+void
+CcnxL3Protocol::SendRealOut (Ptr<CcnxRoute> route,
+ Ptr<Packet> packet,
+ CcnxHeader const &ipHeader)
+{
+ NS_LOG_FUNCTION (this << packet << &ipHeader);
+
+ // if (route == 0)
+ // {
+ // NS_LOG_WARN ("No route to host. Drop.");
+ // m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, m_node->GetObject<Ccnx> (), 0);
+ // return;
+ // }
+ // packet->AddHeader (ipHeader);
+ // Ptr<NetDevice> outDev = route->GetOutputDevice ();
+ // int32_t interface = GetInterfaceForDevice (outDev);
+ // NS_ASSERT (interface >= 0);
+ // Ptr<CcnxInterface> outInterface = GetInterface (interface);
+ // NS_LOG_LOGIC ("Send via NetDevice ifIndex " << outDev->GetIfIndex () << " ccnxInterfaceIndex " << interface);
+
+ // NS_ASSERT_MSG (packet->GetSize () <= outInterface->GetDevice ()->GetMtu (),
+ // "Packet size " << packet->GetSize () << " exceeds device MTU "
+ // << outInterface->GetDevice ()->GetMtu ()
+ // << " for Ccnx; fragmentation not supported");
+ // if (!route->GetGateway ().IsEqual (CcnxAddress ("0.0.0.0")))
+ // {
+ // if (outInterface->IsUp ())
+ // {
+ // NS_LOG_LOGIC ("Send to gateway " << route->GetGateway ());
+ // m_txTrace (packet, m_node->GetObject<Ccnx> (), interface);
+ // outInterface->Send (packet, route->GetGateway ());
+ // }
+ // else
+ // {
+ // NS_LOG_LOGIC ("Dropping -- outgoing interface is down: " << route->GetGateway ());
+ // CcnxHeader ipHeader;
+ // packet->RemoveHeader (ipHeader);
+ // m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ccnx> (), interface);
+ // }
+ // }
+ // else
+ // {
+ // if (outInterface->IsUp ())
+ // {
+ // NS_LOG_LOGIC ("Send to destination " << ipHeader.GetDestination ());
+ // m_txTrace (packet, m_node->GetObject<Ccnx> (), interface);
+ // outInterface->Send (packet, ipHeader.GetDestination ());
+ // }
+ // else
+ // {
+ // NS_LOG_LOGIC ("Dropping -- outgoing interface is down: " << ipHeader.GetDestination ());
+ // CcnxHeader ipHeader;
+ // packet->RemoveHeader (ipHeader);
+ // m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, m_node->GetObject<Ccnx> (), interface);
+ // }
+ // }
+}
+
+
+// This function analogous to Linux ip_forward()
+// void
+// CcnxL3Protocol::IpForward (Ptr<CcnxRoute> rtentry, Ptr<const Packet> p, const CcnxHeader &header)
+// {
+// NS_LOG_FUNCTION (this << rtentry << p << header);
+// NS_LOG_LOGIC ("Forwarding logic for node: " << m_node->GetId ());
+// // Forwarding
+// CcnxHeader ipHeader = header;
+// Ptr<Packet> packet = p->Copy ();
+// int32_t interface = GetInterfaceForDevice (rtentry->GetOutputDevice ());
+// ipHeader.SetTtl (ipHeader.GetTtl () - 1);
+// if (ipHeader.GetTtl () == 0)
+// {
+// // Do not reply to ICMP or to multicast/broadcast IP address
+// if (ipHeader.GetProtocol () != Icmpv4L4Protocol::PROT_NUMBER &&
+// ipHeader.GetDestination ().IsBroadcast () == false &&
+// ipHeader.GetDestination ().IsMulticast () == false)
+// {
+// Ptr<Icmpv4L4Protocol> icmp = GetIcmp ();
+// icmp->SendTimeExceededTtl (ipHeader, packet);
+// }
+// NS_LOG_WARN ("TTL exceeded. Drop.");
+// m_dropTrace (header, packet, DROP_TTL_EXPIRED, m_node->GetObject<Ccnx> (), interface);
+// return;
+// }
+// m_unicastForwardTrace (ipHeader, packet, interface);
+// SendRealOut (rtentry, packet, ipHeader);
+// }
+
+// Will be called from CcnxRoutingProtocol if prefix is locally registered
+// Local interest will be satisfied inside CcnxInterface::Send call
+
+void
+CcnxL3Protocol::LocalDeliver (Ptr<const Packet> packet, CcnxHeader const&ip, uint32_t iif)
+{
+ NS_LOG_FUNCTION (this << packet << &ip);
+ Ptr<Packet> p = packet->Copy (); // need to pass a non-const packet up
+
+// m_localDeliverTrace (ip, packet, iif);
+
+// Ptr<CcnxL4Protocol> protocol = GetProtocol (ip.GetProtocol ());
+// if (protocol != 0)
+// {
+// // we need to make a copy in the unlikely event we hit the
+// // RX_ENDPOINT_UNREACH codepath
+// Ptr<Packet> copy = p->Copy ();
+// enum CcnxL4Protocol::RxStatus status =
+// protocol->Receive (p, ip, GetInterface (iif));
+// switch (status) {
+// case CcnxL4Protocol::RX_OK:
+// // fall through
+// case CcnxL4Protocol::RX_ENDPOINT_CLOSED:
+// // fall through
+// case CcnxL4Protocol::RX_CSUM_FAILED:
+// break;
+// case CcnxL4Protocol::RX_ENDPOINT_UNREACH:
+// if (ip.GetDestination ().IsBroadcast () == true ||
+// ip.GetDestination ().IsMulticast () == true)
+// {
+// break; // Do not reply to broadcast or multicast
+// }
+// // Another case to suppress ICMP is a subnet-directed broadcast
+// bool subnetDirected = false;
+// for (uint32_t i = 0; i < GetNAddresses (iif); i++)
+// {
+// CcnxInterfaceAddress addr = GetAddress (iif, i);
+// if (addr.GetLocal ().CombineMask (addr.GetMask ()) == ip.GetDestination ().CombineMask (addr.GetMask ()) &&
+// ip.GetDestination ().IsSubnetDirectedBroadcast (addr.GetMask ()))
+// {
+// subnetDirected = true;
+// }
+s// }
+// if (subnetDirected == false)
+// {
+// GetIcmp ()->SendDestUnreachPort (ip, copy);
+// }
+// }
+// }
+}
+
+void
+CcnxL3Protocol::SetMetric (uint32_t i, uint16_t metric)
+{
+ NS_LOG_FUNCTION (this << i << metric);
+ Ptr<CcnxInterface> interface = GetInterface (i);
+ interface->SetMetric (metric);
+}
+
+uint16_t
+CcnxL3Protocol::GetMetric (uint32_t i) const
+{
+ Ptr<CcnxInterface> interface = GetInterface (i);
+ return interface->GetMetric ();
+}
+
+uint16_t
+CcnxL3Protocol::GetMtu (uint32_t i) const
+{
+ Ptr<CcnxInterface> interface = GetInterface (i);
+ return interface->GetDevice ()->GetMtu ();
+}
+
+bool
+CcnxL3Protocol::IsUp (uint32_t i) const
+{
+ Ptr<CcnxInterface> interface = GetInterface (i);
+ return interface->IsUp ();
+}
+
+void
+CcnxL3Protocol::SetUp (uint32_t i)
+{
+ NS_LOG_FUNCTION (this << i);
+ Ptr<CcnxInterface> interface = GetInterface (i);
+ interface->SetUp ();
+
+ if (m_routingProtocol != 0)
+ {
+ m_routingProtocol->NotifyInterfaceUp (i);
+ }
+}
+
+void
+CcnxL3Protocol::SetDown (uint32_t ifaceIndex)
+{
+ NS_LOG_FUNCTION (this << ifaceIndex);
+ Ptr<CcnxInterface> interface = GetInterface (ifaceIndex);
+ interface->SetDown ();
+
+ if (m_routingProtocol != 0)
+ {
+ m_routingProtocol->NotifyInterfaceDown (ifaceIndex);
+ }
+}
+
+Ptr<NetDevice>
+CcnxL3Protocol::GetNetDevice (uint32_t i)
+{
+ return GetInterface (i)->GetDevice ();
+}
+
+void
+CcnxL3Protocol::RouteInputError (Ptr<const Packet> p, const CcnxHeader & ipHeader, Socket::SocketErrno sockErrno)
+{
+ NS_LOG_FUNCTION (this << p << ipHeader << sockErrno);
+ NS_LOG_LOGIC ("Route input failure-- dropping packet to " << ipHeader << " with errno " << sockErrno);
+ m_dropTrace (ipHeader, p, DROP_ROUTE_ERROR, m_node->GetObject<Ccnx> (), 0);
+}
+
+} //namespace ns3
diff --git a/model/ccnx-l3-protocol.h b/model/ccnx-l3-protocol.h
new file mode 100644
index 0000000..d83f687
--- /dev/null
+++ b/model/ccnx-l3-protocol.h
@@ -0,0 +1,191 @@
+// -*- 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
+//
+// Author: George F. Riley<riley@ece.gatech.edu>
+//
+
+#ifndef CCNX_L3_PROTOCOL_H
+#define CCNX_L3_PROTOCOL_H
+
+#include <list>
+#include <vector>
+#include <stdint.h>
+#include "ns3/ptr.h"
+#include "ns3/net-device.h"
+#include "ns3/ccnx.h"
+#include "ns3/traced-callback.h"
+
+namespace ns3 {
+
+class Packet;
+class NetDevice;
+class CcnxInterface;
+// class CcnxAddress;
+// class CcnxHeader;
+// class CcnxRoutingTableEntry;
+class CcnxRoute;
+class Node;
+class Socket;
+
+
+/**
+ * \brief Implement the Ccnx layer.
+ *
+ * This is the actual implementation of IP. It contains APIs to send and
+ * receive packets at the IP layer, as well as APIs for IP routing.
+ *
+ * This class contains two distinct groups of trace sources. The
+ * trace sources 'Rx' and 'Tx' are called, respectively, immediately
+ * after receiving from the NetDevice and immediately before sending
+ * to a NetDevice for transmitting a packet. These are low level
+ * trace sources that include the CcnxHeader already serialized into
+ * the packet. In contrast, the Drop, SendOutgoing, UnicastForward,
+ * and LocalDeliver trace sources are slightly higher-level and pass
+ * around the CcnxHeader as an explicit parameter and not as part of
+ * the packet.
+ */
+class CcnxL3Protocol : public Ccnx
+{
+public:
+ static TypeId GetTypeId (void);
+ static const uint16_t PROT_NUMBER;
+
+ CcnxL3Protocol();
+ virtual ~CcnxL3Protocol ();
+
+ /**
+ * \enum DropReason
+ * \brief Reason why a packet has been dropped.
+ */
+ enum DropReason
+ {
+ DROP_TTL_EXPIRED = 1, /**< Packet TTL has expired */
+ DROP_NO_ROUTE, /**< No route to host */
+ DROP_BAD_CHECKSUM, /**< Bad checksum */
+ DROP_INTERFACE_DOWN, /**< Interface is down so can not send packet */
+ DROP_ROUTE_ERROR, /**< Route error */
+ };
+
+ void SetNode (Ptr<Node> node);
+
+ // functions defined in base class Ccnx
+
+ // void SetRoutingProtocol (Ptr<CcnxRoutingProtocol> routingProtocol);
+ // Ptr<CcnxRoutingProtocol> GetRoutingProtocol (void) const;
+
+ // Ptr<Socket> CreateRawSocket (void);
+ // void DeleteRawSocket (Ptr<Socket> socket);
+
+ /**
+ * Lower layer calls this method after calling L3Demux::Lookup
+ * The ARP subclass needs to know from which NetDevice this
+ * packet is coming to:
+ * - implement a per-NetDevice ARP cache
+ * - send back arp replies on the right device
+ * \param device network device
+ * \param p the packet
+ * \param protocol lower layer protocol value
+ * \param from lower layer address of the correspondant
+ * \param to lower layer address of the destination
+ * \param packetType type of the packet (broadcast/multicast/unicast/otherhost)
+ */
+ void Receive ( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol,
+ const Address &from,
+ const Address &to,
+ NetDevice::PacketType packetType);
+
+ /**
+ * \param packet packet to send
+ * \param route route entry
+ *
+ * Higher-level layers call this method to send a packet
+ * down the stack to the MAC and PHY layers.
+ */
+ void Send (Ptr<Packet> packet, Ptr<CcnxRoute> route);
+
+ uint32_t AddInterface (Ptr<NetDevice> device);
+ Ptr<CcnxInterface> GetInterface (uint32_t i) const;
+ uint32_t GetNInterfaces (void) const;
+
+ int32_t GetInterfaceForDevice (Ptr<const NetDevice> device) const;
+ // bool IsDestinationAddress (CcnxAddress address, uint32_t iif) const;
+
+ void SetMetric (uint32_t i, uint16_t metric);
+ uint16_t GetMetric (uint32_t i) const;
+ uint16_t GetMtu (uint32_t i) const;
+ bool IsUp (uint32_t i) const;
+ void SetUp (uint32_t i);
+ void SetDown (uint32_t i);
+
+ Ptr<NetDevice> GetNetDevice (uint32_t i);
+
+protected:
+
+ virtual void DoDispose (void);
+ /**
+ * This function will notify other components connected to the node that a new stack member is now connected
+ * This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
+ */
+ virtual void NotifyNewAggregate ();
+private:
+ // friend class CcnxL3ProtocolTestCase;
+ CcnxL3Protocol(const CcnxL3Protocol &);
+ CcnxL3Protocol &operator = (const CcnxL3Protocol &);
+
+ void
+ SendRealOut (Ptr<CcnxRoute> route,
+ Ptr<Packet> packet,
+ CcnxHeader const &ipHeader);
+
+ // void
+ // IpForward (Ptr<CcnxRoute> rtentry,
+ // Ptr<const Packet> p,
+ // const CcnxHeader &header);
+
+ // void
+ // IpMulticastForward (Ptr<CcnxMulticastRoute> mrtentry,
+ // Ptr<const Packet> p,
+ // const CcnxHeader &header);
+
+ void LocalDeliver (Ptr<const Packet> p, CcnxHeader const&ip, uint32_t iif);
+ void RouteInputError (Ptr<const Packet> p, const CcnxHeader & ipHeader, Socket::SocketErrno sockErrno);
+
+ uint32_t AddCcnxInterface (Ptr<CcnxInterface> interface);
+
+ typedef std::vector<Ptr<CcnxInterface> > CcnxInterfaceList;
+
+ CcnxInterfaceList m_interfaces;
+ uint16_t m_identification;
+ Ptr<Node> m_node;
+ CcnxL4Protocol m_layer4;
+
+ TracedCallback<const CcnxHeader &, Ptr<const Packet>, uint32_t> m_sendOutgoingTrace;
+ TracedCallback<const CcnxHeader &, Ptr<const Packet>, uint32_t> m_unicastForwardTrace;
+ TracedCallback<const CcnxHeader &, Ptr<const Packet>, uint32_t> m_localDeliverTrace;
+
+ // The following two traces pass a packet with an IP header
+ TracedCallback<Ptr<const Packet>, Ptr<Ccnx>, uint32_t> m_txTrace;
+ TracedCallback<Ptr<const Packet>, Ptr<Ccnx>, uint32_t> m_rxTrace;
+ // <ip-header, payload, reason, ifindex> (ifindex not valid if reason is DROP_NO_ROUTE)
+ TracedCallback<const CcnxHeader &, Ptr<const Packet>, DropReason, Ptr<Ccnx>, uint32_t> m_dropTrace;
+
+ // Ptr<CcnxRoutingProtocol> m_routingProtocol;
+};
+
+} // Namespace ns3
+
+#endif /* CCNX_L3_PROTOCOL_H */
diff --git a/model/ccnx-l4-protocol.cc b/model/ccnx-l4-protocol.cc
new file mode 100644
index 0000000..8c4d400
--- /dev/null
+++ b/model/ccnx-l4-protocol.cc
@@ -0,0 +1,43 @@
+// -*- 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
+//
+// Author:
+//
+
+
+#include "ccnx-l4-protocol.h"
+
+#include "ns3/uinteger.h"
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (CcnxL4Protocol);
+
+TypeId
+CcnxL4Protocol::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::CcnxL4Protocol")
+ .SetParent<Object> ()
+ ;
+ return tid;
+}
+
+CcnxL4Protocol::~CcnxL4Protocol ()
+{
+}
+
+} //namespace ns3
diff --git a/model/ccnx-l4-protocol.h b/model/ccnx-l4-protocol.h
new file mode 100644
index 0000000..14aceef
--- /dev/null
+++ b/model/ccnx-l4-protocol.h
@@ -0,0 +1,84 @@
+// -*- 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
+//
+// Author:
+//
+
+#ifndef CCNX_L4_PROTOCOL_H
+#define CCNX_L4_PROTOCOL_H
+
+#include "ns3/object.h"
+#include "ns3/callback.h"
+#include "ns3/ccnx-interest-header.h"
+#include "ns3/ccnx-content-object-header.h"
+
+namespace ns3 {
+
+class Packet;
+class CcnxInterface;
+class CcnxRoute;
+
+/**
+ * \brief Actual implementation of CCNx protocol
+ */
+class CcnxL4Protocol : public Object
+{
+public:
+ enum RxStatus {
+ RX_OK,
+
+ // RX_CSUM_FAILED,
+ // RX_ENDPOINT_CLOSED,
+ // RX_ENDPOINT_UNREACH
+ };
+
+ static TypeId GetTypeId (void);
+
+ virtual ~CcnxL4Protocol ();
+
+ /**
+ * \param p packet to forward up
+ * \param header Ccnx Header information
+ * \param incomingInterface the CcnxInterface on which the packet arrived
+ *
+ * Called from lower-level layers to send the packet up
+ * in the stack.
+ */
+ virtual enum RxStatus Receive (Ptr<Packet> p,
+ CcnxHeader const &header,
+ Ptr<CcnxInterface> incomingInterface) = 0;
+
+ typedef Callback<void,Ptr<Packet>, Ptr<CcnxRoute> > DownTargetCallback;
+ /**
+ * This method allows a caller to set the current down target callback
+ * set for this L4 protocol
+ *
+ * \param cb current Callback for the L4 protocol
+ */
+ virtual void SetDownTarget (DownTargetCallback cb) = 0;
+ /**
+ * This method allows a caller to get the current down target callback
+ * set for this L4 protocol, for
+ *
+ * \return current Callback for the L4 protocol
+ */
+ virtual DownTargetCallback GetDownTarget (void) const = 0;
+};
+
+} // Namespace ns3
+
+#endif // CCNX_L4_PROTOCOL_H
diff --git a/model/ccnx-route.cc b/model/ccnx-route.cc
new file mode 100644
index 0000000..704f08c
--- /dev/null
+++ b/model/ccnx-route.cc
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2009 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
+ *
+ */
+
+#include "ccnx-route.h"
+
+#include "ns3/net-device.h"
+#include "ns3/assert.h"
+
+namespace ns3 {
+
+CcnxRoute::CcnxRoute ()
+{
+}
+
+void
+CcnxRoute::SetPrefix (const Ptr<Name::Components> &prefix)
+{
+ m_prefix = prefix;
+}
+
+const Name::Components&
+CcnxRoute::GetPrefix (void) const
+{
+ return *m_prefix;
+}
+
+void
+CcnxRoute::SetOutputDevice (Ptr<NetDevice> outputDevice)
+{
+ m_outputDevice = outputDevice;
+}
+
+Ptr<NetDevice>
+CcnxRoute::GetOutputDevice (void) const
+{
+ return m_outputDevice;
+}
+
+std::ostream& operator<< (std::ostream& os, CcnxRoute const& route)
+{
+ os << "prefix=" << route.GetPrefix () << ", dev=" << route.GetOutputDevice ()->GetIfIndex ();
+ return os;
+}
+
+} //namespace ns3
diff --git a/model/ccnx-route.h b/model/ccnx-route.h
new file mode 100644
index 0000000..9502330
--- /dev/null
+++ b/model/ccnx-route.h
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2009 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
+ *
+ */
+#ifndef CCNX_ROUTE_H
+#define CCNX_ROUTE_H
+
+#include <list>
+#include <map>
+#include <ostream>
+
+#include "ns3/simple-ref-count.h"
+
+namespace ns3 {
+
+class NetDevice;
+
+/**
+ * \ingroup ccnxRouting
+ *
+ *\brief Ccnx route cache entry (similar to Linux struct rtable)
+ *
+ * This is a reference counted object. In the future, we will add other
+ * entries from struct dst_entry, struct rtable, and struct dst_ops as needed.
+ */
+class CcnxRoute : public SimpleRefCount<CcnxRoute>
+{
+public:
+ CcnxRoute ();
+
+ /**
+ * \param dest Destination CcnxAddress
+ */
+ void SetPrefix (const Ptr<Name::Components> &dest);
+ /**
+ * \return Destination CcnxAddress of the route
+ */
+ const Name::Components& GetPrefix (void) const;
+
+ /**
+ * Equivalent in Linux to dst_entry.dev
+ *
+ * \param outputDevice pointer to NetDevice for outgoing packets
+ */
+ void SetOutputDevice (Ptr<NetDevice> outputDevice);
+ /**
+ * \return pointer to NetDevice for outgoing packets
+ */
+ Ptr<NetDevice> GetOutputDevice (void) const;
+
+private:
+ Name::Components m_prefix;
+ Ptr<NetDevice> m_outputDevice;
+};
+
+std::ostream& operator<< (std::ostream& os, CcnxRoute const& route);
+
+} //namespace NDNabstraction
+} //namespace ns3
+
+#endif /* CCNX_ROUTE_H */
diff --git a/model/ccnx.cc b/model/ccnx.cc
new file mode 100644
index 0000000..8a5e6d0
--- /dev/null
+++ b/model/ccnx.cc
@@ -0,0 +1,47 @@
+/* -*- 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: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ns3/assert.h"
+#include "ns3/node.h"
+#include "ns3/boolean.h"
+#include "ccnx.h"
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (Ccnx);
+
+TypeId
+Ccnx::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::Ccnx")
+ .SetParent<Object> ()
+ ;
+ return tid;
+}
+
+Ccnx::Ccnx ()
+{
+}
+
+Ccnx::~Ccnx ()
+{
+}
+
+} // namespace ns3
diff --git a/model/ccnx.h b/model/ccnx.h
new file mode 100644
index 0000000..9196067
--- /dev/null
+++ b/model/ccnx.h
@@ -0,0 +1,168 @@
+/* -*- 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+#ifndef CCNX_H
+#define CCNX_H
+
+#include <stdint.h>
+#include "ns3/object.h"
+#include "ns3/socket.h"
+#include "ns3/callback.h"
+
+#include "ccnx-route.h"
+
+namespace ns3 {
+
+class Node;
+class NetDevice;
+class Packet;
+// class CcnxRoutingProtocol;
+
+/**
+ * \ingroup internet
+ * \defgroup ccnx Ccnx
+ */
+/**
+ * \ingroup ccnx
+ * \brief Access to the Ccnx forwarding table, interfaces, and configuration
+ *
+ * This class defines the API to manipulate the following aspects of
+ * the Ccnx implementation:
+ * -# register a NetDevice for use by the Ccnx layer (basically, to
+ * create Ccnx-related state such as addressing and neighbor cache that
+ * is associated with a NetDevice)
+ * -# manipulate the status of the NetDevice from the Ccnx perspective,
+ * such as marking it as Up or Down,
+ // * -# adding, deleting, and getting addresses associated to the Ccnx
+ // * interfaces.
+ * -# exporting Ccnx configuration attributes
+ *
+ * Each NetDevice has conceptually a single Ccnx interface associated
+ * with it.
+ */
+class Ccnx : public Object
+{
+public:
+ static TypeId GetTypeId (void);
+ Ccnx ();
+ virtual ~Ccnx ();
+
+ /**
+ * \brief Register a new routing protocol to be used by this Ccnx stack
+ *
+ * This call will replace any routing protocol that has been previously
+ * registered. If you want to add multiple routing protocols, you must
+ * add them to a CcnxListRoutingProtocol directly.
+ *
+ * \param routingProtocol smart pointer to CcnxRoutingProtocol object
+ */
+ // virtual void SetRoutingProtocol (Ptr<CcnxRoutingProtocol> routingProtocol) = 0;
+
+ /**
+ * \brief Get the routing protocol to be used by this Ccnx stack
+ *
+ * \returns smart pointer to CcnxRoutingProtocol object, or null pointer if none
+ */
+ // virtual Ptr<CcnxRoutingProtocol> GetRoutingProtocol (void) const = 0;
+
+ /**
+ * \param device device to add to the list of Ccnx interfaces
+ * which can be used as output interfaces during packet forwarding.
+ * \returns the index of the Ccnx interface added.
+ *
+ * Once a device has been added, it can never be removed: if you want
+ * to disable it, you can invoke Ccnx::SetDown which will
+ * make sure that it is never used during packet forwarding.
+ */
+ virtual uint32_t AddInterface (Ptr<NetDevice> device) = 0;
+
+ /**
+ * \returns the number of interfaces added by the user.
+ */
+ virtual uint32_t GetNInterfaces (void) const = 0;
+
+ /**
+ * \param packet packet to send
+ * \param route route entry
+ *
+ * Higher-level layers call this method to send a packet
+ * down the stack to the MAC and PHY layers.
+ */
+ virtual void Send (Ptr<Packet> packet, Ptr<CcnxRoute> route) = 0;
+
+ /**
+ * \param interface The interface number of an Ccnx interface.
+ * \returns The NetDevice associated with the Ccnx interface number.
+ */
+ virtual Ptr<NetDevice> GetNetDevice (uint32_t interface) = 0;
+
+ /**
+ * \param device The NetDevice for an CcnxInterface
+ * \returns The interface number of an Ccnx interface or -1 if not found.
+ */
+ virtual int32_t GetInterfaceForDevice (Ptr<const NetDevice> device) const = 0;
+
+ /**
+ * \param interface The interface number of an Ccnx interface
+ * \param metric routing metric (cost) associated to the underlying
+ * Ccnx interface
+ */
+ virtual void SetMetric (uint32_t interface, uint16_t metric) = 0;
+
+ /**
+ * \param interface The interface number of an Ccnx interface
+ * \returns routing metric (cost) associated to the underlying
+ * Ccnx interface
+ */
+ virtual uint16_t GetMetric (uint32_t interface) const = 0;
+
+ /**
+ * \param interface Interface number of Ccnx interface
+ * \returns the Maximum Transmission Unit (in bytes) associated
+ * to the underlying Ccnx interface
+ */
+ virtual uint16_t GetMtu (uint32_t interface) const = 0;
+
+ /**
+ * \param interface Interface number of Ccnx interface
+ * \returns true if the underlying interface is in the "up" state,
+ * false otherwise.
+ */
+ virtual bool IsUp (uint32_t interface) const = 0;
+
+ /**
+ * \param interface Interface number of Ccnx interface
+ *
+ * Set the interface into the "up" state. In this state, it is
+ * considered valid during Ccnx forwarding.
+ */
+ virtual void SetUp (uint32_t interface) = 0;
+
+ /**
+ * \param interface Interface number of Ccnx interface
+ *
+ * Set the interface into the "down" state. In this state, it is
+ * ignored during Ccnx forwarding.
+ */
+ virtual void SetDown (uint32_t interface) = 0;
+};
+
+} // namespace ns3
+
+#endif /* CCNX_H */
diff --git a/model/content-object-header.cc b/model/content-object-header.cc
deleted file mode 100644
index 4399afd..0000000
--- a/model/content-object-header.cc
+++ /dev/null
@@ -1,84 +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 "content-object-header.h"
-
-namespace ns3
-{
-namespace NDNabstraction
-{
-
- ContentObjectHeader::ContentObjectHeader ()
- {
- }
-
- void
- ContentObjectHeader::SetName (const Ptr<Name::Components> &name)
- {
- m_name = name;
- }
-
- const Name::Components&
- ContentObjectHeader::GetName () const
- {
- return *m_name;
- }
-
- uint32_t
- ContentObjectHeader::GetSerializedSize (void) const
- {
- return 0;
- }
-
- void
- ContentObjectHeader::Serialize (Buffer::Iterator start) const
- {
- return;
- }
-
- uint32_t
- ContentObjectHeader::Deserialize (Buffer::Iterator start)
- {
- return 0;
- }
-
- TypeId
- ContentObjectHeader::GetTypeId (void)
- {
- static TypeId tid = TypeId ("ns3::NDNabstraction::ContentObjectHeader")
- .SetParent<Header> ()
- .AddConstructor<ContentObjectHeader> ()
- ;
- return tid;
- }
-
- TypeId
- ContentObjectHeader::GetInstanceTypeId (void) const
- {
- return GetTypeId ();
- }
-
- void
- ContentObjectHeader::Print (std::ostream &os) const
- {
- os << "ContentObject: " << *m_name;
- }
-}
-}
diff --git a/model/interest-header.cc b/model/interest-header.cc
deleted file mode 100644
index f9300c4..0000000
--- a/model/interest-header.cc
+++ /dev/null
@@ -1,191 +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>
- */
-
-///< #CCN_PR_SCOPE0 (0x20) local scope,
-///< #CCN_PR_SCOPE1 (0x40) this host,
-///< #CCN_PR_SCOPE2 (0x80) immediate neighborhood
-
-#include "interest-header.h"
-
-namespace ns3
-{
-namespace NDNabstraction
-{
-
- InterestHeader::InterestHeader ()
- : m_minSuffixComponents (-1)
- , m_maxSuffixComponents (-1)
- , m_childSelector (false)
- , m_answerOriginKind (false)
- , m_scope (-1)
- , m_interestLifetime (-1)
- , m_nonce (0)
- {
- }
-
- void
- InterestHeader::SetName (const Ptr<Name::Components> &name)
- {
- m_name = name;
- }
-
- const Name::Components&
- InterestHeader::GetName () const
- {
- return *m_name;
- }
-
- void
- InterestHeader::SetMinSuffixComponents (int32_t value)
- {
- m_minSuffixComponents = value;
- }
-
- int32_t
- InterestHeader::GetMinSuffixComponents () const
- {
- return m_minSuffixComponents;
- }
-
- void
- InterestHeader::SetMaxSuffixComponents (int32_t value)
- {
- m_maxSuffixComponents = value;
- }
-
- int32_t
- InterestHeader::GetMaxSuffixComponents () const
- {
- return m_maxSuffixComponents;
- }
-
- void
- InterestHeader::SetExclude (const Ptr<Name::Components> &exclude)
- {
- m_exclude = exclude;
- }
-
- const Name::Components&
- InterestHeader::GetExclude () const
- {
- return *m_exclude;
- }
-
- void
- InterestHeader::EnableChildSelector ()
- {
- m_childSelector = true;
- }
-
- bool
- InterestHeader::IsEnabledChildSelector () const
- {
- return m_childSelector;
- }
-
- void
- InterestHeader::EnableAnswerOriginKind ()
- {
- m_answerOriginKind = true;
- }
-
- bool
- InterestHeader::IsEnabledAnswerOriginKind () const
- {
- return m_answerOriginKind;
- }
-
- void
- InterestHeader::SetScope (int8_t scope)
- {
- m_scope = scope;
- }
-
- int8_t
- InterestHeader::GetScope () const
- {
- return m_scope;
- }
-
- void
- InterestHeader::SetInterestLifetime (intmax_t lifetime)
- {
- m_interestLifetime = lifetime;
- }
-
- intmax_t
- InterestHeader::GetInterestLifetime () const
- {
- return m_interestLifetime;
- }
-
- void
- InterestHeader::SetNonce (uint32_t nonce)
- {
- m_nonce = nonce;
- }
-
- uint32_t
- InterestHeader::GetNonce () const
- {
- return m_nonce;
- }
-
- uint32_t
- InterestHeader::GetSerializedSize (void) const
- {
- return 0;
- }
-
- void
- InterestHeader::Serialize (Buffer::Iterator start) const
- {
- return;
- }
-
- uint32_t
- InterestHeader::Deserialize (Buffer::Iterator start)
- {
- return 0;
- }
-
- TypeId
- InterestHeader::GetTypeId (void)
- {
- static TypeId tid = TypeId ("ns3::NDNabstraction::InterestHeader")
- .SetParent<Header> ()
- .AddConstructor<InterestHeader> ()
- ;
- return tid;
- }
-
- TypeId
- InterestHeader::GetInstanceTypeId (void) const
- {
- return GetTypeId ();
- }
-
- void
- InterestHeader::Print (std::ostream &os) const
- {
- os << "Interest: " << *m_name;
- }
-}
-}
diff --git a/model/name-components.cc b/model/name-components.cc
index a6aae87..319151f 100644
--- a/model/name-components.cc
+++ b/model/name-components.cc
@@ -28,7 +28,6 @@
using namespace std;
namespace ns3 {
-namespace NDNabstraction {
namespace Name {
Components::Components ()
@@ -87,5 +86,4 @@
}
}
-}
diff --git a/model/name-components.h b/model/name-components.h
index 2cdfd99..4e74ad8 100644
--- a/model/name-components.h
+++ b/model/name-components.h
@@ -27,7 +27,6 @@
#include <list>
namespace ns3 {
-namespace NDNabstraction {
namespace Name {
class Components : public SimpleRefCount<Components>
@@ -60,7 +59,6 @@
std::ostream & operator << (std::ostream &os, const Components &components);
} // Namespace Name
-} // namespace NDNabstraction
} // namespace ns3
#endif // _NDN_NAME_COMPONENTS_H_