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>
10#include <util/filesystem.h>
11#include <cstdlib>
12#include <iostream>
13
14using namespace isc::agent;
15using namespace isc::process;
16
17int main(int argc, char* argv[]) {
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.
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
50
51 return (ret);
52}
int main(int argc, char *argv[])
Definition agent/main.cc:17
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