From f943413ae943aa332af9cef69e6a148a47639c7c Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 15 May 2013 10:21:50 +0200 Subject: [PATCH] Remove useless examples --- src/ex_filter_frontend_net.cpp | 164 ---------------------------------------- src/ex_router_flexml.cpp | 103 ------------------------- win/makefile | 14 +--- 3 files changed, 1 insertion(+), 280 deletions(-) delete mode 100644 src/ex_filter_frontend_net.cpp delete mode 100644 src/ex_router_flexml.cpp diff --git a/src/ex_filter_frontend_net.cpp b/src/ex_filter_frontend_net.cpp deleted file mode 100644 index f5c16ed..0000000 --- a/src/ex_filter_frontend_net.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* This file is part of Metaproxy. - Copyright (C) 2005-2013 Index Data - -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 this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "config.hpp" - -#include -#include -#include - -#include -#include -#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 - -namespace mp = metaproxy_1; - -class HTTPFilter: public mp::filter::Base { -public: - void process(mp::Package & package) const { - if (package.session().is_closed()) - { - // std::cout << "Got Close.\n"; - } - - Z_GDU *gdu = package.request().get(); - if (gdu && gdu->which == Z_GDU_HTTP_Request) - { - mp::odr odr; - Z_GDU *gdu = z_get_HTTP_Response(odr, 200); - Z_HTTP_Response *http_res = gdu->u.HTTP_Response; - - z_HTTP_header_add(odr, &http_res->headers, - "Content-Type", "text/plain"); - - http_res->content_buf = - odr_strdup(odr, "Welcome to Metaproxy"); - http_res->content_len = strlen(http_res->content_buf); - - package.response() = gdu; - } - return package.move(); - }; - void configure(const xmlNode * ptr, bool test_only, - const char *path) { }; -}; - -int main(int argc, char **argv) -{ - try - { - std::vector ports; - int duration = -1; - int ret; - char *arg; - - while ((ret = options("h{help}d{duration}:p{port}:", - argv, argc, &arg)) != -2) - { - switch(ret) - { - case -1: - std::cerr << "bad option " << arg << std::endl; - case 'h': - std::cerr << "ex_filter_frontend_net\n" - " -h|--help help\n" - " -d|--duration n duration\n" - " -p|--port n port number\n" - << std::endl; - break; - case 'p': - ports.push_back(arg); - break; - case 'd': - duration = atoi(arg); - break; - } - } - { - for (size_t i = 0; i0 timeout in seconds - if (duration != -1) - filter_front.set_listen_duration(duration); - - router.append(filter_front); - - // put log filter in router - mp::filter::Log filter_log_front("FRONT"); - router.append(filter_log_front); - - // put Virt db filter in router - 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); - - 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 - HTTPFilter filter_init; - router.append(filter_init); - - // put Z39.50 backend filter in router - mp::filter::Z3950Client z3950_client; - router.append(z3950_client); - - mp::Session session; - mp::Origin origin; - mp::Package pack(session, origin); - - pack.router(router).move(); - } - } - catch ( ... ) { - std::cerr << "unknown exception\n"; - std::exit(1); - } - std::exit(0); -} - -/* - * Local variables: - * c-basic-offset: 4 - * c-file-style: "Stroustrup" - * indent-tabs-mode: nil - * End: - * vim: shiftwidth=4 tabstop=8 expandtab - */ - diff --git a/src/ex_router_flexml.cpp b/src/ex_router_flexml.cpp deleted file mode 100644 index 7916540..0000000 --- a/src/ex_router_flexml.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* This file is part of Metaproxy. - Copyright (C) 2005-2013 Index Data - -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 this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "config.hpp" - -#include - -#include -#include - -#include -#include -#include "router_flexml.hpp" -#include "factory_static.hpp" - -namespace mp = metaproxy_1; - -int main(int argc, char **argv) -{ - try - { - int ret; - char *arg; - char *fname = 0; - - while ((ret = options("h{help}c{config}:", - argv, argc, &arg)) != -2) - { - switch(ret) - { - case -1: - std::cerr << "bad option " << arg << std::endl; - case 'h': - std::cerr << "ex_router_flexml\n" - " -h|--help help\n" - " -c|--config fname configuation\n" - << std::endl; - std::exit(1); - case 'c': - fname = arg; - } - } - - xmlDocPtr doc = 0; - if (fname) - { - doc = xmlParseFile(fname); - if (!doc) - { - std::cerr << "xmlParseFile failed\n"; - std::exit(1); - } - } - else - { - std::cerr << "No configuration given\n"; - std::exit(1); - } - if (doc) - { - mp::FactoryStatic factory; - mp::RouterFleXML router(doc, factory, false, 0); - - mp::Package pack; - - pack.router(router).move(); - - xmlFreeDoc(doc); - } - } - catch ( ... ) { - std::cerr << "Unknown Exception" << std::endl; - throw; - std::exit(1); - } - std::exit(0); -} - - -/* - * Local variables: - * c-basic-offset: 4 - * c-file-style: "Stroustrup" - * indent-tabs-mode: nil - * End: - * vim: shiftwidth=4 tabstop=8 expandtab - */ - diff --git a/win/makefile b/win/makefile index 7d49c6a..90707dc 100644 --- a/win/makefile +++ b/win/makefile @@ -31,7 +31,7 @@ default: all all: dirs config yaz yazpp libxslt progs -progs: metaproxy ex_filter_frontend_net # test_pipe does not work +progs: metaproxy # test_pipe does not work NSIS="c:\program files\nsis\makensis.exe" nsis: all @@ -62,12 +62,10 @@ TMP=$(TMPDIR) ############### Targets - what to make ########################################################### -EX_FILTER_FRONTEND_NET=$(BINDIR)\ex_filter_frontend_net.exe METAPROXY_PROG=$(BINDIR)\metaproxy.exe TEST_PIPE=$(BINDIR)\test_pipe.exe # shortcut names defined here -ex_filter_frontend_net: $(EX_FILTER_FRONTEND_NET) metaproxy: $(METAPROXY_PROG) test_pipe: $(TEST_PIPE) @@ -255,7 +253,6 @@ PROJECT_DLL_OBJS = \ $(OBJDIR)\util.obj \ $(OBJDIR)\xmlutil.obj -EX_FILTER_FRONTEND_NET_OBJS = $(OBJDIR)\ex_filter_frontend_net.obj METAPROXY_OBJS = $(OBJDIR)\metaproxy_prog.obj TEST_PIPE_OBJS = $(OBJDIR)\test_pipe.obj @@ -295,15 +292,6 @@ $(PROJECT_RES): $(PROJECT_RC) ############### Linking ########################################################### -$(EX_FILTER_FRONTEND_NET) : "$(BINDIR)" $(EX_FILTER_FRONTEND_NET_OBJS) $(PROJECT_DLL_OBJS) - $(LINK) \ - $(LNKOPT) \ - $(PROG_LINK_OPTIONS) \ - $(LINK_LIBS) \ - $(PROJECT_DLL_OBJS) \ - $(EX_FILTER_FRONTEND_NET_OBJS) \ - /out:$(EX_FILTER_FRONTEND_NET) - $(METAPROXY_PROG) : "$(BINDIR)" $(METAPROXY_OBJS) $(PROJECT_DLL_OBJS) $(LINK) \ $(LNKOPT) \ -- 1.7.10.4