Files
NFD/daemon/fw/best-route-strategy.cpp
T
Junxiao Shi 8c8d2187b3 fw: integrate forwarder, strategy, tables
refs #1131, #1136

Change-Id: Ica58341cdc1ea1dc421693a87f35fc50177a707d
2014-01-31 00:53:45 -07:00

39 lines
896 B
C++

/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (C) 2014 Named Data Networking Project
* See COPYING for copyright and distribution information.
*/
#include "best-route-strategy.hpp"
namespace nfd {
namespace fw {
BestRouteStrategy::BestRouteStrategy(Forwarder& forwarder)
: Strategy(forwarder)
{
}
BestRouteStrategy::~BestRouteStrategy()
{
}
void
BestRouteStrategy::afterReceiveInterest(const Face& inFace,
const Interest& interest,
shared_ptr<fib::Entry> fibEntry,
shared_ptr<pit::Entry> pitEntry)
{
const fib::NextHopList& nexthops = fibEntry->getNextHops();
if (nexthops.size() == 0) {
this->rebuffPendingInterest(pitEntry);
return;
}
shared_ptr<Face> outFace = nexthops.begin()->getFace();
this->sendInterest(pitEntry, outFace);
}
} // namespace fw
} // namespace nfd