X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Fex_filter_frontend_net.cpp;h=4ae21fa50a0778cc1be4ea1acef8828ec4b75fb7;hb=fb02f5d8ceb8c0062dd976626c8517f7d78280ea;hp=f8cbf5ae40452510a92423beb5b74b2a1bc577c9;hpb=bb5caa9f44b4e94c814a214881d42bff4a2be027;p=metaproxy-moved-to-github.git diff --git a/src/ex_filter_frontend_net.cpp b/src/ex_filter_frontend_net.cpp index f8cbf5a..4ae21fa 100644 --- a/src/ex_filter_frontend_net.cpp +++ b/src/ex_filter_frontend_net.cpp @@ -3,6 +3,9 @@ #include #include +#include +namespace po = boost::program_options; + #include "config.hpp" #include "filter_frontend_net.hpp" @@ -51,7 +54,7 @@ public: break; } odr_destroy(odr); - } + } return package.move(); }; }; @@ -60,6 +63,22 @@ int main(int argc, char **argv) { try { + po::options_description desc("Allowed options"); + desc.add_options() + ("help", "produce help message") + ("duration", po::value(), + "number of seconds for server to exist") + ; + + po::variables_map vm; + po::store(po::parse_command_line(argc, argv, desc), vm); + po::notify(vm); + + if (vm.count("help")) { + std::cout << desc << "\n"; + return 1; + } + { yp2::RouterChain router; @@ -68,7 +87,10 @@ int main(int argc, char **argv) filter_front.listen_address() = "tcp:@:9999"; // 0=no time, >0 timeout in seconds - filter_front.listen_duration() = 0; + if (vm.count("duration")) { + filter_front.listen_duration() = + vm["duration"].as(); + } router.rule(filter_front); // put in a backend @@ -86,6 +108,7 @@ int main(int argc, char **argv) std::cerr << "unknown exception\n"; std::exit(1); } + std::exit(0); } /*