+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: config.xsd,v 1.21 2006-08-31 14:18:04 marc Exp $ -->
-<!--
- This Schema prescribes the format of YP2 configuration files.
- Invoke it like this:
- xmllint -noout -schema config.xsd config1.xml
- But use double-dashes for the option names instead of single.
- (I couldn't include them literally, as, believe it or not,
- it's an error to include a double dash in an XML comment.
--->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified"
- targetNamespace="http://indexdata.dk/yp2/config/1"
- xmlns:config="http://indexdata.dk/yp2/config/1">
-
- <xs:element name="yp2">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="config:start"/>
- <xs:element minOccurs="0" ref="config:filters"/>
- <xs:element ref="config:routes"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
-
- <xs:element name="start">
- <xs:complexType>
- <!-- Absence of elements listed here mandates that <start> is empty -->
- <xs:attribute name="route" use="required" type="xs:NCName"/>
- </xs:complexType>
- </xs:element>
-
-
- <xs:element name="filters">
- <xs:complexType>
- <xs:sequence>
- <xs:element maxOccurs="unbounded" ref="config:filter"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="filter">
- <xs:complexType>
- <xs:choice>
- <!-- In general, the content depends on the "type" attribute.
- Perhaps the various filter-types' configuration
- structures should each be described by their own little
- subschemas? -->
-
- <!-- type="frontend_net" -->
- <xs:sequence>
- <xs:element minOccurs="0" ref="config:threads"/>
- <xs:element ref="config:port"/>
- </xs:sequence>
-
- <!-- type="z3950_client" -->
- <xs:element ref="config:timeout"/>
-
- <!-- type="log" -->
- <xs:sequence>
- <xs:element minOccurs="0" ref="config:message"/>
- <xs:element minOccurs="0" ref="config:filename"/>
- <xs:element minOccurs="0" name="category">
- <xs:complexType>
- <xs:attribute name="request-session" type="xs:boolean"/>
- <xs:attribute name="response-session" type="xs:boolean"/>
- <xs:attribute name="session" type="xs:boolean"/>
- <xs:attribute name="request-apdu" type="xs:boolean"/>
- <xs:attribute name="response-apdu" type="xs:boolean"/>
- <xs:attribute name="apdu" type="xs:boolean"/>
- <xs:attribute name="init-options" type="xs:boolean"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
-
- <!-- type="virt_db" or type="multi" -->
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="unbounded" ref="config:virtual"/>
- <xs:element minOccurs="0" maxOccurs="1" name="hideunavailable">
- <xs:complexType/>
- </xs:element>
- </xs:sequence>
-
- <!-- type="auth_simple" -->
- <xs:sequence>
- <xs:element minOccurs="0" ref="config:userRegister"/>
- <xs:element minOccurs="0" ref="config:targetRegister"/>
- <xs:element minOccurs="0" name="discardUnauthorisedTargets">
- <xs:complexType/>
- </xs:element>
- </xs:sequence>
-
- <!-- type="backend_test" -->
- <!-- No elements included -->
-
- <!-- type="session_shared" -->
- <xs:sequence>
- <xs:element minOccurs="0" name="resultset">
- <xs:complexType>
- <xs:attribute name="ttl" type="xs:integer"/>
- <xs:attribute name="max" type="xs:integer"/>
- </xs:complexType>
- </xs:element>
- <xs:element minOccurs="0" name="session">
- <xs:complexType>
- <xs:attribute name="ttl" type="xs:integer"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
-
- <!-- type="template" -->
- <!-- No example configuration to deduce from yet -->
-
- <!-- type="http_file" -->
- <xs:sequence>
- <xs:element ref="config:mimetypes"/>
- <xs:element name="area">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="config:documentroot"/>
- <xs:element ref="config:prefix"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
-
- <!-- type="query_rewrite" -->
- <xs:element ref="config:xslt"/>
-
- </xs:choice>
- <xs:attribute name="id" type="xs:NCName"/>
- <xs:attribute name="refid" type="xs:NCName"/>
- <xs:attribute name="type">
- <xs:simpleType>
- <xs:restriction base="xs:NCName">
- <xs:enumeration value="frontend_net"/>
- <xs:enumeration value="z3950_client"/>
- <xs:enumeration value="log"/>
- <xs:enumeration value="virt_db"/>
- <xs:enumeration value="auth_simple"/>
- <xs:enumeration value="backend_test"/>
- <xs:enumeration value="bounce"/>
- <xs:enumeration value="multi"/>
- <xs:enumeration value="session_shared"/>
- <xs:enumeration value="template"/>
- <xs:enumeration value="http_file"/>
- <xs:enumeration value="query_rewrite"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="threads" type="xs:integer"/>
- <xs:element name="port" type="xs:string"/>
- <xs:element name="timeout" type="xs:integer"/>
- <xs:element name="message" type="xs:NCName"/>
- <xs:element name="filename" type="xs:string"/>
- <xs:element name="userRegister" type="xs:string"/>
- <xs:element name="targetRegister" type="xs:string"/>
- <xs:element name="discardUnauthorisedTargets" type="xs:string"/>
- <xs:element name="mimetypes" type="xs:string"/>
- <xs:element name="documentroot" type="xs:string"/>
- <xs:element name="prefix" type="xs:string"/>
- <xs:element name="xslt" type="xs:string"/>
-
- <!-- ### This is used differently depending on whether it occurs
- within a "virt_db" or "multi" filter: for the former, it
- contains one database and one target; for the latter, it
- contains an optional vhost and one or more targets. This
- schema should be tweaked to enforce this. -->
- <xs:element name="virtual">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="0" ref="config:database"/>
- <xs:element minOccurs="0" ref="config:vhost"/>
- <xs:element maxOccurs="unbounded" ref="config:target"/>
- </xs:sequence>
- <xs:attribute name="route" type="xs:NCName"/>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="database" type="xs:NCName"/>
- <xs:element name="vhost" type="xs:NCName"/>
- <xs:element name="target" type="xs:anyURI"/>
-
-
- <xs:element name="routes">
- <xs:complexType>
- <xs:sequence>
- <xs:element minOccurs="1" maxOccurs="unbounded" ref="config:route"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="route">
- <xs:complexType>
- <xs:sequence>
- <xs:element maxOccurs="unbounded" ref="config:filter"/>
- </xs:sequence>
- <xs:attribute name="id" use="required" type="xs:NCName"/>
- </xs:complexType>
- </xs:element>
-</xs:schema>
-/* $Id: filter_frontend_net.cpp,v 1.21 2006-08-30 10:48:52 adam Exp $
+/* $Id: filter_frontend_net.cpp,v 1.22 2006-11-17 14:03:46 adam Exp $
Copyright (c) 2005-2006, Index Data.
See the LICENSE file for details
int m_no_threads;
std::vector<std::string> m_ports;
int m_listen_duration;
+ int m_session_timeout;
};
}
class My_Timer_Thread : public yazpp_1::ISocketObserver {
~ZAssocServer();
ZAssocServer(yazpp_1::IPDU_Observable *PDU_Observable,
mp::ThreadPoolSocketObserver *m_thread_pool_observer,
- const mp::Package *package);
+ const mp::Package *package,
+ int timeout);
private:
yazpp_1::IPDU_Observer* sessionNotify(
yazpp_1::IPDU_Observable *the_PDU_Observable,
private:
mp::ThreadPoolSocketObserver *m_thread_pool_observer;
const mp::Package *m_package;
+ int m_session_timeout;
};
}
}
mp::ZAssocServer::ZAssocServer(yazpp_1::IPDU_Observable *PDU_Observable,
- mp::ThreadPoolSocketObserver *thread_pool_observer,
- const mp::Package *package)
- : Z_Assoc(PDU_Observable)
+ mp::ThreadPoolSocketObserver *thread_pool_observer,
+ const mp::Package *package,
+ int timeout)
+ : Z_Assoc(PDU_Observable), m_session_timeout(timeout)
{
m_thread_pool_observer = thread_pool_observer;
m_package = package;
mp::ZAssocChild *my =
new mp::ZAssocChild(the_PDU_Observable, m_thread_pool_observer,
m_package);
+ my->timeout(m_session_timeout);
return my;
}
{
m_p->m_no_threads = 5;
m_p->m_listen_duration = 0;
+ m_p->m_session_timeout = 300; // 5 minutes
}
mp::filter::FrontendNet::~FrontendNet()
yazpp_1::PDU_Assoc *as = new yazpp_1::PDU_Assoc(&mySocketManager);
// create ZAssoc with PDU Assoc
- az[i] = new mp::ZAssocServer(as, &threadPool, &package);
+ az[i] = new mp::ZAssocServer(as, &threadPool, &package,
+ m_p->m_session_timeout);
az[i]->server(m_p->m_ports[i].c_str());
}
while (mySocketManager.processEvent() > 0)
+ threads_str);
m_p->m_no_threads = threads;
}
+ else if (!strcmp((const char *) ptr->name, "timeout"))
+ {
+ std::string timeout_str = mp::xml::get_text(ptr);
+ int timeout = atoi(timeout_str.c_str());
+ if (timeout < 1)
+ throw mp::filter::FilterException("Bad value for timeout: "
+ + timeout_str);
+ m_p->m_session_timeout = timeout;
+ }
else
{
throw mp::filter::FilterException("Bad element "