Kea: lfc_controller.h Source File

| Kea 3.0.3-git

lfc_controller.h
Go to the documentation of this file.
1// Copyright (C) 2015-2024 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#ifndef LFC_CONTROLLER_H
8#define LFC_CONTROLLER_H
9
10#include <exceptions/exceptions.h>
11#include <string>
12
13namespace isc {
14namespace lfc {
15
17 class InvalidUsage : public isc::Exception {
18public:
19 InvalidUsage(const char* file, size_t line, const char* what) :
20 isc::Exception(file, line, what) { }
21};
22
25 class RunTimeFail : public isc::Exception {
26public:
27 RunTimeFail(const char* file, size_t line, const char* what) :
28 isc::Exception(file, line, what) { }
29};
30
37 class LFCController {
38public:
41 static const char* lfc_app_name_;
42
45 static const char* lfc_bin_name_;
46
48 LFCController();
49
51 ~LFCController();
52
79 void launch(int argc, char* argv[], const bool test_mode);
80
89 void parseArgs(int argc, char* argv[]);
90
98 void fileRotate() const;
99
101
102
108 int getProtocolVersion() const {
109 return (protocol_version_);
110 }
111
115 std::string getConfigFile() const {
116 return (config_file_);
117 }
118
122 std::string getPreviousFile() const {
123 return (previous_file_);
124 }
125
129 std::string getCopyFile() const {
130 return (copy_file_);
131 }
132
136 std::string getOutputFile() const {
137 return (output_file_);
138 }
139
143 std::string getFinishFile() const {
144 return (finish_file_);
145 }
146
150 std::string getPidFile() const {
151 return (pid_file_);
152 }
153
154
155private:
157 int protocol_version_;
159 bool verbose_;
160 std::string config_file_;
161 std::string previous_file_;
162 std::string copy_file_;
163 std::string output_file_;
164 std::string finish_file_;
165 std::string pid_file_;
166
171 void usage(const std::string& text);
172
177 std::string getVersion(const bool extended) const;
178
190 template<typename LeaseObjectType, typename LeaseFileType, typename StorageType>
191 void processLeases() const;
192
197 void startLogger(const bool test_mode) const;
198};
199
200} // namespace isc::lfc
201} // namespace isc
202
203#endif // LFC_CONTROLLER_H
isc::Exception
This is a base class for exceptions thrown from the DNS library module.
Definition exceptions/exceptions.h:23
isc::Exception::Exception
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
Definition exceptions/exceptions.cc:17
isc::Exception::what
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Definition exceptions/exceptions.cc:32
isc::lfc::InvalidUsage::InvalidUsage
InvalidUsage(const char *file, size_t line, const char *what)
Definition lfc_controller.h:19
isc::lfc::LFCController::fileRotate
void fileRotate() const
Rotate files.
Definition lfc_controller.cc:385
isc::lfc::LFCController::launch
void launch(int argc, char *argv[], const bool test_mode)
Acts as the primary entry point to start execution of the process.
Definition lfc_controller.cc:59
isc::lfc::LFCController::getProtocolVersion
int getProtocolVersion() const
Gets the protocol version of the leases files.
Definition lfc_controller.h:108
isc::lfc::LFCController::LFCController
LFCController()
Constructor.
Definition lfc_controller.cc:50
isc::lfc::LFCController::getFinishFile
std::string getFinishFile() const
Gets the finish file name.
Definition lfc_controller.h:143
isc::lfc::LFCController::getPidFile
std::string getPidFile() const
Gets the pid file name.
Definition lfc_controller.h:150
isc::lfc::LFCController::~LFCController
~LFCController()
Destructor.
Definition lfc_controller.cc:55
isc::lfc::LFCController::getCopyFile
std::string getCopyFile() const
Gets the copy file name.
Definition lfc_controller.h:129
isc::lfc::LFCController::lfc_bin_name_
static const char * lfc_bin_name_
Defines the executable name, by convention this should match the executable name.
Definition lfc_controller.h:45
isc::lfc::LFCController::parseArgs
void parseArgs(int argc, char *argv[])
Process the command line arguments.
Definition lfc_controller.cc:146
isc::lfc::LFCController::lfc_app_name_
static const char * lfc_app_name_
Defines the application name, it may be used to locate configuration data and appears in log statemen...
Definition lfc_controller.h:41
isc::lfc::LFCController::getPreviousFile
std::string getPreviousFile() const
Gets the previous file name.
Definition lfc_controller.h:122
isc::lfc::LFCController::getOutputFile
std::string getOutputFile() const
Gets the output file name.
Definition lfc_controller.h:136
isc::lfc::LFCController::getConfigFile
std::string getConfigFile() const
Gets the config file name.
Definition lfc_controller.h:115
isc::lfc::RunTimeFail::RunTimeFail
RunTimeFail(const char *file, size_t line, const char *what)
Definition lfc_controller.h:27
exceptions.h
usage
void usage()
Print Usage.
Definition log/compiler/message.cc:76
isc::lfc
Definition lfc_controller.cc:41
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148