1 /* This file is part of Metaproxy.
2 Copyright (C) 2005-2011 Index Data
4 Metaproxy is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include "filter_bounce.hpp"
20 #include <metaproxy/package.hpp>
21 #include <metaproxy/util.hpp>
22 #include "gduutil.hpp"
28 namespace yf = mp::filter;
30 namespace metaproxy_1 {
39 yf::Bounce::Bounce() : m_p(new Rep)
45 { // must have a destructor because of boost::scoped_ptr
48 void yf::Bounce::process(mp::Package &package) const
55 package.session().close();
57 Z_GDU *zgdu = package.request().get();
62 //std::string message("BOUNCE ");
63 std::ostringstream message;
64 message << "BOUNCE " << *zgdu;
68 if (zgdu->which == Z_GDU_Z3950)
71 apdu_res = odr.create_close(zgdu->u.z3950,
72 Z_Close_systemProblem,
73 message.str().c_str());
74 package.response() = apdu_res;
76 else if (zgdu->which == Z_GDU_HTTP_Request)
80 = odr.create_HTTP_Response(package.session(),
81 zgdu->u.HTTP_Request, 400);
83 package.response() = zgdu_res;
85 else if (zgdu->which == Z_GDU_HTTP_Response)
93 void mp::filter::Bounce::configure(const xmlNode * ptr, bool test_only,
96 mp::xml::check_empty(ptr);
99 static mp::filter::Base* filter_creator()
101 return new mp::filter::Bounce;
105 struct metaproxy_1_filter_struct metaproxy_1_filter_bounce = {
116 * c-file-style: "Stroustrup"
117 * indent-tabs-mode: nil
119 * vim: shiftwidth=4 tabstop=8 expandtab