Fixed CLOSE
[yaz-moved-to-github.git] / include / proto.h
index 8d43b04..48f63f9 100644 (file)
@@ -1,10 +1,55 @@
 /*
- * Copyright (C) 1994, Index Data I/S 
- * All rights reserved.
- * Sebastian Hammer, Adam Dickmeiss
+ * Copyright (c) 1995, Index Data.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation, in whole or in part, for any purpose, is hereby granted,
+ * provided that:
+ *
+ * 1. This copyright and permission notice appear in all copies of the
+ * software and its documentation. Notices of copyright or attribution
+ * which appear at the beginning of any file must remain unchanged.
+ *
+ * 2. The name of Index Data or the individual authors may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
+ * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
  *
  * $Log: proto.h,v $
- * Revision 1.6  1995-05-15 11:55:55  quinn
+ * Revision 1.14  1995-06-07 14:42:34  quinn
+ * Fixed CLOSE
+ *
+ * Revision 1.13  1995/06/07  14:36:47  quinn
+ * Added CLOSE
+ *
+ * Revision 1.12  1995/06/05  10:53:13  quinn
+ * Smallish.
+ *
+ * Revision 1.11  1995/06/02  09:49:47  quinn
+ * Add access control
+ *
+ * Revision 1.10  1995/05/29  08:11:34  quinn
+ * Moved oid from odr/asn to util.
+ *
+ * Revision 1.9  1995/05/22  11:31:25  quinn
+ * Added PDUs
+ *
+ * Revision 1.8  1995/05/17  08:41:35  quinn
+ * Added delete to proto & other little things.
+ * Relaying auth info to backend.
+ *
+ * Revision 1.7  1995/05/16  08:50:37  quinn
+ * License, documentation, and memory fixes
+ *
+ * Revision 1.6  1995/05/15  11:55:55  quinn
  * Work on asynchronous activity.
  *
  * Revision 1.5  1995/04/17  11:28:18  quinn
 #define PROTO_H
 
 #include <odr.h>
+#include <oid.h>
 #include <odr_use.h>
 
 /* ----------------- GLOBAL AUXILIARY DEFS ----------------*/
@@ -68,6 +114,65 @@ typedef char Z_ResultSetId;
 typedef Odr_oct Z_ResultsetId;
 typedef Odr_external Z_UserInformationField;
 
+typedef struct Z_InfoCategory
+{
+    Odr_oid *categoryTypeId;         /* OPTIONAL */
+    int *categoryValue;
+} Z_InfoCategory;
+
+typedef struct Z_OtherInformationUnit
+{
+    Z_InfoCategory *category;        /* OPTIONAL */
+    enum
+    {
+       Z_OtherInfo_characterInfo,
+       Z_OtherInfo_binaryInfo,
+       Z_OtherInfo_externallyDefinedInfo,
+       Z_OtherInfo_oid
+    } which;
+    union
+    {
+       char *characterInfo; 
+       Odr_oct *binaryInfo;
+       Odr_external *externallyDefinedInfo;
+       Odr_oid *oid;
+    } information;
+} Z_OtherInformationUnit;
+
+typedef struct Z_OtherInformation
+{
+    int num_elements;
+    Z_OtherInformationUnit **list;
+} Z_OtherInformation;
+
+typedef struct Z_StringOrNumeric
+{
+    enum
+    {
+       Z_StringOrNumeric_string,
+       Z_StringOrNumeric_numeric
+    } which;
+    union
+    {
+       char *string;
+       int *numeric;
+    } u;
+} Z_StringOrNumeric;
+
+typedef struct Z_Unit
+{
+    char *unitSystem;               /* OPTIONAL */
+    Z_StringOrNumeric *unitType;    /* OPTIONAL */
+    Z_StringOrNumeric *unit;        /* OPTIONAL */
+    int *scaleFactor;               /* OPTIONAL */
+} Z_Unit;
+
+typedef struct Z_IntUnit
+{
+    int *value;
+    Z_Unit *unitUsed;
+} Z_IntUnit;
+
 /* ----------------- INIT SERVICE  ----------------*/
 
 typedef struct
@@ -90,7 +195,7 @@ typedef struct Z_IdAuthentication
     {
        char *open;
        Z_IdPass *idPass;
-       void *anonymous;         /* NULL */
+       Odr_null *anonymous;
        Odr_external *other;
     } u;
 } Z_IdAuthentication;
@@ -249,7 +354,7 @@ typedef struct Z_Term
        char *dateTime;
        Odr_external *external;
        /* Z_IntUnit *integerAndUnit; */
-       void *null;
+       Odr_null *null;
     } u;
 } Z_Term;
 
@@ -272,16 +377,29 @@ typedef struct Z_ProximityOperator
     int *distance;
     bool_t *ordered;
     int *relationType;
+#define Z_Prox_lessThan           1
+#define Z_Prox_lessThanOrEqual    2
+#define Z_Prox_equal              3
+#define Z_Prox_greaterThanOrEqual 4
+#define Z_Prox_greaterThan        5
+#define Z_Prox_notEqual           6
     enum
     {
-       Z_ProximityOperator_known,
-       Z_ProximityOperator_private
+       Z_ProxCode_known,
+       Z_ProxCode_private
     } which;
