blob: d216b4f563cfcae350a0bf4d764bb9db2d8c8d46 [file] [log] [blame]
Alexander Afanasyevc74a6022011-08-15 20:01:35 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Alexander Afanasyevab1d5602011-08-17 19:17:18 -07002/*
3 * Copyright (c) 2011 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
Ilya Moiseenko172763c2011-10-28 13:21:53 -070019 * Ilya Moiseenko <iliamo@cs.ucla.edu>
Alexander Afanasyevab1d5602011-08-17 19:17:18 -070020 */
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070021
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070022#include "ccnx-l3-protocol.h"
23
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070024#include "ns3/packet.h"
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070025#include "ns3/node.h"
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070026#include "ns3/log.h"
27#include "ns3/callback.h"
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070028#include "ns3/uinteger.h"
29#include "ns3/trace-source-accessor.h"
30#include "ns3/object-vector.h"
Alexander Afanasyevcbe92ae2011-12-16 13:06:18 -080031#include "ns3/pointer.h"
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070032#include "ns3/boolean.h"
Alexander Afanasyev07827182011-12-13 01:07:32 -080033#include "ns3/string.h"
Alexander Afanasyev4975f732011-12-20 17:52:19 -080034#include "ns3/simulator.h"
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -070035#include "ns3/random-variable.h"
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070036
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070037#include "ns3/ccnx-header-helper.h"
38
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070039#include "ccnx-face.h"
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070040#include "ccnx-forwarding-strategy.h"
41#include "ccnx-interest-header.h"
42#include "ccnx-content-object-header.h"
43
Alexander Afanasyev52e9aa92011-11-15 20:23:20 -080044#include "ccnx-net-device-face.h"
45
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070046#include <boost/foreach.hpp>
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080047#include <boost/lambda/lambda.hpp>
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080048#include <boost/lambda/bind.hpp>
Alexander Afanasyeva46844b2011-11-21 19:13:26 -080049
50using namespace boost::tuples;
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080051namespace ll = boost::lambda;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070052
53NS_LOG_COMPONENT_DEFINE ("CcnxL3Protocol");
54
55namespace ns3 {
56
Alexander Afanasyev7112f482011-08-17 14:05:57 -070057const uint16_t CcnxL3Protocol::ETHERNET_FRAME_TYPE = 0x7777;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070058
Alexander Afanasyev07827182011-12-13 01:07:32 -080059
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070060NS_OBJECT_ENSURE_REGISTERED (CcnxL3Protocol);
61
62TypeId
63CcnxL3Protocol::GetTypeId (void)
64{
65 static TypeId tid = TypeId ("ns3::CcnxL3Protocol")
66 .SetParent<Ccnx> ()
Alexander Afanasyev070aa482011-08-20 00:38:25 -070067 .SetGroupName ("Ccnx")
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070068 .AddConstructor<CcnxL3Protocol> ()
Alexander Afanasyevcbe92ae2011-12-16 13:06:18 -080069 .AddAttribute ("FaceList", "List of faces associated with CCNx stack",
70 ObjectVectorValue (),
71 MakeObjectVectorAccessor (&CcnxL3Protocol::m_faces),
72 MakeObjectVectorChecker<CcnxFace> ())
73
74 .AddAttribute ("ForwardingStrategy", "Forwarding strategy used by CCNx stack",
75 PointerValue (),
76 MakePointerAccessor (&CcnxL3Protocol::SetForwardingStrategy, &CcnxL3Protocol::GetForwardingStrategy),
77 MakePointerChecker<CcnxForwardingStrategy> ())
78
Alexander Afanasyevbab81b12012-02-04 14:20:09 -080079 .AddAttribute ("EnableNACKs", "Enabling support of NACKs",
Alexander Afanasyev082dbca2012-02-14 18:43:13 -080080 BooleanValue (false),
Alexander Afanasyevbab81b12012-02-04 14:20:09 -080081 MakeBooleanAccessor (&CcnxL3Protocol::m_nacksEnabled),
82 MakeBooleanChecker ())
Alexander Afanasyevde009992012-02-04 18:54:54 -080083 .AddAttribute ("CacheUnsolicitedData", "Cache overheard data that have not been requested",
84 BooleanValue (false),
85 MakeBooleanAccessor (&CcnxL3Protocol::m_cacheUnsolicitedData),
86 MakeBooleanChecker ())
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -070087 .AddAttribute ("RandomDataDelaying", "Delaying data processing",
88 BooleanValue (false),
89 MakeBooleanAccessor (&CcnxL3Protocol::m_delayingDataProcessing),
90 MakeBooleanChecker ())
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070091 ;
92 return tid;
93}
94
95CcnxL3Protocol::CcnxL3Protocol()
Alexander Afanasyevab1d5602011-08-17 19:17:18 -070096: m_faceCounter (0)
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070097{
98 NS_LOG_FUNCTION (this);
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070099
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700100 m_pit = CreateObject<CcnxPit> ();
101 m_contentStore = CreateObject<CcnxContentStore> ();
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700102}
103
104CcnxL3Protocol::~CcnxL3Protocol ()
105{
106 NS_LOG_FUNCTION (this);
107}
108
109void
110CcnxL3Protocol::SetNode (Ptr<Node> node)
111{
112 m_node = node;
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -0700113 m_fib = m_node->GetObject<CcnxFib> ();
114 NS_ASSERT_MSG (m_fib != 0, "FIB should be created and aggregated to a node before calling Ccnx::SetNode");
115
116 m_pit->SetFib (m_fib);
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700117}
118
119/*
120 * This method is called by AddAgregate and completes the aggregation
121 * by setting the node in the ccnx stack
122 */
123void
124CcnxL3Protocol::NotifyNewAggregate ()
125{
126 if (m_node == 0)
127 {
128 Ptr<Node>node = this->GetObject<Node>();
129 // verify that it's a valid node and that
130 // the node has not been set before
131 if (node != 0)
132 {
133 this->SetNode (node);
134 }
135 }
136 Object::NotifyNewAggregate ();
137}
138
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700139void
140CcnxL3Protocol::DoDispose (void)
141{
142 NS_LOG_FUNCTION (this);
143
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700144 for (CcnxFaceList::iterator i = m_faces.begin (); i != m_faces.end (); ++i)
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700145 {
146 *i = 0;
147 }
Alexander Afanasyev98256102011-08-14 01:00:02 -0700148 m_faces.clear ();
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700149 m_node = 0;
Alexander Afanasyevd02a5d62011-11-21 11:01:51 -0800150
151 // Force delete on objects
Alexander Afanasyev18252852011-11-21 13:35:31 -0800152 m_forwardingStrategy = 0; // there is a reference to PIT stored in here
Alexander Afanasyevd02a5d62011-11-21 11:01:51 -0800153 m_pit = 0;
154 m_contentStore = 0;
Alexander Afanasyev18252852011-11-21 13:35:31 -0800155 m_fib = 0;
156
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700157 // m_forwardingStrategy = 0;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700158 Object::DoDispose ();
159}
160
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700161void
162CcnxL3Protocol::SetForwardingStrategy (Ptr<CcnxForwardingStrategy> forwardingStrategy)
163{
164 NS_LOG_FUNCTION (this);
165 m_forwardingStrategy = forwardingStrategy;
Alexander Afanasyev19426ef2011-11-23 20:55:28 -0800166 m_forwardingStrategy->SetPit (m_pit);
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700167}
168
169Ptr<CcnxForwardingStrategy>
170CcnxL3Protocol::GetForwardingStrategy (void) const
171{
172 return m_forwardingStrategy;
173}
174
Alexander Afanasyev7f3e49e2012-04-30 00:17:07 -0700175Ptr<CcnxPit>
176CcnxL3Protocol::GetPit () const
177{
178 return m_pit;
179}
180
181
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700182uint32_t
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700183CcnxL3Protocol::AddFace (const Ptr<CcnxFace> &face)
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700184{
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700185 NS_LOG_FUNCTION (this << &face);
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700186
Alexander Afanasyevab1d5602011-08-17 19:17:18 -0700187 face->SetId (m_faceCounter); // sets a unique ID of the face. This ID serves only informational purposes
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700188
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700189 // ask face to register in lower-layer stack
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700190 face->RegisterProtocolHandler (MakeCallback (&CcnxL3Protocol::Receive, this));
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700191
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700192 m_faces.push_back (face);
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -0800193 m_faceCounter++;
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -0700194 return face->GetId ();
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700195}
196
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -0700197void
198CcnxL3Protocol::RemoveFace (Ptr<CcnxFace> face)
199{
200 // ask face to register in lower-layer stack
201 face->RegisterProtocolHandler (MakeNullCallback<void,const Ptr<CcnxFace>&,const Ptr<const Packet>&> ());
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -0800202
203 // just to be on a safe side. Do the process in two steps
Alexander Afanasyev4a5c2c12011-12-12 18:50:57 -0800204 std::list<boost::reference_wrapper<const CcnxPitEntry> > entriesToRemoves;
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -0800205 BOOST_FOREACH (const CcnxPitEntry &pitEntry, *m_pit)
206 {
207 m_pit->modify (m_pit->iterator_to (pitEntry),
Alexander Afanasyev19426ef2011-11-23 20:55:28 -0800208 ll::bind (&CcnxPitEntry::RemoveAllReferencesToFace, ll::_1, face));
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -0800209
210 // If this face is the only for the associated FIB entry, then FIB entry will be removed soon.
211 // Thus, we have to remove the whole PIT entry
Alexander Afanasyev19426ef2011-11-23 20:55:28 -0800212 if (pitEntry.m_fibEntry.m_faces.size () == 1 &&
213 pitEntry.m_fibEntry.m_faces.begin ()->m_face == face)
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -0800214 {
Alexander Afanasyev4a5c2c12011-12-12 18:50:57 -0800215 entriesToRemoves.push_back (boost::cref (pitEntry));
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -0800216 }
217 }
Alexander Afanasyev4a5c2c12011-12-12 18:50:57 -0800218 BOOST_FOREACH (const CcnxPitEntry &removedEntry, entriesToRemoves)
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -0800219 {
Alexander Afanasyev4a5c2c12011-12-12 18:50:57 -0800220 m_pit->erase (m_pit->iterator_to (removedEntry));
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -0800221 }
222
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -0700223 CcnxFaceList::iterator face_it = find (m_faces.begin(), m_faces.end(), face);
224 NS_ASSERT_MSG (face_it != m_faces.end (), "Attempt to remove face that doesn't exist");
225 m_faces.erase (face_it);
226}
227
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700228Ptr<CcnxFace>
Alexander Afanasyev98256102011-08-14 01:00:02 -0700229CcnxL3Protocol::GetFace (uint32_t index) const
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700230{
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700231 BOOST_FOREACH (const Ptr<CcnxFace> &face, m_faces) // this function is not supposed to be called often, so linear search is fine
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700232 {
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700233 if (face->GetId () == index)
234 return face;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700235 }
236 return 0;
237}
238
Alexander Afanasyev52e9aa92011-11-15 20:23:20 -0800239Ptr<CcnxFace>
240CcnxL3Protocol::GetFaceByNetDevice (Ptr<NetDevice> netDevice) const
241{
242 BOOST_FOREACH (const Ptr<CcnxFace> &face, m_faces) // this function is not supposed to be called often, so linear search is fine
243 {
244 Ptr<CcnxNetDeviceFace> netDeviceFace = DynamicCast<CcnxNetDeviceFace> (face);
245 if (netDeviceFace == 0) continue;
246
247 if (netDeviceFace->GetNetDevice () == netDevice)
248 return face;
249 }
250 return 0;
251}
252
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700253uint32_t
Alexander Afanasyev98256102011-08-14 01:00:02 -0700254CcnxL3Protocol::GetNFaces (void) const
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700255{
Alexander Afanasyev98256102011-08-14 01:00:02 -0700256 return m_faces.size ();
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700257}
258
Alexander Afanasyev98256102011-08-14 01:00:02 -0700259// Callback from lower layer
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700260void
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -0700261CcnxL3Protocol::Receive (const Ptr<CcnxFace> &face, const Ptr<const Packet> &p)
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700262{
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -0700263 NS_LOG_LOGIC ("Packet from face " << *face << " received on node " << m_node->GetId ());
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700264
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700265 Ptr<Packet> packet = p->Copy (); // give upper layers a rw copy of the packet
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700266 try
267 {
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -0700268 CcnxHeaderHelper::Type type = CcnxHeaderHelper::GetCcnxHeaderType (p);
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700269 switch (type)
270 {
271 case CcnxHeaderHelper::INTEREST:
272 {
273 Ptr<CcnxInterestHeader> header = Create<CcnxInterestHeader> ();
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700274
275 // Deserialization. Exception may be thrown
276 packet->RemoveHeader (*header);
277 NS_ASSERT_MSG (packet->GetSize () == 0, "Payload of Interests should be zero");
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800278
279 if (header->GetNack () > 0)
280 OnNack (face, header, p/*original packet*/);
281 else
282 OnInterest (face, header, p/*original packet*/);
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700283 break;
284 }
285 case CcnxHeaderHelper::CONTENT_OBJECT:
286 {
287 Ptr<CcnxContentObjectHeader> header = Create<CcnxContentObjectHeader> ();
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700288
289 static CcnxContentObjectTail contentObjectTrailer; //there is no data in this object
290
291 // Deserialization. Exception may be thrown
292 packet->RemoveHeader (*header);
293 packet->RemoveTrailer (contentObjectTrailer);
294
295 OnData (face, header, packet/*payload*/, p/*original packet*/);
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700296 break;
297 }
298 }
299
300 // exception will be thrown if packet is not recognized
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700301 }
302 catch (CcnxUnknownHeaderException)
303 {
304 NS_ASSERT_MSG (false, "Unknown CCNx header. Should not happen");
305 }
Alexander Afanasyev98256102011-08-14 01:00:02 -0700306}
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700307
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800308void
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800309CcnxL3Protocol::OnNack (const Ptr<CcnxFace> &incomingFace,
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800310 Ptr<CcnxInterestHeader> &header,
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800311 const Ptr<const Packet> &packet)
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800312{
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800313 NS_LOG_FUNCTION (incomingFace << header << packet);
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800314 m_inNacks (header, incomingFace);
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800315
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800316 tuple<const CcnxPitEntry&,bool,bool> ret = m_pit->Lookup (*header);
317 CcnxPitEntry const& pitEntry = ret.get<0> ();
Alexander Afanasyeva7a2b8b2011-11-28 18:19:09 -0800318 bool isNew = ret.get<1> ();
Alexander Afanasyeve67a97f2011-11-29 14:28:59 -0800319 bool isDuplicated = ret.get<2> ();
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800320
Alexander Afanasyeve67a97f2011-11-29 14:28:59 -0800321 if (isNew || !isDuplicated) // potential flow
Alexander Afanasyeva7a2b8b2011-11-28 18:19:09 -0800322 {
323 // somebody is doing something bad
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800324 m_dropNacks (header, NON_DUPLICATED, incomingFace);
Alexander Afanasyeva7a2b8b2011-11-28 18:19:09 -0800325 return;
326 }
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800327
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800328 // CcnxPitEntryIncomingFaceContainer::type::iterator inFace = pitEntry.m_incoming.find (incomingFace);
329 CcnxPitEntryOutgoingFaceContainer::type::iterator outFace = pitEntry.m_outgoing.find (incomingFace);
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800330
Alexander Afanasyeve67a97f2011-11-29 14:28:59 -0800331 if (outFace == pitEntry.m_outgoing.end ())
Alexander Afanasyeva7a2b8b2011-11-28 18:19:09 -0800332 {
Alexander Afanasyev8f5a9bb2011-12-18 19:49:02 -0800333// NS_ASSERT_MSG (false,
334// "Node " << GetObject<Node> ()->GetId () << ", outgoing entry should exist for face " << boost::cref(*incomingFace) << "\n" <<
335// "size: " << pitEntry.m_outgoing.size ());
Alexander Afanasyeva7a2b8b2011-11-28 18:19:09 -0800336
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800337 // m_dropNacks (header, NON_DUPLICATE, incomingFace);
Alexander Afanasyeva7a2b8b2011-11-28 18:19:09 -0800338 return;
339 }
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800340
Alexander Afanasyev0a61c342011-12-06 12:48:55 -0800341 // This was done in error. Never, never do anything, except normal leakage. This way we ensure that we will not have losses,
342 // at least when there is only one client
343 //
344 // incomingFace->LeakBucketByOnePacket ();
Alexander Afanasyeve67a97f2011-11-29 14:28:59 -0800345
Alexander Afanasyev23d2b542011-12-07 18:54:46 -0800346 NS_LOG_ERROR ("Nack on " << boost::cref(*incomingFace));
347
Alexander Afanasyev5a595072011-11-25 14:49:07 -0800348 m_pit->modify (m_pit->iterator_to (pitEntry),
349 ll::bind (&CcnxPitEntry::SetWaitingInVain, ll::_1, outFace));
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800350
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800351 // If NACK is NACK_GIVEUP_PIT, then neighbor gave up trying to and removed it's PIT entry.
352 // So, if we had an incoming entry to this neighbor, then we can remove it now
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800353
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800354 if (header->GetNack () == CcnxInterestHeader::NACK_GIVEUP_PIT)
355 {
356 m_pit->modify (m_pit->iterator_to (pitEntry),
357 ll::bind (&CcnxPitEntry::RemoveIncoming, ll::_1, incomingFace));
358 }
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800359
Alexander Afanasyev07827182011-12-13 01:07:32 -0800360 m_fib->m_fib.modify (m_fib->m_fib.iterator_to (pitEntry.m_fibEntry),
361 ll::bind (&CcnxFibEntry::UpdateStatus,
362 ll::_1, incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW));
Alexander Afanasyeva7a2b8b2011-11-28 18:19:09 -0800363
Alexander Afanasyev23d2b542011-12-07 18:54:46 -0800364 if (pitEntry.m_incoming.size () == 0) // interest was actually satisfied
365 {
366 // no need to do anything
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800367 m_dropNacks (header, AFTER_SATISFIED, incomingFace);
Alexander Afanasyev23d2b542011-12-07 18:54:46 -0800368 return;
369 }
370
Alexander Afanasyeve67a97f2011-11-29 14:28:59 -0800371 if (!pitEntry.AreAllOutgoingInVain ()) // not all ougtoing are in vain
Alexander Afanasyeva7a2b8b2011-11-28 18:19:09 -0800372 {
Alexander Afanasyev23d2b542011-12-07 18:54:46 -0800373 NS_LOG_DEBUG ("Not all outgoing are in vain");
Alexander Afanasyeva7a2b8b2011-11-28 18:19:09 -0800374 // suppress
375 // Don't do anything, we are still expecting data from some other face
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800376 m_dropNacks (header, SUPPRESSED, incomingFace);
Alexander Afanasyeva7a2b8b2011-11-28 18:19:09 -0800377 return;
378 }
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800379
380 NS_ASSERT_MSG (m_forwardingStrategy != 0, "Need a forwarding protocol object to process packets");
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800381
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800382 Ptr<Packet> nonNackInterest = Create<Packet> ();
383 header->SetNack (CcnxInterestHeader::NORMAL_INTEREST);
384 nonNackInterest->AddHeader (*header);
385
386 bool propagated = m_forwardingStrategy->
387 PropagateInterest (pitEntry, incomingFace, header, nonNackInterest);
388
Alexander Afanasyev23d2b542011-12-07 18:54:46 -0800389 // // ForwardingStrategy will try its best to forward packet to at least one interface.
390 // // If no interests was propagated, then there is not other option for forwarding or
391 // // ForwardingStrategy failed to find it.
Alexander Afanasyeve67a97f2011-11-29 14:28:59 -0800392 if (!propagated)
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800393 {
394 m_dropNacks (header, NO_FACES, incomingFace); // this headers doesn't have NACK flag set
395 GiveUpInterest (pitEntry, header);
396 }
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800397}
398
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700399// Processing Interests
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800400//
401// !!! Key point.
402// !!! All interests should be answerred!!! Either later with data, immediately with data, or immediately with NACK
Alexander Afanasyeva67e28c2011-08-31 21:16:25 -0700403void CcnxL3Protocol::OnInterest (const Ptr<CcnxFace> &incomingFace,
404 Ptr<CcnxInterestHeader> &header,
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700405 const Ptr<const Packet> &packet)
Alexander Afanasyev98256102011-08-14 01:00:02 -0700406{
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800407 m_inInterests (header, incomingFace);
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700408 // NS_LOG_DEBUG (*m_pit);
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700409
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800410 // Lookup of Pit (and associated Fib) entry for this Interest
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -0800411 tuple<const CcnxPitEntry&,bool,bool> ret = m_pit->Lookup (*header);
412 CcnxPitEntry const& pitEntry = ret.get<0> ();
Alexander Afanasyev4e970942012-03-09 10:58:11 -0800413 bool isNew = ret.get<1> ();
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -0800414 bool isDuplicated = ret.get<2> ();
Ilya Moiseenkod83eb0d2011-11-16 15:23:46 -0800415
Alexander Afanasyev8d11fcc2011-12-30 12:42:31 -0800416 // NS_LOG_DEBUG ("isNew: " << isNew << ", isDup: " << isDuplicated);
Alexander Afanasyev120bf312011-12-19 01:24:47 -0800417
Alexander Afanasyev7f3e49e2012-04-30 00:17:07 -0700418 NS_LOG_FUNCTION (header->GetName () << header->GetNonce () << boost::cref (*incomingFace) << isDuplicated);
419
420 /////////////////////////////////////////////////////////////////////////////////////////
421 /////////////////////////////////////////////////////////////////////////////////////////
422 /////////////////////////////////////////////////////////////////////////////////////////
423 // //
424 // !!!! IMPORTANT CHANGE !!!! Duplicate interests will create incoming face entry !!!! //
425 // //
426 /////////////////////////////////////////////////////////////////////////////////////////
427 /////////////////////////////////////////////////////////////////////////////////////////
428 /////////////////////////////////////////////////////////////////////////////////////////
429
430 // Data is not in cache
431 CcnxPitEntryIncomingFaceContainer::type::iterator inFace = pitEntry.m_incoming.find (incomingFace);
432 CcnxPitEntryOutgoingFaceContainer::type::iterator outFace = pitEntry.m_outgoing.find (incomingFace);
433
434 bool isRetransmitted = false;
435
436 if (inFace != pitEntry.m_incoming.end ())
437 {
438 // CcnxPitEntryIncomingFace.m_arrivalTime keeps track arrival time of the first packet... why?
439
440 isRetransmitted = true;
441 // this is almost definitely a retransmission. But should we trust the user on that?
442 }
443 else
444 {
445 m_pit->modify (m_pit->iterator_to (pitEntry),
446 ll::var(inFace) = ll::bind (&CcnxPitEntry::AddIncoming, ll::_1, incomingFace));
447 }
448 //////////////////////////////////////////////////////////////////////////////////
449 //////////////////////////////////////////////////////////////////////////////////
450 //////////////////////////////////////////////////////////////////////////////////
451
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800452 if (isDuplicated)
Ilya Moiseenko172763c2011-10-28 13:21:53 -0700453 {
Alexander Afanasyev7f3e49e2012-04-30 00:17:07 -0700454 NS_LOG_DEBUG ("Received duplicatie interest on " << *incomingFace);
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800455 m_dropInterests (header, DUPLICATED, incomingFace);
456
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800457 /**
458 * This condition will handle "routing" loops and also recently satisfied interests.
459 * Every time interest is satisfied, PIT entry (with empty incoming and outgoing faces)
460 * is kept for another small chunk of time.
461 */
Ilya Moiseenko172763c2011-10-28 13:21:53 -0700462
Alexander Afanasyevbab81b12012-02-04 14:20:09 -0800463 if (m_nacksEnabled)
464 {
465 NS_LOG_DEBUG ("Sending NACK_LOOP");
466 header->SetNack (CcnxInterestHeader::NACK_LOOP);
467 Ptr<Packet> nack = Create<Packet> ();
468 nack->AddHeader (*header);
469
470 incomingFace->Send (nack);
471 m_outNacks (header, incomingFace);
472 }
Ilya Moiseenko172763c2011-10-28 13:21:53 -0700473
Alexander Afanasyevcf133f02011-09-06 12:13:48 -0700474 return;
475 }
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800476
477 Ptr<Packet> contentObject;
Alexander Afanasyevc86c2832011-12-23 02:56:22 -0800478 Ptr<const CcnxContentObjectHeader> contentObjectHeader; // used for tracing
479 Ptr<const Packet> payload; // used for tracing
480 tie (contentObject, contentObjectHeader, payload) = m_contentStore->Lookup (header);
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800481 if (contentObject != 0)
482 {
Alexander Afanasyev7f3e49e2012-04-30 00:17:07 -0700483 NS_ASSERT (contentObjectHeader != 0);
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800484 NS_LOG_LOGIC("Found in cache");
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800485
Alexander Afanasyev7f3e49e2012-04-30 00:17:07 -0700486 OnDataDelayed (contentObjectHeader, contentObject, payload);
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800487 return;
488 }
489
Alexander Afanasyev0a61c342011-12-06 12:48:55 -0800490 // update PIT entry lifetime
491 m_pit->modify (m_pit->iterator_to (pitEntry),
492 ll::bind (&CcnxPitEntry::UpdateLifetime, ll::_1,
493 header->GetInterestLifetime ()));
494
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800495 if (outFace != pitEntry.m_outgoing.end ())
496 {
Alexander Afanasyeve192a2a2012-04-09 14:57:54 -0700497 NS_LOG_DEBUG ("Non duplicate interests from the face we have sent interest to. Don't suppress");
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800498 // got a non-duplicate interest from the face we have sent interest to
499 // Probably, there is no point in waiting data from that face... Not sure yet
500
501 // If we're expecting data from the interface we got the interest from ("producer" asks us for "his own" data)
502 // Mark interface YELLOW, but keep a small hope that data will come eventually.
503
504 // ?? not sure if we need to do that ?? ...
505
Alexander Afanasyev07827182011-12-13 01:07:32 -0800506 m_fib->m_fib.modify(m_fib->m_fib.iterator_to (pitEntry.m_fibEntry),
507 ll::bind (&CcnxFibEntry::UpdateStatus,
508 ll::_1, incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW));
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800509 }
Alexander Afanasyeve192a2a2012-04-09 14:57:54 -0700510 else
511 if (!isNew && !isRetransmitted)
512 {
513 // Suppress this interest if we're still expecting data from some other face
514 NS_LOG_DEBUG ("Suppress interests");
515 m_dropInterests (header, SUPPRESSED, incomingFace);
516 return;
517 }
Alexander Afanasyeva7a2b8b2011-11-28 18:19:09 -0800518
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800519 /////////////////////////////////////////////////////////////////////
520 // Propagate
521 /////////////////////////////////////////////////////////////////////
522
523 NS_ASSERT_MSG (m_forwardingStrategy != 0, "Need a forwarding protocol object to process packets");
524
525 bool propagated = m_forwardingStrategy->
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -0800526 PropagateInterest (pitEntry, incomingFace, header, packet);
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800527
Alexander Afanasyev0a61c342011-12-06 12:48:55 -0800528 if (isRetransmitted) //give another chance if retransmitted
529 {
530 // increase max number of allowed retransmissions
531 m_pit->modify (m_pit->iterator_to (pitEntry),
532 ll::bind (&CcnxPitEntry::IncreaseAllowedRetxCount, ll::_1));
533
534 // try again
535 propagated = m_forwardingStrategy->
536 PropagateInterest (pitEntry, incomingFace, header, packet);
537 }
538
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800539 // ForwardingStrategy will try its best to forward packet to at least one interface.
540 // If no interests was propagated, then there is not other option for forwarding or
541 // ForwardingStrategy failed to find it.
Alexander Afanasyeve67a97f2011-11-29 14:28:59 -0800542 if (!propagated)
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800543 {
Alexander Afanasyev120bf312011-12-19 01:24:47 -0800544 NS_LOG_DEBUG ("Not propagated");
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800545 m_dropInterests (header, NO_FACES, incomingFace);
546 GiveUpInterest (pitEntry, header);
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800547 }
Alexander Afanasyev9d313d42011-11-25 13:36:15 -0800548}
549
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700550void
Alexander Afanasyev7f3e49e2012-04-30 00:17:07 -0700551CcnxL3Protocol::OnDataDelayed (Ptr<const CcnxContentObjectHeader> header,
552 Ptr<const Packet> payload,
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700553 const Ptr<const Packet> &packet)
554{
555 if (m_delayingDataProcessing)
556 {
557 NS_LOG_DEBUG ("Delayed processing " << header->GetName ());
558 // NS_LOG_DEBUG (*m_pit);
559 }
560
561 // 1. Lookup PIT entry
562 try
563 {
564 CcnxPitEntryContainer::type::iterator pitEntry = m_pit->Lookup (*header);
565
566 //satisfy all pending incoming Interests
567 BOOST_FOREACH (const CcnxPitEntryIncomingFace &incoming, pitEntry->m_incoming)
568 {
569 incoming.m_face->Send (packet->Copy ());
570 m_outData (header, payload, false, incoming.m_face);
571 NS_LOG_DEBUG ("Satisfy " << *incoming.m_face);
572
573 // successfull forwarded data trace
574 }
575
576 if (pitEntry->m_incoming.size () > 0)
577 {
578 // All incoming interests are satisfied. Remove them
579 m_pit->modify (pitEntry,
580 ll::bind (&CcnxPitEntry::ClearIncoming, ll::_1));
581
582 // Remove all outgoing faces
583 m_pit->modify (pitEntry,
584 ll::bind (&CcnxPitEntry::ClearOutgoing, ll::_1));
585
586 // Set pruning timout on PIT entry (instead of deleting the record)
587 m_pit->modify (pitEntry,
588 ll::bind (&CcnxPitEntry::SetExpireTime, ll::_1,
589 Simulator::Now () + m_pit->GetPitEntryPruningTimeout ()));
590 }
591 }
592 catch (CcnxPitEntryNotFound)
593 {
594 NS_LOG_DEBUG ("Pit entry not found (was satisfied and removed before)");
595 return; // do not process unsoliced data packets
596 }
597}
598
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700599// Processing ContentObjects
Alexander Afanasyev19426ef2011-11-23 20:55:28 -0800600void
601CcnxL3Protocol::OnData (const Ptr<CcnxFace> &incomingFace,
602 Ptr<CcnxContentObjectHeader> &header,
603 Ptr<Packet> &payload,
604 const Ptr<const Packet> &packet)
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700605{
Ilya Moiseenko172763c2011-10-28 13:21:53 -0700606
Alexander Afanasyev1aeaf922012-04-23 13:48:09 -0700607 NS_LOG_FUNCTION (incomingFace << header->GetName () << payload << packet);
Alexander Afanasyevc86c2832011-12-23 02:56:22 -0800608 m_inData (header, payload, incomingFace);
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700609 // NS_LOG_DEBUG (*m_pit);
610
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700611 // 1. Lookup PIT entry
612 try
613 {
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700614 CcnxPitEntryContainer::type::iterator pitEntry = m_pit->Lookup (*header);
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700615
616 // Note that with MultiIndex we need to modify entries indirectly
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700617
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700618 CcnxPitEntryOutgoingFaceContainer::type::iterator out = pitEntry->m_outgoing.find (incomingFace);
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700619
620 // If we have sent interest for this data via this face, then update stats.
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700621 if (out != pitEntry->m_outgoing.end ())
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700622 {
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700623 m_fib->m_fib.modify (m_fib->m_fib.iterator_to (pitEntry->m_fibEntry),
Alexander Afanasyev07827182011-12-13 01:07:32 -0800624 ll::bind (&CcnxFibEntry::UpdateFaceRtt,
625 ll::_1,
626 incomingFace,
627 Simulator::Now () - out->m_sendTime));
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700628 }
629 else
630 {
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800631 // Unsolicited data, but we're interested in it... should we get it?
632 // Potential hole for attacks
Alexander Afanasyeva46844b2011-11-21 19:13:26 -0800633
Alexander Afanasyevde009992012-02-04 18:54:54 -0800634 if (m_cacheUnsolicitedData)
635 {
636 // Optimistically add or update entry in the content store
637 m_contentStore->Add (header, payload);
638 }
639 else
640 {
641 NS_LOG_ERROR ("Node "<< m_node->GetId() <<
642 ". PIT entry for "<< header->GetName ()<<" is valid, "
643 "but outgoing entry for interface "<< boost::cref(*incomingFace) <<" doesn't exist\n");
644 }
Alexander Afanasyev19426ef2011-11-23 20:55:28 -0800645 // ignore unsolicited data
646 return;
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700647 }
648
Alexander Afanasyev19426ef2011-11-23 20:55:28 -0800649 // Update metric status for the incoming interface in the corresponding FIB entry
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700650 m_fib->m_fib.modify (m_fib->m_fib.iterator_to (pitEntry->m_fibEntry),
Alexander Afanasyev07827182011-12-13 01:07:32 -0800651 ll::bind (&CcnxFibEntry::UpdateStatus, ll::_1,
652 incomingFace, CcnxFibFaceMetric::NDN_FIB_GREEN));
Alexander Afanasyev19426ef2011-11-23 20:55:28 -0800653
654 // Add or update entry in the content store
655 m_contentStore->Add (header, payload);
656
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700657 m_pit->modify (pitEntry,
658 ll::bind (&CcnxPitEntry::RemoveIncoming, ll::_1, incomingFace));
659
660 if (pitEntry->m_incoming.size () == 0)
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700661 {
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700662 // Set pruning timout on PIT entry (instead of deleting the record)
663 m_pit->modify (pitEntry,
664 ll::bind (&CcnxPitEntry::SetExpireTime, ll::_1,
665 Simulator::Now () + m_pit->GetPitEntryPruningTimeout ()));
666 }
667 else
668 {
669 if (!m_delayingDataProcessing)
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800670 {
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700671 OnDataDelayed (header, payload, packet);
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800672 }
Alexander Afanasyev1aeaf922012-04-23 13:48:09 -0700673 else
674 {
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700675 NS_LOG_DEBUG ("Delaying Data forwarding " << header->GetName ());
676 UniformVariable delay (0.0001, 0.002);
677 Simulator::Schedule (Seconds (delay.GetValue ()),
678 &CcnxL3Protocol::OnDataDelayed, this, header, payload, packet);
Alexander Afanasyev1aeaf922012-04-23 13:48:09 -0700679 }
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700680 }
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700681 }
682 catch (CcnxPitEntryNotFound)
683 {
Alexander Afanasyev1aeaf922012-04-23 13:48:09 -0700684 NS_LOG_DEBUG ("Pit entry not found");
Alexander Afanasyevde009992012-02-04 18:54:54 -0800685 if (m_cacheUnsolicitedData)
686 {
687 // Optimistically add or update entry in the content store
688 m_contentStore->Add (header, payload);
689 }
690 else
691 {
692 // Drop data packet if PIT entry is not found
693 // (unsolicited data packets should not "poison" content store)
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700694
Alexander Afanasyevde009992012-02-04 18:54:54 -0800695 //drop dulicated or not requested data packet
696 m_dropData (header, payload, UNSOLICITED, incomingFace);
697 }
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -0700698 return; // do not process unsoliced data packets
699 }
700}
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700701
702void
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800703CcnxL3Protocol::GiveUpInterest (const CcnxPitEntry &pitEntry,
704 Ptr<CcnxInterestHeader> header)
705{
Alexander Afanasyevde009992012-02-04 18:54:54 -0800706 NS_LOG_FUNCTION (this << &pitEntry);
Alexander Afanasyevff8c5d62012-04-25 15:14:51 -0700707 // NS_LOG_DEBUG (*m_pit);
Alexander Afanasyevbab81b12012-02-04 14:20:09 -0800708 if (m_nacksEnabled)
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800709 {
Alexander Afanasyevbab81b12012-02-04 14:20:09 -0800710 Ptr<Packet> packet = Create<Packet> ();
711 header->SetNack (CcnxInterestHeader::NACK_GIVEUP_PIT);
712 packet->AddHeader (*header);
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800713
Alexander Afanasyevbab81b12012-02-04 14:20:09 -0800714 BOOST_FOREACH (const CcnxPitEntryIncomingFace &incoming, pitEntry.m_incoming)
715 {
Alexander Afanasyevde009992012-02-04 18:54:54 -0800716 NS_LOG_DEBUG ("Send NACK for " << boost::cref (header->GetName ()) << " to " << boost::cref (*incoming.m_face));
Alexander Afanasyevbab81b12012-02-04 14:20:09 -0800717 incoming.m_face->Send (packet->Copy ());
718
719 m_outNacks (header, incoming.m_face);
720 }
Alexander Afanasyevbab81b12012-02-04 14:20:09 -0800721
Alexander Afanasyev1aeaf922012-04-23 13:48:09 -0700722 // All incoming interests cannot be satisfied. Remove them
723 m_pit->modify (m_pit->iterator_to (pitEntry),
724 ll::bind (&CcnxPitEntry::ClearIncoming, ll::_1));
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800725
Alexander Afanasyev1aeaf922012-04-23 13:48:09 -0700726 // Remove also outgoing
727 m_pit->modify (m_pit->iterator_to (pitEntry),
728 ll::bind (&CcnxPitEntry::ClearOutgoing, ll::_1));
Alexander Afanasyev120bf312011-12-19 01:24:47 -0800729
Alexander Afanasyev1aeaf922012-04-23 13:48:09 -0700730 // Set pruning timout on PIT entry (instead of deleting the record)
731 m_pit->modify (m_pit->iterator_to (pitEntry),
732 ll::bind (&CcnxPitEntry::SetExpireTime, ll::_1,
733 Simulator::Now () + m_pit->GetPitEntryPruningTimeout ()));
734 }
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800735}
736
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700737} //namespace ns3