Kea  2.5.3
netconf_controller.cc
Go to the documentation of this file.
1 // Copyright (C) 2018-2023 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 
11 #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(string const& 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 
68  return (boost::dynamic_pointer_cast<NetconfProcess>(getProcess()));
69 }
70 
71 } // namespace netconf
72 } // namespace isc
Process Controller for Netconf Process.
NetconfProcessPtr getNetconfProcess()
Returns pointer to an instance of the underlying process object.
Kea Netconf Application Process.
Parser context is a wrapper around flex/bison instances dedicated to Netconf-agent config file parser...
isc::data::ElementPtr parseFile(const std::string &filename, ParserType parser_type)
Run the parser on the file specified.
Application Controller.
Definition: d_controller.h:103
virtual void processSignal(int signum)
Application-level signal processing method.
DProcessBasePtr getProcess()
Fetches the current process.
Definition: d_controller.h:594
Application Process Interface.
Definition: d_process.h:75
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
Definition: macros.h:26
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:29
boost::shared_ptr< NetconfProcess > NetconfProcessPtr
Defines a shared pointer to NetconfProcess.
isc::log::Logger dctl_logger("dctl")
Defines the logger used within libkea-process library.
Definition: d_log.h:18
boost::shared_ptr< DControllerBase > DControllerBasePtr
Definition: d_controller.h:77
const isc::log::MessageID DCTL_UNSUPPORTED_SIGNAL
Defines the logger used by the top-level component of kea-lfc.