X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Fex_filter_frontend_net.cpp;h=e402e68f5efd96cbd9aa4e9405fd2e6d110a745a;hb=637a685d61a9ff0e3f398a59da426979815c4d68;hp=d7701adfe317ed3149226b2d5b71ab7ccfd05a2f;hpb=b54482cdb759f092fcd07a9be4fdc8c28009b895;p=metaproxy-moved-to-github.git diff --git a/src/ex_filter_frontend_net.cpp b/src/ex_filter_frontend_net.cpp index d7701ad..e402e68 100644 --- a/src/ex_filter_frontend_net.cpp +++ b/src/ex_filter_frontend_net.cpp @@ -1,9 +1,26 @@ -/* $Id: ex_filter_frontend_net.cpp,v 1.14 2005-10-26 18:53:49 adam Exp $ - Copyright (c) 2005, Index Data. +/* $Id: ex_filter_frontend_net.cpp,v 1.30 2007-05-09 21:23:09 adam Exp $ + Copyright (c) 2005-2007, Index Data. -%LICENSE% +This file is part of Metaproxy. + +Metaproxy is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Metaproxy; see the file LICENSE. If not, write to the +Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ +#include "config.hpp" + #include #include #include @@ -11,20 +28,23 @@ #include namespace po = boost::program_options; -#include "config.hpp" +#include "util.hpp" #include "filter_frontend_net.hpp" #include "filter_z3950_client.hpp" #include "filter_virt_db.hpp" +#include "filter_session_shared.hpp" #include "filter_log.hpp" #include "router_chain.hpp" #include "session.hpp" #include "package.hpp" -class HTTPFilter: public yp2::filter::Base { +namespace mp = metaproxy_1; + +class HTTPFilter: public mp::filter::Base { public: - void process(yp2::Package & package) const { + void process(mp::Package & package) const { if (package.session().is_closed()) { // std::cout << "Got Close.\n"; @@ -33,7 +53,7 @@ public: Z_GDU *gdu = package.request().get(); if (gdu && gdu->which == Z_GDU_HTTP_Request) { - ODR odr = odr_createmem(ODR_ENCODE); + mp::odr odr; Z_GDU *gdu = z_get_HTTP_Response(odr, 200); Z_HTTP_Response *http_res = gdu->u.HTTP_Response; @@ -45,7 +65,6 @@ public: http_res->content_len = strlen(http_res->content_buf); package.response() = gdu; - odr_destroy(odr); } return package.move(); }; @@ -84,10 +103,10 @@ int main(int argc, char **argv) for (size_t i = 0; i0 timeout in seconds @@ -97,17 +116,22 @@ int main(int argc, char **argv) router.append(filter_front); // put log filter in router - yp2::filter::Log filter_log_front("FRONT"); + mp::filter::Log filter_log_front("FRONT"); router.append(filter_log_front); // put Virt db filter in router - yp2::filter::Virt_db filter_virt_db; - filter_virt_db.add_map_db2vhost("Default", "indexdata.dk/gils"); - filter_virt_db.add_map_db2vhost("Local", "localhost:9100/Default"); - + mp::filter::VirtualDB filter_virt_db; + filter_virt_db.add_map_db2target("gils", "indexdata.dk/gils", + ""); + filter_virt_db.add_map_db2target("Default", "localhost:9999/Default", + ""); + filter_virt_db.add_map_db2target("2", "localhost:9999/Slow", ""); router.append(filter_virt_db); - yp2::filter::Log filter_log_back("BACK"); + mp::filter::SessionShared filter_session_shared; + //router.append(filter_session_shared); + + mp::filter::Log filter_log_back("BACK"); router.append(filter_log_back); // put HTTP backend filter in router @@ -115,12 +139,12 @@ int main(int argc, char **argv) router.append(filter_init); // put Z39.50 backend filter in router - yp2::filter::Z3950Client z3950_client; + mp::filter::Z3950Client z3950_client; router.append(z3950_client); - yp2::Session session; - yp2::Origin origin; - yp2::Package pack(session, origin); + mp::Session session; + mp::Origin origin; + mp::Package pack(session, origin); pack.router(router).move(); }