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
10#include <util/filesystem.h>
12
13#include <cstdlib>
14#include <iostream>
15
16using namespace isc::netconf;
17using namespace isc::process;
18
19using namespace std;
20
21int main(int argc, char* argv[]) {
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.
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
54
55 return (ret);
56}
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
static process::DControllerBasePtr & instance()
Static singleton instance method.
Exception thrown when the command line is invalid.
Exception used to convey version info upwards.
boost::shared_ptr< DControllerBase > DControllerBasePtr
void setUmask()
Set umask (at least 0027 i.e. no group write and no other access).
Definition filesystem.cc:98
int main(int argc, char *argv[])