blob: ba9e81a1c634e8b76898edc27d0865414b1263ff [file] [log] [blame]
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
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>
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070019 */
20
21#include "per-fib-limits.h"
22
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -070023#include "ns3/ndn-l3-protocol.h"
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070024#include "ns3/ndn-interest-header.h"
25#include "ns3/ndn-content-object-header.h"
26#include "ns3/ndn-pit.h"
27#include "ns3/ndn-pit-entry.h"
28
29#include "ns3/assert.h"
30#include "ns3/log.h"
31#include "ns3/simulator.h"
Alexander Afanasyev6a3bb132012-08-15 09:47:35 -070032#include "ns3/random-variable.h"
Alexander Afanasyevccbd8342012-08-16 16:54:39 -070033#include "ns3/double.h"
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070034
35#include <boost/foreach.hpp>
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -070036#include <boost/lexical_cast.hpp>
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070037#include <boost/lambda/lambda.hpp>
38#include <boost/lambda/bind.hpp>
39namespace ll = boost::lambda;
40
41NS_LOG_COMPONENT_DEFINE ("ndn.fw.PerFibLimits");
42
43namespace ns3 {
44namespace ndn {
45namespace fw {
46
47NS_OBJECT_ENSURE_REGISTERED (PerFibLimits);
48
49TypeId
50PerFibLimits::GetTypeId (void)
51{
52 static TypeId tid = TypeId ("ns3::ndn::fw::PerFibLimits")
53 .SetGroupName ("Ndn")
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070054 .SetParent <super> ()
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070055 .AddConstructor <PerFibLimits> ()
Alexander Afanasyevc7719612012-08-30 17:42:20 -070056
57 .AddAttribute ("AnnounceLimits", "Enable limit announcement using scope 0 interests",
58 BooleanValue (false),
59 MakeBooleanAccessor (&PerFibLimits::m_announceLimits),
60 MakeBooleanChecker ())
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070061 ;
62 return tid;
63}
64
65PerFibLimits::PerFibLimits ()
66{
67}
68
69void
70PerFibLimits::DoDispose ()
71{
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -070072 m_announceEvent.Cancel ();
73
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070074 super::DoDispose ();
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070075}
76
Alexander Afanasyev5db92172012-08-21 16:52:07 -070077void
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -070078PerFibLimits::NotifyNewAggregate ()
79{
80 super::NotifyNewAggregate ();
81
Alexander Afanasyevc7719612012-08-30 17:42:20 -070082 if (m_announceLimits)
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -070083 {
Alexander Afanasyevc7719612012-08-30 17:42:20 -070084 if (m_pit != 0 && m_fib != 0)
85 {
86 m_announceEvent = Simulator::Schedule (Seconds (1.0),
87 &PerFibLimits::AnnounceLimits, this);
88 }
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -070089 }
90}
91
92void
Alexander Afanasyev5db92172012-08-21 16:52:07 -070093PerFibLimits::RemoveFace (Ptr<Face> face)
94{
Alexander Afanasyev5db92172012-08-21 16:52:07 -070095 for (PitQueueMap::iterator item = m_pitQueues.begin ();
96 item != m_pitQueues.end ();
97 item ++)
98 {
99 item->second.Remove (face);
100 }
101 m_pitQueues.erase (face);
Alexander Afanasyev08b7d9e2012-08-23 10:53:46 -0700102
103 super::RemoveFace (face);
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700104}
105
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -0700106void
107PerFibLimits::OnInterest (Ptr<Face> face,
108 Ptr<const InterestHeader> header,
109 Ptr<const Packet> origPacket)
110{
111 if (header->GetScope () != 0)
112 super::OnInterest (face, header, origPacket);
113 else
114 ApplyAnnouncedLimit (face, header);
115}
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700116
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700117bool
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700118PerFibLimits::TrySendOutInterest (Ptr<Face> inFace,
119 Ptr<Face> outFace,
120 Ptr<const InterestHeader> header,
121 Ptr<const Packet> origPacket,
122 Ptr<pit::Entry> pitEntry)
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700123{
124 NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700125 // totally override all (if any) parent processing
Alexander Afanasyevff033952012-08-23 15:45:52 -0700126
Alexander Afanasyev98c16e02012-08-28 00:02:02 -0700127 if (pitEntry->GetFwTag<PitQueueTag> () != boost::shared_ptr<PitQueueTag> ())
128 {
129 pitEntry->UpdateLifetime (Seconds (0.10));
130 NS_LOG_DEBUG ("Packet is still in queue and is waiting for its processing");
131 return true; // already in the queue
132 }
133
Alexander Afanasyevff033952012-08-23 15:45:52 -0700134 if (header->GetInterestLifetime () < Seconds (0.1))
135 {
Alexander Afanasyevc7719612012-08-30 17:42:20 -0700136 NS_LOG_DEBUG( "??? Why interest lifetime is so short? [" << header->GetInterestLifetime ().ToDouble (Time::S) << "s]");
Alexander Afanasyevff033952012-08-23 15:45:52 -0700137 }
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700138
139 pit::Entry::out_iterator outgoing =
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700140 pitEntry->GetOutgoing ().find (outFace);
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700141
142 if (outgoing != pitEntry->GetOutgoing ().end ())
143 {
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700144 // just suppress without any other action
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700145 return false;
146 }
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700147
Alexander Afanasyev0ffa7162012-08-21 22:39:22 -0700148 NS_LOG_DEBUG ("Limit: " << outFace->GetLimits ().m_curMaxLimit << ", outstanding: " << outFace->GetLimits ().m_outstanding);
149
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700150 if (outFace->GetLimits ().IsBelowLimit ())
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700151 {
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700152 pitEntry->AddOutgoing (outFace);
153
154 //transmission
155 Ptr<Packet> packetToSend = origPacket->Copy ();
156 outFace->Send (packetToSend);
157
Alexander Afanasyev0ffa7162012-08-21 22:39:22 -0700158 DidSendOutInterest (outFace, header, origPacket, pitEntry);
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700159 return true;
160 }
161 else
162 {
Alexander Afanasyev0ffa7162012-08-21 22:39:22 -0700163 NS_LOG_DEBUG ("Face limit for " << header->GetName ());
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700164 }
Alexander Afanasyev0ffa7162012-08-21 22:39:22 -0700165
Alexander Afanasyev08b7d9e2012-08-23 10:53:46 -0700166 // hack
167 // offset lifetime, so we don't keep entries in queue for too long
Alexander Afanasyevff033952012-08-23 15:45:52 -0700168 // pitEntry->OffsetLifetime (Seconds (0.010) + );
169 // std::cerr << (pitEntry->GetExpireTime () - Simulator::Now ()).ToDouble (Time::S) * 1000 << "ms" << std::endl;
170 pitEntry->OffsetLifetime (Seconds (-pitEntry->GetInterest ()->GetInterestLifetime ().ToDouble (Time::S)));
171 pitEntry->UpdateLifetime (Seconds (0.10));
Alexander Afanasyev98c16e02012-08-28 00:02:02 -0700172
173 // const ndnSIM::LoadStatsFace &stats = GetStatsTree ()[header->GetName ()].incoming ().find (inFace)->second;
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -0700174 // const ndnSIM::LoadStatsFace &stats = GetStatsTree ()["/"].incoming ().find (inFace)->second;
175 // double weight = std::min (1.0, stats.GetSatisfiedRatio ().get<0> ());
176 bool enqueued = m_pitQueues[outFace].Enqueue (inFace, pitEntry, 1);
Alexander Afanasyevff033952012-08-23 15:45:52 -0700177
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700178 if (enqueued)
179 {
180 NS_LOG_DEBUG ("PIT entry is enqueued for delayed processing. Telling that we forwarding possible");
181 return true;
182 }
183 else
184 return false;
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700185}
186
187void
188PerFibLimits::WillEraseTimedOutPendingInterest (Ptr<pit::Entry> pitEntry)
189{
190 NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
191
Alexander Afanasyevc7719612012-08-30 17:42:20 -0700192 if (pitEntry->GetOutgoing ().size () == 0)
193 {
194 super::DidReceiveValidNack (0, 0, pitEntry); // semi safe
Alexander Afanasyev98c16e02012-08-28 00:02:02 -0700195
Alexander Afanasyevc7719612012-08-30 17:42:20 -0700196 Ptr<InterestHeader> nackHeader = Create<InterestHeader> (*pitEntry->GetInterest ());
197
198 NS_ASSERT (pitEntry->GetFwTag<PitQueueTag> () != boost::shared_ptr<PitQueueTag> ());
199 if (pitEntry->GetFwTag<PitQueueTag> ()->IsLastOneInQueues ())
200 {
201 nackHeader->SetNack (100);
202 }
203 else
204 {
205 nackHeader->SetNack (101);
206 }
Alexander Afanasyev98c16e02012-08-28 00:02:02 -0700207
Alexander Afanasyevc7719612012-08-30 17:42:20 -0700208 Ptr<Packet> pkt = Create<Packet> ();
209 pkt->AddHeader (*nackHeader);
Alexander Afanasyev98c16e02012-08-28 00:02:02 -0700210
Alexander Afanasyevc7719612012-08-30 17:42:20 -0700211 for (pit::Entry::in_container::iterator face = pitEntry->GetIncoming ().begin ();
212 face != pitEntry->GetIncoming ().end ();
213 face ++)
214 {
215 face->m_face->Send (pkt->Copy ());
216 }
217 }
218 else
219 {
220 // make bad stats only for "legitimately" timed out interests
221 super::WillEraseTimedOutPendingInterest (pitEntry);
222 }
Alexander Afanasyev187cba22012-08-28 11:16:52 -0700223
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700224 PitQueue::Remove (pitEntry);
225
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700226 for (pit::Entry::out_container::iterator face = pitEntry->GetOutgoing ().begin ();
227 face != pitEntry->GetOutgoing ().end ();
228 face ++)
229 {
Alexander Afanasyev6a3bb132012-08-15 09:47:35 -0700230 face->m_face->GetLimits ().RemoveOutstanding ();
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700231 }
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700232
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700233 ProcessFromQueue ();
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700234}
235
236
237void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700238PerFibLimits::WillSatisfyPendingInterest (Ptr<Face> inFace,
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700239 Ptr<pit::Entry> pitEntry)
240{
241 NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700242 super::WillSatisfyPendingInterest (inFace, pitEntry);
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700243
244 PitQueue::Remove (pitEntry);
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700245
246 for (pit::Entry::out_container::iterator face = pitEntry->GetOutgoing ().begin ();
247 face != pitEntry->GetOutgoing ().end ();
248 face ++)
249 {
Alexander Afanasyev6a3bb132012-08-15 09:47:35 -0700250 face->m_face->GetLimits ().RemoveOutstanding ();
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700251 }
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700252
253 ProcessFromQueue ();
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700254}
255
256
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700257void
258PerFibLimits::ProcessFromQueue ()
259{
Alexander Afanasyev0ffa7162012-08-21 22:39:22 -0700260 NS_LOG_FUNCTION (this);
261
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700262 for (PitQueueMap::iterator queue = m_pitQueues.begin ();
263 queue != m_pitQueues.end ();
264 queue++)
265 {
Alexander Afanasyev91e11282012-08-21 17:23:11 -0700266 Ptr<Face> outFace = queue->first;
Alexander Afanasyev0ffa7162012-08-21 22:39:22 -0700267
268 NS_LOG_DEBUG ("Processing " << *outFace);
Alexander Afanasyev91e11282012-08-21 17:23:11 -0700269
270 while (!queue->second.IsEmpty () && outFace->GetLimits ().IsBelowLimit ())
271 {
272 // now we have enqueued packet and have slot available. Send out delayed packet
273 Ptr<pit::Entry> pitEntry = queue->second.Pop ();
Alexander Afanasyev187cba22012-08-28 11:16:52 -0700274 if (pitEntry == 0)
275 {
276 outFace->GetLimits ().RemoveOutstanding ();
277 NS_LOG_DEBUG ("Though there are Interests in queue, weighted round robin decided that packet is not allowed yet");
278 break;
279 }
Alexander Afanasyev0ffa7162012-08-21 22:39:22 -0700280
Alexander Afanasyev08b7d9e2012-08-23 10:53:46 -0700281 // hack
282 // offset lifetime back, so PIT entry wouldn't prematurely expire
Alexander Afanasyev0ffa7162012-08-21 22:39:22 -0700283
Alexander Afanasyevff033952012-08-23 15:45:52 -0700284 // std::cerr << Simulator::GetContext () << ", Lifetime before " << (pitEntry->GetExpireTime () - Simulator::Now ()).ToDouble (Time::S) << "s" << std::endl;
285 pitEntry->OffsetLifetime (Seconds (-0.10) + Seconds (pitEntry->GetInterest ()->GetInterestLifetime ().ToDouble (Time::S)));
286 // std::cerr << Simulator::GetContext () << ", Lifetime after " << (pitEntry->GetExpireTime () - Simulator::Now ()).ToDouble (Time::S) << "s" << std::endl;
287
Alexander Afanasyev91e11282012-08-21 17:23:11 -0700288 pitEntry->AddOutgoing (outFace);
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700289
Alexander Afanasyev91e11282012-08-21 17:23:11 -0700290 Ptr<Packet> packetToSend = Create<Packet> ();
Alexander Afanasyevff033952012-08-23 15:45:52 -0700291 Ptr<InterestHeader> header = Create<InterestHeader> (*pitEntry->GetInterest ());
292 NS_LOG_DEBUG ("Adjust interest lifetime to " << pitEntry->GetExpireTime () - Simulator::Now () << "s");
293 // header->SetInterestLifetime (
294 // // header->GetInterestLifetime () - ()
295 // pitEntry->GetExpireTime () - Simulator::Now ()
296 // );
297 // std::cerr << "New lifetime: " << (pitEntry->GetExpireTime () - Simulator::Now ()).ToDouble (Time::S) << "s" << std::endl;
298 packetToSend->AddHeader (*header);
Alexander Afanasyev0ffa7162012-08-21 22:39:22 -0700299
300 NS_LOG_DEBUG ("Delayed sending for " << pitEntry->GetPrefix ());
Alexander Afanasyev91e11282012-08-21 17:23:11 -0700301 outFace->Send (packetToSend);
302 DidSendOutInterest (outFace, pitEntry->GetInterest (), packetToSend, pitEntry);
303 }
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700304 }
305}
306
Alexander Afanasyev08b7d9e2012-08-23 10:53:46 -0700307void
308PerFibLimits::DidReceiveValidNack (Ptr<Face> inFace,
309 uint32_t nackCode,
310 Ptr<pit::Entry> pitEntry)
311{
Alexander Afanasyevc7719612012-08-30 17:42:20 -0700312 super::DidReceiveValidNack (inFace, nackCode, pitEntry); // will reset count stats
Alexander Afanasyev187cba22012-08-28 11:16:52 -0700313
Alexander Afanasyevc7719612012-08-30 17:42:20 -0700314 // NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
315 PitQueue::Remove (pitEntry);
Alexander Afanasyev98c16e02012-08-28 00:02:02 -0700316
Alexander Afanasyevc7719612012-08-30 17:42:20 -0700317 Ptr<InterestHeader> nackHeader = Create<InterestHeader> (*pitEntry->GetInterest ());
318 nackHeader->SetNack (100);
319 Ptr<Packet> pkt = Create<Packet> ();
320 pkt->AddHeader (*nackHeader);
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700321
Alexander Afanasyevc7719612012-08-30 17:42:20 -0700322 for (pit::Entry::in_container::iterator face = pitEntry->GetIncoming ().begin ();
323 face != pitEntry->GetIncoming ().end ();
324 face ++)
325 {
326 face->m_face->Send (pkt->Copy ());
327 }
Alexander Afanasyev98c16e02012-08-28 00:02:02 -0700328
Alexander Afanasyevc7719612012-08-30 17:42:20 -0700329 for (pit::Entry::out_container::iterator face = pitEntry->GetOutgoing ().begin ();
330 face != pitEntry->GetOutgoing ().end ();
331 face ++)
332 {
333 face->m_face->GetLimits ().RemoveOutstanding ();
334 }
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -0700335
Alexander Afanasyevc7719612012-08-30 17:42:20 -0700336 m_pit->MarkErased (pitEntry);
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -0700337
Alexander Afanasyevc7719612012-08-30 17:42:20 -0700338 ProcessFromQueue ();
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -0700339}
340
341void
342PerFibLimits::AnnounceLimits ()
343{
344 Ptr<L3Protocol> l3 = GetObject<L3Protocol> ();
345 NS_ASSERT (l3 != 0);
346
347 if (l3->GetNFaces () < 2)
Alexander Afanasyev6f101fc2012-08-23 16:34:34 -0700348 {
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -0700349 m_announceEvent = Simulator::Schedule (Seconds (1.0),
350 &PerFibLimits::AnnounceLimits, this);
351 return;
352 }
353
354 double sumOfWeights = 0;
355 double weightNormalization = 1.0;
356 for (uint32_t faceId = 0; faceId < l3->GetNFaces (); faceId ++)
357 {
358 Ptr<Face> inFace = l3->GetFace (faceId);
359
360 const ndnSIM::LoadStatsFace &stats = GetStatsTree ()["/"].incoming ().find (inFace)->second;
361 double weight = std::min (1.0, stats.GetSatisfiedRatio ().get<0> ());
362 if (weight < 0) weight = 0.5;
363
364 sumOfWeights += weight;
365 }
366 if (sumOfWeights >= 1)
367 {
368 // disable normalization (not necessary)
369 weightNormalization = 1.0;
370 }
371 else
372 {
373 // sumOfWeights /= (l3->GetNFaces ());
374 weightNormalization = 1 / sumOfWeights;
Alexander Afanasyev6f101fc2012-08-23 16:34:34 -0700375 }
Alexander Afanasyev08b7d9e2012-08-23 10:53:46 -0700376
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -0700377 for (Ptr<fib::Entry> entry = m_fib->Begin ();
378 entry != m_fib->End ();
379 entry = m_fib->Next (entry))
380 {
381 InterestHeader announceInterest;
382 announceInterest.SetScope (0); // link-local
383
384 uint32_t totalAllowance = 0;
385 for (fib::FaceMetricContainer::type::iterator fibFace = entry->m_faces.begin ();
386 fibFace != entry->m_faces.end ();
387 fibFace ++)
388 {
389 totalAllowance += fibFace->m_face->GetLimits ().GetMaxLimit ();
390 }
391
392 if (totalAllowance == 0)
393 {
394 // don't announce anything, there is no limit
395 continue;
396 }
397
398 for (uint32_t faceId = 0; faceId < l3->GetNFaces (); faceId ++)
399 {
400 Ptr<Face> inFace = l3->GetFace (faceId);
401
402 const ndnSIM::LoadStatsFace &stats = GetStatsTree ()["/"].incoming ().find (inFace)->second;
403 double weight = std::min (1.0, stats.GetSatisfiedRatio ().get<0> ());
404 if (weight < 0) weight = 0.5;
405
406 Ptr<NameComponents> prefixWithLimit = Create<NameComponents> (entry->GetPrefix ());
407 (*prefixWithLimit)
408 ("limit")
409 (static_cast<uint32_t> (std::max (1.0, weightNormalization * weight * totalAllowance)));
410
411 announceInterest.SetName (prefixWithLimit);
412 // lifetime is 0
413
414 Ptr<Packet> pkt = Create<Packet> ();
415 pkt->AddHeader (announceInterest);
416
417 inFace->Send (pkt);
418 }
419 }
420
421 m_announceEvent = Simulator::Schedule (Seconds (1.0),
422 &PerFibLimits::AnnounceLimits, this);
423}
424
425void
426PerFibLimits::ApplyAnnouncedLimit (Ptr<Face> inFace,
427 Ptr<const InterestHeader> header)
428{
429 // Ptr<fib::Entry> fibEntry = m_fib->LongestPrefixMatch (header);
430 // if (fibEntry == 0)
431 // return;
432
433 uint32_t limit = boost::lexical_cast<uint32_t> (header->GetName ().GetLastComponent ());
434 inFace->GetLimits ().SetMaxLimit (limit);
Alexander Afanasyev08b7d9e2012-08-23 10:53:46 -0700435
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -0700436 // if (Simulator::GetContext () == 6 || Simulator::GetContext () == 4)
437 // {
438 // std::cerr << Simulator::Now ().ToDouble (Time::S) << "s from:" << *inFace << " " << *header << std::endl;
439 // std::cerr << header->GetName ().GetLastComponent () << ", " << boost::lexical_cast<uint32_t> (header->GetName ().GetLastComponent ()) << std::endl;
440 // }
Alexander Afanasyev08b7d9e2012-08-23 10:53:46 -0700441}
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700442
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700443
444} // namespace fw
445} // namespace ndn
446} // namespace ns3