blob: 04b34a23ea110a29d7e1835723adf1bcff4de554 [file] [log] [blame]
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -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 Afanasyev2b4c9472012-08-09 15:00:38 -070019 */
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070020
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070021#ifndef NDN_FORWARDING_STRATEGY_H
22#define NDN_FORWARDING_STRATEGY_H
23
24#include "ns3/packet.h"
25#include "ns3/callback.h"
26#include "ns3/object.h"
27#include "ns3/traced-callback.h"
28
29namespace ns3 {
30namespace ndn {
31
32class Face;
33class InterestHeader;
34class ContentObjectHeader;
35class Pit;
36namespace pit { class Entry; }
37class FibFaceMetric;
38class Fib;
Alexander Afanasyevadcccf42012-11-26 23:55:34 -080039namespace fib { class Entry; }
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070040class ContentStore;
41
42/**
43 * \ingroup ndn
44 * \brief Abstract base class for Ndn forwarding strategies
45 */
46class ForwardingStrategy :
47 public Object
48{
49public:
50 static TypeId GetTypeId (void);
51
52 /**
Alexander Afanasyev042b4a72012-11-09 17:47:48 -080053 * @brief Helper function to retrieve logging name for the forwarding strategy
54 */
55 static std::string GetLogName ();
56
57 /**
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070058 * @brief Default constructor
59 */
60 ForwardingStrategy ();
61 virtual ~ForwardingStrategy ();
62
63 /**
64 * \brief Actual processing of incoming Ndn interests. Note, interests do not have payload
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -080065 *
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070066 * Processing Interest packets
67 * @param face incoming face
68 * @param header deserialized Interest header
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070069 * @param origPacket original packet
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070070 */
71 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070072 OnInterest (Ptr<Face> face,
73 Ptr<const InterestHeader> header,
74 Ptr<const Packet> origPacket);
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070075
76 /**
77 * \brief Actual processing of incoming Ndn content objects
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -080078 *
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070079 * Processing ContentObject packets
80 * @param face incoming face
81 * @param header deserialized ContentObject header
82 * @param payload data packet payload
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070083 * @param origPacket original packet
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070084 */
85 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070086 OnData (Ptr<Face> face,
87 Ptr<const ContentObjectHeader> header,
88 Ptr<Packet> payload,
89 Ptr<const Packet> origPacket);
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070090
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070091 /**
92 * @brief Event fired just before PIT entry is removed by timeout
93 * @param pitEntry PIT entry to be removed
94 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070095 virtual void
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070096 WillEraseTimedOutPendingInterest (Ptr<pit::Entry> pitEntry);
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070097
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070098 /**
Alexander Afanasyevf5c07742012-10-31 13:13:05 -070099 * @brief Event fired every time face is added to NDN stack
100 * @param face face to be removed
101 */
102 virtual void
103 AddFace (Ptr<Face> face);
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800104
Alexander Afanasyevf5c07742012-10-31 13:13:05 -0700105 /**
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700106 * @brief Event fired every time face is removed from NDN stack
107 * @param face face to be removed
108 *
109 * For example, when an application terminates, AppFace is removed and this method called by NDN stack.
110 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700111 virtual void
112 RemoveFace (Ptr<Face> face);
Alexander Afanasyevadcccf42012-11-26 23:55:34 -0800113
114 /**
115 * @brief Event fired every time a FIB entry is added to FIB
116 * @param fibEntry FIB entry that was added
117 */
118 virtual void
119 DidAddFibEntry (Ptr<fib::Entry> fibEntry);
120
121 /**
122 * @brief Fired just before FIB entry will be removed from FIB
123 * @param fibEntry FIB entry that will be removed
124 */
125 virtual void
126 WillRemoveFibEntry (Ptr<fib::Entry> fibEntry);
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800127
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700128protected:
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700129 /**
130 * @brief An event that is fired every time a new PIT entry is created
131 *
132 * Note that if NDN node is receiving a similar interest (interest for the same name),
133 * then either DidReceiveDuplicateInterest, DidSuppressSimilarInterest, or DidForwardSimilarInterest
134 * will be called
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800135 *
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700136 * Suppression of similar Interests is controlled using ShouldSuppressIncomingInterest virtual method
137 *
138 * @param inFace incoming face
139 * @param header deserialized Interest header
140 * @param origPacket original packet
141 * @param pitEntry created PIT entry (incoming and outgoing face sets are empty)
142 *
143 * @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
144 */
145 virtual void
146 DidCreatePitEntry (Ptr<Face> inFace,
147 Ptr<const InterestHeader> header,
148 Ptr<const Packet> origPacket,
149 Ptr<pit::Entry> pitEntry);
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800150
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700151 /**
152 * @brief An event that is fired every time a new PIT entry cannot be created (e.g., PIT container imposes a limit)
153 *
154 * Note that this call can be called only for non-similar Interest (i.e., there is an attempt to create a new PIT entry).
155 * For any non-similar Interests, either FailedToCreatePitEntry or DidCreatePitEntry is called.
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800156 *
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700157 * @param inFace incoming face
158 * @param header deserialized Interest header
159 * @param origPacket original packet
160 */
161 virtual void
162 FailedToCreatePitEntry (Ptr<Face> inFace,
163 Ptr<const InterestHeader> header,
164 Ptr<const Packet> origPacket);
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800165
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700166 /**
167 * @brief An event that is fired every time a duplicated Interest is received
168 *
169 * This even is the last action that is performed before the Interest processing is halted
170 *
171 * @param inFace incoming face
172 * @param header deserialized Interest header
173 * @param origPacket original packet
174 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
175 *
176 * @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
177 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700178 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700179 DidReceiveDuplicateInterest (Ptr<Face> inFace,
180 Ptr<const InterestHeader> header,
181 Ptr<const Packet> origPacket,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700182 Ptr<pit::Entry> pitEntry);
183
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700184 /**
185 * @brief An event that is fired every time when a similar Interest is received and suppressed (collapsed)
186 *
187 * This even is the last action that is performed before the Interest processing is halted
188 *
189 * @param inFace incoming face
190 * @param header deserialized Interest header
191 * @param origPacket original packet
192 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
193 *
194 * @see DidReceiveDuplicateInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
195 */
196 virtual void
197 DidSuppressSimilarInterest (Ptr<Face> inFace,
198 Ptr<const InterestHeader> header,
199 Ptr<const Packet> origPacket,
200 Ptr<pit::Entry> pitEntry);
201
202 /**
203 * @brief An event that is fired every time when a similar Interest is received and further forwarded (not suppressed/collapsed)
204 *
205 * This even is fired just before handling the Interest to PropagateInterest method
206 *
207 * @param inFace incoming face
208 * @param header deserialized Interest header
209 * @param origPacket original packet
210 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
211 *
212 * @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, ShouldSuppressIncomingInterest
213 */
214 virtual void
215 DidForwardSimilarInterest (Ptr<Face> inFace,
216 Ptr<const InterestHeader> header,
217 Ptr<const Packet> origPacket,
218 Ptr<pit::Entry> pitEntry);
219
220 /**
221 * @brief An even that is fired when Interest cannot be forwarded
222 *
223 * Note that the event will not fire if retransmission detection is enabled (by default)
224 * and retransmitted Interest cannot by forwarded. For more details, refer to the implementation.
225 *
226 * @param inFace incoming face
227 * @param header deserialized Interest header
228 * @param origPacket original packet
229 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
230 *
231 * @see DetectRetransmittedInterest
232 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700233 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700234 DidExhaustForwardingOptions (Ptr<Face> inFace,
235 Ptr<const InterestHeader> header,
236 Ptr<const Packet> origPacket,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700237 Ptr<pit::Entry> pitEntry);
238
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800239 /**
240 * @brief Method that implements logic to distinguish between new and retransmitted interest
241 *
242 * This method is called only when DetectRetransmissions attribute is set true (by default).
243 *
244 * Currently, the retransmission detection logic relies on the fact that list of incoming faces
245 * already has inFace (i.e., a similar interest is received on the same face more than once).
246 *
247 * @param inFace incoming face
248 * @param header deserialized Interest header
249 * @param origPacket original packet
250 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
251 * @return true if Interest should be considered as retransmitted
252 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700253 virtual bool
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700254 DetectRetransmittedInterest (Ptr<Face> inFace,
255 Ptr<const InterestHeader> header,
256 Ptr<const Packet> origPacket,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700257 Ptr<pit::Entry> pitEntry);
258
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800259 /**
260 * @brief Even fired just before Interest will be satisfied
261 *
262 * Note that when Interest is satisfied from the cache, incoming face will be 0
263 *
264 * @param inFace incoming face
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800265 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800266 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700267 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700268 WillSatisfyPendingInterest (Ptr<Face> inFace,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700269 Ptr<pit::Entry> pitEntry);
270
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800271 /**
272 * @brief Actual procedure to satisfy Interest
273 *
274 * Note that when Interest is satisfied from the cache, incoming face will be 0
275 *
276 * @param inFace incoming face
277 * @param header deserialized ContentObject header
278 * @param payload ContentObject payload
279 * @param origPacket original packet
280 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
281 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700282 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700283 SatisfyPendingInterest (Ptr<Face> inFace, // 0 allowed (from cache)
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700284 Ptr<const ContentObjectHeader> header,
285 Ptr<const Packet> payload,
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700286 Ptr<const Packet> origPacket,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700287 Ptr<pit::Entry> pitEntry);
288
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800289 /**
290 * @brief Event which is fired just after data was send out on the face
291 *
Alexander Afanasyev67f4a4a2012-11-24 17:18:17 -0800292 * @param inFace incoming face of the ContentObject
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800293 * @param outFace outgoing face
294 * @param header deserialized ContentObject header
295 * @param payload ContentObject payload
296 * @param origPacket original packet
297 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
298 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700299 virtual void
Alexander Afanasyev67f4a4a2012-11-24 17:18:17 -0800300 DidSendOutData (Ptr<Face> inFace,
301 Ptr<Face> outFace,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700302 Ptr<const ContentObjectHeader> header,
303 Ptr<const Packet> payload,
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700304 Ptr<const Packet> origPacket,
305 Ptr<pit::Entry> pitEntry);
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800306
307 /**
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800308 * @brief Event which is fired every time a requested (solicited) DATA packet (there is an active PIT entry) is received
309 *
310 * @param inFace incoming face
311 * @param header deserialized ContentObject header
312 * @param payload ContentObject payload
313 * @param origPacket original packet
314 * @param didCreateCacheEntry flag indicating whether a cache entry was added for this data packet or not (e.g., packet already exists in cache)
315 */
316 virtual void
317 DidReceiveSolicitedData (Ptr<Face> inFace,
318 Ptr<const ContentObjectHeader> header,
319 Ptr<const Packet> payload,
320 Ptr<const Packet> origPacket,
321 bool didCreateCacheEntry);
322
323 /**
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800324 * @brief Event which is fired every time an unsolicited DATA packet (no active PIT entry) is received
325 *
326 * The current implementation allows ignoring unsolicited DATA (by default), or cache it by setting
327 * attribute CacheUnsolicitedData true
328 *
329 * @param inFace incoming face
330 * @param header deserialized ContentObject header
331 * @param payload ContentObject payload
332 * @param origPacket original packet
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800333 * @param didCreateCacheEntry flag indicating whether a cache entry was added for this data packet or not (e.g., packet already exists in cache)
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800334 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700335 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700336 DidReceiveUnsolicitedData (Ptr<Face> inFace,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700337 Ptr<const ContentObjectHeader> header,
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700338 Ptr<const Packet> payload,
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800339 Ptr<const Packet> origPacket,
340 bool didCreateCacheEntry);
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800341
342 /**
343 * @brief Method implementing logic to suppress (collapse) similar Interests
344 *
345 * In the base class implementation this method checks list of incoming/outgoing faces of the PIT entry
346 * (for new Intersets, both lists are empty before this call)
347 *
348 * For more details, refer to the source code.
349 *
350 * @param inFace incoming face
351 * @param header deserialized ContentObject header
352 * @param payload ContentObject payload
353 * @param origPacket original packet
354 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700355 virtual bool
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700356 ShouldSuppressIncomingInterest (Ptr<Face> inFace,
357 Ptr<const InterestHeader> header,
358 Ptr<const Packet> origPacket,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700359 Ptr<pit::Entry> pitEntry);
360
361 /**
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800362 * @brief Method to check whether Interest can be send out on the particular face or not
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700363 *
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800364 * In the base class, this method perfoms two checks:
365 * 1. If inFace is equal to outFace (when equal, Interest forwarding is prohibited)
366 * 2. Whether Interest should be suppressed (list of outgoing faces include outFace),
367 * considering (if enabled) retransmission logic
368 *
369 * @param inFace incoming face of the Interest
370 * @param outFace proposed outgoing face of the Interest
371 * @param header parsed Interest header
372 * @param origPacket original Interest packet
373 * @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
374 *
375 * @see DetectRetransmittedInterest
376 */
377 virtual bool
378 CanSendOutInterest (Ptr<Face> inFace,
379 Ptr<Face> outFace,
380 Ptr<const InterestHeader> header,
381 Ptr<const Packet> origPacket,
382 Ptr<pit::Entry> pitEntry);
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800383
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800384 /**
385 * @brief Method implementing actual interest forwarding, taking into account CanSendOutInterest decision
386 *
387 * If event returns false, then there is some kind of a problem exists
388 *
389 * @param inFace incoming face of the Interest
390 * @param outFace proposed outgoing face of the Interest
391 * @param header parsed Interest header
392 * @param origPacket original Interest packet
393 * @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
394 *
395 * @see CanSendOutInterest
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700396 */
397 virtual bool
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700398 TrySendOutInterest (Ptr<Face> inFace,
399 Ptr<Face> outFace,
400 Ptr<const InterestHeader> header,
401 Ptr<const Packet> origPacket,
402 Ptr<pit::Entry> pitEntry);
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700403
404 /**
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800405 * @brief Event fired just after forwarding the Interest
406 *
Alexander Afanasyev67f4a4a2012-11-24 17:18:17 -0800407 * @param inFace incoming face of the Interest
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800408 * @param outFace outgoing face of the Interest
409 * @param header parsed Interest header
410 * @param origPacket original Interest packet
411 * @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700412 */
413 virtual void
Alexander Afanasyev67f4a4a2012-11-24 17:18:17 -0800414 DidSendOutInterest (Ptr<Face> inFace,
415 Ptr<Face> outFace,
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700416 Ptr<const InterestHeader> header,
417 Ptr<const Packet> origPacket,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700418 Ptr<pit::Entry> pitEntry);
419
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700420 /**
421 * @brief Wrapper method, which performs general tasks and calls DoPropagateInterest method
422 *
423 * General tasks so far are adding face to the list of incoming face, updating
424 * PIT entry lifetime, calling DoPropagateInterest, and retransmissions (enabled by default).
425 *
426 * @param inFace incoming face
427 * @param header Interest header
428 * @param origPacket original Interest packet
429 * @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
430 *
431 * @see DoPropagateInterest
432 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700433 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700434 PropagateInterest (Ptr<Face> inFace,
435 Ptr<const InterestHeader> header,
436 Ptr<const Packet> origPacket,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700437 Ptr<pit::Entry> pitEntry);
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800438
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700439 /**
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700440 * @brief Virtual method to perform Interest propagation according to the forwarding strategy logic
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700441 *
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700442 * In most cases, this is the call that needs to be implemented/re-implemented in order
443 * to perform forwarding of Interests according to the desired logic.
444 *
445 * There is also PropagateInterest method (generally, do not require to be overriden)
446 * which performs general tasks (adding face to the list of incoming face, updating
447 * PIT entry lifetime, calling DoPropagateInterest, as well as perform retransmissions (enabled by default).
448 *
449 * @param inFace incoming face
450 * @param header Interest header
451 * @param origPacket original Interest packet
452 * @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700453 *
454 * @return true if interest was successfully propagated, false if all options have failed
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700455 *
456 * @see PropagateInterest
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700457 */
458 virtual bool
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700459 DoPropagateInterest (Ptr<Face> inFace,
460 Ptr<const InterestHeader> header,
461 Ptr<const Packet> origPacket,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700462 Ptr<pit::Entry> pitEntry) = 0;
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800463
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700464protected:
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800465 // inherited from Object class
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700466 virtual void NotifyNewAggregate (); ///< @brief Even when object is aggregated to another Object
467 virtual void DoDispose (); ///< @brief Do cleanup
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800468
469protected:
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700470 Ptr<Pit> m_pit; ///< \brief Reference to PIT to which this forwarding strategy is associated
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800471 Ptr<Fib> m_fib; ///< \brief FIB
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700472 Ptr<ContentStore> m_contentStore; ///< \brief Content store (for caching purposes only)
473
474 bool m_cacheUnsolicitedData;
475 bool m_detectRetransmissions;
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800476
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700477 TracedCallback<Ptr<const InterestHeader>,
478 Ptr<const Face> > m_outInterests; ///< @brief Transmitted interests trace
479
480 TracedCallback<Ptr<const InterestHeader>,
481 Ptr<const Face> > m_inInterests; ///< @brief trace of incoming Interests
482
483 TracedCallback<Ptr<const InterestHeader>,
484 Ptr<const Face> > m_dropInterests; ///< @brief trace of dropped Interests
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800485
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700486 ////////////////////////////////////////////////////////////////////
487 ////////////////////////////////////////////////////////////////////
488 ////////////////////////////////////////////////////////////////////
489
490 TracedCallback<Ptr<const ContentObjectHeader>, Ptr<const Packet>,
491 bool /*from cache*/,
492 Ptr<const Face> > m_outData; ///< @brief trace of outgoing Data
493
494 TracedCallback<Ptr<const ContentObjectHeader>, Ptr<const Packet>,
495 Ptr<const Face> > m_inData; ///< @brief trace of incoming Data
496
497 TracedCallback<Ptr<const ContentObjectHeader>, Ptr<const Packet>,
498 Ptr<const Face> > m_dropData; ///< @brief trace of dropped Data
499};
500
501} // namespace ndn
502} // namespace ns3
503
504#endif /* NDN_FORWARDING_STRATEGY_H */