Kea 2.7.4
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>
10#include <cstdlib>
11#include <iostream>
12
13using namespace isc::agent;
14using namespace isc::process;
15
16int 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.
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
47
48 return (ret);
49}
int main(int argc, char *argv[])
Definition agent/main.cc:16
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