2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.6 1995-05-15 11:55:55 quinn
8 * Work on asynchronous activity.
10 * Revision 1.5 1995/04/17 11:28:18 quinn
13 * Revision 1.4 1995/04/10 10:22:47 quinn
16 * Revision 1.3 1995/03/30 12:18:09 quinn
19 * Revision 1.2 1995/03/30 10:26:48 quinn
20 * Added Term structure
22 * Revision 1.1 1995/03/30 09:39:42 quinn
23 * Moved .h files to include directory
25 * Revision 1.11 1995/03/30 09:08:44 quinn
26 * Added Resource control protocol
28 * Revision 1.10 1995/03/29 15:39:39 quinn
29 * Adding some resource control elements, and a null-check to getentbyoid
31 * Revision 1.9 1995/03/29 08:06:18 quinn
32 * Added a few v3 elements
34 * Revision 1.8 1995/03/22 10:12:49 quinn
35 * Added Z_PRES constants.
37 * Revision 1.7 1995/03/20 09:45:12 quinn
40 * Revision 1.5 1995/03/07 16:29:34 quinn
41 * Added authentication stuff.
43 * Revision 1.4 1995/03/07 10:13:00 quinn
44 * Added prototype for z_APDU()
46 * Revision 1.3 1995/02/14 11:54:23 quinn
49 * Revision 1.2 1995/02/09 15:51:40 quinn
52 * Revision 1.1 1995/02/06 16:44:48 quinn
53 * First hack at Z/SR protocol
63 /* ----------------- GLOBAL AUXILIARY DEFS ----------------*/
65 typedef Odr_oct Z_ReferenceId;
66 typedef char Z_DatabaseName;
67 typedef char Z_ResultSetId;
68 typedef Odr_oct Z_ResultsetId;
69 typedef Odr_external Z_UserInformationField;
71 /* ----------------- INIT SERVICE ----------------*/
75 char *groupId; /* OPTIONAL */
76 char *userId; /* OPTIONAL */
77 char *password; /* OPTIONAL */
80 typedef struct Z_IdAuthentication
84 Z_IdAuthentication_open,
85 Z_IdAuthentication_idPass,
86 Z_IdAuthentication_anonymous,
87 Z_IdAuthentication_other
93 void *anonymous; /* NULL */
98 #define Z_ProtocolVersion_1 0
99 #define Z_ProtocolVersion_2 1
100 #define Z_ProtocolVersion_3 2
102 #define Z_Options_search 0
103 #define Z_Options_present 1
104 #define Z_Options_delSet 2
105 #define Z_Options_resourceReport 3
106 #define Z_Options_triggerResourceCtrl 4
107 #define Z_Options_resourceCtrl 5
108 #define Z_Options_accessCtrl 6
109 #define Z_Options_scan 7
110 #define Z_Options_sort 8
111 #define Z_Options_reserved 9
112 #define Z_Options_extendedServices 10
113 #define Z_Options_level_1Segmentation 11
114 #define Z_Options_level_2Segmentation 12
115 #define Z_Options_concurrentOperations 13
116 #define Z_Options_namedResultSets 14
118 typedef struct Z_InitRequest
120 Z_ReferenceId *referenceId; /* OPTIONAL */
121 Odr_bitmask *options;
122 Odr_bitmask *protocolVersion;
123 int *preferredMessageSize;
124 int *maximumRecordSize;
125 Z_IdAuthentication* idAuthentication; /* OPTIONAL */
126 char *implementationId; /* OPTIONAL */
127 char *implementationName; /* OPTIONAL */
128 char *implementationVersion; /* OPTIONAL */
129 Z_UserInformationField *userInformationField; /* OPTIONAL */
132 typedef struct Z_InitResponse
134 Z_ReferenceId *referenceId; /* OPTIONAL */
135 Odr_bitmask *options;
136 Odr_bitmask *protocolVersion;
137 int *preferredMessageSize;
138 int *maximumRecordSize;
140 char *implementationId; /* OPTIONAL */
141 char *implementationName; /* OPTIONAL */
142 char *implementationVersion; /* OPTIONAL */
143 Z_UserInformationField *userInformationField; /* OPTIONAL */
146 typedef struct Z_NSRAuthentication
151 } Z_NSRAuthentication;
153 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt);
155 int z_StrAuthentication(ODR o, char **p, int opt);
158 /* ------------------ RESOURCE CONTROL ----------------*/
160 typedef struct Z_TriggerResourceControlRequest
162 Z_ReferenceId *referenceId; /* OPTIONAL */
163 int *requestedAction;
164 #define Z_TriggerResourceCtrl_resourceReport 1
165 #define Z_TriggerResourceCtrl_resourceControl 2
166 #define Z_TriggerResourceCtrl_cancel 3
167 Odr_oid *prefResourceReportFormat; /* OPTIONAL */
168 bool_t *resultSetWanted; /* OPTIONAL */
169 } Z_TriggerResourceControlRequest;
171 typedef struct Z_ResourceControlRequest
173 Z_ReferenceId *referenceId; /* OPTIONAL */
174 bool_t *suspendedFlag; /* OPTIONAL */
175 Odr_external *resourceReport; /* OPTIONAL */
176 int *partialResultsAvailable; /* OPTIONAL */
177 #define Z_ResourceControlRequest_subset 1
178 #define Z_ResourceControlRequest_interim 2
179 #define Z_ResourceControlRequest_none 3
180 bool_t *responseRequired;
181 bool_t *triggeredRequestFlag; /* OPTIONAL */
182 } Z_ResourceControlRequest;
184 typedef struct Z_ResourceControlResponse
186 Z_ReferenceId *referenceId; /* OPTIONAL */
187 bool_t *continueFlag;
188 bool_t *resultSetWanted; /* OPTIONAL */
189 } Z_ResourceControlResponse;
191 /* ------------------ SEARCH SERVICE ----------------*/
193 typedef Odr_oid Z_PreferredRecordSyntax;
195 typedef struct Z_DatabaseSpecificUnit
198 char *elementSetName;
199 } Z_DatabaseSpecificUnit;
201 typedef struct Z_DatabaseSpecific
204 Z_DatabaseSpecificUnit **elements;
205 } Z_DatabaseSpecific;
207 typedef struct Z_ElementSetNames
210 #define Z_ElementSetNames_generic 0
211 #define Z_ElementSetNames_databaseSpecific 1
215 Z_DatabaseSpecific *databaseSpecific;
219 /* ---------------------- RPN QUERY --------------------------- */
221 typedef struct Z_AttributeElement
225 } Z_AttributeElement;
230 typedef struct Z_Term
236 Z_Term_characterString,
240 Z_Term_integerAndUnit,
245 Odr_oct *general; /* this is required for v2 */
247 char *characterString;
250 Odr_external *external;
251 /* Z_IntUnit *integerAndUnit; */
258 typedef struct Z_AttributesPlusTerm
261 Z_AttributeElement **attributeList;
267 } Z_AttributesPlusTerm;
269 typedef struct Z_ProximityOperator
271 bool_t *exclusion; /* OPTIONAL */
277 Z_ProximityOperator_known,
278 Z_ProximityOperator_private
285 } Z_ProximityOperator;
287 typedef struct Z_Operator
298 void *and; /* these guys are nulls. */
301 Z_ProximityOperator *proximity;
305 typedef struct Z_Operand
308 #define Z_Operand_APT 0
309 #define Z_Operand_resultSetId 1
312 Z_AttributesPlusTerm *attributesPlusTerm;
313 Z_ResultSetId *resultSetId;
317 typedef struct Z_Complex
319 struct Z_RPNStructure *s1;
320 struct Z_RPNStructure *s2;
321 Z_Operator *operator;
324 typedef struct Z_RPNStructure
327 #define Z_RPNStructure_simple 0
328 #define Z_RPNStructure_complex 1
336 typedef struct Z_RPNQuery
338 Odr_oid *attributeSetId;
339 Z_RPNStructure *RPNStructure;
342 /* -------------------------- SEARCHREQUEST -------------------------- */
344 typedef struct Z_Query
347 #define Z_Query_type_1 1
348 #define Z_Query_type_2 2
356 typedef struct Z_SearchRequest
358 Z_ReferenceId *referenceId; /* OPTIONAL */
359 int *smallSetUpperBound;
360 int *largeSetLowerBound;
361 int *mediumSetPresentNumber;
362 bool_t *replaceIndicator;
364 int num_databaseNames;
365 char **databaseNames;
366 Z_ElementSetNames *smallSetElementSetNames; /* OPTIONAL */
367 Z_ElementSetNames *mediumSetElementSetNames; /* OPTIONAL */
368 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
372 /* ------------------------ RECORD -------------------------- */
374 typedef Odr_external Z_DatabaseRecord;
376 typedef struct Z_DiagRec
378 Odr_oid *diagnosticSetId;
383 typedef struct Z_NamePlusRecord
385 char *databaseName; /* OPTIONAL */
387 #define Z_NamePlusRecord_databaseRecord 0
388 #define Z_NamePlusRecord_surrogateDiagnostic 1
391 Z_DatabaseRecord *databaseRecord;
392 Z_DiagRec *surrogateDiagnostic;
396 typedef struct Z_NamePlusRecordList
399 Z_NamePlusRecord **records;
400 } Z_NamePlusRecordList;
402 typedef struct Z_Records
405 #define Z_Records_DBOSD 0
406 #define Z_Records_NSD 1
409 Z_NamePlusRecordList *databaseOrSurDiagnostics;
410 Z_DiagRec *nonSurrogateDiagnostic;
414 /* ------------------------ SCAN SERVICE -------------------- */
416 typedef struct Z_AttributeList
419 Z_AttributeElement **attributes;
422 typedef struct Z_AlternativeTerm
425 Z_AttributesPlusTerm **terms;
428 typedef struct Z_OccurrenceByAttributes
430 Z_AttributeList *attributes;
442 /* Z_ByDatabase *byDatabase; */
445 } Z_OccurrenceByAttributes;
447 typedef struct Z_TermInfo
450 Z_AttributeList *suggestedAttributes; /* OPTIONAL */
451 Z_AlternativeTerm *alternativeTerm; /* OPTIONAL */
452 int *globalOccurrences; /* OPTIONAL */
453 Z_OccurrenceByAttributes *byAttributes; /* OPTIONAL */
456 typedef struct Z_Entry
461 Z_Entry_surrogateDiagnostic
465 Z_TermInfo *termInfo;
466 Z_DiagRec *surrogateDiagnostic;
470 typedef struct Z_Entries
476 typedef struct Z_DiagRecs
479 Z_DiagRec **diagRecs;
482 typedef struct Z_ListEntries
486 Z_ListEntries_entries,
487 Z_ListEntries_nonSurrogateDiagnostics
492 Z_DiagRecs *nonSurrogateDiagnostics;
496 typedef struct Z_ScanRequest
498 Z_ReferenceId *referenceId; /* OPTIONAL */
499 int num_databaseNames;
500 char **databaseNames;
501 Odr_oid *attributeSet; /* OPTIONAL */
503 Z_AttributesPlusTerm *termListAndStartPoint;
504 int *stepSize; /* OPTIONAL */
505 int *numberOfTermsRequested;
506 int *preferredPositionInResponse; /* OPTIONAL */
509 typedef struct Z_ScanResponse
511 Z_ReferenceId *referenceId; /* OPTIONAL */
512 int *stepSize; /* OPTIONAL */
514 #define Z_Scan_success 0
515 #define Z_Scan_partial_1 1
516 #define Z_Scan_partial_2 2
517 #define Z_Scan_partial_3 3
518 #define Z_Scan_partial_4 4
519 #define Z_Scan_partial_5 5
520 #define Z_Scan_failure 6
521 int *numberOfEntriesReturned;
522 int *positionOfTerm; /* OPTIONAL */
523 Z_ListEntries *entries; /* OPTIONAL */
524 Odr_oid *attributeSet; /* OPTIONAL */
527 /* ------------------------ SEARCHRESPONSE ------------------ */
529 typedef struct Z_SearchResponse
531 Z_ReferenceId *referenceId; /* OPTIONAL */
533 int *numberOfRecordsReturned;
534 int *nextResultSetPosition;
535 bool_t *searchStatus;
536 int *resultSetStatus; /* OPTIONAL */
537 #define Z_RES_SUBSET 1
538 #define Z_RES_INTERIM 2
540 int *presentStatus; /* OPTIONAL */
541 #define Z_PRES_SUCCESS 0
542 #define Z_PRES_PARTIAL_1 1
543 #define Z_PRES_PARTIAL_2 2
544 #define Z_PRES_PARTIAL_3 3
545 #define Z_PRES_PARTIAL_4 4
546 #define Z_PRES_FAILURE 5
547 Z_Records *records; /* OPTIONAL */
550 /* ------------------------- PRESENT SERVICE -----------------*/
552 typedef struct Z_PresentRequest
554 Z_ReferenceId *referenceId; /* OPTIONAL */
555 Z_ResultSetId *resultSetId;
556 int *resultSetStartPoint;
557 int *numberOfRecordsRequested;
558 Z_ElementSetNames *elementSetNames; /* OPTIONAL */
559 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
562 typedef struct Z_PresentResponse
564 Z_ReferenceId *referenceId; /* OPTIONAL */
565 int *numberOfRecordsReturned;
566 int *nextResultSetPosition;
571 /* ------------------------ DELETE -------------------------- */
573 typedef struct Z_ListStatus
579 typedef struct Z_DeleteResultSetRequest
581 Z_ReferenceId *referenceId; /* OPTIONAL */
583 #define Z_DeleteRequest_list 0
584 #define Z_DeleteRequest_all 1
586 Z_ResultSetId *resultSetList; /* OPTIONAL */
587 } Z_DeleteResultSetRequest;
589 typedef enum Z_DeleteSetStatus
591 Z_Delete_success = 0,
592 Z_Delete_resultSetDidNotExist,
593 Z_Delete_previouslyDeletedByTarget,
594 Z_Delete_systemProblemAtTarget,
595 Z_Delete_accessNotAllowed,
596 Z_Delete_resourceControlAtOrigin,
597 Z_Delete_resourceControlAtTarget,
598 Z_Delete_bulkDeleteNotSupported,
599 Z_Delete_notAllRsltSetsDeletedOnBulkDlte,
600 Z_Delete_notAllRequestedResultSetsDeleted,
601 Z_Delete_resultSetInUse
604 typedef struct Z_DeleteResultSetResponse
606 Z_ReferenceId *referenceId; /* OPTIONAL */
607 int *deleteOperationStatus;
609 Z_ListStatus *deleteListStatuses; /* OPTIONAL */
610 int *numberNotDeleted; /* OPTIONAL */
611 int num_bulkstatuses;
612 Z_ListStatus *bulkStatuses; /* OPTIONAL */
613 char *deleteMessage; /* OPTIONAL */
614 } Z_DeleteResultSetResponse;
616 /* ------------------------ APDU ---------------------------- */
618 typedef struct Z_APDU
624 Z_APDU_searchRequest,
625 Z_APDU_searchResponse,
626 Z_APDU_presentRequest,
627 Z_APDU_presentResponse,
628 Z_APDU_resourceControlRequest,
629 Z_APDU_resourceControlResponse,
630 Z_APDU_triggerResourceControlRequest,
636 Z_InitRequest *initRequest;
637 Z_InitResponse *initResponse;
638 Z_SearchRequest *searchRequest;
639 Z_SearchResponse *searchResponse;
640 Z_PresentRequest *presentRequest;
641 Z_PresentResponse *presentResponse;
642 Z_ResourceControlRequest *resourceControlRequest;
643 Z_ResourceControlResponse *resourceControlResponse;
644 Z_TriggerResourceControlRequest *triggerResourceControlRequest;
645 Z_ScanRequest *scanRequest;
646 Z_ScanResponse *scanResponse;
650 int z_APDU(ODR o, Z_APDU **p, int opt);