X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=ill%2Fill-get.c;h=f95375218d3fef1baa29f6d933bf0a494007f902;hp=124e5b9e0e649722cb8c97b2c1c30755cfd2d5cb;hb=c71d717ada2a9ef730d527f161eb5ba9aa641a9f;hpb=16ce40aa92448a07d7b8673d873f549087f27e83 diff --git a/ill/ill-get.c b/ill/ill-get.c index 124e5b9..f953752 100644 --- a/ill/ill-get.c +++ b/ill/ill-get.c @@ -1,9 +1,18 @@ /* - * 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.9 2001-03-25 21:55:12 adam + * Added odr_intdup. Ztest server returns TaskPackage for ItemUpdate. + * + * Revision 1.8 2001/02/21 13:46:53 adam + * C++ fixes. + * + * 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 @@ -33,7 +42,7 @@ bool_t *ill_get_bool (struct ill_get_ctl *gc, const char *name, ODR o = gc->odr; char element[128]; const char *v; - bool_t *r = odr_malloc (o, sizeof(*r)); + bool_t *r = (bool_t *) odr_malloc (o, sizeof(*r)); strcpy(element, name); if (sub) @@ -57,7 +66,6 @@ int *ill_get_int (struct ill_get_ctl *gc, const char *name, ODR o = gc->odr; char element[128]; const char *v; - int *r = odr_malloc (o, sizeof(*r)); strcpy(element, name); if (sub) @@ -68,8 +76,7 @@ int *ill_get_int (struct ill_get_ctl *gc, const char *name, v = (gc->f)(gc->clientData, element); if (v) val = atoi(v); - *r = val; - return r; + return odr_intdup(o, val); } int *ill_get_enumerated (struct ill_get_ctl *gc, const char *name, @@ -152,7 +159,8 @@ ILL_Person_Or_Institution_Symbol *ill_get_Person_Or_Insitution_Symbol ( { char element[128]; ODR o = gc->odr; - ILL_Person_Or_Institution_Symbol *p = odr_malloc (o, sizeof(*p)); + ILL_Person_Or_Institution_Symbol *p = + (ILL_Person_Or_Institution_Symbol *) odr_malloc (o, sizeof(*p)); strcpy(element, name); if (sub) @@ -176,7 +184,8 @@ static ILL_Name_Of_Person_Or_Institution *ill_get_Name_Of_Person_Or_Institution( { char element[128]; ODR o = gc->odr; - ILL_Name_Of_Person_Or_Institution *p = odr_malloc (o, sizeof(*p)); + ILL_Name_Of_Person_Or_Institution *p = + (ILL_Name_Of_Person_Or_Institution *) odr_malloc (o, sizeof(*p)); strcpy(element, name); if (sub) @@ -621,3 +630,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.illRequest = 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; +}