2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.5 1995-04-17 11:28:18 quinn
10 * Revision 1.4 1995/04/10 10:22:47 quinn
13 * Revision 1.3 1995/03/30 12:18:09 quinn
16 * Revision 1.2 1995/03/30 10:26:48 quinn
17 * Added Term structure
19 * Revision 1.1 1995/03/30 09:39:42 quinn
20 * Moved .h files to include directory
22 * Revision 1.11 1995/03/30 09:08:44 quinn
23 * Added Resource control protocol
25 * Revision 1.10 1995/03/29 15:39:39 quinn
26 * Adding some resource control elements, and a null-check to getentbyoid
28 * Revision 1.9 1995/03/29 08:06:18 quinn
29 * Added a few v3 elements
31 * Revision 1.8 1995/03/22 10:12:49 quinn
32 * Added Z_PRES constants.
34 * Revision 1.7 1995/03/20 09:45:12 quinn
37 * Revision 1.5 1995/03/07 16:29:34 quinn
38 * Added authentication stuff.
40 * Revision 1.4 1995/03/07 10:13:00 quinn
41 * Added prototype for z_APDU()
43 * Revision 1.3 1995/02/14 11:54:23 quinn
46 * Revision 1.2 1995/02/09 15:51:40 quinn
49 * Revision 1.1 1995/02/06 16:44:48 quinn
50 * First hack at Z/SR protocol
60 /* ----------------- GLOBAL AUXILIARY DEFS ----------------*/
62 typedef Odr_oct Z_ReferenceId;
63 typedef char Z_DatabaseName;
64 typedef char Z_ResultSetId;
65 typedef Odr_oct Z_ResultsetId;
66 typedef Odr_external Z_UserInformationField;
68 /* ----------------- INIT SERVICE ----------------*/
72 char *groupId; /* OPTIONAL */
73 char *userId; /* OPTIONAL */
74 char *password; /* OPTIONAL */
77 typedef struct Z_IdAuthentication
81 Z_IdAuthentication_open,
82 Z_IdAuthentication_idPass,
83 Z_IdAuthentication_anonymous,
84 Z_IdAuthentication_other
90 void *anonymous; /* NULL */
95 #define Z_ProtocolVersion_1 0
96 #define Z_ProtocolVersion_2 1
97 #define Z_ProtocolVersion_3 2
99 #define Z_Options_search 0
100 #define Z_Options_present 1
101 #define Z_Options_delSet 2
102 #define Z_Options_resourceReport 3
103 #define Z_Options_triggerResourceCtrl 4
104 #define Z_Options_resourceCtrl 5
105 #define Z_Options_accessCtrl 6
106 #define Z_Options_scan 7
107 #define Z_Options_sort 8
108 #define Z_Options_reserved 9
109 #define Z_Options_extendedServices 10
110 #define Z_Options_level_1Segmentation 11
111 #define Z_Options_level_2Segmentation 12
112 #define Z_Options_concurrentOperations 13
113 #define Z_Options_namedResultSets 14
115 typedef struct Z_InitRequest
117 Z_ReferenceId *referenceId; /* OPTIONAL */
118 Odr_bitmask *options;
119 Odr_bitmask *protocolVersion;
120 int *preferredMessageSize;
121 int *maximumRecordSize;
122 Z_IdAuthentication* idAuthentication; /* OPTIONAL */
123 char *implementationId; /* OPTIONAL */
124 char *implementationName; /* OPTIONAL */
125 char *implementationVersion; /* OPTIONAL */
126 Z_UserInformationField *userInformationField; /* OPTIONAL */
129 typedef struct Z_InitResponse
131 Z_ReferenceId *referenceId; /* OPTIONAL */
132 Odr_bitmask *options;
133 Odr_bitmask *protocolVersion;
134 int *preferredMessageSize;
135 int *maximumRecordSize;
137 char *implementationId; /* OPTIONAL */
138 char *implementationName; /* OPTIONAL */
139 char *implementationVersion; /* OPTIONAL */
140 Z_UserInformationField *userInformationField; /* OPTIONAL */
143 typedef struct Z_NSRAuthentication
148 } Z_NSRAuthentication;
150 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt);
152 int z_StrAuthentication(ODR o, char **p, int opt);
155 /* ------------------ RESOURCE CONTROL ----------------*/
157 typedef struct Z_TriggerResourceControlRequest
159 Z_ReferenceId *referenceId; /* OPTIONAL */
160 int *requestedAction;
161 #define Z_TriggerResourceCtrl_resourceReport 1
162 #define Z_TriggerResourceCtrl_resourceControl 2
163 #define Z_TriggerResourceCtrl_cancel 3
164 Odr_oid *prefResourceReportFormat; /* OPTIONAL */
165 bool_t *resultSetWanted; /* OPTIONAL */
166 } Z_TriggerResourceControlRequest;
168 typedef struct Z_ResourceControlRequest
170 Z_ReferenceId *referenceId; /* OPTIONAL */
171 bool_t *suspendedFlag; /* OPTIONAL */
172 Odr_external *resourceReport; /* OPTIONAL */
173 int *partialResultsAvailable; /* OPTIONAL */
174 #define Z_ResourceControlRequest_subset 1
175 #define Z_ResourceControlRequest_interim 2
176 #define Z_ResourceControlRequest_none 3
177 bool_t *responseRequired;
178 bool_t *triggeredRequestFlag; /* OPTIONAL */
179 } Z_ResourceControlRequest;
181 typedef struct Z_ResourceControlResponse
183 Z_ReferenceId *referenceId; /* OPTIONAL */
184 bool_t *continueFlag;
185 bool_t *resultSetWanted; /* OPTIONAL */
186 } Z_ResourceControlResponse;
188 /* ------------------ SEARCH SERVICE ----------------*/
190 typedef Odr_oid Z_PreferredRecordSyntax;
192 typedef struct Z_DatabaseSpecificUnit
195 char *elementSetName;
196 } Z_DatabaseSpecificUnit;
198 typedef struct Z_DatabaseSpecific
201 Z_DatabaseSpecificUnit **elements;
202 } Z_DatabaseSpecific;
204 typedef struct Z_ElementSetNames
207 #define Z_ElementSetNames_generic 0
208 #define Z_ElementSetNames_databaseSpecific 1
212 Z_DatabaseSpecific *databaseSpecific;
216 /* ---------------------- RPN QUERY --------------------------- */
218 typedef struct Z_AttributeElement
222 } Z_AttributeElement;
227 typedef struct Z_Term
233 Z_Term_characterString,
237 Z_Term_integerAndUnit,
242 Odr_oct *general; /* this is required for v2 */
244 char *characterString;
247 Odr_external *external;
248 /* Z_IntUnit *integerAndUnit; */
255 typedef struct Z_AttributesPlusTerm
258 Z_AttributeElement **attributeList;
264 } Z_AttributesPlusTerm;
266 typedef struct Z_ProximityOperator
268 bool_t *exclusion; /* OPTIONAL */
274 Z_ProximityOperator_known,
275 Z_ProximityOperator_private
282 } Z_ProximityOperator;
284 typedef struct Z_Operator
295 void *and; /* these guys are nulls. */
298 Z_ProximityOperator *proximity;
302 typedef struct Z_Operand
305 #define Z_Operand_APT 0
306 #define Z_Operand_resultSetId 1
309 Z_AttributesPlusTerm *attributesPlusTerm;
310 Z_ResultSetId *resultSetId;
314 typedef struct Z_Complex
316 struct Z_RPNStructure *s1;
317 struct Z_RPNStructure *s2;
318 Z_Operator *operator;
321 typedef struct Z_RPNStructure
324 #define Z_RPNStructure_simple 0
325 #define Z_RPNStructure_complex 1
333 typedef struct Z_RPNQuery
335 Odr_oid *attributeSetId;
336 Z_RPNStructure *RPNStructure;
339 /* -------------------------- SEARCHREQUEST -------------------------- */
341 typedef struct Z_Query
344 #define Z_Query_type_1 1
345 #define Z_Query_type_2 2
353 typedef struct Z_SearchRequest
355 Z_ReferenceId *referenceId; /* OPTIONAL */
356 int *smallSetUpperBound;
357 int *largeSetLowerBound;
358 int *mediumSetPresentNumber;
359 bool_t *replaceIndicator;
361 int num_databaseNames;
362 char **databaseNames;
363 Z_ElementSetNames *smallSetElementSetNames; /* OPTIONAL */
364 Z_ElementSetNames *mediumSetElementSetNames; /* OPTIONAL */
365 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
369 /* ------------------------ RECORD -------------------------- */
371 typedef Odr_external Z_DatabaseRecord;
373 typedef struct Z_DiagRec
375 Odr_oid *diagnosticSetId;
380 typedef struct Z_NamePlusRecord
382 char *databaseName; /* OPTIONAL */
384 #define Z_NamePlusRecord_databaseRecord 0
385 #define Z_NamePlusRecord_surrogateDiagnostic 1
388 Z_DatabaseRecord *databaseRecord;
389 Z_DiagRec *surrogateDiagnostic;
393 typedef struct Z_NamePlusRecordList
396 Z_NamePlusRecord **records;
397 } Z_NamePlusRecordList;
399 typedef struct Z_Records
402 #define Z_Records_DBOSD 0
403 #define Z_Records_NSD 1
406 Z_NamePlusRecordList *databaseOrSurDiagnostics;
407 Z_DiagRec *nonSurrogateDiagnostic;
411 /* ------------------------ SCAN SERVICE -------------------- */
413 typedef struct Z_AttributeList
416 Z_AttributeElement **attributes;
419 typedef struct Z_AlternativeTerm
422 Z_AttributesPlusTerm **terms;
425 typedef struct Z_OccurrenceByAttributes
427 Z_AttributeList *attributes;
439 /* Z_ByDatabase *byDatabase; */
442 } Z_OccurrenceByAttributes;
444 typedef struct Z_TermInfo
447 Z_AttributeList *suggestedAttributes; /* OPTIONAL */
448 Z_AlternativeTerm *alternativeTerm; /* OPTIONAL */
449 int *globalOccurrences; /* OPTIONAL */
450 Z_OccurrenceByAttributes *byAttributes; /* OPTIONAL */
453 typedef struct Z_Entry
458 Z_Entry_surrogateDiagnostic
462 Z_TermInfo *termInfo;
463 Z_DiagRec *surrogateDiagnostic;
467 typedef struct Z_Entries
473 typedef struct Z_DiagRecs
476 Z_DiagRec **diagRecs;
479 typedef struct Z_ListEntries
483 Z_ListEntries_entries,
484 Z_ListEntries_nonSurrogateDiagnostics
489 Z_DiagRecs *nonSurrogateDiagnostics;
493 typedef struct Z_ScanRequest
495 Z_ReferenceId *referenceId; /* OPTIONAL */
496 int num_databaseNames;
497 char **databaseNames;
498 Odr_oid *attributeSet; /* OPTIONAL */
500 Z_AttributesPlusTerm *termListAndStartPoint;
501 int *stepSize; /* OPTIONAL */
502 int *numberOfTermsRequested;
503 int *preferredPositionInResponse; /* OPTIONAL */
506 typedef struct Z_ScanResponse
508 Z_ReferenceId *referenceId; /* OPTIONAL */
509 int *stepSize; /* OPTIONAL */
511 #define Z_Scan_success 0
512 #define Z_Scan_partial_1 1
513 #define Z_Scan_partial_2 2
514 #define Z_Scan_partial_3 3
515 #define Z_Scan_partial_4 4
516 #define Z_Scan_partial_5 5
517 #define Z_Scan_failure 6
518 int *numberOfEntriesReturned;
519 int *positionOfTerm; /* OPTIONAL */
520 Z_ListEntries *entries; /* OPTIONAL */
521 Odr_oid *attributeSet; /* OPTIONAL */
524 /* ------------------------ SEARCHRESPONSE ------------------ */
526 typedef struct Z_SearchResponse
528 Z_ReferenceId *referenceId; /* OPTIONAL */
530 int *numberOfRecordsReturned;
531 int *nextResultSetPosition;
532 bool_t *searchStatus;
533 int *resultSetStatus; /* OPTIONAL */
534 #define Z_RES_SUBSET 1
535 #define Z_RES_INTERIM 2
537 int *presentStatus; /* OPTIONAL */
538 #define Z_PRES_SUCCESS 0
539 #define Z_PRES_PARTIAL_1 1
540 #define Z_PRES_PARTIAL_2 2
541 #define Z_PRES_PARTIAL_3 3
542 #define Z_PRES_PARTIAL_4 4
543 #define Z_PRES_FAILURE 5
544 Z_Records *records; /* OPTIONAL */
547 /* ------------------------- PRESENT SERVICE -----------------*/
549 typedef struct Z_PresentRequest
551 Z_ReferenceId *referenceId; /* OPTIONAL */
552 Z_ResultSetId *resultSetId;
553 int *resultSetStartPoint;
554 int *numberOfRecordsRequested;
555 Z_ElementSetNames *elementSetNames; /* OPTIONAL */
556 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
559 typedef struct Z_PresentResponse
561 Z_ReferenceId *referenceId; /* OPTIONAL */
562 int *numberOfRecordsReturned;
563 int *nextResultSetPosition;
568 /* ------------------------ DELETE -------------------------- */
570 typedef struct Z_ListStatus
576 typedef struct Z_DeleteResultSetRequest
578 Z_ReferenceId *referenceId; /* OPTIONAL */
580 #define Z_DeleteRequest_list 0
581 #define Z_DeleteRequest_all 1
583 Z_ResultSetId *resultSetList; /* OPTIONAL */
584 } Z_DeleteResultSetRequest;
586 typedef enum Z_DeleteSetStatus
588 Z_Delete_success = 0,
589 Z_Delete_resultSetDidNotExist,
590 Z_Delete_previouslyDeletedByTarget,
591 Z_Delete_systemProblemAtTarget,
592 Z_Delete_accessNotAllowed,
593 Z_Delete_resourceControlAtOrigin,
594 Z_Delete_resourceControlAtTarget,
595 Z_Delete_bulkDeleteNotSupported,
596 Z_Delete_notAllRsltSetsDeletedOnBulkDlte,
597 Z_Delete_notAllRequestedResultSetsDeleted,
598 Z_Delete_resultSetInUse
601 typedef struct Z_DeleteResultSetResponse
603 Z_ReferenceId *referenceId; /* OPTIONAL */
604 int *deleteOperationStatus;
606 Z_ListStatus *deleteListStatuses; /* OPTIONAL */
607 int *numberNotDeleted; /* OPTIONAL */
608 int num_bulkstatuses;
609 Z_ListStatus *bulkStatuses; /* OPTIONAL */
610 char *deleteMessage; /* OPTIONAL */
611 } Z_DeleteResultSetResponse;
613 /* ------------------------ APDU ---------------------------- */
615 typedef struct Z_APDU
621 Z_APDU_searchRequest,
622 Z_APDU_searchResponse,
623 Z_APDU_presentRequest,
624 Z_APDU_presentResponse,
630 Z_InitRequest *initRequest;
631 Z_InitResponse *initResponse;
632 Z_SearchRequest *searchRequest;
633 Z_SearchResponse *searchResponse;
634 Z_PresentRequest *presentRequest;
635 Z_PresentResponse *presentResponse;
636 Z_ScanRequest *scanRequest;
637 Z_ScanResponse *scanResponse;
641 int z_APDU(ODR o, Z_APDU **p, int opt);