Control the various optimizations with config..
-Control the various logging facilities APDU, etc. in XML configuration.
-
Handle invalidate sessions (-1 hit, control-number search).
Live status (via search, present).
-EXTRA_DIST = config.xml yaz-proxy.sh
+EXTRA_DIST = config.xml voyager.xml yaz-proxy.sh
noinst_SCRIPTS = yaz-proxy.sh
--- /dev/null
+<?xml version="1.0"?>
+<!-- $Id: voyager.xml,v 1.1 2003-10-24 10:21:23 adam Exp $ -->
+<proxy>
+ <!-- define default target and name it voyager -->
+ <target default="1" name="voyager">
+ <!-- all backend addresses as seen from this proxy .. -->
+ <url>z3950.loc.gov:7090</url>
+ <url>z3950.loc.gov:7094</url>
+
+ <!-- set session timeout between proxy and backend target -->
+ <target-timeout>300</target-timeout>
+
+ <!-- set session timeout between client and proxy.
+ Should be lower than target-timeout -->
+ <client-timeout>180</client-timeout>
+
+ <!-- if either bandwidth or pdu limit is reached the session is no
+ longer kept alive -->
+ <keepalive>
+ <bandwidth>500000</bandwidth>
+ <pdu>500</pdu>
+ </keepalive>
+
+ <!-- client limits .. -->
+ <limit>
+ <bandwidth>200000</bandwidth>
+ <pdu>31</pdu>
+ <retrieve>20</retrieve>
+ </limit>
+
+ <!-- use attributes -->
+ <attribute type="1" value="1-11,13-1010,1013-1023,1025-1030"/>
+ <attribute type="1" value="*" error="114"/>
+
+ <!-- relation attributes -->
+ <attribute type="2" value="1,2,3,4,5,6"/>
+ <attribute type="2" value="*" error="117"/>
+
+ <!-- position attributes -->
+ <attribute type="3" value="1,2,3"/>
+ <attribute type="3" value="*" error="119"/>
+
+ <!-- structure attributes -->
+ <attribute type="4" value="1,2,3,4,5,6"/>
+ <attribute type="4" value="*" error="118"/>
+
+ <!-- truncation attributes -->
+ <attribute type="5" value="1,100"/>
+ <attribute type="5" value="*" error="120"/>
+
+ <!-- completeness attributes -->
+ <attribute type="6" value="1,2,3"/>
+ <attribute type="6" value="*" error="122"/>
+
+ <!-- other types -->
+ <attribute type="*" value="*" error="113"/>
+
+ <!-- list allowed record syntaxes; reject all others at the end -->
+ <syntax type="opac"/>
+ <syntax type="usmarc"/>
+ <syntax type="none"/>
+ <syntax type="xml" marcxml="1"/>
+ <syntax type="*" error="238"/>
+
+ <!-- keep this number of spare sessions for future sessions -->
+ <preinit>2</preinit>
+ </target>
+
+ <!-- maximum number of client sessions. Remember to allow for
+ at least max-clients*2+5 sockets. Use 'ulimit -n 1040' on bash -->
+ <max-clients>500</max-clients>
+
+ <!-- what we log. Allowed tokens: client-apdu, server-apdu,
+ client-requests, server-requests -->
+ <log>client-requests server-requests</log>
+</proxy>
+++ /dev/null
-<?xml version="1.0"?>
-<!-- $Id: voyager.xml,v 1.1 2003-10-23 08:46:17 adam Exp $ -->
-<proxy>
- <!-- define default target and name it voyager -->
- <target default="1" name="voyager">
- <!-- all backend addresses as seen from this proxy .. -->
- <url>z3950.loc.gov:7090</url>
- <url>z3950.loc.gov:7094</url>
-
- <!-- set session timeout between proxy and backend target -->
- <target-timeout>300</target-timeout>
-
- <!-- set session timeout between client and proxy.
- Should be lower than target-timeout -->
- <client-timeout>180</client-timeout>
-
- <!-- if either bandwidth or pdu limit is reached the session is no
- longer kept alive -->
- <keepalive>
- <bandwidth>500000</bandwidth>
- <pdu>500</pdu>
- </keepalive>
-
- <!-- client limits .. -->
- <limit>
- <bandwidth>200000</bandwidth>
- <pdu>31</pdu>
- <retrieve>20</retrieve>
- </limit>
-
- <!-- list allowed attributes; reject all others at the end -->
- <attribute type="1" value="1-11,13-1010"/>
- <attribute type="1" value="*" error="114"/>
-
- <!-- list allowed record syntaxes; reject all others at the end -->
- <syntax type="opac"/>
- <syntax type="usmarc"/>
- <syntax type="none"/>
- <syntax type="xml" marcxml="1"/>
- <syntax type="*" error="238"/>
-
- <!-- keep this number of spare sessions for future sessions -->
- <preinit>2</preinit>
- </target>
-
- <!-- maximum number of client sessions. Remember to allow for
- at least max-clients*2+5 sockets. Use 'ulimit -n 1040' on bash -->
- <max-clients>500</max-clients>
-
- <!-- what we log. Allowed tokens: client-apdu, server-apdu,
- client-requests, server-requests -->
- <log>client-requests server-requests</log>
-</proxy>
* Copyright (c) 1998-2003, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-proxy-config.cpp,v 1.12 2003-10-20 18:31:44 adam Exp $
+ * $Id: yaz-proxy-config.cpp,v 1.13 2003-10-24 10:21:24 adam Exp $
*/
#include <ctype.h>
}
#if HAVE_XML2
-int Yaz_ProxyConfig::check_type_1_attributes(ODR odr, xmlNodePtr ptr,
+int Yaz_ProxyConfig::check_type_1_attributes(ODR odr, xmlNodePtr ptrl,
Z_AttributeList *attrs,
char **addinfo)
{
- for(ptr = ptr->children; ptr; ptr = ptr->next)
+ int i;
+ for (i = 0; i<attrs->num_attributes; i++)
{
- if (ptr->type == XML_ELEMENT_NODE &&
- !strcmp((const char *) ptr->name, "attribute"))
+ Z_AttributeElement *el = attrs->attributes[i];
+
+ if (!el->attributeType)
+ continue;
+ int type = *el->attributeType;
+ int *value = 0;
+
+ if (el->which == Z_AttributeValue_numeric && el->value.numeric)
+ value = el->value.numeric;
+
+ xmlNodePtr ptr;
+ for(ptr = ptrl->children; ptr; ptr = ptr->next)
{
- const char *match_type = 0;
- const char *match_value = 0;
- const char *match_error = 0;
- struct _xmlAttr *attr;
- for (attr = ptr->properties; attr; attr = attr->next)
- {
- if (!strcmp((const char *) attr->name, "type") &&
- attr->children && attr->children->type == XML_TEXT_NODE)
- match_type = (const char *) attr->children->content;
- if (!strcmp((const char *) attr->name, "value") &&
- attr->children && attr->children->type == XML_TEXT_NODE)
- match_value = (const char *) attr->children->content;
- if (!strcmp((const char *) attr->name, "error") &&
- attr->children && attr->children->type == XML_TEXT_NODE)
- match_error = (const char *) attr->children->content;
- }
- int i;
-
- if (match_type && match_value)
+ if (ptr->type == XML_ELEMENT_NODE &&
+ !strcmp((const char *) ptr->name, "attribute"))
{
- for (i = 0; i<attrs->num_attributes; i++)
+ const char *match_type = 0;
+ const char *match_value = 0;
+ const char *match_error = 0;
+ struct _xmlAttr *attr;
+ for (attr = ptr->properties; attr; attr = attr->next)
{
- Z_AttributeElement *el = attrs->attributes[i];
- char value_str[20];
-
- value_str[0] = '\0';
- if (!el->attributeType)
- continue;
- int type = *el->attributeType;
-
+ if (!strcmp((const char *) attr->name, "type") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ match_type = (const char *) attr->children->content;
+ if (!strcmp((const char *) attr->name, "value") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ match_value = (const char *) attr->children->content;
+ if (!strcmp((const char *) attr->name, "error") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ match_error = (const char *) attr->children->content;
+ }
+ if (match_type && match_value)
+ {
+ char addinfo_str[20];
if (!match_list(type, match_type))
continue;
- if (el->which == Z_AttributeValue_numeric &&
- el->value.numeric)
+
+ *addinfo_str = '\0';
+ if (!strcmp(match_type, "*"))
+ sprintf (addinfo_str, "%d", type);
+ else if (value)
{
- if (!match_list(*el->value.numeric, match_value))
+ if (!match_list(*value, match_value))
continue;
- sprintf (value_str, "%d", *el->value.numeric);
+ sprintf (addinfo_str, "%d", *value);
}
else
continue;
+
if (match_error)
{
- if (*value_str)
- *addinfo = odr_strdup(odr, value_str);
+ if (*addinfo_str)
+ *addinfo = odr_strdup(odr, addinfo_str);
return atoi(match_error);
}
return 0;