From f6379872ace49628473c47d23b29e9f46b5afbe4 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 6 Dec 2006 11:12:14 +0000 Subject: [PATCH] Fixed bug #722: Allow Z39.50 Init Options to be specified / retrieved. Client code may now interrogate options such as "init_opt_sort" to find out whether the server claims to support various options. --- NEWS | 4 ++++ doc/zoom.xml | 8 +++++++- src/zoom-c.c | 18 ++++++++++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index e64545b..d494fd0 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,10 @@ impatient clients. Fixed bug #740: Handle SRU records referring to xmlns's outside recordData. +Fixed bug #722: Allow Z39.50 Init Options to be specified / retrieved. +Client code may now interrogate options such as "init_opt_sort" to +find out whether the server claims to support various options. + --- 2.1.40 2006/11/27 Added utilities yaz_{set,get}_esn to set/get element set name from diff --git a/doc/zoom.xml b/doc/zoom.xml index 0085b3d..0d0bac2 100644 --- a/doc/zoom.xml +++ b/doc/zoom.xml @@ -20,7 +20,7 @@ ZOOM_options_set_int(opt, name, value) ZOOM_connection_scan1 (ZOOM_connection c, ZOOM_query startterm) ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn) --> - + ZOOM &zoom; is an acronym for 'Z39.50 Object-Orientation Model' and is @@ -257,6 +257,12 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn) mediumSetElementSetName The element set name to be for medium-sized result sets. none + + init_opt_search, init_opt_present, init_opt_delSet, etc. + After a successful Init, these options may be interrogated to + discover whether the server claims to support the specified + operations. + none diff --git a/src/zoom-c.c b/src/zoom-c.c index 61e08a8..65d14ab 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2006, Index Data ApS * See the file LICENSE for details. * - * $Id: zoom-c.c,v 1.100 2006-11-30 17:07:50 mike Exp $ + * $Id: zoom-c.c,v 1.101 2006-12-06 11:12:14 mike Exp $ */ /** * \file zoom-c.c @@ -1276,7 +1276,7 @@ static zoom_ret ZOOM_connection_send_init(ZOOM_connection c) odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName)); - version = odr_strdup(c->odr_out, "$Revision: 1.100 $"); + version = odr_strdup(c->odr_out, "$Revision: 1.101 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; ireq->implementationVersion = @@ -3436,6 +3436,16 @@ static void interpret_otherinformation_field(ZOOM_connection c, } } + +static void set_init_option(const char *name, void *clientData) { + ZOOM_connection c = clientData; + char buf[80]; + + sprintf(buf, "init_opt_%.70s", name); + ZOOM_connection_option_set(c, buf, "1"); +} + + static void recv_apdu(ZOOM_connection c, Z_APDU *apdu) { Z_InitResponse *initrs; @@ -3466,6 +3476,10 @@ static void recv_apdu(ZOOM_connection c, Z_APDU *apdu) ZOOM_connection_option_set(c, "targetImplementationVersion", initrs->implementationVersion ? initrs->implementationVersion : ""); + + /* Make initrs->options available as ZOOM-level options */ + yaz_init_opt_decode(initrs->options, set_init_option, (void*) c); + if (!*initrs->result) { Z_External *uif = initrs->userInformationField; -- 1.7.10.4