Kea  1.9.9-git
netconf_controller.cc
Go to the documentation of this file.
1 // Copyright (C) 2018-2021 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #include <config.h>
8 
9 #include <cfgrpt/config_report.h>
12 #include <netconf/parser_context.h>
13 #include <signal.h>
14 
15 using namespace isc::process;
16 
17 namespace isc {
18 namespace netconf {
19 
22 const char* NetconfController::netconf_app_name_ = "Netconf";
23 
25 const char* NetconfController::netconf_bin_name_ = "kea-netconf";
26 
28 NetconfController::instance() {
29  // If the instance hasn't been created yet, create it. Note this method
30  // must use the base class singleton instance methods.
31  if (!getController()) {
32  DControllerBasePtr controller_ptr(new NetconfController());
33  setController(controller_ptr);
34  }
35 
36  return (getController());
37 }
38 
39 void
40 NetconfController::processSignal(int signum) {
41  if (signum == SIGHUP) {
43  } else {
45  }
46 }
47 
49 NetconfController::createProcess() {
50  // Instantiate and return an instance of the D2 application process. Note
51  // that the process is passed the controller's io_service.
52  return (new NetconfProcess(getAppName().c_str(), getIOService()));
53 }
54 
56 NetconfController::parseFile(const std::string& name) {
57  ParserContext parser;
58  return (parser.parseFile(name, ParserContext::PARSER_NETCONF));
59 }
60 
61 NetconfController::NetconfController()
62  : DControllerBase(netconf_app_name_, netconf_bin_name_) {
63 }
64 
66 }
67 
70  return (boost::dynamic_pointer_cast<NetconfProcess>(getProcess()));
71 }
72 
73 // Refer to config_report so it will be embedded in the binary.
75 
76 } // namespace isc::netconf
77 } // namespace isc
boost::shared_ptr< DControllerBase > DControllerBasePtr
Definition: d_controller.h:78
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
Definition: macros.h:26
virtual void processSignal(int signum)
Application-level signal processing method.
DProcessBasePtr getProcess()
Fetches the current process.
Definition: d_controller.h:584
isc::log::Logger dctl_logger("dctl")
Defines the logger used within libkea-process library.
Definition: d_log.h:18
const char *const config_report[]
Definition: config_report.h:15
isc::data::ElementPtr parseFile(const std::string &filename, ParserType parser_type)
Run the parser on the file specified.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
Kea Netconf Application Process.
Process Controller for Netconf Process.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Parser context is a wrapper around flex/bison instances dedicated to Netconf-agent config file parser...
boost::shared_ptr< NetconfProcess > NetconfProcessPtr
Defines a shared pointer to NetconfProcess.
Application Process Interface.
Definition: d_process.h:81
Application Controller.
Definition: d_controller.h:104
const char *const * netconf_config_report
NetconfProcessPtr getNetconfProcess()
Returns pointer to an instance of the underlying process object.
virtual ~NetconfController()
Destructor.
const isc::log::MessageID DCTL_UNSUPPORTED_SIGNAL