141{
  142  std::string server("localhost");
  143  std::string logger("localhost");
  144  std::string client_name("MonRouter");
  146  int port = 0;
  147 
  148  po::options_description desc("Options");
  149  desc.add_options()
  150      ("help,h", "Print this help and exit.")
  151      ("version,v", "Print the version and exit.")
  152      (
  153          ",H"
  154        , po::value<std::string>(&server)->default_value(server)
  155        , "Set the address of the SM server."
  156      )
  157      (
  158          ",M"
  159        , po::value<std::string>(&logger)->default_value(logger)
  160        , "Set the address of the logger server."
  161      )
  162      (
  163          ",u"
  164        , po::value<std::string>(&client_name)->default_value(client_name)
  165        , "Set the address of the client name."
  166      )
  167      (
  168          ",P"
  169        , po::value<int>(&port)->required()
  170        , "Set the UDP port to read data from"
  171      )
  172      (
  173          ",d"
  174        , po::value<int>(&
debug)->default_value(
debug)
 
  175        , "Set the debug level."
  176      );
  177 
  178  try {
  179    po::variables_map vm;
  180    po::store(
  181        po::command_line_parser(argc, argv).options(desc).run(),
  182        vm
  183    );
  184 
  185    if (vm.count("help")) {
  186      std::cout << desc << std::endl;
  187      return EXIT_SUCCESS;
  188    }
  189 
  190    if (vm.count("version")) {
  191      std::cout << monrouter::version::v() << std::endl;
  192      return EXIT_SUCCESS;
  193    }
  194 
  195    po::notify(vm);
  196  } catch (const po::error& e) {
  197    std::cerr << "MonRouter: Error: " << e.what() << '\n'
  198              << desc << std::endl;
  199    return EXIT_FAILURE;
  200  } catch (const std::runtime_error& e) {
  201    std::cerr << "MonRouter: Error: " << e.what() << '\n'
  202              << desc << std::endl;
  203    return EXIT_FAILURE;
  204  }
  205 
  206  
  208 
  210 
  211  router.enter();
  212  router.run();
  213}
Message logging based on ControlHost.