Work on Extended Services.
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 1 Jun 1999 14:29:11 +0000 (14:29 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 1 Jun 1999 14:29:11 +0000 (14:29 +0000)
client/client.c
include/backend.h
server/seshigh.c
ztest/ztest.c

index 9b17c9c..c979041 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: client.c,v $
- * Revision 1.83  1999-05-26 15:24:26  adam
+ * Revision 1.84  1999-06-01 14:29:11  adam
+ * Work on Extended Services.
+ *
+ * Revision 1.83  1999/05/26 15:24:26  adam
  * Fixed minor bugs regarding DB Update (introduced by previous commit).
  *
  * Revision 1.82  1999/05/26 13:49:12  adam
@@ -1129,7 +1132,20 @@ static int process_resourceControlRequest (Z_ResourceControlRequest *req)
 
 void process_ESResponse(Z_ExtendedServicesResponse *res)
 {
-    printf("process_ESResponse\n");
+    printf("process_ESResponse status=");
+    switch (*res->operationStatus)
+    {
+    case Z_ExtendedServicesResponse_done:
+       printf ("done\n");
+       break;
+    case Z_ExtendedServicesResponse_accepted:
+       printf ("accepted\n");
+       break;
+    case Z_ExtendedServicesResponse_failure:
+       printf ("failure\n");
+       display_diagrecs(res->diagnostics, res->num_diagnostics);
+       break;
+    }
 }
 
 static Z_External *CreateItemOrderExternal(int itemno)
index b531fe3..7dbd211 100644 (file)
  * OF THIS SOFTWARE.
  *
  * $Log: backend.h,v $
- * Revision 1.24  1999-03-31 11:18:24  adam
+ * Revision 1.25  1999-06-01 14:29:12  adam
+ * Work on Extended Services.
+ *
+ * Revision 1.24  1999/03/31 11:18:24  adam
  * Implemented odr_strdup. Added Reference ID to backend server API.
  *
  * Revision 1.23  1998/10/13 16:12:23  adam
@@ -231,7 +234,7 @@ typedef struct bend_esrequest_rr
     Z_ReferenceId *referenceId;/* reference ID */
     bend_request request;
     bend_association association;
-    int errcode;               /* 0==success */
+    int errcode;               /* 0==success, -1==accepted, >0 = failure */
     char *errstring;           /* system error string or NULL */
 } bend_esrequest_rr;
 
index 78d65d8..9646fa7 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: seshigh.c,v $
- * Revision 1.90  1999-05-27 13:02:20  adam
+ * Revision 1.91  1999-06-01 14:29:12  adam
+ * Work on Extended Services.
+ *
+ * Revision 1.90  1999/05/27 13:02:20  adam
  * Assigned OID for old DB Update (VAL_DBUPDATE0).
  *
  * Revision 1.89  1999/05/26 15:24:26  adam
@@ -1761,21 +1764,31 @@ static Z_APDU *process_ESRequest(association *assoc, request *reqb, int *fd)
 
     resp->referenceId = req->referenceId;
 
-    if ( esrequest.errcode == 0 )
+    if (esrequest.errcode == -1)
+    {
+        /* Backend service indicates request will be processed */
+        logf(LOG_DEBUG,"Request could be processed...Accepted !");
+        *resp->operationStatus = Z_ExtendedServicesResponse_accepted;
+    }
+    else if (esrequest.errcode == 0)
     {
         /* Backend service indicates request will be processed */
-        logf(LOG_DEBUG,"Request will be processed...Good !");
+        logf(LOG_DEBUG,"Request could be processed...Done !");
         *resp->operationStatus = Z_ExtendedServicesResponse_done;
     }
     else
     {
+       Z_DiagRecs *diagRecs = diagrecs (assoc, esrequest.errcode,
+                                        esrequest.errstring);
+
         /* Backend indicates error, request will not be processed */
-        logf(LOG_DEBUG,"Request will not be processed...BAD !");
+        logf(LOG_DEBUG,"Request could not be processed...failure !");
         *resp->operationStatus = Z_ExtendedServicesResponse_failure;
+       resp->num_diagnostics = diagRecs->num_diagRecs;
+       resp->diagnostics = diagRecs->diagRecs;
     }
     /* Do something with the members of bend_extendedservice */
 
     logf(LOG_DEBUG,"Send the result apdu");
-
     return apdu;
 }
index 71d3074..c6cfa7f 100644 (file)
@@ -7,7 +7,10 @@
  *    Chas Woodfield, Fretwell Downing Datasystems.
  *
  * $Log: ztest.c,v $
- * Revision 1.24  1999-05-27 13:07:54  adam
+ * Revision 1.25  1999-06-01 14:29:12  adam
+ * Work on Extended Services.
+ *
+ * Revision 1.24  1999/05/27 13:07:54  adam
  * Fix.
  *
  * Revision 1.23  1999/05/27 13:02:20  adam
@@ -215,8 +218,17 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr)
                    logf (LOG_LOG, " unknown (%d)", *toKeep->action);
                }
            }
-           logf (LOG_LOG, "database: %s", 
-                 (toKeep->databaseName ? toKeep->databaseName : "<null>"));
+           if (toKeep->databaseName)
+           {
+               logf (LOG_LOG, "database: %s", toKeep->databaseName);
+               if (!strcmp(toKeep->databaseName, "fault"))
+               {
+                   rr->errcode = 109;
+                   rr->errstring = toKeep->databaseName;
+               }
+               if (!strcmp(toKeep->databaseName, "accept"))
+                   rr->errcode = -1;
+           }
            if (notToKeep)
            {
                int i;
@@ -264,7 +276,6 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr)
              rr->esr->taskSpecificParameters->which);
        
     }
-    rr->errcode = 0;
     return 0;
 }