Kea
3.1.1
agent/main.cc
Go to the documentation of this file.
1
// Copyright (C) 2016-2025 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 <
util/filesystem.h
>
11
#include <cstdlib>
12
#include <iostream>
13
14
using namespace
isc::agent
;
15
using namespace
isc::process
;
16
17
int
main
(
int
argc,
char
* argv[]) {
18
isc::util::file::setUmask
();
19
20
int
ret = EXIT_SUCCESS;
21
22
// Launch the controller passing in command line arguments.
23
// Exit program with the controller's return code.
24
try
{
25
// Instantiate/fetch the application controller singleton.
26
DControllerBasePtr
& controller =
CtrlAgentController::instance
();
27
28
// 'false' value disables test mode.
29
ret = controller->launch(argc, argv,
false
);
30
}
catch
(
const
VersionMessage
& ex) {
31
std::string msg(ex.
what
());
32
if
(!msg.empty()) {
33
std::cout << msg << std::endl;
34
}
35
}
catch
(
const
InvalidUsage
& ex) {
36
std::string msg(ex.
what
());
37
if
(!msg.empty()) {
38
std::cerr << msg << std::endl;
39
}
40
ret = EXIT_FAILURE;
41
}
catch
(
const
std::exception& ex) {
42
std::cerr <<
"Service failed: "
<< ex.
what
() << std::endl;
43
ret = EXIT_FAILURE;
44
}
catch
(...) {
45
std::cerr <<
"Service failed"
<< std::endl;
46
ret = EXIT_FAILURE;
47
}
48
49
CtrlAgentController::instance
().reset();
50
51
return
(ret);
52
}
main
int main(int argc, char *argv[])
Definition
agent/main.cc:17
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
filesystem.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
isc::util::file::setUmask
void setUmask()
Set umask (at least 0027 i.e. no group write and no other access).
Definition
filesystem.cc:98
src
bin
agent
main.cc
Generated on Fri Aug 29 2025 13:13:08 for Kea by
1.13.2