X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=0b5972493418cfbd3df06353c4a27bcc970aefe7;hb=49bb5732e64ef1bd772d5393450815684eac39b6;hp=cdcad4d69c954eb50c2e79ff60e4d01ebb2480c1;hpb=548d8ab9b0b5930db27643b47fc55afce5511219;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index cdcad4d..0b59724 100644 --- a/client/client.c +++ b/client/client.c @@ -1,10 +1,25 @@ /* - * 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.109 2001-01-22 10:41:47 adam + * Revision 1.114 2001-02-21 13:46:53 adam + * C++ fixes. + * + * Revision 1.113 2001/02/21 09:41:15 adam + * Fixed problem with old codecs. + * + * 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 + * + * Revision 1.110 2001/01/29 11:19:05 adam + * Clients prints options in InitResponse. + * + * Revision 1.109 2001/01/22 10:41:47 adam * Multiple attribute may be specified for sorging. * * Revision 1.108 2000/11/23 10:58:32 adam @@ -414,6 +429,7 @@ static NMEM session_mem = NULL; /* memory handle for init-response */ static Z_InitResponse *session = 0; /* session parameters */ static char last_scan_line[512] = "0"; static char last_scan_query[512] = "0"; +char* esPackageName = 0; static char last_cmd[100] = "?"; static FILE *marcdump = 0; @@ -542,6 +558,35 @@ static int process_initResponse(Z_InitResponse *res) } odr_reset (print); } + printf ("Options:"); + if (ODR_MASK_GET(res->options, Z_Options_search)) + printf (" search"); + if (ODR_MASK_GET(res->options, Z_Options_present)) + printf (" present"); + if (ODR_MASK_GET(res->options, Z_Options_delSet)) + printf (" delSet"); + if (ODR_MASK_GET(res->options, Z_Options_resourceReport)) + printf (" resourceReport"); + if (ODR_MASK_GET(res->options, Z_Options_resourceCtrl)) + printf (" resourceCtrl"); + if (ODR_MASK_GET(res->options, Z_Options_accessCtrl)) + printf (" accessCtrl"); + if (ODR_MASK_GET(res->options, Z_Options_scan)) + printf (" scan"); + if (ODR_MASK_GET(res->options, Z_Options_sort)) + printf (" sort"); + if (ODR_MASK_GET(res->options, Z_Options_extendedServices)) + printf (" extendedServices"); + if (ODR_MASK_GET(res->options, Z_Options_level_1Segmentation)) + printf (" level1Segmentation"); + if (ODR_MASK_GET(res->options, Z_Options_level_2Segmentation)) + printf (" level2Segmentation"); + if (ODR_MASK_GET(res->options, Z_Options_concurrentOperations)) + printf (" concurrentOperations"); + if (ODR_MASK_GET(res->options, Z_Options_namedResultSets)) + printf (" namedResultSets"); + printf ("\n"); + fflush (stdout); return 0; } @@ -1327,7 +1372,8 @@ static Z_External *create_external_itemRequest() r->u.single_ASN1_type = (Odr_oct *) odr_malloc (out, sizeof(*r->u.single_ASN1_type)); - r->u.single_ASN1_type->buf = odr_malloc (out, item_request_size); + r->u.single_ASN1_type->buf = (unsigned char *) + odr_malloc (out, item_request_size); r->u.single_ASN1_type->len = item_request_size; r->u.single_ASN1_type->size = item_request_size; memcpy (r->u.single_ASN1_type->buf, item_request_buf, @@ -1344,10 +1390,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; @@ -1356,14 +1402,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"); } @@ -1390,7 +1436,8 @@ static Z_External *create_external_ILLRequest() r->u.single_ASN1_type = (Odr_oct *) odr_malloc (out, sizeof(*r->u.single_ASN1_type)); - r->u.single_ASN1_type->buf = odr_malloc (out, ill_request_size); + r->u.single_ASN1_type->buf = (unsigned char *) + odr_malloc (out, ill_request_size); r->u.single_ASN1_type->len = ill_request_size; r->u.single_ASN1_type->size = ill_request_size; memcpy (r->u.single_ASN1_type->buf, ill_request_buf, ill_request_size); @@ -1453,6 +1500,7 @@ static Z_External *create_ItemOrderExternal(const char *type, int itemno) (int *) odr_malloc(out, sizeof(int)); *r->u.itemOrder->u.esRequest->notToKeep->resultSetItem->item = itemno; +#ifdef ASN_COMPILED if (!strcmp (type, "item") || !strcmp(type, "2")) { printf ("using item-request\n"); @@ -1463,10 +1511,14 @@ 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; + +#else + r->u.itemOrder->u.esRequest->notToKeep->itemRequest = 0; +#endif return r; } @@ -1480,7 +1532,7 @@ static int send_itemorder(const char *type, int itemno) ItemOrderRequest.oclass = CLASS_EXTSERV; ItemOrderRequest.value = VAL_ITEMORDER; req->packageType = odr_oiddup(out,oid_getoidbyent(&ItemOrderRequest)); - req->packageName = "1.Extendedserveq"; + req->packageName = esPackageName; req->taskSpecificParameters = create_ItemOrderExternal(type, itemno); @@ -1507,7 +1559,7 @@ static int cmd_update(char *arg) update_oid.value = VAL_DBUPDATE; oid_ent_to_oid (&update_oid, oid); req->packageType = odr_oiddup(out,oid); - req->packageName = "1.Extendedserveq"; + req->packageName = esPackageName; r = req->taskSpecificParameters = (Z_External *) odr_malloc (out, sizeof(*r)); @@ -1864,7 +1916,7 @@ int send_scanrequest(const char *query, int pp, int num, const char *term) req->termListAndStartPoint->term->u.general) { req->termListAndStartPoint->term->u.general->buf = - odr_strdup(out, term); + (unsigned char *) odr_strdup(out, term); req->termListAndStartPoint->term->u.general->len = req->termListAndStartPoint->term->u.general->size = strlen(term); @@ -2292,6 +2344,17 @@ int cmd_close(char *arg) return 2; } +int cmd_packagename(char* arg) { + xfree (esPackageName); + esPackageName = NULL; + if (*arg) + { + esPackageName = (char *) xmalloc (strlen(arg)+1); + strcpy (esPackageName, arg); + } + return 1; +}; + static void initialize(void) { #if CCL2RPN @@ -2353,6 +2416,7 @@ static int client(int wait) {"refid", cmd_refid, ""}, {"itemorder", cmd_itemorder, "ill|item "}, {"update", cmd_update, ""}, + {"packagename", cmd_packagename, ""}, #ifdef ASN_COMPILED /* Server Admin Functions */ {"adm-reindex", cmd_adm_reindex, ""},