+int Yaz_ProxyConfig::check_type_1_attributes(ODR odr, xmlNodePtr ptr,
+ Z_AttributeList *attrs,
+ char **addinfo)
+{
+ for(ptr = ptr->children; ptr; ptr = ptr->next)
+ {
+ if (ptr->type == XML_ELEMENT_NODE &&
+ !strcmp((const char *) ptr->name, "query"))
+ {
+ 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)
+ {
+ for (i = 0; i<attrs->num_attributes; i++)
+ {
+ Z_AttributeElement *el = attrs->attributes[i];
+ char value_str[20];
+
+ value_str[0] = '\0';
+ if (!el->attributeType)
+ continue;
+ int type = *el->attributeType;
+
+ if (strcmp(match_type, "*")) {
+ if (type != atoi(match_type))
+ continue; // no match on type
+ }
+ if (el->which == Z_AttributeValue_numeric &&
+ el->value.numeric)
+ {
+ int value = *el->value.numeric;
+ if (strcmp(match_value, "*")) {
+ if (value != atoi(match_value))
+ continue; // no match on value
+ }
+ sprintf(value_str, "%d", value);
+ }
+ else
+ continue;
+ if (match_error)
+ {
+ if (*value_str)
+ *addinfo = odr_strdup(odr, value_str);
+ return atoi(match_error);
+ }
+ return 0;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+int Yaz_ProxyConfig::check_type_1_structure(ODR odr, xmlNodePtr ptr,
+ Z_RPNStructure *q,
+ char **addinfo)
+{
+ int c;
+ if (q->which == Z_RPNStructure_complex)
+ {
+ int e = check_type_1_structure(odr, ptr, q->u.complex->s1, addinfo);
+ if (e)
+ return e;
+ e = check_type_1_structure(odr, ptr, q->u.complex->s2, addinfo);
+ return e;
+ }
+ else if (q->which == Z_RPNStructure_simple)
+ {
+ if (q->u.simple->which == Z_Operand_APT)
+ {
+ return check_type_1_attributes(
+ odr, ptr, q->u.simple->u.attributesPlusTerm->attributes,
+ addinfo);
+ }
+ }
+ return 0;
+}
+
+int Yaz_ProxyConfig::check_type_1(ODR odr, xmlNodePtr ptr, Z_RPNQuery *query,
+ char **addinfo)
+{
+ // possibly check for Bib-1
+ return check_type_1_structure(odr, ptr, query->RPNStructure, addinfo);
+}
+
+int Yaz_ProxyConfig::check_query(ODR odr, const char *name, Z_Query *query,
+ char **addinfo)