projects
/
metaproxy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implemented FilterLog filter
[metaproxy-moved-to-github.git]
/
src
/
ex_filter_frontend_net.cpp
diff --git
a/src/ex_filter_frontend_net.cpp
b/src/ex_filter_frontend_net.cpp
index
4ae21fa
..
41813af
100644
(file)
--- a/
src/ex_filter_frontend_net.cpp
+++ b/
src/ex_filter_frontend_net.cpp
@@
-9,6
+9,7
@@
namespace po = boost::program_options;
#include "config.hpp"
#include "filter_frontend_net.hpp"
#include "config.hpp"
#include "filter_frontend_net.hpp"
+#include "filter_log.hpp"
#include "router.hpp"
#include "session.hpp"
#include "router.hpp"
#include "session.hpp"
@@
-68,10
+69,15
@@
int main(int argc, char **argv)
("help", "produce help message")
("duration", po::value<int>(),
"number of seconds for server to exist")
("help", "produce help message")
("duration", po::value<int>(),
"number of seconds for server to exist")
+ ("port", po::value< std::vector<std::string> >(), "listener port")
;
;
+ po::positional_options_description p;
+ p.add("port", -1);
+
po::variables_map vm;
po::variables_map vm;
- po::store(po::parse_command_line(argc, argv, desc), vm);
+ po::store(po::command_line_parser(argc, argv).
+ options(desc).positional(p).run(), vm);
po::notify(vm);
if (vm.count("help")) {
po::notify(vm);
if (vm.count("help")) {
@@
-79,21
+85,31
@@
int main(int argc, char **argv)
return 1;
}
return 1;
}
+ if (vm.count("port"))
{
{
+ std::vector<std::string> ports =
+ vm["port"].as< std::vector<std::string> >();
+
+ for (size_t i = 0; i<ports.size(); i++)
+ std::cout << "port " << i << " " << ports[i] << "\n";
+
yp2::RouterChain router;
yp2::RouterChain router;
- // put in frontend first
+ // put frontend filter in router
yp2::FilterFrontendNet filter_front;
yp2::FilterFrontendNet filter_front;
- filter_front.listen_address() = "tcp:@:9999";
+ filter_front.ports() = ports;
// 0=no time, >0 timeout in seconds
if (vm.count("duration")) {
// 0=no time, >0 timeout in seconds
if (vm.count("duration")) {
- filter_front.listen_duration() =
- vm["duration"].as<int>();
+ filter_front.listen_duration() = vm["duration"].as<int>();
}
router.rule(filter_front);
}
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);
FilterInit filter_init;
router.rule(filter_init);