Kea  2.5.3
netconf/main.cc
Go to the documentation of this file.
1 // Copyright (C) 2018-2022 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 
11 
12 #include <cstdlib>
13 #include <iostream>
14 
15 using namespace isc::netconf;
16 using namespace isc::process;
17 
18 using namespace std;
19 
20 int main(int argc, char* argv[]) {
21  int ret = EXIT_SUCCESS;
22 
23  // Launch the controller passing in command line arguments.
24  // Exit program with the controller's return code.
25  try {
26  // Instantiate/fetch the application controller singleton.
28 
29  // 'false' value disables test mode.
30  controller->launch(argc, argv, false);
31  } catch (const VersionMessage& ex) {
32  string msg(ex.what());
33  if (!msg.empty()) {
34  cout << msg << endl;
35  }
36  } catch (const InvalidUsage& ex) {
37  string msg(ex.what());
38  if (!msg.empty()) {
39  cerr << msg << endl;
40  }
41  ret = EXIT_FAILURE;
42  } catch (exception const& ex) {
43  cerr << "Service failed: " << ex.what() << endl;
44  ret = EXIT_FAILURE;
45  } catch (...) {
46  cerr << "Service failed" << endl;
47  ret = EXIT_FAILURE;
48  }
49 
51 
52  return (ret);
53 }
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.
Definition: d_controller.h:30
Exception used to convey version info upwards.
Definition: d_controller.h:41
boost::shared_ptr< DControllerBase > DControllerBasePtr
Definition: d_controller.h:77
int main(int argc, char *argv[])
Definition: netconf/main.cc:20