X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ffilter_session_shared.cpp;h=0936bc0f26e9fc85881e584d173c17a1105bae58;hb=63ea8aedbfd7dc56ab28dbc82c38b4458dcecb68;hp=abd22143e8372a26f8f839ced98199ca15809df8;hpb=a7bb1a7f8f0c91fa5bc74f712b3e00cb962a0263;p=metaproxy-moved-to-github.git diff --git a/src/filter_session_shared.cpp b/src/filter_session_shared.cpp index abd2214..0936bc0 100644 --- a/src/filter_session_shared.cpp +++ b/src/filter_session_shared.cpp @@ -1,4 +1,4 @@ -/* $Id: filter_session_shared.cpp,v 1.2 2005-12-02 11:05:08 adam Exp $ +/* $Id: filter_session_shared.cpp,v 1.3 2006-01-04 11:19:04 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -28,32 +28,32 @@ namespace yf = yp2::filter; namespace yp2 { namespace filter { - class Session_shared::Rep { - friend class Session_shared; + class SessionShared::Rep { + friend class SessionShared; void handle_init(Z_InitRequest *req, Package &package); void handle_search(Z_SearchRequest *req, Package &package); public: - typedef boost::shared_ptr SharedList; + typedef boost::shared_ptr SharedList; - typedef std::map InitListMap; + typedef std::map InitListMap; InitListMap m_init_list_map; typedef std::map SessionListMap; SessionListMap m_session_list_map; }; - class Session_shared::InitKey { - friend class Session_shared; - friend class Session_shared::Rep; + class SessionShared::InitKey { + friend class SessionShared; + friend class SessionShared::Rep; std::string m_vhost; std::string m_open; std::string m_user; std::string m_group; std::string m_password; public: - bool operator < (const Session_shared::InitKey &k) const; + bool operator < (const SessionShared::InitKey &k) const; }; - class Session_shared::List { + class SessionShared::List { public: yazpp_1::GDU m_init_response; // init response for backend Session m_session; // session for backend @@ -65,7 +65,7 @@ namespace yp2 { using namespace yp2; -bool yf::Session_shared::InitKey::operator < (const Session_shared::InitKey +bool yf::SessionShared::InitKey::operator < (const SessionShared::InitKey &k) const { if (m_vhost < k.m_vhost) @@ -95,15 +95,15 @@ bool yf::Session_shared::InitKey::operator < (const Session_shared::InitKey return false; } -yf::Session_shared::Session_shared() : m_p(new Rep) +yf::SessionShared::SessionShared() : m_p(new Rep) { } -yf::Session_shared::~Session_shared() +yf::SessionShared::~SessionShared() { } -void yf::Session_shared::Rep::handle_search(Z_SearchRequest *req, +void yf::SessionShared::Rep::handle_search(Z_SearchRequest *req, Package &package) { yaz_log(YLOG_LOG, "Got search"); @@ -129,11 +129,11 @@ void yf::Session_shared::Rep::handle_search(Z_SearchRequest *req, package.response() = search_package.response(); } -void yf::Session_shared::Rep::handle_init(Z_InitRequest *req, Package &package) +void yf::SessionShared::Rep::handle_init(Z_InitRequest *req, Package &package) { yaz_log(YLOG_LOG, "Got init"); - Session_shared::InitKey key; + SessionShared::InitKey key; const char *vhost = yaz_oi_get_string_oidval(&req->otherInfo, VAL_PROXY, 1, 0); if (vhost) @@ -176,7 +176,7 @@ void yf::Session_shared::Rep::handle_init(Z_InitRequest *req, Package &package) yaz_log(YLOG_LOG, "New KEY"); // building new package with original init and new session - SharedList l(new Session_shared::List); // new session for backend + SharedList l(new SessionShared::List); // new session for backend Package init_package(l->m_session, package.origin()); init_package.copy_filter(package); @@ -210,7 +210,7 @@ void yf::Session_shared::Rep::handle_init(Z_InitRequest *req, Package &package) } } -void yf::Session_shared::process(Package &package) const +void yf::SessionShared::process(Package &package) const { // don't tell the backend if the "fronent" filter closes.. // we want to keep them alive @@ -251,6 +251,20 @@ void yf::Session_shared::process(Package &package) const package.move(); // Not Z39.50 or not Init } +static yp2::filter::Base* filter_creator() +{ + return new yp2::filter::SessionShared; +} + +extern "C" { + const struct yp2_filter_struct yp2_filter_session_shared = { + 0, + "session_shared", + filter_creator + }; +} + + /* * Local variables: