Kea  1.5.0
netconf_controller.cc
Go to the documentation of this file.
1 // Copyright (C) 2018 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>
12 
13 using namespace isc::process;
14 
15 namespace isc {
16 namespace netconf {
17 
20 const char* NetconfController::netconf_app_name_ = "Netconf";
21 
23 const char* NetconfController::netconf_bin_name_ = "kea-netconf";
24 
26 NetconfController::instance() {
27  // If the instance hasn't been created yet, create it. Note this method
28  // must use the base class singleton instance methods.
29  if (!getController()) {
30  DControllerBasePtr controller_ptr(new NetconfController());
31  setController(controller_ptr);
32  }
33 
34  return (getController());
35 }
36 
37 void
38 NetconfController::processSignal(int signum) {
39  if (signum == SIGHUP) {
40  LOG_WARN(dctl_logger, DCTL_UNSUPPORTED_SIGNAL).arg(signum);
41  } else {
43  }
44 }
45 
47 NetconfController::createProcess() {
48  // Instantiate and return an instance of the D2 application process. Note
49  // that the process is passed the controller's io_service.
50  return (new NetconfProcess(getAppName().c_str(), getIOService()));
51 }
52 
54 NetconfController::parseFile(const std::string& name) {
55  ParserContext parser;
56  return (parser.parseFile(name, ParserContext::PARSER_NETCONF));
57 }
58 
59 NetconfController::NetconfController()
60  : DControllerBase(netconf_app_name_, netconf_bin_name_) {
61 }
62 
64 }
65 
68  return (boost::dynamic_pointer_cast<NetconfProcess>(getProcess()));
69 }
70 
71 } // namespace isc::netconf
72 } // namespace isc
isc::netconf::NetconfProcessPtr
boost::shared_ptr< NetconfProcess > NetconfProcessPtr
Defines a shared pointer to NetconfProcess.
Definition: netconf_process.h:103
parser_context.h
isc::process::DControllerBase
Application Controller.
Definition: d_controller.h:104
isc::netconf::NetconfController::getNetconfProcess
NetconfProcessPtr getNetconfProcess()
Returns pointer to an instance of the underlying process object.
Definition: netconf_controller.cc:67
isc::netconf::ParserContext
Parser context is a wrapper around flex/bison instances dedicated to Netconf-agent config file parser...
Definition: netconf/parser_context.h:38
netconf_process.h
isc::process::DControllerBase::getProcess
DProcessBasePtr getProcess()
Fetches the current process.
Definition: d_controller.h:565
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::process::DControllerBasePtr
boost::shared_ptr< DControllerBase > DControllerBasePtr
Definition: d_controller.h:78
isc::process::DProcessBase
Application Process Interface.
Definition: d_process.h:67
LOG_WARN
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
Definition: macros.h:26
isc::netconf::NetconfController
Process Controller for Netconf Process.
Definition: netconf_controller.h:21
isc::process::DControllerBase::processSignal
virtual void processSignal(int signum)
Application-level signal processing method.
Definition: d_controller.cc:619
isc::process
Definition: config_base.cc:16
isc::process::dctl_logger
isc::log::Logger dctl_logger("dctl")
Defines the logger used within libkea-process library.
Definition: d_log.h:18
isc::netconf::NetconfProcess
Kea Netconf Application Process.
Definition: netconf_process.h:24
netconf_controller.h
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
isc::netconf::NetconfController::~NetconfController
virtual ~NetconfController()
Destructor.
Definition: netconf_controller.cc:63
isc::netconf::ParserContext::parseFile
isc::data::ElementPtr parseFile(const std::string &filename, ParserType parser_type)
Run the parser on the file specified.
Definition: netconf/parser_context.cc:37