-/* $Id: filter_session_shared.cpp,v 1.4 2006-01-04 11:55:31 adam Exp $
- Copyright (c) 2005, Index Data.
+/* $Id: filter_session_shared.cpp,v 1.7 2006-03-16 10:40:59 adam Exp $
+ Copyright (c) 2005-2006, Index Data.
%LICENSE%
*/
#include "config.hpp"
#include "filter.hpp"
-#include "router.hpp"
#include "package.hpp"
#include <boost/thread/mutex.hpp>
#include <map>
#include <iostream>
-namespace yf = yp2::filter;
+namespace mp = metaproxy_1;
+namespace yf = mp::filter;
-namespace yp2 {
+namespace metaproxy_1 {
namespace filter {
class SessionShared::Rep {
friend class SessionShared;
void handle_init(Z_InitRequest *req, Package &package);
- void handle_search(Z_SearchRequest *req, Package &package);
+ void handle_search(Z_APDU *req, Package &package);
public:
typedef boost::shared_ptr<SessionShared::List> SharedList;
}
-
-using namespace yp2;
+using namespace mp;
bool yf::SessionShared::InitKey::operator < (const SessionShared::InitKey
&k) const
{
}
-void yf::SessionShared::Rep::handle_search(Z_SearchRequest *req,
- Package &package)
+void yf::SessionShared::Rep::handle_search(Z_APDU *apdu_req,
+ Package &package)
{
yaz_log(YLOG_LOG, "Got search");
+ // Z_SearchRequest *req = apdu_req->u.searchRequest;
+
SessionListMap::iterator it = m_session_list_map.find(package.session());
if (it == m_session_list_map.end())
{
- yp2::odr odr;
- package.response() = odr.create_close(
- Z_Close_protocolError,
- "no session for search request in session_shared");
+ mp::odr odr;
+ package.response() =
+ odr.create_close(apdu_req,
+ Z_Close_protocolError,
+ "no session for search request in session_shared");
package.session().close();
return;
m_p->handle_init(apdu->u.initRequest, package);
break;
case Z_APDU_searchRequest:
- m_p->handle_search(apdu->u.searchRequest, package);
+ m_p->handle_search(apdu, package);
break;
default:
- yp2::odr odr;
- package.response() = odr.create_close(
- Z_Close_protocolError,
- "cannot handle a package of this type");
+ mp::odr odr;
+ package.response() =
+ odr.create_close(apdu, Z_Close_protocolError,
+ "cannot handle a package of this type");
package.session().close();
break;
package.move(); // Not Z39.50 or not Init
}
-static yp2::filter::Base* filter_creator()
+static mp::filter::Base* filter_creator()
{
- return new yp2::filter::SessionShared;
+ return new mp::filter::SessionShared;
}
extern "C" {
- struct yp2_filter_struct yp2_filter_session_shared = {
+ struct metaproxy_1_filter_struct metaproxy_1_filter_session_shared = {
0,
"session_shared",
filter_creator