2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.2 1995-03-30 10:26:48 quinn
10 * Revision 1.1 1995/03/30 09:39:42 quinn
11 * Moved .h files to include directory
13 * Revision 1.11 1995/03/30 09:08:44 quinn
14 * Added Resource control protocol
16 * Revision 1.10 1995/03/29 15:39:39 quinn
17 * Adding some resource control elements, and a null-check to getentbyoid
19 * Revision 1.9 1995/03/29 08:06:18 quinn
20 * Added a few v3 elements
22 * Revision 1.8 1995/03/22 10:12:49 quinn
23 * Added Z_PRES constants.
25 * Revision 1.7 1995/03/20 09:45:12 quinn
28 * Revision 1.5 1995/03/07 16:29:34 quinn
29 * Added authentication stuff.
31 * Revision 1.4 1995/03/07 10:13:00 quinn
32 * Added prototype for z_APDU()
34 * Revision 1.3 1995/02/14 11:54:23 quinn
37 * Revision 1.2 1995/02/09 15:51:40 quinn
40 * Revision 1.1 1995/02/06 16:44:48 quinn
41 * First hack at Z/SR protocol
51 /* ----------------- GLOBAL AUXILIARY DEFS ----------------*/
53 typedef Odr_oct Z_ReferenceId;
54 typedef char Z_DatabaseName;
55 typedef char Z_ResultSetId;
56 typedef Odr_oct Z_ResultsetId;
57 typedef Odr_external Z_UserInformationField;
59 /* ----------------- INIT SERVICE ----------------*/
63 char *groupId; /* OPTIONAL */
64 char *userId; /* OPTIONAL */
65 char *password; /* OPTIONAL */
68 typedef struct Z_IdAuthentication
72 Z_IdAuthentication_open,
73 Z_IdAuthentication_idPass,
74 Z_IdAuthentication_anonymous,
75 Z_IdAuthentication_other
81 void *anonymous; /* NULL */
86 #define Z_ProtocolVersion_1 0
87 #define Z_ProtocolVersion_2 1
88 #define Z_ProtocolVersion_3 2
90 #define Z_Options_search 0
91 #define Z_Options_present 1
92 #define Z_Options_delSet 2
93 #define Z_Options_resourceReport 3
94 #define Z_Options_triggerResourceCtrl 4
95 #define Z_Options_resourceCtrl 5
96 #define Z_Options_accessCtrl 6
97 #define Z_Options_scan 7
98 #define Z_Options_sort 8
99 #define Z_Options_reserved 9
100 #define Z_Options_extendedServices 10
101 #define Z_Options_level_1Segmentation 11
102 #define Z_Options_level_2Segmentation 12
103 #define Z_Options_concurrentOperations 13
104 #define Z_Options_namedResultSets 14
106 typedef struct Z_InitRequest
108 Z_ReferenceId *referenceId; /* OPTIONAL */
109 Odr_bitmask *options;
110 Odr_bitmask *protocolVersion;
111 int *preferredMessageSize;
112 int *maximumRecordSize;
113 Z_IdAuthentication* idAuthentication; /* OPTIONAL */
114 char *implementationId; /* OPTIONAL */
115 char *implementationName; /* OPTIONAL */
116 char *implementationVersion; /* OPTIONAL */
117 Z_UserInformationField *userInformationField; /* OPTIONAL */
120 typedef struct Z_InitResponse
122 Z_ReferenceId *referenceId; /* OPTIONAL */
123 Odr_bitmask *options;
124 Odr_bitmask *protocolVersion;
125 int *preferredMessageSize;
126 int *maximumRecordSize;
128 char *implementationId; /* OPTIONAL */
129 char *implementationName; /* OPTIONAL */
130 char *implementationVersion; /* OPTIONAL */
131 Z_UserInformationField *userInformationField; /* OPTIONAL */
134 typedef struct Z_NSRAuthentication
139 } Z_NSRAuthentication;
141 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt);
143 int z_StrAuthentication(ODR o, char **p, int opt);
146 /* ------------------ RESOURCE CONTROL ----------------*/
148 typedef struct Z_TriggerResourceControlRequest
150 Z_ReferenceId *referenceId; /* OPTIONAL */
151 int *requestedAction;
152 #define Z_TriggerResourceCtrl_resourceReport 1
153 #define Z_TriggerResourceCtrl_resourceControl 2
154 #define Z_TriggerResourceCtrl_cancel 3
155 Odr_oid *prefResourceReportFormat; /* OPTIONAL */
156 bool_t *resultSetWanted; /* OPTIONAL */
157 } Z_TriggerResourceControlRequest;
159 typedef struct Z_ResourceControlRequest
161 Z_ReferenceId *referenceId; /* OPTIONAL */
162 bool_t *suspendedFlag; /* OPTIONAL */
163 Odr_external *resourceReport; /* OPTIONAL */
164 int *partialResultsAvailable; /* OPTIONAL */
165 #define Z_ResourceControlRequest_subset 1
166 #define Z_ResourceControlRequest_interim 2
167 #define Z_ResourceControlRequest_none 3
168 bool_t *responseRequired;
169 bool_t *triggeredRequestFlag; /* OPTIONAL */
170 } Z_ResourceControlRequest;
172 typedef struct Z_ResourceControlResponse
174 Z_ReferenceId *referenceId; /* OPTIONAL */
175 bool_t *continueFlag;
176 bool_t *resultSetWanted; /* OPTIONAL */
177 } Z_ResourceControlResponse;
179 /* ------------------ SEARCH SERVICE ----------------*/
181 typedef Odr_oid Z_PreferredRecordSyntax;
183 typedef struct Z_DatabaseSpecificUnit
186 char *elementSetName;
187 } Z_DatabaseSpecificUnit;
189 typedef struct Z_DatabaseSpecific
192 Z_DatabaseSpecificUnit **elements;
193 } Z_DatabaseSpecific;
195 typedef struct Z_ElementSetNames
198 #define Z_ElementSetNames_generic 0
199 #define Z_ElementSetNames_databaseSpecific 1
203 Z_DatabaseSpecific *databaseSpecific;
207 /* ---------------------- RPN QUERY --------------------------- */
209 typedef struct Z_AttributeElement
213 } Z_AttributeElement;
218 typedef struct Z_Term
224 Z_Term_characterString,
228 Z_Term_integerAndUnit,
233 Odr_oct *general; /* this is required for v2 */
235 char *characterString;
238 Odr_external *external;
239 /* Z_IntUnit *integerAndUnit; */
246 typedef struct Z_AttributesPlusTerm
249 Z_AttributeElement **attributeList;
255 } Z_AttributesPlusTerm;
257 typedef struct Z_ProximityOperator
259 bool_t *exclusion; /* OPTIONAL */
265 Z_ProximityOperator_known,
266 Z_ProximityOperator_private
273 } Z_ProximityOperator;
275 typedef struct Z_Operator
286 void *and; /* these guys are nulls. */
289 Z_ProximityOperator *proximity;
293 typedef struct Z_Operand
296 #define Z_Operand_APT 0
297 #define Z_Operand_resultSetId 1
300 Z_AttributesPlusTerm *attributesPlusTerm;
301 Z_ResultSetId *resultSetId;
305 typedef struct Z_Complex
307 struct Z_RPNStructure *s1;
308 struct Z_RPNStructure *s2;
309 Z_Operator *operator;
312 typedef struct Z_RPNStructure
315 #define Z_RPNStructure_simple 0
316 #define Z_RPNStructure_complex 1
324 typedef struct Z_RPNQuery
326 Odr_oid *attributeSetId;
327 Z_RPNStructure *RPNStructure;
330 /* -------------------------- SEARCHREQUEST -------------------------- */
332 typedef struct Z_Query
335 #define Z_Query_type_1 1
336 #define Z_Query_type_2 2
344 typedef struct Z_SearchRequest
346 Z_ReferenceId *referenceId; /* OPTIONAL */
347 int *smallSetUpperBound;
348 int *largeSetLowerBound;
349 int *mediumSetPresentNumber;
350 bool_t *replaceIndicator;
352 int num_databaseNames;
353 char **databaseNames;
354 Z_ElementSetNames *smallSetElementSetNames; /* OPTIONAL */
355 Z_ElementSetNames *mediumSetElementSetNames; /* OPTIONAL */
356 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
360 /* ------------------------ RECORD -------------------------- */
362 typedef Odr_external Z_DatabaseRecord;
364 typedef struct Z_DiagRec
366 Odr_oid *diagnosticSetId;
371 typedef struct Z_NamePlusRecord
373 char *databaseName; /* OPTIONAL */
375 #define Z_NamePlusRecord_databaseRecord 0
376 #define Z_NamePlusRecord_surrogateDiagnostic 1
379 Z_DatabaseRecord *databaseRecord;
380 Z_DiagRec *surrogateDiagnostic;
384 typedef struct Z_NamePlusRecordList
387 Z_NamePlusRecord **records;
388 } Z_NamePlusRecordList;
390 typedef struct Z_Records
393 #define Z_Records_DBOSD 0
394 #define Z_Records_NSD 1
397 Z_NamePlusRecordList *databaseOrSurDiagnostics;
398 Z_DiagRec *nonSurrogateDiagnostic;
402 /* ------------------------ SEARCHRESPONSE ------------------ */
404 typedef struct Z_SearchResponse
406 Z_ReferenceId *referenceId; /* OPTIONAL */
408 int *numberOfRecordsReturned;
409 int *nextResultSetPosition;
410 bool_t *searchStatus;
411 int *resultSetStatus; /* OPTIONAL */
412 int *presentStatus; /* OPTIONAL */
413 #define Z_PRES_SUCCESS 0
414 #define Z_PRES_PARTIAL_1 1
415 #define Z_PRES_PARTIAL_2 2
416 #define Z_PRES_PARTIAL_3 3
417 #define Z_PRES_PARTIAL_4 4
418 #define Z_PRES_FAILURE 5
419 Z_Records *records; /* OPTIONAL */
422 /* ------------------------- PRESENT SERVICE -----------------*/
424 typedef struct Z_PresentRequest
426 Z_ReferenceId *referenceId; /* OPTIONAL */
427 Z_ResultSetId *resultSetId;
428 int *resultSetStartPoint;
429 int *numberOfRecordsRequested;
430 Z_ElementSetNames *elementSetNames; /* OPTIONAL */
431 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
434 typedef struct Z_PresentResponse
436 Z_ReferenceId *referenceId; /* OPTIONAL */
437 int *numberOfRecordsReturned;
438 int *nextResultSetPosition;
443 /* ------------------------ APDU ---------------------------- */
445 typedef struct Z_APDU
448 #define Z_APDU_initRequest 0
449 #define Z_APDU_initResponse 1
450 #define Z_APDU_searchRequest 2
451 #define Z_APDU_searchResponse 3
452 #define Z_APDU_presentRequest 4
453 #define Z_APDU_presentResponse 5
456 Z_InitRequest *initRequest;
457 Z_InitResponse *initResponse;
458 Z_SearchRequest *searchRequest;
459 Z_SearchResponse *searchResponse;
460 Z_PresentRequest *presentRequest;
461 Z_PresentResponse *presentResponse;
465 int z_APDU(ODR o, Z_APDU **p, int opt);