X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=src%2Fex_filter_frontend_net.cpp;h=41813aff3257cddd939386d03d072ae4f57c2e4f;hb=a27375762602ee41a01282b59aae617c0764b38b;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..41813af 100644 --- a/src/ex_filter_frontend_net.cpp +++ b/src/ex_filter_frontend_net.cpp @@ -3,9 +3,13 @@ #include #include +#include +namespace po = boost::program_options; + #include "config.hpp" #include "filter_frontend_net.hpp" +#include "filter_log.hpp" #include "router.hpp" #include "session.hpp" @@ -51,7 +55,7 @@ public: break; } odr_destroy(odr); - } + } return package.move(); }; }; @@ -60,18 +64,52 @@ 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") + ("port", po::value< std::vector >(), "listener port") + ; + + po::positional_options_description p; + p.add("port", -1); + + po::variables_map vm; + po::store(po::command_line_parser(argc, argv). + options(desc).positional(p).run(), vm); + po::notify(vm); + + if (vm.count("help")) { + std::cout << desc << "\n"; + return 1; + } + + if (vm.count("port")) { + std::vector ports = + vm["port"].as< std::vector >(); + + for (size_t i = 0; i0 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 + // put log filter in router + yp2::FilterLog filter_log; + router.rule(filter_log); + + // put backend init filter in router FilterInit filter_init; router.rule(filter_init); @@ -86,6 +124,7 @@ int main(int argc, char **argv) std::cerr << "unknown exception\n"; std::exit(1); } + std::exit(0); } /*