metaproxy  1.21.0
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
metaproxy_1::filter::SessionShared Class Reference

#include <filter_session_shared.hpp>

Inheritance diagram for metaproxy_1::filter::SessionShared:
Inheritance graph
Collaboration diagram for metaproxy_1::filter::SessionShared:
Collaboration graph

Classes

class  BackendClass
 
class  BackendInstance
 
class  BackendSet
 
struct  Frontend
 
class  FrontendSet
 
class  InitKey
 
class  Rep
 
class  Worker
 

Public Member Functions

 ~SessionShared ()
 
 SessionShared ()
 
void process (metaproxy_1::Package &package) const
 
void configure (const xmlNode *ptr, bool test_only, const char *path)
 
void start () const
 

Private Types

typedef boost::shared_ptr< FrontendFrontendPtr
 
typedef boost::shared_ptr< BackendClassBackendClassPtr
 
typedef boost::shared_ptr< BackendInstanceBackendInstancePtr
 
typedef boost::shared_ptr< BackendSetBackendSetPtr
 
typedef boost::shared_ptr< FrontendSetFrontendSetPtr
 
typedef std::list< std::string > Databases
 
typedef std::list< BackendInstancePtrBackendInstanceList
 
typedef std::map< InitKey, BackendClassPtrBackendClassMap
 
typedef std::list< BackendSetPtrBackendSetList
 
typedef std::map< std::string, FrontendSetPtrFrontendSets
 

Private Attributes

boost::scoped_ptr< Repm_p
 

Detailed Description

Definition at line 30 of file filter_session_shared.hpp.

Member Typedef Documentation

◆ BackendClassMap

Definition at line 48 of file filter_session_shared.hpp.

◆ BackendClassPtr

Definition at line 41 of file filter_session_shared.hpp.

◆ BackendInstanceList

Definition at line 47 of file filter_session_shared.hpp.

◆ BackendInstancePtr

Definition at line 42 of file filter_session_shared.hpp.

◆ BackendSetList

Definition at line 49 of file filter_session_shared.hpp.

◆ BackendSetPtr

Definition at line 43 of file filter_session_shared.hpp.

◆ Databases

typedef std::list<std::string> metaproxy_1::filter::SessionShared::Databases
private

Definition at line 45 of file filter_session_shared.hpp.

◆ FrontendPtr

typedef boost::shared_ptr<Frontend> metaproxy_1::filter::SessionShared::FrontendPtr
private

Definition at line 40 of file filter_session_shared.hpp.

◆ FrontendSetPtr

Definition at line 44 of file filter_session_shared.hpp.

◆ FrontendSets

typedef std::map<std::string, FrontendSetPtr> metaproxy_1::filter::SessionShared::FrontendSets
private

Definition at line 50 of file filter_session_shared.hpp.

Constructor & Destructor Documentation

◆ ~SessionShared()

mp::filter::SessionShared::~SessionShared ( )

Definition at line 1428 of file filter_session_shared.cpp.

1428  {
1429 }

◆ SessionShared()

mp::filter::SessionShared::SessionShared ( )

Definition at line 1424 of file filter_session_shared.cpp.

1424  : m_p(new SessionShared::Rep)
1425 {
1426 }

Member Function Documentation

◆ configure()

void mp::filter::SessionShared::configure ( const xmlNode *  ptr,
bool  test_only,
const char *  path 
)

Definition at line 1552 of file filter_session_shared.cpp.

