X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ffilter_backend_test.cpp;h=3e964070facc1f63d9f1dfa7dac1c289e8eb9bee;hb=4bfec20c393570a81471c644fad6268eed3dba29;hp=57f6b391bccce008cba449e14237f6513a687f84;hpb=637a685d61a9ff0e3f398a59da426979815c4d68;p=metaproxy-moved-to-github.git diff --git a/src/filter_backend_test.cpp b/src/filter_backend_test.cpp index 57f6b39..3e96407 100644 --- a/src/filter_backend_test.cpp +++ b/src/filter_backend_test.cpp @@ -1,7 +1,5 @@ -/* $Id: filter_backend_test.cpp,v 1.26 2007-05-09 21:23:09 adam Exp $ - Copyright (c) 2005-2007, Index Data. - -This file is part of Metaproxy. +/* This file is part of Metaproxy. + Copyright (C) 2005-2011 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 @@ -14,16 +12,15 @@ 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. - */ +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 "filter.hpp" -#include "package.hpp" -#include "util.hpp" +#include +#include +#include #include "filter_backend_test.hpp" #include @@ -47,6 +44,8 @@ namespace metaproxy_1 { namespace filter { class Session_info { int dummy; + public: + Session_info() { dummy = 0; }; }; class BackendTest::Rep { friend class BackendTest; @@ -235,7 +234,7 @@ void yf::BackendTest::process(Package &package) const Z_InitRequest *req = apdu_req->u.initRequest; Z_InitResponse *resp = apdu_res->u.initResponse; - resp->implementationName = "backend_test"; + resp->implementationName = odr_strdup(odr, "backend_test"); if (ODR_MASK_GET(req->options, Z_Options_namedResultSets)) m_p->m_support_named_result_sets = true; @@ -259,6 +258,9 @@ void yf::BackendTest::process(Package &package) const else break; + *resp->preferredMessageSize = *req->preferredMessageSize; + *resp->maximumRecordSize = *req->maximumRecordSize; + Session_info info; m_p->m_sessions.create(info, package.session()); } @@ -280,13 +282,11 @@ void yf::BackendTest::process(Package &package) const int next_position = 0; int error_code = 0; std::string addinfo; + const char *element_set_name = 0; - int number = 0; - mp::util::piggyback(*req->smallSetUpperBound, - *req->largeSetLowerBound, - *req->mediumSetPresentNumber, - result_set_size, - number); + Odr_int number = 0; + mp::util::piggyback_sr(req, result_set_size, + number, &element_set_name); if (number) { // not a large set for sure @@ -369,6 +369,12 @@ void yf::BackendTest::process(Package &package) const *resp->nextResultSetPosition = next_position; } } + else if (apdu_req->which == Z_APDU_close) + { + apdu_res = odr.create_close(apdu_req, + Z_Close_finished, 0); + package.session().close(); + } else { apdu_res = odr.create_close(apdu_req, @@ -383,6 +389,12 @@ void yf::BackendTest::process(Package &package) const m_p->m_sessions.release(package.session()); } +void mp::filter::BackendTest::configure(const xmlNode * ptr, bool test_only, + const char *path) +{ + mp::xml::check_empty(ptr); +} + static mp::filter::Base* filter_creator() { return new mp::filter::BackendTest; @@ -400,8 +412,9 @@ extern "C" { /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil - * c-file-style: "stroustrup" * End: * vim: shiftwidth=4 tabstop=8 expandtab */ +