2 * Copyright (c) 1995, Index Data.
4 * Permission to use, copy, modify, distribute, and sell this software and
5 * its documentation, in whole or in part, for any purpose, is hereby granted,
8 * 1. This copyright and permission notice appear in all copies of the
9 * software and its documentation. Notices of copyright or attribution
10 * which appear at the beginning of any file must remain unchanged.
12 * 2. The name of Index Data or the individual authors may not be used to
13 * endorse or promote products derived from this software without specific
14 * prior written permission.
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
18 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19 * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
20 * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
21 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
22 * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
27 * Revision 1.8 1995-05-17 08:41:35 quinn
28 * Added delete to proto & other little things.
29 * Relaying auth info to backend.
31 * Revision 1.7 1995/05/16 08:50:37 quinn
32 * License, documentation, and memory fixes
34 * Revision 1.6 1995/05/15 11:55:55 quinn
35 * Work on asynchronous activity.
37 * Revision 1.5 1995/04/17 11:28:18 quinn
40 * Revision 1.4 1995/04/10 10:22:47 quinn
43 * Revision 1.3 1995/03/30 12:18:09 quinn
46 * Revision 1.2 1995/03/30 10:26:48 quinn
47 * Added Term structure
49 * Revision 1.1 1995/03/30 09:39:42 quinn
50 * Moved .h files to include directory
52 * Revision 1.11 1995/03/30 09:08:44 quinn
53 * Added Resource control protocol
55 * Revision 1.10 1995/03/29 15:39:39 quinn
56 * Adding some resource control elements, and a null-check to getentbyoid
58 * Revision 1.9 1995/03/29 08:06:18 quinn
59 * Added a few v3 elements
61 * Revision 1.8 1995/03/22 10:12:49 quinn
62 * Added Z_PRES constants.
64 * Revision 1.7 1995/03/20 09:45:12 quinn
67 * Revision 1.5 1995/03/07 16:29:34 quinn
68 * Added authentication stuff.
70 * Revision 1.4 1995/03/07 10:13:00 quinn
71 * Added prototype for z_APDU()
73 * Revision 1.3 1995/02/14 11:54:23 quinn
76 * Revision 1.2 1995/02/09 15:51:40 quinn
79 * Revision 1.1 1995/02/06 16:44:48 quinn
80 * First hack at Z/SR protocol
90 /* ----------------- GLOBAL AUXILIARY DEFS ----------------*/
92 typedef Odr_oct Z_ReferenceId;
93 typedef char Z_DatabaseName;
94 typedef char Z_ResultSetId;
95 typedef Odr_oct Z_ResultsetId;
96 typedef Odr_external Z_UserInformationField;
98 typedef struct Z_InfoCategory
100 Odr_oid *categoryTypeId; /* OPTIONAL */
104 typedef struct Z_OtherInformationUnit
106 Z_InfoCategory *category; /* OPTIONAL */
109 Z_OtherInfo_characterInfo,
110 Z_OtherInfo_binaryInfo,
111 Z_OtherInfo_externallyDefinedInfo,
118 Odr_external *externallyDefinedInfo;
121 } Z_OtherInformationUnit;
123 typedef struct Z_OtherInformation
126 Z_OtherInformationUnit **list;
127 } Z_OtherInformation;
129 /* ----------------- INIT SERVICE ----------------*/
133 char *groupId; /* OPTIONAL */
134 char *userId; /* OPTIONAL */
135 char *password; /* OPTIONAL */
138 typedef struct Z_IdAuthentication
142 Z_IdAuthentication_open,
143 Z_IdAuthentication_idPass,
144 Z_IdAuthentication_anonymous,
145 Z_IdAuthentication_other
151 void *anonymous; /* NULL */
154 } Z_IdAuthentication;
156 #define Z_ProtocolVersion_1 0
157 #define Z_ProtocolVersion_2 1
158 #define Z_ProtocolVersion_3 2
160 #define Z_Options_search 0
161 #define Z_Options_present 1
162 #define Z_Options_delSet 2
163 #define Z_Options_resourceReport 3
164 #define Z_Options_triggerResourceCtrl 4
165 #define Z_Options_resourceCtrl 5
166 #define Z_Options_accessCtrl 6
167 #define Z_Options_scan 7
168 #define Z_Options_sort 8
169 #define Z_Options_reserved 9
170 #define Z_Options_extendedServices 10
171 #define Z_Options_level_1Segmentation 11
172 #define Z_Options_level_2Segmentation 12
173 #define Z_Options_concurrentOperations 13
174 #define Z_Options_namedResultSets 14
176 typedef struct Z_InitRequest
178 Z_ReferenceId *referenceId; /* OPTIONAL */
179 Odr_bitmask *options;
180 Odr_bitmask *protocolVersion;
181 int *preferredMessageSize;
182 int *maximumRecordSize;
183 Z_IdAuthentication* idAuthentication; /* OPTIONAL */
184 char *implementationId; /* OPTIONAL */
185 char *implementationName; /* OPTIONAL */
186 char *implementationVersion; /* OPTIONAL */
187 Z_UserInformationField *userInformationField; /* OPTIONAL */
190 typedef struct Z_InitResponse
192 Z_ReferenceId *referenceId; /* OPTIONAL */
193 Odr_bitmask *options;
194 Odr_bitmask *protocolVersion;
195 int *preferredMessageSize;
196 int *maximumRecordSize;
198 char *implementationId; /* OPTIONAL */
199 char *implementationName; /* OPTIONAL */
200 char *implementationVersion; /* OPTIONAL */
201 Z_UserInformationField *userInformationField; /* OPTIONAL */
204 typedef struct Z_NSRAuthentication
209 } Z_NSRAuthentication;
211 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt);
213 int z_StrAuthentication(ODR o, char **p, int opt);
216 /* ------------------ RESOURCE CONTROL ----------------*/
218 typedef struct Z_TriggerResourceControlRequest
220 Z_ReferenceId *referenceId; /* OPTIONAL */
221 int *requestedAction;
222 #define Z_TriggerResourceCtrl_resourceReport 1
223 #define Z_TriggerResourceCtrl_resourceControl 2
224 #define Z_TriggerResourceCtrl_cancel 3
225 Odr_oid *prefResourceReportFormat; /* OPTIONAL */
226 bool_t *resultSetWanted; /* OPTIONAL */
227 } Z_TriggerResourceControlRequest;
229 typedef struct Z_ResourceControlRequest
231 Z_ReferenceId *referenceId; /* OPTIONAL */
232 bool_t *suspendedFlag; /* OPTIONAL */
233 Odr_external *resourceReport; /* OPTIONAL */
234 int *partialResultsAvailable; /* OPTIONAL */
235 #define Z_ResourceControlRequest_subset 1
236 #define Z_ResourceControlRequest_interim 2
237 #define Z_ResourceControlRequest_none 3
238 bool_t *responseRequired;
239 bool_t *triggeredRequestFlag; /* OPTIONAL */
240 } Z_ResourceControlRequest;
242 typedef struct Z_ResourceControlResponse
244 Z_ReferenceId *referenceId; /* OPTIONAL */
245 bool_t *continueFlag;
246 bool_t *resultSetWanted; /* OPTIONAL */
247 } Z_ResourceControlResponse;
249 /* ------------------ SEARCH SERVICE ----------------*/
251 typedef Odr_oid Z_PreferredRecordSyntax;
253 typedef struct Z_DatabaseSpecificUnit
256 char *elementSetName;
257 } Z_DatabaseSpecificUnit;
259 typedef struct Z_DatabaseSpecific
262 Z_DatabaseSpecificUnit **elements;
263 } Z_DatabaseSpecific;
265 typedef struct Z_ElementSetNames
268 #define Z_ElementSetNames_generic 0
269 #define Z_ElementSetNames_databaseSpecific 1
273 Z_DatabaseSpecific *databaseSpecific;
277 /* ---------------------- RPN QUERY --------------------------- */
279 typedef struct Z_AttributeElement
283 } Z_AttributeElement;
288 typedef struct Z_Term
294 Z_Term_characterString,
298 Z_Term_integerAndUnit,
303 Odr_oct *general; /* this is required for v2 */
305 char *characterString;
308 Odr_external *external;
309 /* Z_IntUnit *integerAndUnit; */
316 typedef struct Z_AttributesPlusTerm
319 Z_AttributeElement **attributeList;
325 } Z_AttributesPlusTerm;
327 typedef struct Z_ProximityOperator
329 bool_t *exclusion; /* OPTIONAL */
335 Z_ProximityOperator_known,
336 Z_ProximityOperator_private
343 } Z_ProximityOperator;
345 typedef struct Z_Operator
356 void *and; /* these guys are nulls. */
359 Z_ProximityOperator *proximity;
363 typedef struct Z_Operand
366 #define Z_Operand_APT 0
367 #define Z_Operand_resultSetId 1
370 Z_AttributesPlusTerm *attributesPlusTerm;
371 Z_ResultSetId *resultSetId;
375 typedef struct Z_Complex
377 struct Z_RPNStructure *s1;
378 struct Z_RPNStructure *s2;
379 Z_Operator *operator;
382 typedef struct Z_RPNStructure
385 #define Z_RPNStructure_simple 0
386 #define Z_RPNStructure_complex 1
394 typedef struct Z_RPNQuery
396 Odr_oid *attributeSetId;
397 Z_RPNStructure *RPNStructure;
400 /* -------------------------- SEARCHREQUEST -------------------------- */
402 typedef struct Z_Query
405 #define Z_Query_type_1 1
406 #define Z_Query_type_2 2
414 typedef struct Z_SearchRequest
416 Z_ReferenceId *referenceId; /* OPTIONAL */
417 int *smallSetUpperBound;
418 int *largeSetLowerBound;
419 int *mediumSetPresentNumber;
420 bool_t *replaceIndicator;
422 int num_databaseNames;
423 char **databaseNames;
424 Z_ElementSetNames *smallSetElementSetNames; /* OPTIONAL */
425 Z_ElementSetNames *mediumSetElementSetNames; /* OPTIONAL */
426 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
430 /* ------------------------ RECORD -------------------------- */
432 typedef Odr_external Z_DatabaseRecord;
434 typedef struct Z_DiagRec
436 Odr_oid *diagnosticSetId;
441 typedef struct Z_NamePlusRecord
443 char *databaseName; /* OPTIONAL */
445 #define Z_NamePlusRecord_databaseRecord 0
446 #define Z_NamePlusRecord_surrogateDiagnostic 1
449 Z_DatabaseRecord *databaseRecord;
450 Z_DiagRec *surrogateDiagnostic;
454 typedef struct Z_NamePlusRecordList
457 Z_NamePlusRecord **records;
458 } Z_NamePlusRecordList;
460 typedef struct Z_Records
463 #define Z_Records_DBOSD 0
464 #define Z_Records_NSD 1
467 Z_NamePlusRecordList *databaseOrSurDiagnostics;
468 Z_DiagRec *nonSurrogateDiagnostic;
472 /* ------------------------ SCAN SERVICE -------------------- */
474 typedef struct Z_AttributeList
477 Z_AttributeElement **attributes;
480 typedef struct Z_AlternativeTerm
483 Z_AttributesPlusTerm **terms;
486 typedef struct Z_OccurrenceByAttributes
488 Z_AttributeList *attributes;
500 /* Z_ByDatabase *byDatabase; */
503 } Z_OccurrenceByAttributes;
505 typedef struct Z_TermInfo
508 Z_AttributeList *suggestedAttributes; /* OPTIONAL */
509 Z_AlternativeTerm *alternativeTerm; /* OPTIONAL */
510 int *globalOccurrences; /* OPTIONAL */
511 Z_OccurrenceByAttributes *byAttributes; /* OPTIONAL */
514 typedef struct Z_Entry
519 Z_Entry_surrogateDiagnostic
523 Z_TermInfo *termInfo;
524 Z_DiagRec *surrogateDiagnostic;
528 typedef struct Z_Entries
534 typedef struct Z_DiagRecs
537 Z_DiagRec **diagRecs;
540 typedef struct Z_ListEntries
544 Z_ListEntries_entries,
545 Z_ListEntries_nonSurrogateDiagnostics
550 Z_DiagRecs *nonSurrogateDiagnostics;
554 typedef struct Z_ScanRequest
556 Z_ReferenceId *referenceId; /* OPTIONAL */
557 int num_databaseNames;
558 char **databaseNames;
559 Odr_oid *attributeSet; /* OPTIONAL */
561 Z_AttributesPlusTerm *termListAndStartPoint;
562 int *stepSize; /* OPTIONAL */
563 int *numberOfTermsRequested;
564 int *preferredPositionInResponse; /* OPTIONAL */
567 typedef struct Z_ScanResponse
569 Z_ReferenceId *referenceId; /* OPTIONAL */
570 int *stepSize; /* OPTIONAL */
572 #define Z_Scan_success 0
573 #define Z_Scan_partial_1 1
574 #define Z_Scan_partial_2 2
575 #define Z_Scan_partial_3 3
576 #define Z_Scan_partial_4 4
577 #define Z_Scan_partial_5 5
578 #define Z_Scan_failure 6
579 int *numberOfEntriesReturned;
580 int *positionOfTerm; /* OPTIONAL */
581 Z_ListEntries *entries; /* OPTIONAL */
582 Odr_oid *attributeSet; /* OPTIONAL */
585 /* ------------------------ SEARCHRESPONSE ------------------ */
587 typedef struct Z_SearchResponse
589 Z_ReferenceId *referenceId; /* OPTIONAL */
591 int *numberOfRecordsReturned;
592 int *nextResultSetPosition;
593 bool_t *searchStatus;
594 int *resultSetStatus; /* OPTIONAL */
595 #define Z_RES_SUBSET 1
596 #define Z_RES_INTERIM 2
598 int *presentStatus; /* OPTIONAL */
599 #define Z_PRES_SUCCESS 0
600 #define Z_PRES_PARTIAL_1 1
601 #define Z_PRES_PARTIAL_2 2
602 #define Z_PRES_PARTIAL_3 3
603 #define Z_PRES_PARTIAL_4 4
604 #define Z_PRES_FAILURE 5
605 Z_Records *records; /* OPTIONAL */
608 /* ------------------------- PRESENT SERVICE -----------------*/
610 typedef struct Z_PresentRequest
612 Z_ReferenceId *referenceId; /* OPTIONAL */
613 Z_ResultSetId *resultSetId;
614 int *resultSetStartPoint;
615 int *numberOfRecordsRequested;
616 Z_ElementSetNames *elementSetNames; /* OPTIONAL */
617 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
620 typedef struct Z_PresentResponse
622 Z_ReferenceId *referenceId; /* OPTIONAL */
623 int *numberOfRecordsReturned;
624 int *nextResultSetPosition;
629 /* ------------------------ DELETE -------------------------- */
631 #define Z_DeleteStatus_success 0
632 #define Z_DeleteStatus_resultSetDidNotExist 1
633 #define Z_DeleteStatus_previouslyDeletedByTarget 2
634 #define Z_DeleteStatus_systemProblemAtTarget 3
635 #define Z_DeleteStatus_accessNotAllowed 4
636 #define Z_DeleteStatus_resourceControlAtOrigin 5
637 #define Z_DeleteStatus_resourceControlAtTarget 6
638 #define Z_DeleteStatus_bulkDeleteNotSupported 7
639 #define Z_DeleteStatus_notAllRsltSetsDeletedOnBulkDlte 8
640 #define Z_DeleteStatus_notAllRequestedResultSetsDeleted 9
641 #define Z_DeleteStatus_resultSetInUse 10
643 typedef struct Z_ListStatus
649 typedef struct Z_DeleteResultSetRequest
651 Z_ReferenceId *referenceId; /* OPTIONAL */
653 #define Z_DeleteRequest_list 0
654 #define Z_DeleteRequest_all 1
656 Z_ResultSetId **resultSetList; /* OPTIONAL */
658 Z_OtherInformation *otherInfo;
660 } Z_DeleteResultSetRequest;
662 typedef struct Z_DeleteResultSetResponse
664 Z_ReferenceId *referenceId; /* OPTIONAL */
665 int *deleteOperationStatus;
667 Z_ListStatus *deleteListStatuses; /* OPTIONAL */
668 int *numberNotDeleted; /* OPTIONAL */
669 int num_bulkStatuses;
670 Z_ListStatus *bulkStatuses; /* OPTIONAL */
671 char *deleteMessage; /* OPTIONAL */
673 Z_OtherInformation *otherInfo;
675 } Z_DeleteResultSetResponse;
677 /* ------------------------ APDU ---------------------------- */
679 typedef struct Z_APDU
685 Z_APDU_searchRequest,
686 Z_APDU_searchResponse,
687 Z_APDU_presentRequest,
688 Z_APDU_presentResponse,
689 Z_APDU_deleteResultSetRequest,
690 Z_APDU_deleteResultSetResponse,
691 Z_APDU_resourceControlRequest,
692 Z_APDU_resourceControlResponse,
693 Z_APDU_triggerResourceControlRequest,
699 Z_InitRequest *initRequest;
700 Z_InitResponse *initResponse;
701 Z_SearchRequest *searchRequest;
702 Z_SearchResponse *searchResponse;
703 Z_PresentRequest *presentRequest;
704 Z_PresentResponse *presentResponse;
705 Z_DeleteResultSetRequest *deleteResultSetRequest;
706 Z_DeleteResultSetResponse *deleteResultSetResponse;
707 Z_ResourceControlRequest *resourceControlRequest;
708 Z_ResourceControlResponse *resourceControlResponse;
709 Z_TriggerResourceControlRequest *triggerResourceControlRequest;
710 Z_ScanRequest *scanRequest;
711 Z_ScanResponse *scanResponse;
715 int z_APDU(ODR o, Z_APDU **p, int opt);