Added step-size for Scan backend interface.
[yaz-moved-to-github.git] / ztest / ztest.c
index 3279ae2..d10e4b5 100644 (file)
@@ -1,12 +1,21 @@
 /*
- * Copyright (c) 1995-2000, Index Data.
+ * Copyright (c) 1995-2001, Index Data.
  * See the file LICENSE for details.
  *
  * NT Service interface by
  *    Chas Woodfield, Fretwell Downing Datasystems.
  *
  * $Log: ztest.c,v $
- * Revision 1.33  2000-08-10 08:41:26  adam
+ * Revision 1.36  2001-01-30 21:34:18  adam
+ * Added step-size for Scan backend interface.
+ *
+ * Revision 1.35  2000/11/23 10:58:33  adam
+ * SSL comstack support. Separate POSIX thread support library.
+ *
+ * Revision 1.34  2000/09/04 08:58:15  adam
+ * Added prefix yaz_ for most logging utility functions.
+ *
+ * Revision 1.33  2000/08/10 08:41:26  adam
  * Fixes for ILL.
  *
  * Revision 1.32  2000/04/05 07:39:55  adam
@@ -219,7 +228,7 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr)
                                        odr_offset(rr->decode));
 #if 0
                                 yaz_log(LOG_LOG, "PDU dump:");
-                                odr_dumpBER(log_file(),
+                                odr_dumpBER(yaz_log_file(),
                                      r->u.single_ASN1_type->buf,
                                      r->u.single_ASN1_type->len);
 #endif
@@ -247,7 +256,7 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr)
                                        odr_errmsg(odr_geterror(rr->decode)),
                                        odr_offset(rr->decode));
                                 yaz_log(LOG_LOG, "PDU dump:");
-                                odr_dumpBER(log_file(),
+                                odr_dumpBER(yaz_log_file(),
                                      r->u.single_ASN1_type->buf,
                                      r->u.single_ASN1_type->len);
                             }
@@ -475,12 +484,21 @@ int ztest_fetch(void *handle, bend_fetch_rr *r)
     r->output_format = r->request_format;  
     if (r->request_format == VAL_SUTRS)
     {
+#if 0
+/* this section returns a huge record (for testing non-blocking write, etc) */
+       r->len = 980000;
+       r->record = odr_malloc (r->stream, r->len);
+       memset (r->record, 'x', r->len);
+#else
+/* this section returns a small record */
        char buf[100];
 
        sprintf(buf, "This is dummy SUTRS record number %d\n", r->number);
+
        r->len = strlen(buf);
        r->record = (char *) odr_malloc (r->stream, r->len+1);
        strcpy(r->record, buf);
+#endif
     }
     else if (r->request_format == VAL_GRS1)
     {
@@ -535,6 +553,11 @@ int ztest_scan(void *handle, bend_scan_rr *q)
        q->errcode = 229; /* unsupported term type */
        return 0;
     }
+    if (*q->step_size != 0)
+    {
+       q->errcode = 205; /*Only zero step size supported for Scan */
+       return 0;
+    }
     if (q->term->term->u.general->len >= 80)
     {
        q->errcode = 11; /* term too long */