From: ian Date: Tue, 14 Mar 2000 14:06:04 +0000 (+0000) Subject: Minor change to order of debugging output for send_apdu, X-Git-Tag: YAZ.1.8~234 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=91bd424e18017a225bc500e5ac94f71382a6a03f Minor change to order of debugging output for send_apdu, fixed encoding of admin request. --- diff --git a/client/admin.c b/client/admin.c index e803928..aa9ed43 100644 --- a/client/admin.c +++ b/client/admin.c @@ -1,6 +1,10 @@ /* * $Log: admin.c,v $ - * Revision 1.1 2000-03-14 09:27:07 ian + * Revision 1.2 2000-03-14 14:06:04 ian + * Minor change to order of debugging output for send_apdu, + * fixed encoding of admin request. + * + * Revision 1.1 2000/03/14 09:27:07 ian * Added code to enable sending of admin extended service requests * * @@ -49,6 +53,7 @@ int sendAdminES(int type, char* dbname) printf ("Admin request\n"); fflush(stdout); + /* Set up the OID for the external */ update_oid.proto = PROTO_Z3950; update_oid.oclass = CLASS_EXTSERV; update_oid.value = VAL_ADMINSERVICE; @@ -57,8 +62,8 @@ int sendAdminES(int type, char* dbname) req->packageType = odr_oiddup(out,oid); req->packageName = "1.Extendedserveq"; - r = req->taskSpecificParameters = (Z_External *) - odr_malloc (out, sizeof(*r)); + /* Allocate the external */ + r = req->taskSpecificParameters = (Z_External *) odr_malloc (out, sizeof(*r)); r->direct_reference = odr_oiddup(out,oid); r->indirect_reference = 0; r->descriptor = 0; @@ -74,39 +79,41 @@ int sendAdminES(int type, char* dbname) { case 1: toKeep->which=Z_ESAdminOriginPartToKeep_reIndex; - toKeep->u.reIndex=NULL; + toKeep->u.reIndex=odr_nullval(); break; case 2: toKeep->which=Z_ESAdminOriginPartToKeep_truncate; - toKeep->u.truncate=NULL; + toKeep->u.truncate=odr_nullval(); break; case 3: toKeep->which=Z_ESAdminOriginPartToKeep_delete; - toKeep->u.delete=NULL; + toKeep->u.delete=odr_nullval(); break; case 4: toKeep->which=Z_ESAdminOriginPartToKeep_create; - toKeep->u.create=NULL; + toKeep->u.create=odr_nullval(); break; case 5: toKeep->which=Z_ESAdminOriginPartToKeep_import; - toKeep->u.import=NULL; + toKeep->u.import=odr_nullval(); break; case 6: toKeep->which=Z_ESAdminOriginPartToKeep_refresh; - toKeep->u.refresh=NULL; + toKeep->u.refresh=odr_nullval(); break; case 7: toKeep->which=Z_ESAdminOriginPartToKeep_commit; - toKeep->u.commit=NULL; + toKeep->u.commit=odr_nullval(); break; } + toKeep->databaseName = dbname; + notToKeep = r->u.adminService->u.esRequest->notToKeep = (Z_ESAdminOriginPartNotToKeep *) odr_malloc(out, sizeof(*r->u.adminService->u.esRequest->notToKeep)); notToKeep->which=Z_ESAdminOriginPartNotToKeep_recordsWillFollow; - notToKeep->u.recordsWillFollow=NULL; + notToKeep->u.recordsWillFollow=odr_nullval(); send_apdu(apdu); diff --git a/client/client.c b/client/client.c index a113433..0e37a1f 100644 --- a/client/client.c +++ b/client/client.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: client.c,v $ - * Revision 1.96 2000-03-14 09:27:07 ian + * Revision 1.97 2000-03-14 14:06:04 ian + * Minor change to order of debugging output for send_apdu, + * fixed encoding of admin request. + * + * Revision 1.96 2000/03/14 09:27:07 ian * Added code to enable sending of admin extended service requests * * Revision 1.95 2000/02/28 11:20:05 adam @@ -398,16 +402,16 @@ void send_apdu(Z_APDU *a) char *buf; int len; - if (!z_APDU(out, &a, 0, 0)) - { - odr_perror(out, "Encoding APDU"); - exit(1); - } if (apdu_file) { z_APDU(print, &a, 0, 0); odr_reset(print); } + if (!z_APDU(out, &a, 0, 0)) + { + odr_perror(out, "Encoding APDU"); + exit(1); + } buf = odr_getbuf(out, &len, 0); /* printf ("sending APDU of size %d\n", len); */ if (cs_put(conn, buf, len) < 0)