nfd-rib-command-processor.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2025, The University of Memphis,
4  * 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/>.
20  */
21 
23 
24 #include <ndn-cxx/mgmt/nfd/control-command.hpp>
25 
26 namespace nlsr::update {
27 
28 NfdRibCommandProcessor::NfdRibCommandProcessor(ndn::mgmt::Dispatcher& dispatcher,
29  NamePrefixList& namePrefixList,
30  Lsdb& lsdb)
31  : CommandProcessor(dispatcher, namePrefixList, lsdb)
32 {
33  m_dispatcher.addControlCommand<ndn::nfd::RibRegisterCommand>(
34  ndn::mgmt::makeAcceptAllAuthorization(),
35  // the first and second arguments are ignored since the handler does not need them
36  std::bind(&NfdRibCommandProcessor::advertiseAndInsertPrefix, this, _3, _4));
37 
38  m_dispatcher.addControlCommand<ndn::nfd::RibUnregisterCommand>(
39  ndn::mgmt::makeAcceptAllAuthorization(),
40  // the first and second arguments are ignored since the handler does not need them
41  std::bind(&NfdRibCommandProcessor::withdrawAndRemovePrefix, this, _3, _4));
42 }
43 
44 } // namespace nlsr::update
ndn::mgmt::Dispatcher & m_dispatcher
void advertiseAndInsertPrefix(const ndn::mgmt::ControlParametersBase &parameters, const ndn::mgmt::CommandContinuation &done)
Add desired name prefix to the advertised name prefix list or insert a prefix into the FIB if paramet...
void withdrawAndRemovePrefix(const ndn::mgmt::ControlParametersBase &parameters, const ndn::mgmt::CommandContinuation &done)
Remove desired name prefix from the advertised name prefix list or remove a prefix from the FIB if pa...
NfdRibCommandProcessor(ndn::mgmt::Dispatcher &dispatcher, NamePrefixList &namePrefixList, Lsdb &lsdb)