blob: 21f9a7b4222708d981efe22a754411558da97d5e [file] [log] [blame]
Nick Gordon4d2c6c02017-01-20 13:18:46 -06001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Davide Pesaventod90338d2021-01-07 17:50:05 -05002/*
Davide Pesavento384327d2025-01-02 01:40:23 -05003 * Copyright (c) 2014-2025, The University of Memphis,
Nick Gordon4d2c6c02017-01-20 13:18:46 -06004 * Regents of the University of California,
5 * Arizona Board of Regents.
6 *
7 * This file is part of NLSR (Named-data Link State Routing).
8 * See AUTHORS.md for complete list of NLSR authors and contributors.
9 *
10 * NLSR is free software: you can redistribute it and/or modify it under the terms
11 * of the GNU General Public License as published by the Free Software Foundation,
12 * either version 3 of the License, or (at your option) any later version.
13 *
14 * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 * PURPOSE. See the GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along with
19 * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
Davide Pesaventod90338d2021-01-07 17:50:05 -050020 */
Nick Gordon4d2c6c02017-01-20 13:18:46 -060021
22#include "nfd-rib-command-processor.hpp"
Nick Gordon4d2c6c02017-01-20 13:18:46 -060023
Davide Pesavento20e60a22025-01-07 01:50:10 -050024#include <ndn-cxx/mgmt/nfd/control-command.hpp>
25
Davide Pesavento384327d2025-01-02 01:40:23 -050026namespace nlsr::update {
Nick Gordon4d2c6c02017-01-20 13:18:46 -060027
Nick Gordon4d2c6c02017-01-20 13:18:46 -060028NfdRibCommandProcessor::NfdRibCommandProcessor(ndn::mgmt::Dispatcher& dispatcher,
Laqin Fan54a43f02017-03-08 12:31:30 -060029 NamePrefixList& namePrefixList,
Ashlesh Gawande3e105a02017-05-16 17:36:56 -050030 Lsdb& lsdb)
Davide Pesavento20e60a22025-01-07 01:50:10 -050031 : CommandProcessor(dispatcher, namePrefixList, lsdb)
Nick Gordon4d2c6c02017-01-20 13:18:46 -060032{
Davide Pesavento968eb1a2025-01-07 00:46:05 -050033 m_dispatcher.addControlCommand<ndn::nfd::RibRegisterCommand>(
Laqin Fan54a43f02017-03-08 12:31:30 -060034 ndn::mgmt::makeAcceptAllAuthorization(),
Davide Pesavento20e60a22025-01-07 01:50:10 -050035 // the first and second arguments are ignored since the handler does not need them
Davide Pesavento968eb1a2025-01-07 00:46:05 -050036 std::bind(&NfdRibCommandProcessor::advertiseAndInsertPrefix, this, _3, _4));
Nick Gordon4d2c6c02017-01-20 13:18:46 -060037
Davide Pesavento968eb1a2025-01-07 00:46:05 -050038 m_dispatcher.addControlCommand<ndn::nfd::RibUnregisterCommand>(
Laqin Fan54a43f02017-03-08 12:31:30 -060039 ndn::mgmt::makeAcceptAllAuthorization(),
Davide Pesavento20e60a22025-01-07 01:50:10 -050040 // the first and second arguments are ignored since the handler does not need them
Davide Pesavento968eb1a2025-01-07 00:46:05 -050041 std::bind(&NfdRibCommandProcessor::withdrawAndRemovePrefix, this, _3, _4));
Nick Gordon4d2c6c02017-01-20 13:18:46 -060042}
43
Davide Pesavento384327d2025-01-02 01:40:23 -050044} // namespace nlsr::update