2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.1 1995-03-30 09:39:42 quinn
8 * Moved .h files to include directory
10 * Revision 1.11 1995/03/30 09:08:44 quinn
11 * Added Resource control protocol
13 * Revision 1.10 1995/03/29 15:39:39 quinn
14 * Adding some resource control elements, and a null-check to getentbyoid
16 * Revision 1.9 1995/03/29 08:06:18 quinn
17 * Added a few v3 elements
19 * Revision 1.8 1995/03/22 10:12:49 quinn
20 * Added Z_PRES constants.
22 * Revision 1.7 1995/03/20 09:45:12 quinn
25 * Revision 1.5 1995/03/07 16:29:34 quinn
26 * Added authentication stuff.
28 * Revision 1.4 1995/03/07 10:13:00 quinn
29 * Added prototype for z_APDU()
31 * Revision 1.3 1995/02/14 11:54:23 quinn
34 * Revision 1.2 1995/02/09 15:51:40 quinn
37 * Revision 1.1 1995/02/06 16:44:48 quinn
38 * First hack at Z/SR protocol
48 /* ----------------- GLOBAL AUXILIARY DEFS ----------------*/
50 typedef Odr_oct Z_ReferenceId;
51 typedef char Z_DatabaseName;
52 typedef char Z_ResultSetId;
53 typedef Odr_oct Z_ResultsetId;
54 typedef Odr_external Z_UserInformationField;
56 /* ----------------- INIT SERVICE ----------------*/
60 char *groupId; /* OPTIONAL */
61 char *userId; /* OPTIONAL */
62 char *password; /* OPTIONAL */
65 typedef struct Z_IdAuthentication
69 Z_IdAuthentication_open,
70 Z_IdAuthentication_idPass,
71 Z_IdAuthentication_anonymous,
72 Z_IdAuthentication_other
78 void *anonymous; /* NULL */
83 #define Z_ProtocolVersion_1 0
84 #define Z_ProtocolVersion_2 1
85 #define Z_ProtocolVersion_3 2
87 #define Z_Options_search 0
88 #define Z_Options_present 1
89 #define Z_Options_delSet 2
90 #define Z_Options_resourceReport 3
91 #define Z_Options_triggerResourceCtrl 4
92 #define Z_Options_resourceCtrl 5
93 #define Z_Options_accessCtrl 6
94 #define Z_Options_scan 7
95 #define Z_Options_sort 8
96 #define Z_Options_reserved 9
97 #define Z_Options_extendedServices 10
98 #define Z_Options_level_1Segmentation 11
99 #define Z_Options_level_2Segmentation 12
100 #define Z_Options_concurrentOperations 13
101 #define Z_Options_namedResultSets 14
103 typedef struct Z_InitRequest
105 Z_ReferenceId *referenceId; /* OPTIONAL */
106 Odr_bitmask *options;
107 Odr_bitmask *protocolVersion;
108 int *preferredMessageSize;
109 int *maximumRecordSize;
110 Z_IdAuthentication* idAuthentication; /* OPTIONAL */
111 char *implementationId; /* OPTIONAL */
112 char *implementationName; /* OPTIONAL */
113 char *implementationVersion; /* OPTIONAL */
114 Z_UserInformationField *userInformationField; /* OPTIONAL */
117 typedef struct Z_InitResponse
119 Z_ReferenceId *referenceId; /* OPTIONAL */
120 Odr_bitmask *options;
121 Odr_bitmask *protocolVersion;
122 int *preferredMessageSize;
123 int *maximumRecordSize;
125 char *implementationId; /* OPTIONAL */
126 char *implementationName; /* OPTIONAL */
127 char *implementationVersion; /* OPTIONAL */
128 Z_UserInformationField *userInformationField; /* OPTIONAL */
131 typedef struct Z_NSRAuthentication
136 } Z_NSRAuthentication;
138 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt);
140 int z_StrAuthentication(ODR o, char **p, int opt);
143 /* ------------------ RESOURCE CONTROL ----------------*/
145 typedef struct Z_TriggerResourceControlRequest
147 Z_ReferenceId *referenceId; /* OPTIONAL */
148 int *requestedAction;
149 #define Z_TriggerResourceCtrl_resourceReport 1
150 #define Z_TriggerResourceCtrl_resourceControl 2
151 #define Z_TriggerResourceCtrl_cancel 3
152 Odr_oid *prefResourceReportFormat; /* OPTIONAL */
153 bool_t *resultSetWanted; /* OPTIONAL */
154 } Z_TriggerResourceControlRequest;
156 typedef struct Z_ResourceControlRequest
158 Z_ReferenceId *referenceId; /* OPTIONAL */
159 bool_t *suspendedFlag; /* OPTIONAL */
160 Odr_external *resourceReport; /* OPTIONAL */
161 int *partialResultsAvailable; /* OPTIONAL */
162 #define Z_ResourceControlRequest_subset 1
163 #define Z_ResourceControlRequest_interim 2
164 #define Z_ResourceControlRequest_none 3
165 bool_t *responseRequired;
166 bool_t *triggeredRequestFlag; /* OPTIONAL */
167 } Z_ResourceControlRequest;
169 typedef struct Z_ResourceControlResponse
171 Z_ReferenceId *referenceId; /* OPTIONAL */
172 bool_t *continueFlag;
173 bool_t *resultSetWanted; /* OPTIONAL */
174 } Z_ResourceControlResponse;
176 /* ------------------ SEARCH SERVICE ----------------*/
178 typedef Odr_oid Z_PreferredRecordSyntax;
180 typedef struct Z_DatabaseSpecificUnit
183 char *elementSetName;
184 } Z_DatabaseSpecificUnit;
186 typedef struct Z_DatabaseSpecific
189 Z_DatabaseSpecificUnit **elements;
190 } Z_DatabaseSpecific;
192 typedef struct Z_ElementSetNames
195 #define Z_ElementSetNames_generic 0
196 #define Z_ElementSetNames_databaseSpecific 1
200 Z_DatabaseSpecific *databaseSpecific;
204 /* ---------------------- RPN QUERY --------------------------- */
206 typedef struct Z_AttributeElement
210 } Z_AttributeElement;
214 typedef struct Z_Term
220 Z_Term_characterString,
224 Z_Term_integerAndUnit,
231 char *characterString;
234 Odr_external *external;
235 Z_IntUnit *integerAndUnit;
242 typedef struct Z_AttributesPlusTerm
245 Z_AttributeElement **attributeList;
251 } Z_AttributesPlusTerm;
253 typedef struct Z_ProximityOperator
255 bool_t *exclusion; /* OPTIONAL */
261 Z_ProximityOperator_known,
262 Z_ProximityOperator_private
269 } Z_ProximityOperator;
271 typedef struct Z_Operator
282 void *and; /* these guys are nulls. */
285 Z_ProximityOperator *proximity;
289 typedef struct Z_Operand
292 #define Z_Operand_APT 0
293 #define Z_Operand_resultSetId 1
296 Z_AttributesPlusTerm *attributesPlusTerm;
297 Z_ResultSetId *resultSetId;
301 typedef struct Z_Complex
303 struct Z_RPNStructure *s1;
304 struct Z_RPNStructure *s2;
305 Z_Operator *operator;
308 typedef struct Z_RPNStructure
311 #define Z_RPNStructure_simple 0
312 #define Z_RPNStructure_complex 1
320 typedef struct Z_RPNQuery
322 Odr_oid *attributeSetId;
323 Z_RPNStructure *RPNStructure;
326 /* -------------------------- SEARCHREQUEST -------------------------- */
328 typedef struct Z_Query
331 #define Z_Query_type_1 1
332 #define Z_Query_type_2 2
340 typedef struct Z_SearchRequest
342 Z_ReferenceId *referenceId; /* OPTIONAL */
343 int *smallSetUpperBound;
344 int *largeSetLowerBound;
345 int *mediumSetPresentNumber;
346 bool_t *replaceIndicator;
348 int num_databaseNames;
349 char **databaseNames;
350 Z_ElementSetNames *smallSetElementSetNames; /* OPTIONAL */
351 Z_ElementSetNames *mediumSetElementSetNames; /* OPTIONAL */
352 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
356 /* ------------------------ RECORD -------------------------- */
358 typedef Odr_external Z_DatabaseRecord;
360 typedef struct Z_DiagRec
362 Odr_oid *diagnosticSetId;
367 typedef struct Z_NamePlusRecord
369 char *databaseName; /* OPTIONAL */
371 #define Z_NamePlusRecord_databaseRecord 0
372 #define Z_NamePlusRecord_surrogateDiagnostic 1
375 Z_DatabaseRecord *databaseRecord;
376 Z_DiagRec *surrogateDiagnostic;
380 typedef struct Z_NamePlusRecordList
383 Z_NamePlusRecord **records;
384 } Z_NamePlusRecordList;
386 typedef struct Z_Records
389 #define Z_Records_DBOSD 0
390 #define Z_Records_NSD 1
393 Z_NamePlusRecordList *databaseOrSurDiagnostics;
394 Z_DiagRec *nonSurrogateDiagnostic;
398 /* ------------------------ SEARCHRESPONSE ------------------ */
400 typedef struct Z_SearchResponse
402 Z_ReferenceId *referenceId; /* OPTIONAL */
404 int *numberOfRecordsReturned;
405 int *nextResultSetPosition;
406 bool_t *searchStatus;
407 int *resultSetStatus; /* OPTIONAL */
408 int *presentStatus; /* OPTIONAL */
409 #define Z_PRES_SUCCESS 0
410 #define Z_PRES_PARTIAL_1 1
411 #define Z_PRES_PARTIAL_2 2
412 #define Z_PRES_PARTIAL_3 3
413 #define Z_PRES_PARTIAL_4 4
414 #define Z_PRES_FAILURE 5
415 Z_Records *records; /* OPTIONAL */
418 /* ------------------------- PRESENT SERVICE -----------------*/
420 typedef struct Z_PresentRequest
422 Z_ReferenceId *referenceId; /* OPTIONAL */
423 Z_ResultSetId *resultSetId;
424 int *resultSetStartPoint;
425 int *numberOfRecordsRequested;
426 Z_ElementSetNames *elementSetNames; /* OPTIONAL */
427 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
430 typedef struct Z_PresentResponse
432 Z_ReferenceId *referenceId; /* OPTIONAL */
433 int *numberOfRecordsReturned;
434 int *nextResultSetPosition;
439 /* ------------------------ APDU ---------------------------- */
441 typedef struct Z_APDU
444 #define Z_APDU_initRequest 0
445 #define Z_APDU_initResponse 1
446 #define Z_APDU_searchRequest 2
447 #define Z_APDU_searchResponse 3
448 #define Z_APDU_presentRequest 4
449 #define Z_APDU_presentResponse 5
452 Z_InitRequest *initRequest;
453 Z_InitResponse *initResponse;
454 Z_SearchRequest *searchRequest;
455 Z_SearchResponse *searchResponse;
456 Z_PresentRequest *presentRequest;
457 Z_PresentResponse *presentResponse;
461 int z_APDU(ODR o, Z_APDU **p, int opt);