X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fproto.h;h=760aa7f7e657cee3d263025d3995ab1d06186891;hp=80139133f6b2b85cc562c3bc59ed48820ea1404b;hb=e0c187d10957ba9aa5c459c4f01afbedb38b33a0;hpb=fe47f8f7fe8dc10cfe508d5cd052dec12683cb50 diff --git a/include/proto.h b/include/proto.h index 8013913..760aa7f 100644 --- a/include/proto.h +++ b/include/proto.h @@ -1,10 +1,58 @@ /* - * 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.3 1995-03-30 12:18:09 quinn + * 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 + * Smallish + * + * Revision 1.4 1995/04/10 10:22:47 quinn + * Added SCAN + * + * Revision 1.3 1995/03/30 12:18:09 quinn * Added info. * * Revision 1.2 1995/03/30 10:26:48 quinn @@ -49,6 +97,7 @@ #define PROTO_H #include +#include #include /* ----------------- GLOBAL AUXILIARY DEFS ----------------*/ @@ -59,6 +108,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 @@ -81,7 +189,7 @@ typedef struct Z_IdAuthentication { char *open; Z_IdPass *idPass; - void *anonymous; /* NULL */ + Odr_null *anonymous; Odr_external *other; } u; } Z_IdAuthentication; @@ -240,7 +348,7 @@ typedef struct Z_Term char *dateTime; Odr_external *external; /* Z_IntUnit *integerAndUnit; */ - void *null; + Odr_null *null; } u; } Z_Term; @@ -263,16 +371,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 @@ -282,14 +403,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; @@ -402,6 +523,157 @@ 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 +{ + int num_attributes; + Z_AttributeElement **attributes; +} Z_AttributeList; + +typedef struct Z_AlternativeTerm +{ + int num_terms; + Z_AttributesPlusTerm **terms; +} Z_AlternativeTerm; + +typedef struct Z_OccurrenceByAttributes +{ + Z_AttributeList *attributes; +#if 0 + enum + { + Z_OByAtt_global, + Z_ObyAtt_byDatabase + } which; + union + { +#endif + int *global; +#if 0 + /* Z_ByDatabase *byDatabase; */ + } u; +#endif +} Z_OccurrenceByAttributes; + +typedef struct Z_TermInfo +{ + Z_Term *term; + Z_AttributeList *suggestedAttributes; /* OPTIONAL */ + Z_AlternativeTerm *alternativeTerm; /* OPTIONAL */ + int *globalOccurrences; /* OPTIONAL */ + Z_OccurrenceByAttributes *byAttributes; /* OPTIONAL */ +} Z_TermInfo; + +typedef struct Z_Entry +{ + enum + { + Z_Entry_termInfo, + Z_Entry_surrogateDiagnostic + } which; + union + { + Z_TermInfo *termInfo; + Z_DiagRec *surrogateDiagnostic; + } u; +} Z_Entry; + +typedef struct Z_Entries +{ + int num_entries; + Z_Entry **entries; +} Z_Entries; + +typedef struct Z_DiagRecs +{ + int num_diagRecs; + Z_DiagRec **diagRecs; +} Z_DiagRecs; + +typedef struct Z_ListEntries +{ + enum + { + Z_ListEntries_entries, + Z_ListEntries_nonSurrogateDiagnostics + } which; + union + { + Z_Entries *entries; + Z_DiagRecs *nonSurrogateDiagnostics; + } u; +} Z_ListEntries; + +typedef struct Z_ScanRequest +{ + Z_ReferenceId *referenceId; /* OPTIONAL */ + int num_databaseNames; + char **databaseNames; + Odr_oid *attributeSet; /* OPTIONAL */ + Z_AttributesPlusTerm *termListAndStartPoint; + int *stepSize; /* OPTIONAL */ + int *numberOfTermsRequested; + int *preferredPositionInResponse; /* OPTIONAL */ +} Z_ScanRequest; + +typedef struct Z_ScanResponse +{ + Z_ReferenceId *referenceId; /* OPTIONAL */ + int *stepSize; /* OPTIONAL */ + int *scanStatus; +#define Z_Scan_success 0 +#define Z_Scan_partial_1 1 +#define Z_Scan_partial_2 2 +#define Z_Scan_partial_3 3 +#define Z_Scan_partial_4 4 +#define Z_Scan_partial_5 5 +#define Z_Scan_failure 6 + int *numberOfEntriesReturned; + int *positionOfTerm; /* OPTIONAL */ + Z_ListEntries *entries; /* OPTIONAL */ + Odr_oid *attributeSet; /* OPTIONAL */ +} Z_ScanResponse; + /* ------------------------ SEARCHRESPONSE ------------------ */ typedef struct Z_SearchResponse @@ -446,17 +718,74 @@ typedef struct Z_PresentResponse Z_Records *records; } 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; + int *status; +} Z_ListStatus; + +typedef struct Z_DeleteResultSetRequest +{ + Z_ReferenceId *referenceId; /* OPTIONAL */ + int *deleteFunction; +#define Z_DeleteRequest_list 0 +#define Z_DeleteRequest_all 1 + int num_ids; + Z_ResultSetId **resultSetList; /* OPTIONAL */ +#ifdef Z_OTHERINFO + Z_OtherInformation *otherInfo; +#endif +} Z_DeleteResultSetRequest; + +typedef struct Z_DeleteResultSetResponse +{ + Z_ReferenceId *referenceId; /* OPTIONAL */ + int *deleteOperationStatus; + int num_statuses; + Z_ListStatus *deleteListStatuses; /* OPTIONAL */ + int *numberNotDeleted; /* OPTIONAL */ + int num_bulkStatuses; + Z_ListStatus *bulkStatuses; /* OPTIONAL */ + char *deleteMessage; /* OPTIONAL */ +#ifdef Z_OTHERINFO + Z_OtherInformation *otherInfo; +#endif +} Z_DeleteResultSetResponse; + /* ------------------------ APDU ---------------------------- */ typedef struct Z_APDU { - int which; -#define Z_APDU_initRequest 0 -#define Z_APDU_initResponse 1 -#define Z_APDU_searchRequest 2 -#define Z_APDU_searchResponse 3 -#define Z_APDU_presentRequest 4 -#define Z_APDU_presentResponse 5 + enum Z_APDU_which + { + Z_APDU_initRequest, + Z_APDU_initResponse, + Z_APDU_searchRequest, + 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 + } which; union { Z_InitRequest *initRequest; @@ -465,9 +794,34 @@ 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; } 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_APDU *zget_APDU(ODR o, enum Z_APDU_which which); + +#include +#include + #endif