More progress on CCNx stack. Now we have helpers. Everything compiles, but not yet working
diff --git a/model/ccnx-content-object-header.cc b/model/ccnx-content-object-header.cc
index f66bf3c..726415e 100644
--- a/model/ccnx-content-object-header.cc
+++ b/model/ccnx-content-object-header.cc
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 University of California, Los Angeles
*
@@ -21,6 +21,8 @@
#include "ccnx-content-object-header.h"
+#include "ns3/log.h"
+
NS_LOG_COMPONENT_DEFINE ("CcnxContentObjectHeader");
namespace ns3
diff --git a/model/ccnx-content-object-header.h b/model/ccnx-content-object-header.h
index 86bcc59..0800885 100644
--- a/model/ccnx-content-object-header.h
+++ b/model/ccnx-content-object-header.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 University of California, Los Angeles
*
@@ -100,7 +100,6 @@
// ? content
};
-} // namespace NDNabstraction
} // namespace ns3
#endif // _CCNX_CONTENT_OBJECT_HEADER_H_
diff --git a/model/ccnx-face.cc b/model/ccnx-face.cc
index 27483b0..7635a3e 100644
--- a/model/ccnx-face.cc
+++ b/model/ccnx-face.cc
@@ -21,7 +21,6 @@
#include "ccnx-face.h"
-#include "ns3/ccnx-address.h"
#include "ns3/ccnx-l3-protocol.h"
#include "ns3/net-device.h"
#include "ns3/log.h"
@@ -50,10 +49,10 @@
* invoke SetUp on them once an Ccnx address and mask have been set.
*/
CcnxFace::CcnxFace ()
- : m_ifup (false),
- m_metric (1),
- m_node (0),
- m_device (0),
+ : m_ifup (false)
+ , m_metric (1)
+ , m_node (0)
+ , m_device (0)
{
NS_LOG_FUNCTION (this);
}
diff --git a/model/ccnx-face.h b/model/ccnx-face.h
index 769f938..2b5ba5f 100644
--- a/model/ccnx-face.h
+++ b/model/ccnx-face.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006,2007 INRIA
*
diff --git a/model/ccnx-forwarding-protocol.cc b/model/ccnx-forwarding-protocol.cc
index b7e5a11..afc7f33 100644
--- a/model/ccnx-forwarding-protocol.cc
+++ b/model/ccnx-forwarding-protocol.cc
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
diff --git a/model/ccnx-forwarding-protocol.h b/model/ccnx-forwarding-protocol.h
index e6d2586..072c7f9 100644
--- a/model/ccnx-forwarding-protocol.h
+++ b/model/ccnx-forwarding-protocol.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
@@ -22,11 +22,10 @@
#include "ns3/callback.h"
#include "ns3/object.h"
#include "ns3/socket.h"
-#include "ccnx-header.h"
-#include "ns3/ccnx-interface-address.h"
-#include "ccnx.h"
#include "ns3/output-stream-wrapper.h"
+#include "ccnx.h"
+
namespace ns3 {
class CcnxRoute;
@@ -51,8 +50,8 @@
public:
static TypeId GetTypeId (void);
- typedef Callback<void, Ptr<const Packet>, Ptr<CcnxRoute> > SendCallback;
- typedef Callback<void, Ptr<const Packet>, Socket::SocketErrno > ErrorCallback;
+ typedef Callback<void, Ptr<Packet>, Ptr<CcnxRoute> > SendCallback;
+ typedef Callback<void, Ptr<Packet>/*, Socket::SocketErrno*/ > ErrorCallback;
/**
* \brief Query forwarding cache for an existing route, for an outbound packet
@@ -88,7 +87,7 @@
* \returns true if the CcnxForwardingProtocol takes responsibility for
* forwarding or delivering the packet, false otherwise
*/
- virtual bool RouteInput (Ptr<const Packet> p, Ptr<const CcnxFace> iface,
+ virtual bool RouteInput (Ptr<Packet> p, Ptr<CcnxFace> iface,
SendCallback ucb, ErrorCallback ecb) = 0;
/**
@@ -106,6 +105,9 @@
*/
virtual void NotifyInterfaceDown (uint32_t interface) = 0;
+
+ // Should be modified to notify about new prefixes ?
+
/**
* \param interface the index of the interface we are being notified about
* \param address a new address being added to an interface
@@ -114,7 +116,7 @@
* a new address is added to an interface. Typically used to add a 'network route' on an
* interface. Can be invoked on an up or down interface.
*/
- virtual void NotifyAddAddress (uint32_t interface, CcnxInterfaceAddress address) = 0;
+ // virtual void NotifyAddAddress (uint32_t interface, CcnxInterfaceAddress address) = 0;
/**
* \param interface the index of the interface we are being notified about
@@ -124,7 +126,7 @@
* a new address is removed from an interface. Typically used to remove the 'network route' of an
* interface. Can be invoked on an up or down interface.
*/
- virtual void NotifyRemoveAddress (uint32_t interface, CcnxInterfaceAddress address) = 0;
+ // virtual void NotifyRemoveAddress (uint32_t interface, CcnxInterfaceAddress address) = 0;
/**
* \param ccnx the ccnx object this forwarding protocol is being associated with
diff --git a/model/ccnx-interest-header.cc b/model/ccnx-interest-header.cc
index a7f2feb..6b322e2 100644
--- a/model/ccnx-interest-header.cc
+++ b/model/ccnx-interest-header.cc
@@ -25,6 +25,8 @@
#include "ccnx-interest-header.h"
+#include "ns3/log.h"
+
NS_LOG_COMPONENT_DEFINE ("CcnxInterestHeader");
namespace ns3
diff --git a/model/ccnx-interest-header.h b/model/ccnx-interest-header.h
index 4b505ea..259e156 100644
--- a/model/ccnx-interest-header.h
+++ b/model/ccnx-interest-header.h
@@ -132,7 +132,7 @@
*
* Creates a null header
**/
- InterestHeader ();
+ CcnxInterestHeader ();
/**
* \brief Set interest name
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
index bbb5853..b906a4c 100644
--- a/model/ccnx-l3-protocol.cc
+++ b/model/ccnx-l3-protocol.cc
@@ -1,4 +1,4 @@
-// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2006 Georgia Tech Research Corporation
//
@@ -18,21 +18,21 @@
// Author:
//
+#include "ccnx-l3-protocol.h"
+
#include "ns3/packet.h"
+#include "ns3/net-device.h"
+#include "ns3/node.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/net-device.h"
#include "ns3/uinteger.h"
#include "ns3/trace-source-accessor.h"
#include "ns3/object-vector.h"
#include "ns3/boolean.h"
-//#include "ns3/ccnx-routing-table-entry.h"
-#include "ccnx-l3-protocol.h"
-#include "ccnx-interface.h"
+#include "ccnx-face.h"
+#include "ccnx-route.h"
+#include "ccnx-forwarding-protocol.h"
NS_LOG_COMPONENT_DEFINE ("CcnxL3Protocol");
@@ -56,8 +56,8 @@
MakeTraceSourceAccessor (&CcnxL3Protocol::m_dropTrace))
.AddAttribute ("InterfaceList", "The set of Ccnx interfaces associated to this Ccnx stack.",
ObjectVectorValue (),
- MakeObjectVectorAccessor (&CcnxL3Protocol::m_interfaces),
- MakeObjectVectorChecker<CcnxInterface> ())
+ MakeObjectVectorAccessor (&CcnxL3Protocol::m_faces),
+ MakeObjectVectorChecker<CcnxFace> ())
.AddTraceSource ("SendOutgoing", "A newly-generated packet by this node is about to be queued for transmission",
MakeTraceSourceAccessor (&CcnxL3Protocol::m_sendOutgoingTrace))
@@ -121,7 +121,7 @@
{
NS_LOG_FUNCTION (this);
- for (CcnxInterfaceList::iterator i = m_faces.begin (); i != m_faces.end (); ++i)
+ for (CcnxFaceList::iterator i = m_faces.begin (); i != m_faces.end (); ++i)
{
*i = 0;
}
@@ -137,21 +137,21 @@
NS_LOG_FUNCTION (this << *face);
// Ptr<Node> node = GetObject<Node> (); ///< \todo not sure why this thing should be called...
- face->setNode (m_node);
+ face->SetNode (m_node);
if (face->GetDevice() != 0)
{
- m_node->RegisterProtocolHandler (MakeCallback (&CcnxL3Protocol::Receive, this),
+ m_node->RegisterProtocolHandler (MakeCallback (&CcnxL3Protocol::ReceiveFromLower, this),
CcnxL3Protocol::PROT_NUMBER, face->GetDevice(), true/*promiscuous mode*/);
}
uint32_t index = m_faces.size ();
- m_faces.push_back (interface);
+ m_faces.push_back (face);
return index;
}
-Ptr<CcnxInterface>
+Ptr<CcnxFace>
CcnxL3Protocol::GetFace (uint32_t index) const
{
if (index < m_faces.size ())
@@ -168,11 +168,11 @@
}
Ptr<CcnxFace>
-GetFaceForDevice (Ptr<const NetDevice> device) const
+CcnxL3Protocol::GetFaceForDevice (Ptr<const NetDevice> device) const
{
- for (CcnxInterfaceList::const_iterator i = m_faces.begin ();
+ for (CcnxFaceList::const_iterator i = m_faces.begin ();
i != m_faces.end ();
- i++, face++)
+ i++)
{
if ((*i)->GetDevice () == device)
{
@@ -180,29 +180,27 @@
}
}
- NS_ASSERT_MSG (false "Should never get to this place" );
+ NS_ASSERT_MSG (false, "Should never get to this place" );
return 0;
}
// Callback from lower layer
void
-CcnxL3Protocol::Receive ( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from,
+CcnxL3Protocol::ReceiveFromLower ( 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<CcnxFace> ccnxFace = GetFaceForDevice (device);
- Ptr<CcnxFace> ccnxFace = GetFaceFromDevice (device);
-
- Receive (ccnxFace, p);
+ Ptr<Packet> packet = p->Copy (); // give upper layers a rw copy of the packet
+ ReceiveAndProcess (ccnxFace, packet);
}
// Callback from higher level
-void Receive (Ptr<CcnxFace> incomingFace, Ptr<const Packet> p)
+void CcnxL3Protocol::ReceiveAndProcess (Ptr<CcnxFace> incomingFace, Ptr<Packet> packet)
{
if ( incomingFace->IsUp ())
{
@@ -213,8 +211,8 @@
m_rxTrace (packet, m_node->GetObject<Ccnx> (), incomingFace);
- NS_ASSERT_MSG (m_routingProtocol != 0, "Need a routing protocol object to process packets");
- if (!m_routingProtocol->RouteInput (packet, incomingFace,
+ NS_ASSERT_MSG (m_forwardingProtocol != 0, "Need a forwarding protocol object to process packets");
+ if (!m_forwardingProtocol->RouteInput (packet, incomingFace,
MakeCallback (&CcnxL3Protocol::Send, this),
MakeCallback (&CcnxL3Protocol::RouteInputError, this)
))
@@ -229,11 +227,11 @@
CcnxL3Protocol::Send (Ptr<Packet> packet, Ptr<CcnxRoute> route)
{
NS_LOG_FUNCTION (this << "packet: " << packet << ", route: "<< route);
-
+
if (route == 0)
{
NS_LOG_WARN ("No route to host. Drop.");
- m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, m_node->GetObject<Ccnx> (), 0);
+ m_dropTrace (packet, DROP_NO_ROUTE, m_node->GetObject<Ccnx> (), 0);
return;
}
Ptr<CcnxFace> outFace = route->GetOutputFace ();
@@ -256,28 +254,28 @@
CcnxL3Protocol::SetMetric (uint32_t i, uint16_t metric)
{
NS_LOG_FUNCTION (this << i << metric);
- Ptr<CcnxInterface> interface = GetInterface (i);
- interface->SetMetric (metric);
+ Ptr<CcnxFace> face = GetFace (i);
+ face->SetMetric (metric);
}
uint16_t
CcnxL3Protocol::GetMetric (uint32_t i) const
{
- Ptr<CcnxInterface> interface = GetInterface (i);
- return interface->GetMetric ();
+ Ptr<const CcnxFace> face = GetFace (i);
+ return face->GetMetric ();
}
uint16_t
CcnxL3Protocol::GetMtu (uint32_t i) const
{
- Ptr<CcnxInterface> interface = GetInterface (i);
- return interface->GetDevice ()->GetMtu ();
+ Ptr<CcnxFace> face = GetFace (i);
+ return face->GetDevice ()->GetMtu ();
}
bool
CcnxL3Protocol::IsUp (uint32_t i) const
{
- Ptr<CcnxInterface> interface = GetInterface (i);
+ Ptr<CcnxFace> interface = GetFace (i);
return interface->IsUp ();
}
@@ -285,12 +283,12 @@
CcnxL3Protocol::SetUp (uint32_t i)
{
NS_LOG_FUNCTION (this << i);
- Ptr<CcnxInterface> interface = GetInterface (i);
+ Ptr<CcnxFace> interface = GetFace (i);
interface->SetUp ();
- if (m_routingProtocol != 0)
+ if (m_forwardingProtocol != 0)
{
- m_routingProtocol->NotifyInterfaceUp (i);
+ m_forwardingProtocol->NotifyInterfaceUp (i);
}
}
@@ -298,21 +296,21 @@
CcnxL3Protocol::SetDown (uint32_t ifaceIndex)
{
NS_LOG_FUNCTION (this << ifaceIndex);
- Ptr<CcnxInterface> interface = GetInterface (ifaceIndex);
+ Ptr<CcnxFace> interface = GetFace (ifaceIndex);
interface->SetDown ();
- if (m_routingProtocol != 0)
+ if (m_forwardingProtocol != 0)
{
- m_routingProtocol->NotifyInterfaceDown (ifaceIndex);
+ m_forwardingProtocol->NotifyInterfaceDown (ifaceIndex);
}
}
void
-CcnxL3Protocol::RouteInputError (Ptr<const Packet> p, const CcnxHeader & ipHeader, Socket::SocketErrno sockErrno)
+CcnxL3Protocol::RouteInputError (Ptr<Packet> p)//, 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);
+ // NS_LOG_FUNCTION (this << p << ipHeader << sockErrno);
+ // NS_LOG_LOGIC ("Route input failure-- dropping packet to " << ipHeader << " with errno " << sockErrno);
+ m_dropTrace (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
index d45f0b3..3af0c9a 100644
--- a/model/ccnx-l3-protocol.h
+++ b/model/ccnx-l3-protocol.h
@@ -1,4 +1,4 @@
-// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
//
// Copyright (c) 2006 Georgia Tech Research Corporation
//
@@ -26,20 +26,19 @@
#include <stdint.h>
#include "ns3/ptr.h"
#include "ns3/net-device.h"
-#include "ns3/ccnx.h"
#include "ns3/traced-callback.h"
+#include "ccnx.h"
+
namespace ns3 {
class Packet;
class NetDevice;
-class CcnxInterface;
-class CcnxRoute;
class Node;
-class Socket;
+class CcnxFace;
+class CcnxRoute;
class CcnxForwardingProtocol;
-
/**
* \brief Implement the Ccnx layer.
*
@@ -96,7 +95,7 @@
* \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,
+ void ReceiveFromLower (Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol,
const Address &from,
const Address &to,
NetDevice::PacketType packetType);
@@ -104,7 +103,7 @@
/**
* Actual processing of incoming CCNx packets. Also processing packets coming from local apps
*/
- void Receive (Ptr<CcnxFace> face, Ptr<const Packet> p);
+ void ReceiveAndProcess (Ptr<CcnxFace> face, Ptr<Packet> p);
/**
* \param packet packet to send
@@ -117,7 +116,7 @@
virtual uint32_t AddFace (Ptr<CcnxFace> face);
virtual uint32_t GetNFaces (void) const;
- virtual Ptr<CcnxFace> GetFace (uint32_t face);
+ virtual Ptr<CcnxFace> GetFace (uint32_t face) const;
virtual void SetMetric (uint32_t i, uint16_t metric);
virtual uint16_t GetMetric (uint32_t i) const;
@@ -144,24 +143,25 @@
*/
Ptr<CcnxFace> GetFaceForDevice (Ptr<const NetDevice> device) const;
- void RouteInputError (Ptr<const Packet> p, const CcnxHeader & ipHeader, Socket::SocketErrno sockErrno);
+ void RouteInputError (Ptr<Packet> p);
+ //, Socket::SocketErrno sockErrno);
private:
typedef std::vector<Ptr<CcnxFace> > CcnxFaceList;
CcnxFaceList m_faces;
Ptr<Node> m_node;
- // Ptr<CcnxForwardingProtocol> m_forwardingProtocol;
+ Ptr<CcnxForwardingProtocol> m_forwardingProtocol;
- 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;
+ TracedCallback<Ptr<const Packet>, Ptr<const CcnxFace> > m_sendOutgoingTrace;
+ TracedCallback<Ptr<const Packet>, Ptr<const CcnxFace> > m_unicastForwardTrace;
+ TracedCallback<Ptr<const Packet>, Ptr<const CcnxFace> > 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;
+ TracedCallback<Ptr<const Packet>, Ptr<Ccnx>, Ptr<const CcnxFace> > m_txTrace;
+ TracedCallback<Ptr<const Packet>, Ptr<Ccnx>, Ptr<const CcnxFace> > 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;
+ TracedCallback<Ptr<const Packet>, DropReason, Ptr<const Ccnx>, Ptr<const CcnxFace> > m_dropTrace;
};
} // Namespace ns3
diff --git a/model/ccnx-l4-protocol.cc b/model/ccnx-l4-protocol.cc
deleted file mode 100644
index 9cdd0a1..0000000
--- a/model/ccnx-l4-protocol.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-// -*- 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"
-
-NS_LOG_COMPONENT_DEFINE ("CcnxL4Protocol");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (CcnxL4Protocol);
-
-TypeId
-CcnxL4Protocol::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::CcnxL4Protocol")
- .SetParent<Object> ()
- ;
- return tid;
-}
-
-CcnxL4Protocol::CcnxL4Protocol ()
-{
- NS_LOG_FUNCTION_NOARGS ();
-}
-
-CcnxL4Protocol::~CcnxL4Protocol ()
-{
- NS_LOG_FUNCTION_NOARGS ();
-}
-
-void
-CcnxL4Protocol::SetNode (Ptr<Node> node)
-{
- m_node = node;
-}
-
-/*
- * This method is called by AddAgregate and completes the aggregation
- * by setting the node in the udp stack and link it to the ipv4 object
- * present in the node along with the socket factory
- */
-void
-CcnxL4Protocol::NotifyNewAggregate ()
-{
- if (m_node == 0)
- {
- Ptr<Node> node = this->GetObject<Node> ();
- if (node != 0)
- {
- Ptr<Ccnx> ccnx = this->GetObject<Ccnx> ();
- if (ccnx != 0)
- {
- this->SetNode (node);
- ccnx->Insert (this);
- // Ptr<UdpSocketFactoryImpl> udpFactory = CreateObject<UdpSocketFactoryImpl> ();
- // udpFactory->SetUdp (this);
- // node->AggregateObject (udpFactory);
- this->SetDownTarget (MakeCallback (&Ccnx::Send, ccnx));
- }
- }
- }
- Object::NotifyNewAggregate ();
-}
-
-void
-CcnxL4Protocol::DoDispose (void)
-{
- NS_LOG_FUNCTION_NOARGS ();
-
- m_node = 0;
- m_downTarget.Nullify ();
- CcnxL4Protocol::DoDispose ();
-}
-
-void
-SetDownTarget (DownTargetCallback cb)
-{
- m_downTarget = cb;
-}
-
-DownTargetCallback
-GetDownTarget (void) const
-{
- retur m_downTarget;
-}
-
-} //namespace ns3
diff --git a/model/ccnx-l4-protocol.h b/model/ccnx-l4-protocol.h
deleted file mode 100644
index e0a6aed..0000000
--- a/model/ccnx-l4-protocol.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// -*- 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);
-
- CcnxL4Protocol ();
- virtual ~CcnxL4Protocol ();
-
- void SetNode (Ptr<Node> node);
-
- /**
- * \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);
-
- 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);
- /**
- * 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;
-
-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:
- DownTargetCallback m_downTarget;
-};
-
-} // Namespace ns3
-
-#endif // CCNX_L4_PROTOCOL_H
diff --git a/model/ccnx-local-face.cc b/model/ccnx-local-face.cc
index aeb2002..d5de90f 100644
--- a/model/ccnx-local-face.cc
+++ b/model/ccnx-local-face.cc
@@ -21,7 +21,6 @@
#include "ccnx-local-face.h"
-#include "ns3/ccnx-address.h"
#include "ns3/ccnx-l3-protocol.h"
#include "ns3/net-device.h"
#include "ns3/log.h"
@@ -70,17 +69,15 @@
void
CcnxLocalFace::SetDevice (Ptr<NetDevice> device)
{
- assert (false);
+ NS_ASSERT_MSG (false, "It is impossible to set device to LocalFace");
}
Ptr<NetDevice>
CcnxLocalFace::GetDevice (void) const
{
- assert (false)
+ return 0;
}
-
-
void
CcnxLocalFace::Send (Ptr<Packet> p)
{
diff --git a/model/ccnx-local-face.h b/model/ccnx-local-face.h
index 33d884a..63ea570 100644
--- a/model/ccnx-local-face.h
+++ b/model/ccnx-local-face.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006,2007 INRIA
*
diff --git a/model/ccnx-route.cc b/model/ccnx-route.cc
index 98e8b7b..987c001 100644
--- a/model/ccnx-route.cc
+++ b/model/ccnx-route.cc
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
diff --git a/model/ccnx-route.h b/model/ccnx-route.h
index c3d7e5e..4d45023 100644
--- a/model/ccnx-route.h
+++ b/model/ccnx-route.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
@@ -23,6 +23,7 @@
#include <map>
#include <ostream>
+#include "ns3/ptr.h"
#include "ns3/simple-ref-count.h"
#include "ns3/name-components.h"
@@ -64,7 +65,7 @@
Ptr<CcnxFace> GetOutputFace (void) const;
private:
- Name::Components m_prefix;
+ Ptr<Name::Components> m_prefix;
Ptr<CcnxFace> m_outputFace;
};
diff --git a/model/ccnx.h b/model/ccnx.h
index 40e2678..b2cde94 100644
--- a/model/ccnx.h
+++ b/model/ccnx.h
@@ -32,7 +32,7 @@
class Node;
class NetDevice;
class Packet;
-// class CcnxRoutingProtocol;
+class CcnxForwardingProtocol;
/**
* \ingroup internet
@@ -64,22 +64,22 @@
virtual ~Ccnx ();
/**
- * \brief Register a new routing protocol to be used by this Ccnx stack
+ * \brief Register a new forwarding 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.
+ * This call will replace any forwarding protocol that has been previously
+ * registered. If you want to add multiple forwarding protocols, you must
+ * add them to a CcnxListForwardingProtocol directly.
*
- * \param routingProtocol smart pointer to CcnxRoutingProtocol object
+ * \param forwardingProtocol smart pointer to CcnxForwardingProtocol object
*/
- // virtual void SetRoutingProtocol (Ptr<CcnxRoutingProtocol> routingProtocol) = 0;
+ virtual void SetForwardingProtocol (Ptr<CcnxForwardingProtocol> forwardingProtocol) = 0;
/**
- * \brief Get the routing protocol to be used by this Ccnx stack
+ * \brief Get the forwarding protocol to be used by this Ccnx stack
*
- * \returns smart pointer to CcnxRoutingProtocol object, or null pointer if none
+ * \returns smart pointer to CcnxForwardingProtocol object, or null pointer if none
*/
- // virtual Ptr<CcnxRoutingProtocol> GetRoutingProtocol (void) const = 0;
+ virtual Ptr<CcnxForwardingProtocol> GetForwardingProtocol (void) const = 0;
/**
* \param device device to add to the list of Ccnx interfaces
@@ -110,7 +110,7 @@
* \param face The face number of an Ccnx interface.
* \returns The CcnxFace associated with the Ccnx face number.
*/
- virtual Ptr<CcnxFace> GetFace (uint32_t face) = 0;
+ virtual Ptr<CcnxFace> GetFace (uint32_t face) const = 0;
// /**
// * \param face CcnxFace object pointer
@@ -120,14 +120,14 @@
/**
* \param face The face number of an Ccnx face
- * \param metric routing metric (cost) associated to the underlying
+ * \param metric forwarding metric (cost) associated to the underlying
* Ccnx interface
*/
virtual void SetMetric (uint32_t face, uint16_t metric) = 0;
/**
* \param face The interface number of an Ccnx interface
- * \returns routing metric (cost) associated to the underlying
+ * \returns forwarding metric (cost) associated to the underlying
* Ccnx interface
*/
virtual uint16_t GetMetric (uint32_t face) const = 0;
diff --git a/model/name-components.cc b/model/name-components.cc
index 319151f..c0e9ea0 100644
--- a/model/name-components.cc
+++ b/model/name-components.cc
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 University of California, Los Angeles
*
diff --git a/model/name-components.h b/model/name-components.h
index 4e74ad8..6faa38c 100644
--- a/model/name-components.h
+++ b/model/name-components.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 University of California, Los Angeles
*
diff --git a/model/ndnabstraction-header.cc b/model/ndnabstraction-header.cc
index a7ea402..ccb3cf3 100644
--- a/model/ndnabstraction-header.cc
+++ b/model/ndnabstraction-header.cc
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 University of California, Los Angeles
*
diff --git a/model/ndnabstraction-header.h b/model/ndnabstraction-header.h
index 2cbd4a3..cd172c7 100644
--- a/model/ndnabstraction-header.h
+++ b/model/ndnabstraction-header.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 University of California, Los Angeles
*