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