2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.4 1995-04-10 10:22:47 quinn
10 * Revision 1.3 1995/03/30 12:18:09 quinn
13 * Revision 1.2 1995/03/30 10:26:48 quinn
14 * Added Term structure
16 * Revision 1.1 1995/03/30 09:39:42 quinn
17 * Moved .h files to include directory
19 * Revision 1.11 1995/03/30 09:08:44 quinn
20 * Added Resource control protocol
22 * Revision 1.10 1995/03/29 15:39:39 quinn
23 * Adding some resource control elements, and a null-check to getentbyoid
25 * Revision 1.9 1995/03/29 08:06:18 quinn
26 * Added a few v3 elements
28 * Revision 1.8 1995/03/22 10:12:49 quinn
29 * Added Z_PRES constants.
31 * Revision 1.7 1995/03/20 09:45:12 quinn
34 * Revision 1.5 1995/03/07 16:29:34 quinn
35 * Added authentication stuff.
37 * Revision 1.4 1995/03/07 10:13:00 quinn
38 * Added prototype for z_APDU()
40 * Revision 1.3 1995/02/14 11:54:23 quinn
43 * Revision 1.2 1995/02/09 15:51:40 quinn
46 * Revision 1.1 1995/02/06 16:44:48 quinn
47 * First hack at Z/SR protocol
57 /* ----------------- GLOBAL AUXILIARY DEFS ----------------*/
59 typedef Odr_oct Z_ReferenceId;
60 typedef char Z_DatabaseName;
61 typedef char Z_ResultSetId;
62 typedef Odr_oct Z_ResultsetId;
63 typedef Odr_external Z_UserInformationField;
65 /* ----------------- INIT SERVICE ----------------*/
69 char *groupId; /* OPTIONAL */
70 char *userId; /* OPTIONAL */
71 char *password; /* OPTIONAL */
74 typedef struct Z_IdAuthentication
78 Z_IdAuthentication_open,
79 Z_IdAuthentication_idPass,
80 Z_IdAuthentication_anonymous,
81 Z_IdAuthentication_other
87 void *anonymous; /* NULL */
92 #define Z_ProtocolVersion_1 0
93 #define Z_ProtocolVersion_2 1
94 #define Z_ProtocolVersion_3 2
96 #define Z_Options_search 0
97 #define Z_Options_present 1
98 #define Z_Options_delSet 2
99 #define Z_Options_resourceReport 3
100 #define Z_Options_triggerResourceCtrl 4
101 #define Z_Options_resourceCtrl 5
102 #define Z_Options_accessCtrl 6
103 #define Z_Options_scan 7
104 #define Z_Options_sort 8
105 #define Z_Options_reserved 9
106 #define Z_Options_extendedServices 10
107 #define Z_Options_level_1Segmentation 11
108 #define Z_Options_level_2Segmentation 12
109 #define Z_Options_concurrentOperations 13
110 #define Z_Options_namedResultSets 14
112 typedef struct Z_InitRequest
114 Z_ReferenceId *referenceId; /* OPTIONAL */
115 Odr_bitmask *options;
116 Odr_bitmask *protocolVersion;
117 int *preferredMessageSize;
118 int *maximumRecordSize;
119 Z_IdAuthentication* idAuthentication; /* OPTIONAL */
120 char *implementationId; /* OPTIONAL */
121 char *implementationName; /* OPTIONAL */
122 char *implementationVersion; /* OPTIONAL */
123 Z_UserInformationField *userInformationField; /* OPTIONAL */
126 typedef struct Z_InitResponse
128 Z_ReferenceId *referenceId; /* OPTIONAL */
129 Odr_bitmask *options;
130 Odr_bitmask *protocolVersion;
131 int *preferredMessageSize;
132 int *maximumRecordSize;
134 char *implementationId; /* OPTIONAL */
135 char *implementationName; /* OPTIONAL */
136 char *implementationVersion; /* OPTIONAL */
137 Z_UserInformationField *userInformationField; /* OPTIONAL */
140 typedef struct Z_NSRAuthentication
145 } Z_NSRAuthentication;
147 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt);
149 int z_StrAuthentication(ODR o, char **p, int opt);
152 /* ------------------ RESOURCE CONTROL ----------------*/
154 typedef struct Z_TriggerResourceControlRequest
156 Z_ReferenceId *referenceId; /* OPTIONAL */
157 int *requestedAction;
158 #define Z_TriggerResourceCtrl_resourceReport 1
159 #define Z_TriggerResourceCtrl_resourceControl 2
160 #define Z_TriggerResourceCtrl_cancel 3
161 Odr_oid *prefResourceReportFormat; /* OPTIONAL */
162 bool_t *resultSetWanted; /* OPTIONAL */
163 } Z_TriggerResourceControlRequest;
165 typedef struct Z_ResourceControlRequest
167 Z_ReferenceId *referenceId; /* OPTIONAL */
168 bool_t *suspendedFlag; /* OPTIONAL */
169 Odr_external *resourceReport; /* OPTIONAL */
170 int *partialResultsAvailable; /* OPTIONAL */
171 #define Z_ResourceControlRequest_subset 1
172 #define Z_ResourceControlRequest_interim 2
173 #define Z_ResourceControlRequest_none 3
174 bool_t *responseRequired;
175 bool_t *triggeredRequestFlag; /* OPTIONAL */
176 } Z_ResourceControlRequest;
178 typedef struct Z_ResourceControlResponse
180 Z_ReferenceId *referenceId; /* OPTIONAL */
181 bool_t *continueFlag;
182 bool_t *resultSetWanted; /* OPTIONAL */
183 } Z_ResourceControlResponse;
185 /* ------------------ SEARCH SERVICE ----------------*/
187 typedef Odr_oid Z_PreferredRecordSyntax;
189 typedef struct Z_DatabaseSpecificUnit
192 char *elementSetName;
193 } Z_DatabaseSpecificUnit;
195 typedef struct Z_DatabaseSpecific
198 Z_DatabaseSpecificUnit **elements;
199 } Z_DatabaseSpecific;
201 typedef struct Z_ElementSetNames
204 #define Z_ElementSetNames_generic 0
205 #define Z_ElementSetNames_databaseSpecific 1
209 Z_DatabaseSpecific *databaseSpecific;
213 /* ---------------------- RPN QUERY --------------------------- */
215 typedef struct Z_AttributeElement
219 } Z_AttributeElement;
224 typedef struct Z_Term
230 Z_Term_characterString,
234 Z_Term_integerAndUnit,
239 Odr_oct *general; /* this is required for v2 */
241 char *characterString;
244 Odr_external *external;
245 /* Z_IntUnit *integerAndUnit; */
252 typedef struct Z_AttributesPlusTerm
255 Z_AttributeElement **attributeList;
261 } Z_AttributesPlusTerm;
263 typedef struct Z_ProximityOperator
265 bool_t *exclusion; /* OPTIONAL */
271 Z_ProximityOperator_known,
272 Z_ProximityOperator_private
279 } Z_ProximityOperator;
281 typedef struct Z_Operator
292 void *and; /* these guys are nulls. */
295 Z_ProximityOperator *proximity;
299 typedef struct Z_Operand
302 #define Z_Operand_APT 0
303 #define Z_Operand_resultSetId 1
306 Z_AttributesPlusTerm *attributesPlusTerm;
307 Z_ResultSetId *resultSetId;
311 typedef struct Z_Complex
313 struct Z_RPNStructure *s1;
314 struct Z_RPNStructure *s2;
315 Z_Operator *operator;
318 typedef struct Z_RPNStructure
321 #define Z_RPNStructure_simple 0
322 #define Z_RPNStructure_complex 1
330 typedef struct Z_RPNQuery
332 Odr_oid *attributeSetId;
333 Z_RPNStructure *RPNStructure;
336 /* -------------------------- SEARCHREQUEST -------------------------- */
338 typedef struct Z_Query
341 #define Z_Query_type_1 1
342 #define Z_Query_type_2 2
350 typedef struct Z_SearchRequest
352 Z_ReferenceId *referenceId; /* OPTIONAL */
353 int *smallSetUpperBound;
354 int *largeSetLowerBound;
355 int *mediumSetPresentNumber;
356 bool_t *replaceIndicator;
358 int num_databaseNames;
359 char **databaseNames;
360 Z_ElementSetNames *smallSetElementSetNames; /* OPTIONAL */
361 Z_ElementSetNames *mediumSetElementSetNames; /* OPTIONAL */
362 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
366 /* ------------------------ RECORD -------------------------- */
368 typedef Odr_external Z_DatabaseRecord;
370 typedef struct Z_DiagRec
372 Odr_oid *diagnosticSetId;
377 typedef struct Z_NamePlusRecord
379 char *databaseName; /* OPTIONAL */
381 #define Z_NamePlusRecord_databaseRecord 0
382 #define Z_NamePlusRecord_surrogateDiagnostic 1
385 Z_DatabaseRecord *databaseRecord;
386 Z_DiagRec *surrogateDiagnostic;
390 typedef struct Z_NamePlusRecordList
393 Z_NamePlusRecord **records;
394 } Z_NamePlusRecordList;
396 typedef struct Z_Records
399 #define Z_Records_DBOSD 0
400 #define Z_Records_NSD 1
403 Z_NamePlusRecordList *databaseOrSurDiagnostics;
404 Z_DiagRec *nonSurrogateDiagnostic;
408 /* ------------------------ SCAN SERVICE -------------------- */
410 typedef struct Z_AttributeList
413 Z_AttributeElement **attributes;
416 typedef struct Z_AlternativeTerm
419 Z_AttributesPlusTerm **terms;
422 typedef struct Z_OccurrenceByAttributes
424 Z_AttributeList *attributes;
436 /* Z_ByDatabase *byDatabase; */
439 } Z_OccurrenceByAttributes;
441 typedef struct Z_TermInfo
444 Z_AttributeList *suggestedAttributes; /* OPTIONAL */
445 Z_AlternativeTerm *alternativeTerm; /* OPTIONAL */
446 int *globalOccurrences; /* OPTIONAL */
447 Z_OccurrenceByAttributes *byAttributes; /* OPTIONAL */
450 typedef struct Z_Entry
455 Z_Entry_surrogateDiagnostic
459 Z_TermInfo *termInfo;
460 Z_DiagRec *surrogateDiagnostic;
464 typedef struct Z_Entries
470 typedef struct Z_DiagRecs
473 Z_DiagRec **diagRecs;
476 typedef struct Z_ListEntries
480 Z_ListEntries_entries,
481 Z_ListEntries_nonSurrogateDiagnostics
486 Z_DiagRecs *nonSurrogateDiagnostics;
490 typedef struct Z_ScanRequest
492 Z_ReferenceId *referenceId; /* OPTIONAL */
493 int num_databaseNames;
494 char **databaseNames;
495 Odr_oid *attributeSet; /* OPTIONAL */
497 Z_AttributesPlusTerm *termListAndStartPoint;
498 int *stepSize; /* OPTIONAL */
499 int *numberOfTermsRequested;
500 int *preferredPositionInResponse; /* OPTIONAL */
503 typedef struct Z_ScanResponse
505 Z_ReferenceId *referenceId; /* OPTIONAL */
506 int *stepSize; /* OPTIONAL */
508 #define Z_Scan_success 0
509 #define Z_Scan_partial_1 1
510 #define Z_Scan_partial_2 2
511 #define Z_Scan_partial_3 3
512 #define Z_Scan_partial_4 4
513 #define Z_Scan_partial_5 5
514 #define Z_Scan_failure 6
515 int *numberOfEntriesReturned;
516 int *positionOfTerm; /* OPTIONAL */
517 Z_ListEntries *entries; /* OPTIONAL */
518 Odr_oid *attributeSet; /* OPTIONAL */
521 /* ------------------------ SEARCHRESPONSE ------------------ */
523 typedef struct Z_SearchResponse
525 Z_ReferenceId *referenceId; /* OPTIONAL */
527 int *numberOfRecordsReturned;
528 int *nextResultSetPosition;
529 bool_t *searchStatus;
530 int *resultSetStatus; /* OPTIONAL */
531 #define Z_RES_SUBSET 1
532 #define Z_RES_INTERIM 2
534 int *presentStatus; /* OPTIONAL */
535 #define Z_PRES_SUCCESS 0
536 #define Z_PRES_PARTIAL_1 1
537 #define Z_PRES_PARTIAL_2 2
538 #define Z_PRES_PARTIAL_3 3
539 #define Z_PRES_PARTIAL_4 4
540 #define Z_PRES_FAILURE 5
541 Z_Records *records; /* OPTIONAL */
544 /* ------------------------- PRESENT SERVICE -----------------*/
546 typedef struct Z_PresentRequest
548 Z_ReferenceId *referenceId; /* OPTIONAL */
549 Z_ResultSetId *resultSetId;
550 int *resultSetStartPoint;
551 int *numberOfRecordsRequested;
552 Z_ElementSetNames *elementSetNames; /* OPTIONAL */
553 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
556 typedef struct Z_PresentResponse
558 Z_ReferenceId *referenceId; /* OPTIONAL */
559 int *numberOfRecordsReturned;
560 int *nextResultSetPosition;
565 /* ------------------------ APDU ---------------------------- */
567 typedef struct Z_APDU
573 Z_APDU_searchRequest,
574 Z_APDU_searchResponse,
575 Z_APDU_presentRequest,
576 Z_APDU_presentResponse,
582 Z_InitRequest *initRequest;
583 Z_InitResponse *initResponse;
584 Z_SearchRequest *searchRequest;
585 Z_SearchResponse *searchResponse;
586 Z_PresentRequest *presentRequest;
587 Z_PresentResponse *presentResponse;
588 Z_ScanRequest *scanRequest;
589 Z_ScanResponse *scanResponse;
593 int z_APDU(ODR o, Z_APDU **p, int opt);