blob: 12db74418f0fae122f794fc4ac2a526d7dc544e6 [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 "best-route-strategy.hpp"
8
9namespace nfd {
10
11BestRouteStrategy::BestRouteStrategy(Forwarder& fw)
12 : Strategy(fw)
13{
14}
15
16BestRouteStrategy::~BestRouteStrategy()
17{
18}
19
20void
21BestRouteStrategy::afterReceiveInterest(const Face& inFace,
22 const Interest& interest,
23 shared_ptr<fib::Entry> fibEntry,
24 shared_ptr<pit::Entry> pitEntry,
25 pit::InRecordCollection::iterator pitInRecord)
26{
27 const fib::NextHopList& nexthops = fibEntry->getNextHops();
28 if (nexthops.size() == 0) {
29 this->rebuffPendingInterest(pitEntry);
30 return;
31 }
32
33 shared_ptr<Face> outFace = nexthops.begin()->getFace();
34 this->sendInterest(pitEntry, outFace);
35}
36
37} // namespace nfd