Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2014 Named Data Networking Project |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #include "strategy.hpp" |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 8 | #include "forwarder.hpp" |
Junxiao Shi | 679e927 | 2014-02-15 20:10:21 -0700 | [diff] [blame] | 9 | #include "core/logger.hpp" |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 10 | |
| 11 | namespace nfd { |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 12 | namespace fw { |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 13 | |
Junxiao Shi | 679e927 | 2014-02-15 20:10:21 -0700 | [diff] [blame] | 14 | NFD_LOG_INIT("Strategy"); |
| 15 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 16 | Strategy::Strategy(Forwarder& forwarder) |
| 17 | : m_forwarder(forwarder) |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 18 | , m_measurements(m_forwarder.getMeasurements(), m_forwarder.getFib(), this) |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 19 | { |
| 20 | } |
| 21 | |
| 22 | Strategy::~Strategy() |
| 23 | { |
| 24 | } |
| 25 | |
Junxiao Shi | 679e927 | 2014-02-15 20:10:21 -0700 | [diff] [blame] | 26 | void |
Junxiao Shi | 22be22c | 2014-02-16 22:53:48 -0700 | [diff] [blame] | 27 | Strategy::beforeSatisfyPendingInterest(shared_ptr<pit::Entry> pitEntry, |
| 28 | const Face& inFace, const Data& data) |
| 29 | { |
| 30 | NFD_LOG_DEBUG("beforeSatisfyPendingInterest pitEntry=" << pitEntry->getName() << |
| 31 | " inFace=" << inFace.getId() << " data=" << data.getName()); |
| 32 | } |
| 33 | |
| 34 | void |
Junxiao Shi | 679e927 | 2014-02-15 20:10:21 -0700 | [diff] [blame] | 35 | Strategy::beforeExpirePendingInterest(shared_ptr<pit::Entry> pitEntry) |
| 36 | { |
| 37 | NFD_LOG_DEBUG("beforeExpirePendingInterest pitEntry=" << pitEntry->getName()); |
| 38 | } |
| 39 | |
Junxiao Shi | 22be22c | 2014-02-16 22:53:48 -0700 | [diff] [blame] | 40 | //void |
| 41 | //Strategy::afterAddFibEntry(shared_ptr<fib::Entry> fibEntry) |
| 42 | //{ |
| 43 | // NFD_LOG_DEBUG("afterAddFibEntry fibEntry=" << fibEntry->getPrefix()); |
| 44 | //} |
| 45 | // |
| 46 | //void |
| 47 | //Strategy::afterUpdateFibEntry(shared_ptr<fib::Entry> fibEntry) |
| 48 | //{ |
| 49 | // NFD_LOG_DEBUG("afterUpdateFibEntry fibEntry=" << fibEntry->getPrefix()); |
| 50 | //} |
| 51 | // |
| 52 | //void |
| 53 | //Strategy::beforeRemoveFibEntry(shared_ptr<fib::Entry> fibEntry) |
| 54 | //{ |
| 55 | // NFD_LOG_DEBUG("beforeRemoveFibEntry fibEntry=" << fibEntry->getPrefix()); |
| 56 | //} |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 57 | |
| 58 | void |
| 59 | Strategy::sendInterest(shared_ptr<pit::Entry> pitEntry, |
| 60 | shared_ptr<Face> outFace) |
| 61 | { |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 62 | m_forwarder.onOutgoingInterest(pitEntry, *outFace); |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | void |
Junxiao Shi | 09498f0 | 2014-02-26 19:41:08 -0700 | [diff] [blame] | 66 | Strategy::rejectPendingInterest(shared_ptr<pit::Entry> pitEntry) |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 67 | { |
Junxiao Shi | 09498f0 | 2014-02-26 19:41:08 -0700 | [diff] [blame] | 68 | m_forwarder.onInterestReject(pitEntry); |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 69 | } |
| 70 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 71 | } // namespace fw |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 72 | } // namespace nfd |