ca_controller.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Copyright (C) 2016-2017 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. #ifndef CTRL_AGENT_CONTROLLER_H
  7. #define CTRL_AGENT_CONTROLLER_H
  8. #include <process/d_controller.h>
  9. namespace isc {
  10. namespace agent {
  11. /// @brief Process Controller for Control Agent Process.
  12. ///
  13. /// This class is the Control Agent specific derivation of the DControllerBase.
  14. /// It creates and manages an instance of the Control Agent application process,
  15. /// CtrlAgentProcess.
  16. class CtrlAgentController : public process::DControllerBase {
  17. public:
  18. /// @brief Static singleton instance method.
  19. ///
  20. /// This method returns the base class singleton instance member.
  21. /// It instantiates the singleton and sets the base class instance
  22. /// member upon first invocation.
  23. ///
  24. /// @return returns the pointer reference to the singleton instance.
  25. static process::DControllerBasePtr& instance();
  26. /// @brief Destructor
  27. virtual ~CtrlAgentController();
  28. /// @brief Defines the application name, this is passed into base class
  29. /// and appears in log statements.
  30. static const char* agent_app_name_;
  31. /// @brief Defines the executable name. This is passed into the base class
  32. /// by convention this should match the executable name.
  33. static const char* agent_bin_name_;
  34. /// @brief Parses the configuration file using Agent::ParserContext (bison)
  35. ///
  36. /// @param name name of the text file to be parsed
  37. /// @return Element tree structure representing parsed configuration
  38. isc::data::ConstElementPtr
  39. parseFile(const std::string& name);
  40. /// @brief Register commands.
  41. void registerCommands();
  42. /// @brief Deregister commands.
  43. void deregisterCommands();
  44. private:
  45. /// @brief Creates an instance of the Control Agent application
  46. /// process.
  47. ///
  48. /// This method is invoked during the process initialization step of
  49. /// the controller launch.
  50. ///
  51. /// @return returns a DProcessBase* to the application process created.
  52. /// Note the caller is responsible for destructing the process. This
  53. /// is handled by the base class, which wraps this pointer with a smart
  54. /// pointer.
  55. virtual process::DProcessBase* createProcess();
  56. /// @brief Constructor is declared private to maintain the integrity of
  57. /// the singleton instance.
  58. CtrlAgentController();
  59. };
  60. // @Defines a shared pointer to CtrlAgentController
  61. typedef boost::shared_ptr<CtrlAgentController> CtrlAgentControllerPtr;
  62. } // namespace isc::agent
  63. } // namespace isc
  64. #endif // CTRL_AGENT_CONTROLLER_H