-    union
-    {
-       int *known;
-       int *private;
-    } u;
+    int *proximityUnitCode;
+#define Z_ProxUnit_character       1
+#define Z_ProxUnit_word            2
+#define Z_ProxUnit_sentence        3
+#define Z_ProxUnit_paragraph       4
+#define Z_ProxUnit_section         5
+#define Z_ProxUnit_chapter         6
+#define Z_ProxUnit_document        7
+#define Z_ProxUnit_element         8
+#define Z_ProxUnit_subelement      9
+#define Z_ProxUnit_elementType    10
+#define Z_ProxUnit_byte           11   /* v3 only */
 } Z_ProximityOperator;
 
 typedef struct Z_Operator
@@ -291,14 +409,14 @@ typedef struct Z_Operator
        Z_Operator_and,
        Z_Operator_or,
        Z_Operator_and_not,
-       Z_Operator_proximity
+       Z_Operator_prox
     } which;
     union
     {
-       void *and;          /* these guys are nulls. */
-       void *or;
-       void *and_not;
-       Z_ProximityOperator *proximity;
+       Odr_null *and;          /* these guys are nulls. */
+       Odr_null *or;
+       Odr_null *and_not;
+       Z_ProximityOperator *prox;
     } u;
 } Z_Operator;
 
@@ -411,6 +529,45 @@ typedef struct Z_Records
     } u;
 } Z_Records;
 
+/* ------------------ ACCESS CTRL SERVICE ----------------*/
+
+typedef struct Z_AccessControlRequest
+{
+    Z_ReferenceId *referenceId;           /* OPTIONAL */
+    enum
+    {
+       Z_AccessRequest_simpleForm,
+       Z_AccessRequest_externallyDefined
+    } which;
+    union
+    {
+       Odr_oct *simpleForm;
+       Odr_external *externallyDefined;
+    } u;
+#ifdef Z_OTHERINFO
+    Z_OtherInformation *otherInfo;           /* OPTIONAL */
+#endif
+} Z_AccessControlRequest;
+
+typedef struct Z_AccessControlResponse
+{
+    Z_ReferenceId *referenceId;              /* OPTIONAL */
+    enum
+    {
+       Z_AccessResponse_simpleForm,
+       Z_AccessResponse_externallyDefined
+    } which;
+    union
+    {
+       Odr_oct *simpleForm;
+       Odr_external *externallyDefined;
+    } u;
+    Z_DiagRec *diagnostic;                   /* OPTIONAL */
+#ifdef Z_OTHERINFO
+    Z_OtherInformation *otherInfo;           /* OPTIONAL */
+#endif
+} Z_AccessControlResponse;
+
 /* ------------------------ SCAN SERVICE -------------------- */
 
 typedef struct Z_AttributeList
@@ -499,7 +656,6 @@ typedef struct Z_ScanRequest
     int num_databaseNames;
     char **databaseNames;
     Odr_oid *attributeSet;          /* OPTIONAL */
-    Odr_any *eatme1;
     Z_AttributesPlusTerm *termListAndStartPoint;
     int *stepSize;                    /* OPTIONAL */
     int *numberOfTermsRequested;
@@ -570,6 +726,18 @@ typedef struct Z_PresentResponse
 
 /* ------------------------ DELETE -------------------------- */
 
+#define Z_DeleteStatus_success                          0
+#define Z_DeleteStatus_resultSetDidNotExist             1
+#define Z_DeleteStatus_previouslyDeletedByTarget        2
+#define Z_DeleteStatus_systemProblemAtTarget            3
+#define Z_DeleteStatus_accessNotAllowed                 4
+#define Z_DeleteStatus_resourceControlAtOrigin          5
+#define Z_DeleteStatus_resourceControlAtTarget          6
+#define Z_DeleteStatus_bulkDeleteNotSupported           7
+#define Z_DeleteStatus_notAllRsltSetsDeletedOnBulkDlte  8
+#define Z_DeleteStatus_notAllRequestedResultSetsDeleted 9
+#define Z_DeleteStatus_resultSetInUse                  10
+
 typedef struct Z_ListStatus
 {
     Z_ResultSetId *id;
@@ -583,24 +751,12 @@ typedef struct Z_DeleteResultSetRequest
 #define Z_DeleteRequest_list    0
 #define Z_DeleteRequest_all     1
     int num_ids;
-    Z_ResultSetId *resultSetList;      /* OPTIONAL */
+    Z_ResultSetId **resultSetList;      /* OPTIONAL */
+#ifdef Z_OTHERINFO
+    Z_OtherInformation *otherInfo;
+#endif
 } Z_DeleteResultSetRequest;
 
