blob: 49b034b110cb4df878fd74bc590506919439f53b [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;
Alexander Afanasyev73f06f62013-03-15 15:41:38 -070033
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070034class Interest;
35class ContentObject;
Alexander Afanasyev73f06f62013-03-15 15:41:38 -070036
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070037class Pit;
38namespace pit { class Entry; }
39class FibFaceMetric;
40class Fib;
Alexander Afanasyevadcccf42012-11-26 23:55:34 -080041namespace fib { class Entry; }
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070042class ContentStore;
43
44/**
45 * \ingroup ndn
46 * \brief Abstract base class for Ndn forwarding strategies
47 */
48class ForwardingStrategy :
49 public Object
50{
51public:
Alexander Afanasyevb989b122013-07-10 17:15:46 -070052 static TypeId GetTypeId ();
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070053
54 /**
Alexander Afanasyev042b4a72012-11-09 17:47:48 -080055 * @brief Helper function to retrieve logging name for the forwarding strategy
56 */
57 static std::string GetLogName ();
58
59 /**
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070060 * @brief Default constructor
61 */
62 ForwardingStrategy ();
63 virtual ~ForwardingStrategy ();
64
65 /**
66 * \brief Actual processing of incoming Ndn interests. Note, interests do not have payload
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -080067 *
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070068 * Processing Interest packets
Alexander Afanasyevb989b122013-07-10 17:15:46 -070069 * @param face incoming face
70 * @param interest Interest packet
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070071 */
72 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070073 OnInterest (Ptr<Face> face,
Alexander Afanasyevb989b122013-07-10 17:15:46 -070074 Ptr<Interest> interest);
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
Alexander Afanasyevb989b122013-07-10 17:15:46 -070081 * @param data Data packet
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070082 */
83 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070084 OnData (Ptr<Face> face,
Alexander Afanasyevb989b122013-07-10 17:15:46 -070085 Ptr<ContentObject> data);
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070086
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070087 /**
88 * @brief Event fired just before PIT entry is removed by timeout
89 * @param pitEntry PIT entry to be removed
90 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070091 virtual void
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070092 WillEraseTimedOutPendingInterest (Ptr<pit::Entry> pitEntry);
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070093
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070094 /**
Alexander Afanasyevf5c07742012-10-31 13:13:05 -070095 * @brief Event fired every time face is added to NDN stack
96 * @param face face to be removed
97 */
98 virtual void
99 AddFace (Ptr<Face> face);
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800100
Alexander Afanasyevf5c07742012-10-31 13:13:05 -0700101 /**
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -0700102 * @brief Event fired every time face is removed from NDN stack
103 * @param face face to be removed
104 *
105 * For example, when an application terminates, AppFace is removed and this method called by NDN stack.
106 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700107 virtual void
108 RemoveFace (Ptr<Face> face);
Alexander Afanasyevadcccf42012-11-26 23:55:34 -0800109
110 /**
111 * @brief Event fired every time a FIB entry is added to FIB
112 * @param fibEntry FIB entry that was added
113 */
114 virtual void
115 DidAddFibEntry (Ptr<fib::Entry> fibEntry);
116
117 /**
118 * @brief Fired just before FIB entry will be removed from FIB
119 * @param fibEntry FIB entry that will be removed
120 */
121 virtual void
122 WillRemoveFibEntry (Ptr<fib::Entry> fibEntry);
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800123
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700124protected:
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700125 /**
126 * @brief An event that is fired every time a new PIT entry is created
127 *
128 * Note that if NDN node is receiving a similar interest (interest for the same name),
129 * then either DidReceiveDuplicateInterest, DidSuppressSimilarInterest, or DidForwardSimilarInterest
130 * will be called
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800131 *
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700132 * Suppression of similar Interests is controlled using ShouldSuppressIncomingInterest virtual method
133 *
134 * @param inFace incoming face
135 * @param header deserialized Interest header
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700136 * @param pitEntry created PIT entry (incoming and outgoing face sets are empty)
137 *
138 * @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
139 */
140 virtual void
141 DidCreatePitEntry (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700142 Ptr<const Interest> interest,
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700143 Ptr<pit::Entry> pitEntry);
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800144
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700145 /**
146 * @brief An event that is fired every time a new PIT entry cannot be created (e.g., PIT container imposes a limit)
147 *
148 * Note that this call can be called only for non-similar Interest (i.e., there is an attempt to create a new PIT entry).
149 * For any non-similar Interests, either FailedToCreatePitEntry or DidCreatePitEntry is called.
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800150 *
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700151 * @param inFace incoming face
152 * @param interest Interest packet
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700153 */
154 virtual void
155 FailedToCreatePitEntry (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700156 Ptr<const Interest> interest);
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800157
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700158 /**
159 * @brief An event that is fired every time a duplicated Interest is received
160 *
161 * This even is the last action that is performed before the Interest processing is halted
162 *
163 * @param inFace incoming face
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700164 * @param interest Interest packet
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700165 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
166 *
167 * @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
168 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700169 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700170 DidReceiveDuplicateInterest (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700171 Ptr<const Interest> interest,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700172 Ptr<pit::Entry> pitEntry);
173
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700174 /**
175 * @brief An event that is fired every time when a similar Interest is received and suppressed (collapsed)
176 *
177 * This even is the last action that is performed before the Interest processing is halted
178 *
179 * @param inFace incoming face
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700180 * @param interest Interest packet
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700181 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
182 *
183 * @see DidReceiveDuplicateInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest
184 */
185 virtual void
186 DidSuppressSimilarInterest (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700187 Ptr<const Interest> interest,
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700188 Ptr<pit::Entry> pitEntry);
189
190 /**
191 * @brief An event that is fired every time when a similar Interest is received and further forwarded (not suppressed/collapsed)
192 *
193 * This even is fired just before handling the Interest to PropagateInterest method
194 *
195 * @param inFace incoming face
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700196 * @param interest Interest packet
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700197 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
198 *
199 * @see DidReceiveDuplicateInterest, DidSuppressSimilarInterest, ShouldSuppressIncomingInterest
200 */
201 virtual void
202 DidForwardSimilarInterest (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700203 Ptr<const Interest> interest,
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700204 Ptr<pit::Entry> pitEntry);
205
206 /**
207 * @brief An even that is fired when Interest cannot be forwarded
208 *
209 * Note that the event will not fire if retransmission detection is enabled (by default)
210 * and retransmitted Interest cannot by forwarded. For more details, refer to the implementation.
211 *
212 * @param inFace incoming face
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700213 * @param interest Interest header
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700214 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
215 *
216 * @see DetectRetransmittedInterest
217 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700218 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700219 DidExhaustForwardingOptions (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700220 Ptr<const Interest> interest,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700221 Ptr<pit::Entry> pitEntry);
222
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800223 /**
224 * @brief Method that implements logic to distinguish between new and retransmitted interest
225 *
226 * This method is called only when DetectRetransmissions attribute is set true (by default).
227 *
228 * Currently, the retransmission detection logic relies on the fact that list of incoming faces
229 * already has inFace (i.e., a similar interest is received on the same face more than once).
230 *
231 * @param inFace incoming face
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700232 * @param interest Interest header
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800233 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
234 * @return true if Interest should be considered as retransmitted
235 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700236 virtual bool
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700237 DetectRetransmittedInterest (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700238 Ptr<const Interest> interest,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700239 Ptr<pit::Entry> pitEntry);
240
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800241 /**
242 * @brief Even fired just before Interest will be satisfied
243 *
244 * Note that when Interest is satisfied from the cache, incoming face will be 0
245 *
246 * @param inFace incoming face
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800247 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800248 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700249 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700250 WillSatisfyPendingInterest (Ptr<Face> inFace,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700251 Ptr<pit::Entry> pitEntry);
252
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800253 /**
254 * @brief Actual procedure to satisfy Interest
255 *
256 * Note that when Interest is satisfied from the cache, incoming face will be 0
257 *
258 * @param inFace incoming face
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700259 * @param data Data packet
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800260 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
261 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700262 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700263 SatisfyPendingInterest (Ptr<Face> inFace, // 0 allowed (from cache)
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700264 Ptr<const ContentObject> data,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700265 Ptr<pit::Entry> pitEntry);
266
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800267 /**
268 * @brief Event which is fired just after data was send out on the face
269 *
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700270 * @param inFace incoming face of the ContentObject
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800271 * @param outFace outgoing face
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700272 * @param data Data packet
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800273 * @param pitEntry an existing PIT entry, corresponding to the duplicated Interest
274 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700275 virtual void
Alexander Afanasyev67f4a4a2012-11-24 17:18:17 -0800276 DidSendOutData (Ptr<Face> inFace,
277 Ptr<Face> outFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700278 Ptr<const ContentObject> data,
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700279 Ptr<pit::Entry> pitEntry);
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800280
281 /**
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800282 * @brief Event which is fired every time a requested (solicited) DATA packet (there is an active PIT entry) is received
283 *
284 * @param inFace incoming face
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700285 * @param data Data packet
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800286 * @param didCreateCacheEntry flag indicating whether a cache entry was added for this data packet or not (e.g., packet already exists in cache)
287 */
288 virtual void
289 DidReceiveSolicitedData (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700290 Ptr<const ContentObject> data,
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800291 bool didCreateCacheEntry);
292
293 /**
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800294 * @brief Event which is fired every time an unsolicited DATA packet (no active PIT entry) is received
295 *
296 * The current implementation allows ignoring unsolicited DATA (by default), or cache it by setting
297 * attribute CacheUnsolicitedData true
298 *
299 * @param inFace incoming face
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700300 * @param data Data packet
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800301 * @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 -0800302 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700303 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700304 DidReceiveUnsolicitedData (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700305 Ptr<const ContentObject> data,
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800306 bool didCreateCacheEntry);
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800307
308 /**
309 * @brief Method implementing logic to suppress (collapse) similar Interests
310 *
311 * In the base class implementation this method checks list of incoming/outgoing faces of the PIT entry
312 * (for new Intersets, both lists are empty before this call)
313 *
314 * For more details, refer to the source code.
315 *
316 * @param inFace incoming face
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700317 * @param interest Interest packet
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800318 * @param payload ContentObject payload
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800319 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700320 virtual bool
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700321 ShouldSuppressIncomingInterest (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700322 Ptr<const Interest> interest,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700323 Ptr<pit::Entry> pitEntry);
324
325 /**
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800326 * @brief Method to check whether Interest can be send out on the particular face or not
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700327 *
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800328 * In the base class, this method perfoms two checks:
329 * 1. If inFace is equal to outFace (when equal, Interest forwarding is prohibited)
330 * 2. Whether Interest should be suppressed (list of outgoing faces include outFace),
331 * considering (if enabled) retransmission logic
332 *
333 * @param inFace incoming face of the Interest
334 * @param outFace proposed outgoing face of the Interest
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700335 * @param interest Interest packet
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800336 * @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
337 *
338 * @see DetectRetransmittedInterest
339 */
340 virtual bool
341 CanSendOutInterest (Ptr<Face> inFace,
342 Ptr<Face> outFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700343 Ptr<const Interest> interest,
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800344 Ptr<pit::Entry> pitEntry);
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800345
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800346 /**
347 * @brief Method implementing actual interest forwarding, taking into account CanSendOutInterest decision
348 *
349 * If event returns false, then there is some kind of a problem exists
350 *
351 * @param inFace incoming face of the Interest
352 * @param outFace proposed outgoing face of the Interest
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700353 * @param interest Interest packet
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800354 * @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
355 *
356 * @see CanSendOutInterest
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700357 */
358 virtual bool
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700359 TrySendOutInterest (Ptr<Face> inFace,
360 Ptr<Face> outFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700361 Ptr<const Interest> interest,
Alexander Afanasyev5db92172012-08-21 16:52:07 -0700362 Ptr<pit::Entry> pitEntry);
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700363
364 /**
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800365 * @brief Event fired just after forwarding the Interest
366 *
Alexander Afanasyev67f4a4a2012-11-24 17:18:17 -0800367 * @param inFace incoming face of the Interest
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800368 * @param outFace outgoing face of the Interest
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700369 * @param interest Interest packet
Alexander Afanasyevdb15acb2012-11-09 14:16:27 -0800370 * @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700371 */
372 virtual void
Alexander Afanasyev67f4a4a2012-11-24 17:18:17 -0800373 DidSendOutInterest (Ptr<Face> inFace,
374 Ptr<Face> outFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700375 Ptr<const Interest> interest,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700376 Ptr<pit::Entry> pitEntry);
377
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700378 /**
379 * @brief Wrapper method, which performs general tasks and calls DoPropagateInterest method
380 *
381 * General tasks so far are adding face to the list of incoming face, updating
382 * PIT entry lifetime, calling DoPropagateInterest, and retransmissions (enabled by default).
383 *
384 * @param inFace incoming face
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700385 * @param interest Interest packet
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700386 * @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
387 *
388 * @see DoPropagateInterest
389 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700390 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700391 PropagateInterest (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700392 Ptr<const Interest> interest,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700393 Ptr<pit::Entry> pitEntry);
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800394
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700395 /**
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700396 * @brief Virtual method to perform Interest propagation according to the forwarding strategy logic
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700397 *
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700398 * In most cases, this is the call that needs to be implemented/re-implemented in order
399 * to perform forwarding of Interests according to the desired logic.
400 *
401 * There is also PropagateInterest method (generally, do not require to be overriden)
402 * which performs general tasks (adding face to the list of incoming face, updating
403 * PIT entry lifetime, calling DoPropagateInterest, as well as perform retransmissions (enabled by default).
404 *
405 * @param inFace incoming face
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700406 * @param interest Interest packet
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700407 * @param pitEntry reference to PIT entry (reference to corresponding FIB entry inside)
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700408 *
409 * @return true if interest was successfully propagated, false if all options have failed
Alexander Afanasyev6466fff2012-10-24 22:51:57 -0700410 *
411 * @see PropagateInterest
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700412 */
413 virtual bool
Alexander Afanasyev31cb4692012-08-17 13:08:20 -0700414 DoPropagateInterest (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700415 Ptr<const Interest> interest,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700416 Ptr<pit::Entry> pitEntry) = 0;
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800417
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700418protected:
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800419 // inherited from Object class
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700420 virtual void NotifyNewAggregate (); ///< @brief Even when object is aggregated to another Object
421 virtual void DoDispose (); ///< @brief Do cleanup
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800422
423protected:
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700424 Ptr<Pit> m_pit; ///< \brief Reference to PIT to which this forwarding strategy is associated
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800425 Ptr<Fib> m_fib; ///< \brief FIB
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700426 Ptr<ContentStore> m_contentStore; ///< \brief Content store (for caching purposes only)
427
Alexander Afanasyevdd9fa4f2013-05-15 16:35:04 -0700428 bool m_cacheUnsolicitedDataFromApps;
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700429 bool m_cacheUnsolicitedData;
430 bool m_detectRetransmissions;
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800431
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700432 TracedCallback<Ptr<const Interest>,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700433 Ptr<const Face> > m_outInterests; ///< @brief Transmitted interests trace
434
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700435 TracedCallback<Ptr<const Interest>,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700436 Ptr<const Face> > m_inInterests; ///< @brief trace of incoming Interests
437
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700438 TracedCallback<Ptr<const Interest>,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700439 Ptr<const Face> > m_dropInterests; ///< @brief trace of dropped Interests
Alexander Afanasyeve6c07b52013-02-12 11:05:14 -0800440
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700441 ////////////////////////////////////////////////////////////////////
442 ////////////////////////////////////////////////////////////////////
443 ////////////////////////////////////////////////////////////////////
444
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700445 TracedCallback<Ptr<const ContentObject>,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700446 bool /*from cache*/,
447 Ptr<const Face> > m_outData; ///< @brief trace of outgoing Data
448
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700449 TracedCallback<Ptr<const ContentObject>,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700450 Ptr<const Face> > m_inData; ///< @brief trace of incoming Data
451
Alexander Afanasyevb989b122013-07-10 17:15:46 -0700452 TracedCallback<Ptr<const ContentObject>,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700453 Ptr<const Face> > m_dropData; ///< @brief trace of dropped Data
Alexander Afanasyev37b84c52013-04-26 13:38:52 -0700454
455 ////////////////////////////////////////////////////////////////////
456 ////////////////////////////////////////////////////////////////////
457 ////////////////////////////////////////////////////////////////////
458
459 TracedCallback< Ptr<const pit::Entry> > m_satisfiedInterests;
460 TracedCallback< Ptr<const pit::Entry> > m_timedOutInterests;
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700461};
462
463} // namespace ndn
464} // namespace ns3
465
466#endif /* NDN_FORWARDING_STRATEGY_H */