blob: fbb2b4af859df94d78294714b8969e8c2c117630 [file] [log] [blame]
Junxiao Shid3c792f2014-01-30 00:46:13 -07001/* -*- 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 Shi8c8d2182014-01-30 22:33:00 -07008#include "forwarder.hpp"
Junxiao Shi679e9272014-02-15 20:10:21 -07009#include "core/logger.hpp"
Junxiao Shid3c792f2014-01-30 00:46:13 -070010
11namespace nfd {
Junxiao Shi8c8d2182014-01-30 22:33:00 -070012namespace fw {
Junxiao Shid3c792f2014-01-30 00:46:13 -070013
Junxiao Shi679e9272014-02-15 20:10:21 -070014NFD_LOG_INIT("Strategy");
15
Junxiao Shibb5105f2014-03-03 12:06:45 -070016Strategy::Strategy(Forwarder& forwarder, const Name& name)
17 : m_name(name)
18 , m_forwarder(forwarder)
Junxiao Shidbe71732014-02-21 22:23:28 -070019 , m_measurements(m_forwarder.getMeasurements(), m_forwarder.getFib(), this)
Junxiao Shid3c792f2014-01-30 00:46:13 -070020{
21}
22
23Strategy::~Strategy()
24{
25}
26
Junxiao Shi679e9272014-02-15 20:10:21 -070027void
Junxiao Shi22be22c2014-02-16 22:53:48 -070028Strategy::beforeSatisfyPendingInterest(shared_ptr<pit::Entry> pitEntry,
29 const Face& inFace, const Data& data)
30{
31 NFD_LOG_DEBUG("beforeSatisfyPendingInterest pitEntry=" << pitEntry->getName() <<
32 " inFace=" << inFace.getId() << " data=" << data.getName());
33}
34
35void
Junxiao Shi679e9272014-02-15 20:10:21 -070036Strategy::beforeExpirePendingInterest(shared_ptr<pit::Entry> pitEntry)
37{
38 NFD_LOG_DEBUG("beforeExpirePendingInterest pitEntry=" << pitEntry->getName());
39}
40
Junxiao Shi22be22c2014-02-16 22:53:48 -070041//void
42//Strategy::afterAddFibEntry(shared_ptr<fib::Entry> fibEntry)
43//{
44// NFD_LOG_DEBUG("afterAddFibEntry fibEntry=" << fibEntry->getPrefix());
45//}
46//
47//void
48//Strategy::afterUpdateFibEntry(shared_ptr<fib::Entry> fibEntry)
49//{
50// NFD_LOG_DEBUG("afterUpdateFibEntry fibEntry=" << fibEntry->getPrefix());
51//}
52//
53//void
54//Strategy::beforeRemoveFibEntry(shared_ptr<fib::Entry> fibEntry)
55//{
56// NFD_LOG_DEBUG("beforeRemoveFibEntry fibEntry=" << fibEntry->getPrefix());
57//}
Junxiao Shid3c792f2014-01-30 00:46:13 -070058
59void
60Strategy::sendInterest(shared_ptr<pit::Entry> pitEntry,
61 shared_ptr<Face> outFace)
62{
Junxiao Shi8c8d2182014-01-30 22:33:00 -070063 m_forwarder.onOutgoingInterest(pitEntry, *outFace);
Junxiao Shid3c792f2014-01-30 00:46:13 -070064}
65
66void
Junxiao Shi09498f02014-02-26 19:41:08 -070067Strategy::rejectPendingInterest(shared_ptr<pit::Entry> pitEntry)
Junxiao Shid3c792f2014-01-30 00:46:13 -070068{
Junxiao Shi09498f02014-02-26 19:41:08 -070069 m_forwarder.onInterestReject(pitEntry);
Junxiao Shid3c792f2014-01-30 00:46:13 -070070}
71
Junxiao Shi8c8d2182014-01-30 22:33:00 -070072} // namespace fw
Junxiao Shid3c792f2014-01-30 00:46:13 -070073} // namespace nfd