1554 {
1555  for (ptr = ptr->children; ptr; ptr = ptr->next)
1556  {
1557  if (ptr->type != XML_ELEMENT_NODE)
1558  continue;
1559  if (!strcmp((const char *) ptr->name, "resultset"))
1560  {
1561  const struct _xmlAttr *attr;
1562  for (attr = ptr->properties; attr; attr = attr->next)
1563  {
1564  if (!strcmp((const char *) attr->name, "ttl"))
1565  m_p->m_resultset_ttl =
1566  mp::xml::get_int(attr->children, 30);
1567  else if (!strcmp((const char *) attr->name, "max"))
1568  {
1569  m_p->m_resultset_max =
1570  mp::xml::get_int(attr->children, 10);
1571  }
1572  else if (!strcmp((const char *) attr->name, "optimizesearch"))
1573  {
1574  m_p->m_optimize_search =
1575  mp::xml::get_bool(attr->children, true);
1576  }
1577  else if (!strcmp((const char *) attr->name, "restart"))
1578  {
1579  m_p->m_restart = mp::xml::get_bool(attr->children, true);
1580  }
1581  else
1582  throw mp::filter::FilterException(
1583  "Bad attribute " + std::string((const char *)
1584  attr->name));
1585  }
1586  }
1587  else if (!strcmp((const char *) ptr->name, "session"))
1588  {
1589  const struct _xmlAttr *attr;
1590  for (attr = ptr->properties; attr; attr = attr->next)
1591  {
1592  if (!strcmp((const char *) attr->name, "ttl"))
1593  m_p->m_session_ttl =
1594  mp::xml::get_int(attr->children, 90);
1595  else if (!strcmp((const char *) attr->name, "max"))
1596  m_p->m_session_max =
1597  mp::xml::get_int(attr->children, 100);
1598  else
1599  throw mp::filter::FilterException(
1600  "Bad attribute " + std::string((const char *)
1601  attr->name));
1602  }
1603  }
1604  else if (!strcmp((const char *) ptr->name, "init"))
1605  {
1606  const struct _xmlAttr *attr;
1607  for (attr = ptr->properties; attr; attr = attr->next)
1608  {
1609  if (!strcmp((const char *) attr->name, "maximum-record-size"))
1610  m_p->m_maximumRecordSize =
1611  mp::xml::get_int(attr->children, 0);
1612  else if (!strcmp((const char *) attr->name,
1613  "preferred-message-size"))
1614  m_p->m_preferredMessageSize =
1615  mp::xml::get_int(attr->children, 0);
1616  else if (!strcmp((const char *) attr->name,
1617  "ignore-auth"))
1618  m_p->m_ignore_auth =
1619  mp::xml::get_bool(attr->children, false);
1620  else
1621  throw mp::filter::FilterException(
1622  "Bad attribute " + std::string((const char *)
1623  attr->name));
1624  }
1625  }
1626  else
1627  {
1628  throw mp::filter::FilterException("Bad element "
1629  + std::string((const char *)
1630  ptr->name));
1631  }
1632  }
1633 }

References m_p.

◆ process()

void mp::filter::SessionShared::process ( metaproxy_1::Package &  package) const

Definition at line 1490 of file filter_session_shared.cpp.

1491 {
1492  FrontendPtr f = m_p->get_frontend(package);
1493 
1494  Z_GDU *gdu = package.request().get();
1495 
1496  if (gdu && gdu->which == Z_GDU_Z3950 && gdu->u.z3950->which ==
1497  Z_APDU_initRequest && !f->m_is_virtual)
1498  {
1499  m_p->init(package, gdu, f);
1500  }
1501  else if (!f->m_is_virtual)
1502  package.move();
1503  else if (gdu && gdu->which == Z_GDU_Z3950)
1504  {
1505  Z_APDU *apdu = gdu->u.z3950;
1506  if (apdu->which == Z_APDU_initRequest)
1507  {
1508  mp::odr odr;
1509 
1510  package.response() = odr.create_close(
1511  apdu,
1512  Z_Close_protocolError,
1513  "double init");
1514 
1515  package.session().close();
1516  }
1517  else if (apdu->which == Z_APDU_close)
1518  {
1519  mp::odr odr;
1520 
1521  package.response() = odr.create_close(
1522  apdu,
1523  Z_Close_peerAbort, "received close from client");
1524  package.session().close();
1525  }
1526  else if (apdu->which == Z_APDU_searchRequest)
1527  {
1528  f->search(package, apdu);
1529  }
1530  else if (apdu->which == Z_APDU_presentRequest)
1531  {
1532  f->present(package, apdu);
1533  }
1534  else if (apdu->which == Z_APDU_scanRequest)
1535  {
1536  f->scan(package, apdu);
1537  }
1538  else
1539  {
1540  mp::odr odr;
1541 
1542  package.response() = odr.create_close(
1543  apdu, Z_Close_protocolError,
1544  "unsupported APDU in filter_session_shared");
1545 
1546  package.session().close();
1547  }
1548  }
1549  m_p->release_frontend(package);
1550 }
boost::shared_ptr< Frontend > FrontendPtr

References m_p.

◆ start()

void mp::filter::SessionShared::start ( ) const

Definition at line 1431 of file filter_session_shared.cpp.

1432 {
1433  m_p->start();
1434 }

Member Data Documentation

◆ m_p

boost::scoped_ptr<Rep> metaproxy_1::filter::SessionShared::m_p
private

The documentation for this class was generated from the following files: