From: Adam Dickmeiss Date: Tue, 20 Feb 2001 11:25:32 +0000 (+0000) Subject: Added ill_get_APDU and ill_get_Cancel. X-Git-Tag: YAZ.1.8~131 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=9f6bbd483ea92b4a5ae114a36bfebd942e138460;p=yaz-moved-to-github.git Added ill_get_APDU and ill_get_Cancel. --- diff --git a/Makefile.in b/Makefile.in index abd6039..284ac87 100644 --- a/Makefile.in +++ b/Makefile.in @@ -152,8 +152,6 @@ uninstall-aclocalDATA: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. -@SET_MAKE@ - all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive \ check-recursive installcheck-recursive info-recursive dvi-recursive: @@ -180,10 +178,11 @@ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ - rev="$$subdir $$rev"; \ - test "$$subdir" = "." && dot_seen=yes; \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ done; \ - test "$$dot_seen" = "no" && rev=". $$rev"; \ + rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ diff --git a/client/client.c b/client/client.c index 9b37bdd..e874e31 100644 --- a/client/client.c +++ b/client/client.c @@ -1,10 +1,12 @@ /* - * Copyright (c) 1995-2000, Index Data + * Copyright (c) 1995-2001, Index Data * See the file LICENSE for details. - * Sebastian Hammer, Adam Dickmeiss * * $Log: client.c,v $ - * Revision 1.111 2001-01-30 15:52:48 ja7 + * Revision 1.112 2001-02-20 11:25:32 adam + * Added ill_get_APDU and ill_get_Cancel. + * + * Revision 1.111 2001/01/30 15:52:48 ja7 * added command for setting packageName in ES packages! * command is named packagename default is NULL for server suplyed package name * @@ -1381,10 +1383,10 @@ static Z_External *create_external_itemRequest() #endif #ifdef ASN_COMPILED -static Z_External *create_external_ILLRequest() +static Z_External *create_external_ILL_APDU(int which) { struct ill_get_ctl ctl; - ILL_Request *req; + ILL_APDU *ill_apdu; Z_External *r = 0; int ill_request_size = 0; char *ill_request_buf = 0; @@ -1393,14 +1395,14 @@ static Z_External *create_external_ILLRequest() ctl.clientData = 0; ctl.f = get_ill_element; - req = ill_get_ILLRequest(&ctl, "ill", 0); + ill_apdu = ill_get_APDU(&ctl, "ill", 0); - if (!ill_Request (out, &req, 0, 0)) + if (!ill_APDU (out, &ill_apdu, 0, 0)) { if (apdu_file) { printf ("-------------------\n"); - ill_Request(print, &req, 0, 0); + ill_APDU(print, &ill_apdu, 0, 0); odr_reset(print); printf ("-------------------\n"); } @@ -1500,7 +1502,7 @@ static Z_External *create_ItemOrderExternal(const char *type, int itemno) { printf ("using ILL-request\n"); r->u.itemOrder->u.esRequest->notToKeep->itemRequest = - create_external_ILLRequest(); + create_external_ILL_APDU(ILL_APDU_ILL_Request); } else r->u.itemOrder->u.esRequest->notToKeep->itemRequest = 0; diff --git a/ill/ill-get.c b/ill/ill-get.c index 124e5b9..bf63003 100644 --- a/ill/ill-get.c +++ b/ill/ill-get.c @@ -1,9 +1,12 @@ /* - * Copyright (c) 1999-2000, Index Data. + * Copyright (c) 1999-2001, Index Data. * See the file LICENSE for details. * * $Log: ill-get.c,v $ - * Revision 1.6 2000-08-10 08:41:26 adam + * Revision 1.7 2001-02-20 11:25:32 adam + * Added ill_get_APDU and ill_get_Cancel. + * + * Revision 1.6 2000/08/10 08:41:26 adam * Fixes for ILL. * * Revision 1.5 2000/02/24 08:52:01 adam @@ -621,3 +624,61 @@ ILL_ItemRequest *ill_get_ItemRequest ( r->iLL_request_extensions = 0; return r; } + +ILL_Cancel *ill_get_Cancel ( + struct ill_get_ctl *gc, const char *name, const char *sub) +{ + ODR o = gc->odr; + ILL_Cancel *r = (ILL_Cancel *)odr_malloc(o, sizeof(*r)); + char element[128]; + + strcpy(element, name); + if (sub) + { + strcat (element, ","); + strcat (element, sub); + } + r->protocol_version_num = + ill_get_enumerated (gc, element, "protocol-version-num", + ILL_Request_version_2); + + r->transaction_id = ill_get_Transaction_Id (gc, element, "transaction-id"); + r->service_date_time = + ill_get_Service_Date_Time (gc, element, "service-date-time"); + r->requester_id = ill_get_System_Id (gc, element, "requester-id"); + r->responder_id = ill_get_System_Id (gc, element, "responder-id"); + r->requester_note = ill_get_ILL_String(gc, element, "requester-note"); + + r->num_cancel_extensions = 0; + r->cancel_extensions = 0; + return r; +} + +ILL_APDU *ill_get_APDU ( + struct ill_get_ctl *gc, const char *name, const char *sub) +{ + ODR o = gc->odr; + ILL_APDU *r = (ILL_APDU *)odr_malloc(o, sizeof(*r)); + char element[128]; + const char *v; + + strcpy (element, name); + strcat (element, ",which"); + + v = (gc->f)(gc->clientData, element); + if (!v) + v = "request"; + if (!strcmp (v, "request")) + { + r->which = ILL_APDU_ILL_Request; + r->u.ILL_Request = ill_get_ILLRequest(gc, name, sub); + } + else if (!strcmp (v, "cancel")) + { + r->which = ILL_APDU_Cancel; + r->u.Cancel = ill_get_Cancel(gc, name, sub); + } + else + return 0; + return r; +} diff --git a/include/yaz/ill.h b/include/yaz/ill.h index d7eeb11..4a70499 100644 --- a/include/yaz/ill.h +++ b/include/yaz/ill.h @@ -1,9 +1,12 @@ /* - * Copyright (c) 1999, Index Data + * Copyright (c) 1999-2001, Index Data * See the file LICENSE for details. * * $Log: ill.h,v $ - * Revision 1.4 2000-02-28 11:20:06 adam + * Revision 1.5 2001-02-20 11:25:32 adam + * Added ill_get_APDU and ill_get_Cancel. + * + * Revision 1.4 2000/02/28 11:20:06 adam * Using autoconf. New definitions: YAZ_BEGIN_CDECL/YAZ_END_CDECL. * * Revision 1.3 2000/01/31 13:15:21 adam @@ -38,6 +41,12 @@ YAZ_EXPORT ILL_ItemRequest *ill_get_ItemRequest ( YAZ_EXPORT ILL_Request *ill_get_ILLRequest ( struct ill_get_ctl *gs, const char *name, const char *sub); +YAZ_EXPORT ILL_Cancel *ill_get_Cancel ( + struct ill_get_ctl *gc, const char *name, const char *sub); + +YAZ_EXPORT ILL_APDU *ill_get_APDU ( + struct ill_get_ctl *gc, const char *name, const char *sub); + YAZ_END_CDECL #endif diff --git a/ztest/ztest.c b/ztest/ztest.c index d10e4b5..c3df75a 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -6,7 +6,10 @@ * Chas Woodfield, Fretwell Downing Datasystems. * * $Log: ztest.c,v $ - * Revision 1.36 2001-01-30 21:34:18 adam + * 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 @@ -205,7 +208,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); @@ -244,15 +247,15 @@ 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, 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:"); @@ -261,11 +264,11 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) 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); } }