Added member named_result_sets for init handler struct for the GFS.
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 29 Jan 2009 09:09:57 +0000 (10:09 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 29 Jan 2009 09:09:57 +0000 (10:09 +0100)
This allows a server to disable named result sets. Until now
all negoation was handled exclusively by the GFS(server) and the
client. The server implementation had no way to tell the system
that it does not handle named result sets.

NEWS
doc/frontend.xml
include/yaz/backend.h
src/seshigh.c

diff --git a/NEWS b/NEWS
index a0f3264..8329188 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+Added member named_result_sets for init handler struct for the GFS. This
+allows a server to disable named result sets.
+
 --- 3.0.41 2008/12/29
 
 Fixed Fixed test that makes VERSION_SHA1 appear on dist versions too.
 --- 3.0.41 2008/12/29
 
 Fixed Fixed test that makes VERSION_SHA1 appear on dist versions too.
index fe1bd27..c22e915 100644 (file)
@@ -409,6 +409,8 @@ typedef struct bend_initrequest
     /** \brief SRU record update handler */
     int (*bend_srw_update)(void *handle, bend_update_rr *rr);
 
     /** \brief SRU record update handler */
     int (*bend_srw_update)(void *handle, bend_update_rr *rr);
 
+    /** \brief whether named result sets are supported (0=disable, 1=enable) */
+    int named_result_sets;
 } bend_initrequest;
 
 typedef struct bend_initresult
 } bend_initrequest;
 
 typedef struct bend_initresult
index c1ed03c..2cf6fa2 100644 (file)
@@ -308,6 +308,8 @@ typedef struct bend_initrequest
     /** \brief SRU record update handler */
     int (*bend_srw_update)(void *handle, bend_update_rr *rr);
 
     /** \brief SRU record update handler */
     int (*bend_srw_update)(void *handle, bend_update_rr *rr);
 
+    /** \brief whether named result sets are supported (0=disable, 1=enable) */
+    int named_result_sets;
 } bend_initrequest;
 
 /** \brief result for init handler (must be filled by handler) */
 } bend_initrequest;
 
 /** \brief result for init handler (must be filled by handler) */
index 277e568..23b7fe5 100644 (file)
@@ -509,6 +509,7 @@ static void assoc_init_reset(association *assoc)
     assoc->init->bend_explain = NULL;
     assoc->init->bend_srw_scan = NULL;
     assoc->init->bend_srw_update = NULL;
     assoc->init->bend_explain = NULL;
     assoc->init->bend_srw_scan = NULL;
     assoc->init->bend_srw_update = NULL;
+    assoc->init->named_result_sets = 0;
 
     assoc->init->charneg_request = NULL;
     assoc->init->charneg_response = NULL;
 
     assoc->init->charneg_request = NULL;
     assoc->init->charneg_response = NULL;
@@ -2198,6 +2199,10 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb)
             assoc->init->charneg_request = negotiation;
     }
 
             assoc->init->charneg_request = negotiation;
     }
 
+    /* by default named_result_sets is 0 .. Enable it if client asks for it. */
+    if (ODR_MASK_GET(req->options, Z_Options_namedResultSets))
+        assoc->init->named_result_sets = 1;
+
     assoc->backend = 0;
     if (cb)
     {
     assoc->backend = 0;
     if (cb)
     {
@@ -2264,7 +2269,8 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb)
         ODR_MASK_SET(resp->options, Z_Options_extendedServices);
         strcat(options, " extendedServices");
     }
         ODR_MASK_SET(resp->options, Z_Options_extendedServices);
         strcat(options, " extendedServices");
     }
-    if (ODR_MASK_GET(req->options, Z_Options_namedResultSets))
+    if (ODR_MASK_GET(req->options, Z_Options_namedResultSets)
+        && assoc->init->named_result_sets)
     {
         ODR_MASK_SET(resp->options, Z_Options_namedResultSets);
         strcat(options, " namedresults");
     {
         ODR_MASK_SET(resp->options, Z_Options_namedResultSets);
         strcat(options, " namedresults");