main.cc 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #include <config.h>
  15. #include <d2/d2_log.h>
  16. #include <d2/d2_controller.h>
  17. #include <exceptions/exceptions.h>
  18. #include <log/logger_support.h>
  19. #include <log/logger_manager.h>
  20. #include <iostream>
  21. using namespace isc::d2;
  22. using namespace std;
  23. /// This file contains entry point (main() function) for standard DHCP-DDNS
  24. /// process, b10-dhcp-ddns, component for BIND10 framework. It fetches
  25. /// the D2Controller singleton instance and invokes its launch method.
  26. /// The exit value of the program will be EXIT_SUCCESS if there were no
  27. /// errors, EXIT_FAILURE otherwise.
  28. int main(int argc, char* argv[]) {
  29. int ret = EXIT_SUCCESS;
  30. // Instantiate/fetch the DHCP-DDNS application controller singleton.
  31. DControllerBasePtr& controller = D2Controller::instance();
  32. // Launch the controller passing in command line arguments.
  33. // Exit program with the controller's return code.
  34. try {
  35. // 'false' value disables test mode.
  36. controller->launch(argc, argv, false);
  37. } catch (const isc::Exception& ex) {
  38. std::cerr << "Service failed:" << ex.what() << std::endl;
  39. ret = EXIT_FAILURE;
  40. }
  41. return (ret);
  42. }