X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=ztest%2Fztest.c;h=32595fe23a8ce0b02b69c25f0692b077b06c43d4;hb=26d07328e36c41d39216d66d742d133cf7512995;hp=3279ae20388e7ad642b9038c768eb7826dba0d49;hpb=16ce40aa92448a07d7b8673d873f549087f27e83;p=yaz-moved-to-github.git diff --git a/ztest/ztest.c b/ztest/ztest.c index 3279ae2..32595fe 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -1,12 +1,30 @@ /* - * 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.39 2001-03-12 14:40:57 adam + * Minor change of print of item update info. + * + * Revision 1.38 2001/02/21 13:46:54 adam + * C++ fixes. + * + * Revision 1.37 2001/02/20 11:25:32 adam + * Added ill_get_APDU and ill_get_Cancel. + * + * 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 @@ -196,7 +214,7 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) { Z_External *r = (Z_External*) n->itemRequest; ILL_ItemRequest *item_req = 0; - ILL_Request *ill_req = 0; + ILL_APDU *ill_apdu = 0; if (r->direct_reference) { oident *ent = oid_getentbyoid(r->direct_reference); @@ -208,7 +226,7 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) if (r->which == ODR_EXTERNAL_single) { odr_setbuf(rr->decode, - r->u.single_ASN1_type->buf, + (char *) r->u.single_ASN1_type->buf, r->u.single_ASN1_type->len, 0); if (!ill_ItemRequest (rr->decode, &item_req, 0, 0)) @@ -219,7 +237,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 @@ -235,28 +253,28 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) } if (!item_req && r->which == ODR_EXTERNAL_single) { - yaz_log (LOG_LOG, "Decode ILLRequest begin"); + yaz_log (LOG_LOG, "Decode ILL APDU begin"); odr_setbuf(rr->decode, - r->u.single_ASN1_type->buf, + (char*) r->u.single_ASN1_type->buf, r->u.single_ASN1_type->len, 0); - if (!ill_Request (rr->decode, &ill_req, 0, 0)) + if (!ill_APDU (rr->decode, &ill_apdu, 0, 0)) { yaz_log (LOG_LOG, - "Couldn't decode ILLRequest %s near %d", + "Couldn't decode ILL APDU %s near %d", odr_errmsg(odr_geterror(rr->decode)), odr_offset(rr->decode)); yaz_log(LOG_LOG, "PDU dump:"); - odr_dumpBER(log_file(), - r->u.single_ASN1_type->buf, + odr_dumpBER(yaz_log_file(), + (char *) r->u.single_ASN1_type->buf, r->u.single_ASN1_type->len); } else - yaz_log(LOG_LOG, "Decode ILLRequest OK"); + yaz_log(LOG_LOG, "Decode ILL APDU OK"); if (rr->print) { - ill_Request (rr->print, &ill_req, 0, - "ILLRequest"); + ill_APDU (rr->print, &ill_apdu, 0, + "ILL APDU"); odr_reset (rr->print); } } @@ -292,7 +310,7 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) yaz_log (LOG_LOG, " recordInsert"); break; case Z_IUOriginPartToKeep_recordReplace: - yaz_log (LOG_LOG, " recordUpdate"); + yaz_log (LOG_LOG, " recordReplace"); break; case Z_IUOriginPartToKeep_recordDelete: yaz_log (LOG_LOG, " recordDelete"); @@ -475,12 +493,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 +562,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 */