1 /* $Id: filter_bounce.cpp,v 1.3 2007-03-20 07:17:40 adam Exp $
2 Copyright (c) 2005-2007, Index Data.
4 See the LICENSE file for details
7 #include "filter_bounce.hpp"
10 #include "gduutil.hpp"
16 //#include "config.hpp"
17 //#include "filter.hpp"
19 //#include <boost/thread/mutex.hpp>
25 namespace mp = metaproxy_1;
26 namespace yf = mp::filter;
28 namespace metaproxy_1 {
37 yf::Bounce::Bounce() : m_p(new Rep)
43 { // must have a destructor because of boost::scoped_ptr
46 void yf::Bounce::process(mp::Package &package) const
53 package.session().close();
55 Z_GDU *zgdu = package.request().get();
60 //std::string message("BOUNCE ");
61 std::ostringstream message;
62 message << "BOUNCE " << *zgdu;
66 if (zgdu->which == Z_GDU_Z3950)
69 apdu_res = odr.create_close(zgdu->u.z3950,
70 Z_Close_systemProblem,
71 message.str().c_str());
72 package.response() = apdu_res;
74 else if (zgdu->which == Z_GDU_HTTP_Request)
78 = odr.create_HTTP_Response(package.session(),
79 zgdu->u.HTTP_Request, 400);
81 package.response() = zgdu_res;
83 else if (zgdu->which == Z_GDU_HTTP_Response)
91 static mp::filter::Base* filter_creator()
93 return new mp::filter::Bounce;
97 struct metaproxy_1_filter_struct metaproxy_1_filter_bounce = {
108 * indent-tabs-mode: nil
109 * c-file-style: "stroustrup"
111 * vim: shiftwidth=4 tabstop=8 expandtab