Kea
2.7.6
agent/main.cc
Go to the documentation of this file.
1
// Copyright (C) 2016-2021 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
#include <
agent/ca_controller.h
>
9
#include <
exceptions/exceptions.h
>
10
#include <cstdlib>
11
#include <iostream>
12
13
using namespace
isc::agent
;
14
using namespace
isc::process
;
15
16
int
main
(
int
argc,
char
* argv[]) {
17
int
ret = EXIT_SUCCESS;
18
19
// Launch the controller passing in command line arguments.
20
// Exit program with the controller's return code.
21
try
{
22
// Instantiate/fetch the application controller singleton.
23
DControllerBasePtr
& controller =
CtrlAgentController::instance
();
24
25
// 'false' value disables test mode.
26
ret = controller->launch(argc, argv,
false
);
27
}
catch
(
const
VersionMessage
& ex) {
28
std::string msg(ex.
what
());
29
if
(!msg.empty()) {
30
std::cout << msg << std::endl;
31
}
32
}
catch
(
const
InvalidUsage
& ex) {
33
std::string msg(ex.
what
());
34
if
(!msg.empty()) {
35
std::cerr << msg << std::endl;
36
}
37
ret = EXIT_FAILURE;
38
}
catch
(
const
std::exception& ex) {
39
std::cerr <<
"Service failed: "
<< ex.
what
() << std::endl;
40
ret = EXIT_FAILURE;
41
}
catch
(...) {
42
std::cerr <<
"Service failed"
<< std::endl;
43
ret = EXIT_FAILURE;
44
}
45
46
CtrlAgentController::instance
().reset();
47
48
return
(ret);
49
}
main
int main(int argc, char *argv[])
Definition
agent/main.cc:16
ca_controller.h
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::agent::CtrlAgentController::instance
static process::DControllerBasePtr & instance()
Static singleton instance method.
Definition
ca_controller.cc:30
isc::process::InvalidUsage
Exception thrown when the command line is invalid.
Definition
d_controller.h:30
isc::process::VersionMessage
Exception used to convey version info upwards.
Definition
d_controller.h:41
exceptions.h
isc::agent
Definition
agent_parser.cc:148
isc::process
Definition
cb_ctl_base.h:22
isc::process::DControllerBasePtr
boost::shared_ptr< DControllerBase > DControllerBasePtr
Definition
d_controller.h:78
src
bin
agent
main.cc
Generated on Fri Dec 20 2024 08:29:22 for Kea by
1.12.0