-typedef enum Z_DeleteSetStatus
-{
-    Z_Delete_success = 0,
-    Z_Delete_resultSetDidNotExist,
-    Z_Delete_previouslyDeletedByTarget,
-    Z_Delete_systemProblemAtTarget,
-    Z_Delete_accessNotAllowed,
-    Z_Delete_resourceControlAtOrigin,
-    Z_Delete_resourceControlAtTarget,
-    Z_Delete_bulkDeleteNotSupported,
-    Z_Delete_notAllRsltSetsDeletedOnBulkDlte,
-    Z_Delete_notAllRequestedResultSetsDeleted,
-    Z_Delete_resultSetInUse
-} Z_DeleteSetStatus;
-
 typedef struct Z_DeleteResultSetResponse
 {
     Z_ReferenceId *referenceId;        /* OPTIONAL */
@@ -608,16 +764,43 @@ typedef struct Z_DeleteResultSetResponse
     int num_statuses;
     Z_ListStatus *deleteListStatuses;  /* OPTIONAL */
     int *numberNotDeleted;             /* OPTIONAL */
-    int num_bulkstatuses;
+    int num_bulkStatuses;
     Z_ListStatus *bulkStatuses;        /* OPTIONAL */
     char *deleteMessage;               /* OPTIONAL */
+#ifdef Z_OTHERINFO
+    Z_OtherInformation *otherInfo;
+#endif
 } Z_DeleteResultSetResponse;
 
+/* ------------------------ CLOSE SERVICE ------------------- */
+
+typedef struct Z_Close
+{
+    Z_ReferenceId *referenceId;         /* OPTIONAL */
+    int *closeReason;
+#define Z_Close_finished           0
+#define Z_Close_shutdown           1
+#define Z_Close_systemProblem      2
+#define Z_Close_costLimit          3
+#define Z_Close_resources          4
+#define Z_Close_securityViolation  5
+#define Z_Close_protocolError      6
+#define Z_Close_lackOfActivity     7
+#define Z_Close_peerAbort          8
+#define Z_Close_unspecified        9
+    char *diagnosticInformation;          /* OPTIONAL */
+    Odr_oid *resourceReportFormat;        /* OPTIONAL */
+    Odr_external *resourceReport;         /* OPTIONAL */
+#ifdef Z_OTHERINFO
+    Z_OtherInformation *otherInfo;        /* OPTIONAL */
+#endif
+} Z_Close;
+
 /* ------------------------ APDU ---------------------------- */
 
 typedef struct Z_APDU
 {    
-    enum
+    enum Z_APDU_which
     {
        Z_APDU_initRequest,
        Z_APDU_initResponse,
@@ -625,11 +808,14 @@ typedef struct Z_APDU
        Z_APDU_searchResponse,
        Z_APDU_presentRequest,
        Z_APDU_presentResponse,
+       Z_APDU_deleteResultSetRequest,
+       Z_APDU_deleteResultSetResponse,
        Z_APDU_resourceControlRequest,
        Z_APDU_resourceControlResponse,
        Z_APDU_triggerResourceControlRequest,
        Z_APDU_scanRequest,
-       Z_APDU_scanResponse
+       Z_APDU_scanResponse,
+       Z_APDU_close
     } which;
     union
     {
@@ -639,14 +825,36 @@ typedef struct Z_APDU
        Z_SearchResponse *searchResponse;
        Z_PresentRequest *presentRequest;
        Z_PresentResponse *presentResponse;
+       Z_DeleteResultSetRequest *deleteResultSetRequest;
+       Z_DeleteResultSetResponse *deleteResultSetResponse;
        Z_ResourceControlRequest *resourceControlRequest;
        Z_ResourceControlResponse *resourceControlResponse;
        Z_TriggerResourceControlRequest *triggerResourceControlRequest;
        Z_ScanRequest *scanRequest;
        Z_ScanResponse *scanResponse;
+       Z_Close *close;
     } u;
 } Z_APDU;
 
 int z_APDU(ODR o, Z_APDU **p, int opt);
 
+Z_InitRequest *zget_InitRequest(ODR o);
+Z_InitResponse *zget_InitResponse(ODR o);
+Z_SearchRequest *zget_SearchRequest(ODR o);
+Z_SearchResponse *zget_SearchResponse(ODR o);
+Z_PresentRequest *zget_PresentRequest(ODR o);
+Z_PresentResponse *zget_PresentResponse(ODR o);
+Z_DeleteResultSetRequest *zget_DeleteResultSetRequest(ODR o);
+Z_DeleteResultSetResponse *zget_DeleteResultSetResponse(ODR o);
+Z_ScanRequest *zget_ScanRequest(ODR o);
+Z_ScanResponse *zget_ScanResponse(ODR o);
+Z_TriggerResourceControlRequest *zget_TriggerResourceControlRequest(ODR o);
+Z_ResourceControlRequest *zget_ResourceControlRequest(ODR o);
+Z_ResourceControlResponse *zget_ResourceControlResponse(ODR o);
+Z_Close *zget_Close(ODR o);
+Z_APDU *zget_APDU(ODR o, enum Z_APDU_which which);
+
+#include <prt-rsc.h>
+#include <prt-acc.h>
+
 #endif