blob: 3c40186528c5d7145884c794d317b1bf4d8661d8 [file] [log] [blame]
Junxiao Shi727ed292014-02-19 23:26:45 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Junxiao Shifaf3eb02015-02-16 10:50:36 -07003 * Copyright (c) 2014-2015, Regents of the University of California,
4 * Arizona Board of Regents,
5 * Colorado State University,
6 * University Pierre & Marie Curie, Sorbonne University,
7 * Washington University in St. Louis,
8 * Beijing Institute of Technology,
9 * The University of Memphis.
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -070010 *
11 * This file is part of NFD (Named Data Networking Forwarding Daemon).
12 * See AUTHORS.md for complete list of NFD authors and contributors.
13 *
14 * NFD is free software: you can redistribute it and/or modify it under the terms
15 * of the GNU General Public License as published by the Free Software Foundation,
16 * either version 3 of the License, or (at your option) any later version.
17 *
18 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20 * PURPOSE. See the GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along with
23 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
Junxiao Shie93d6a32014-09-07 16:13:22 -070024 */
Junxiao Shi727ed292014-02-19 23:26:45 -070025
26#include "broadcast-strategy.hpp"
27
28namespace nfd {
29namespace fw {
30
Junxiao Shi67ba8d22015-08-21 21:21:28 -070031NFD_LOG_INIT("BroadcastStrategy");
32
33const Name BroadcastStrategy::STRATEGY_NAME("ndn:/localhost/nfd/strategy/broadcast/%FD%02");
Junxiao Shifaf3eb02015-02-16 10:50:36 -070034NFD_REGISTER_STRATEGY(BroadcastStrategy);
Junxiao Shif3c07812014-03-11 21:48:49 -070035
36BroadcastStrategy::BroadcastStrategy(Forwarder& forwarder, const Name& name)
Junxiao Shi67ba8d22015-08-21 21:21:28 -070037 : MulticastStrategy(forwarder, name)
38 , m_isFirstUse(true)
Junxiao Shi727ed292014-02-19 23:26:45 -070039{
40}
41
42void
43BroadcastStrategy::afterReceiveInterest(const Face& inFace,
44 const Interest& interest,
45 shared_ptr<fib::Entry> fibEntry,
46 shared_ptr<pit::Entry> pitEntry)
47{
Junxiao Shi67ba8d22015-08-21 21:21:28 -070048 if (m_isFirstUse) {
49 NFD_LOG_WARN("The broadcast strategy has been renamed as multicast strategy. "
50 "Use ndn:/localhost/nfd/strategy/multicast to select the multicast strategy.");
51 m_isFirstUse = false;
Junxiao Shi727ed292014-02-19 23:26:45 -070052 }
53
Junxiao Shi67ba8d22015-08-21 21:21:28 -070054 this->MulticastStrategy::afterReceiveInterest(inFace, interest, fibEntry, pitEntry);
Junxiao Shi727ed292014-02-19 23:26:45 -070055}
56
57} // namespace fw
58} // namespace nfd