Kea  2.1.7-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 
14 #include <signal.h>
15 
16 using namespace isc::process;
17 
18 namespace isc {
19 namespace netconf {
20 
23 const char* NetconfController::netconf_app_name_ = "Netconf";
24 
26 const char* NetconfController::netconf_bin_name_ = "kea-netconf";
27 
29 NetconfController::instance() {
30  // If the instance hasn't been created yet, create it. Note this method
31  // must use the base class singleton instance methods.
32  if (!getController()) {
33  DControllerBasePtr controller_ptr(new NetconfController());
34  setController(controller_ptr);
35  }
36 
37  return (getController());
38 }
39 
40 void
41 NetconfController::processSignal(int signum) {
42  if (signum == SIGHUP) {
44  } else {
46  }
47 }
48 
50 NetconfController::createProcess() {
51  // Instantiate and return an instance of the D2 application process. Note
52  // that the process is passed the controller's io_service.
53  return (new NetconfProcess(getAppName().c_str(), getIOService()));
54 }
55 
57 NetconfController::parseFile(const std::string& name) {
58  ParserContext parser;
59  return (parser.parseFile(name, ParserContext::PARSER_NETCONF));
60 }
61 
62 NetconfController::NetconfController()
63  : DControllerBase(netconf_app_name_, netconf_bin_name_) {
64 }
65 
67 NetconfController::getNetconfProcess() {
68  return (boost::dynamic_pointer_cast<NetconfProcess>(getProcess()));
69 }
70 
71 // Refer to config_report so it will be embedded in the binary.
73 
74 } // namespace isc::netconf
75 } // 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.
isc::log::Logger dctl_logger("dctl")
Defines the logger used within libkea-process library.
Definition: d_log.h:18
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:27
Kea Netconf Application Process.
Process Controller for Netconf Process.
Defines the logger used by the top-level component of kea-lfc.
const char *const config_report[]
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
const isc::log::MessageID DCTL_UNSUPPORTED_SIGNAL