X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=ztest%2Fztest.c;h=2e36956ae0642c1e0a2ca0be72121a5b5c08a3a2;hb=7dabb33444218a5c5b83cf1a4d9fe386699f872e;hp=6e88907730f754e7cbcc88d5a8c60420474a4354;hpb=d9ee01635f03f9095a66f71b73580560d48798e8;p=yaz-moved-to-github.git diff --git a/ztest/ztest.c b/ztest/ztest.c index 6e88907..2e36956 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -1,13 +1,26 @@ /* - * Copyright (c) 1995-1999, Index Data. + * Copyright (c) 1995-2000, Index Data. * See the file LICENSE for details. - * Sebastian Hammer, Adam Dickmeiss * * NT Service interface by * Chas Woodfield, Fretwell Downing Datasystems. * * $Log: ztest.c,v $ - * Revision 1.27 1999-11-30 13:47:12 adam + * Revision 1.31 2000-01-31 13:15:21 adam + * Removed uses of assert(3). Cleanup of ODR. CCL parser update so + * that some characters are not surrounded by spaces in resulting term. + * ILL-code updates. + * + * Revision 1.30 2000/01/13 23:05:50 adam + * Fixed tagging for member requester-CHECKED-IN in ILL ASN.1 spec. + * + * Revision 1.29 2000/01/12 14:36:07 adam + * Added printing stream (ODR) for backend functions. + * + * Revision 1.28 1999/12/16 23:36:19 adam + * Implemented ILL protocol. Minor updates ASN.1 compiler. + * + * Revision 1.27 1999/11/30 13:47:12 adam * Improved installation. Moved header files to include/yaz. * * Revision 1.26 1999/08/27 09:40:32 adam @@ -98,11 +111,14 @@ #include #include #include -#include #include #include +#ifdef ASN_COMPILED +#include +#endif + Z_GenericRecord *read_grs1(FILE *f, ODR o); int ztest_search (void *handle, bend_search_rr *rr); @@ -185,6 +201,78 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) yaz_log(LOG_LOG, "setId: %s", n->resultSetItem->resultSetId); yaz_log(LOG_LOG, "item: %d", *n->resultSetItem->item); } +#ifdef ASN_COMPILED + if (n->itemRequest) + { + Z_External *r = (Z_External*) n->itemRequest; + ILL_ItemRequest *item_req = 0; + ILL_Request *ill_req = 0; + if (r->direct_reference) + { + oident *ent = oid_getentbyoid(r->direct_reference); + if (ent) + yaz_log(LOG_LOG, "OID %s", ent->desc); + if (ent && ent->value == VAL_ISO_ILL_1) + { + yaz_log (LOG_LOG, "ItemRequest"); + if (r->which == ODR_EXTERNAL_single) + { + odr_setbuf(rr->decode, + r->u.single_ASN1_type->buf, + r->u.single_ASN1_type->len, 0); + + if (!ill_ItemRequest (rr->decode, &item_req, 0, 0)) + { + yaz_log (LOG_LOG, + "Couldn't decode ItemRequest %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, + r->u.single_ASN1_type->len); + } + if (rr->print) + { + ill_ItemRequest (rr->print, &item_req, 0, + "ItemRequest"); + odr_reset (rr->print); + } + } + if (!item_req && r->which == ODR_EXTERNAL_single) + { + yaz_log (LOG_LOG, "ILLRequest"); + odr_setbuf(rr->decode, + r->u.single_ASN1_type->buf, + r->u.single_ASN1_type->len, 0); + + if (!ill_Request (rr->decode, &ill_req, 0, 0)) + { + yaz_log (LOG_LOG, + "Couldn't decode ILLRequest %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, + r->u.single_ASN1_type->len); + } + if (rr->print) + { + ill_Request (rr->print, &ill_req, 0, + "ILLRequest"); + odr_reset (rr->print); + } + } + } + } + if (item_req) + { + yaz_log (LOG_LOG, "ILL protocol version = %d", + *item_req->protocol_version_num); + } + } +#endif } break; } @@ -345,7 +433,7 @@ char *marc_read(FILE *inf, ODR odr) static char *dummy_database_record (int num, ODR odr) { FILE *inf = fopen ("dummy-records", "r"); - char *buf; + char *buf = 0; if (!inf) return NULL; @@ -354,7 +442,6 @@ static char *dummy_database_record (int num, ODR odr) if (num == 98) { buf = (char*) odr_malloc(odr, 2101); - assert(buf); memset(buf, 'A', 2100); buf[2100] = '\0'; break;