Kea 2.5.8
lfc_controller.h
Go to the documentation of this file.
1// Copyright (C) 2015-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#ifndef LFC_CONTROLLER_H
8#define LFC_CONTROLLER_H
9
11#include <string>
12
13namespace isc {
14namespace lfc {
15
18public:
19 InvalidUsage(const char* file, size_t line, const char* what) :
20 isc::Exception(file, line, what) { };
21};
22
26public:
27 RunTimeFail(const char* file, size_t line, const char* what) :
28 isc::Exception(file, line, what) { };
29};
30
38public:
41 static const char* lfc_app_name_;
42
45 static const char* lfc_bin_name_;
46
49
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 }
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
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Exception thrown when the command line is invalid.
InvalidUsage(const char *file, size_t line, const char *what)
Process controller for LFC process.
void fileRotate() const
Rotate files.
void launch(int argc, char *argv[], const bool test_mode)
Acts as the primary entry point to start execution of the process.
int getProtocolVersion() const
Gets the protocol version of the leases files.
LFCController()
Constructor.
std::string getFinishFile() const
Gets the finish file name.
std::string getPidFile() const
Gets the pid file name.
std::string getCopyFile() const
Gets the copy file name.
static const char * lfc_bin_name_
Defines the executable name, by convention this should match the executable name.
void parseArgs(int argc, char *argv[])
Process the command line arguments.
static const char * lfc_app_name_
Defines the application name, it may be used to locate configuration data and appears in log statemen...
std::string getPreviousFile() const
Gets the previous file name.
std::string getOutputFile() const
Gets the output file name.
std::string getConfigFile() const
Gets the config file name.
Exceptions thrown when a method is unable to manipulate (remove or rename) a file.
RunTimeFail(const char *file, size_t line, const char *what)
void usage()
Print Usage.
Defines the logger used by the top-level component of kea-lfc.