2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 1995-03-30 12:18:09 quinn
10 * Revision 1.2 1995/03/30 10:26:48 quinn
11 * Added Term structure
13 * Revision 1.1 1995/03/30 09:39:42 quinn
14 * Moved .h files to include directory
16 * Revision 1.11 1995/03/30 09:08:44 quinn
17 * Added Resource control protocol
19 * Revision 1.10 1995/03/29 15:39:39 quinn
20 * Adding some resource control elements, and a null-check to getentbyoid
22 * Revision 1.9 1995/03/29 08:06:18 quinn
23 * Added a few v3 elements
25 * Revision 1.8 1995/03/22 10:12:49 quinn
26 * Added Z_PRES constants.
28 * Revision 1.7 1995/03/20 09:45:12 quinn
31 * Revision 1.5 1995/03/07 16:29:34 quinn
32 * Added authentication stuff.
34 * Revision 1.4 1995/03/07 10:13:00 quinn
35 * Added prototype for z_APDU()
37 * Revision 1.3 1995/02/14 11:54:23 quinn
40 * Revision 1.2 1995/02/09 15:51:40 quinn
43 * Revision 1.1 1995/02/06 16:44:48 quinn
44 * First hack at Z/SR protocol
54 /* ----------------- GLOBAL AUXILIARY DEFS ----------------*/
56 typedef Odr_oct Z_ReferenceId;
57 typedef char Z_DatabaseName;
58 typedef char Z_ResultSetId;
59 typedef Odr_oct Z_ResultsetId;
60 typedef Odr_external Z_UserInformationField;
62 /* ----------------- INIT SERVICE ----------------*/
66 char *groupId; /* OPTIONAL */
67 char *userId; /* OPTIONAL */
68 char *password; /* OPTIONAL */
71 typedef struct Z_IdAuthentication
75 Z_IdAuthentication_open,
76 Z_IdAuthentication_idPass,
77 Z_IdAuthentication_anonymous,
78 Z_IdAuthentication_other
84 void *anonymous; /* NULL */
89 #define Z_ProtocolVersion_1 0
90 #define Z_ProtocolVersion_2 1
91 #define Z_ProtocolVersion_3 2
93 #define Z_Options_search 0
94 #define Z_Options_present 1
95 #define Z_Options_delSet 2
96 #define Z_Options_resourceReport 3
97 #define Z_Options_triggerResourceCtrl 4
98 #define Z_Options_resourceCtrl 5
99 #define Z_Options_accessCtrl 6
100 #define Z_Options_scan 7
101 #define Z_Options_sort 8
102 #define Z_Options_reserved 9
103 #define Z_Options_extendedServices 10
104 #define Z_Options_level_1Segmentation 11
105 #define Z_Options_level_2Segmentation 12
106 #define Z_Options_concurrentOperations 13
107 #define Z_Options_namedResultSets 14
109 typedef struct Z_InitRequest
111 Z_ReferenceId *referenceId; /* OPTIONAL */
112 Odr_bitmask *options;
113 Odr_bitmask *protocolVersion;
114 int *preferredMessageSize;
115 int *maximumRecordSize;
116 Z_IdAuthentication* idAuthentication; /* OPTIONAL */
117 char *implementationId; /* OPTIONAL */
118 char *implementationName; /* OPTIONAL */
119 char *implementationVersion; /* OPTIONAL */
120 Z_UserInformationField *userInformationField; /* OPTIONAL */
123 typedef struct Z_InitResponse
125 Z_ReferenceId *referenceId; /* OPTIONAL */
126 Odr_bitmask *options;
127 Odr_bitmask *protocolVersion;
128 int *preferredMessageSize;
129 int *maximumRecordSize;
131 char *implementationId; /* OPTIONAL */
132 char *implementationName; /* OPTIONAL */
133 char *implementationVersion; /* OPTIONAL */
134 Z_UserInformationField *userInformationField; /* OPTIONAL */
137 typedef struct Z_NSRAuthentication
142 } Z_NSRAuthentication;
144 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt);
146 int z_StrAuthentication(ODR o, char **p, int opt);
149 /* ------------------ RESOURCE CONTROL ----------------*/
151 typedef struct Z_TriggerResourceControlRequest
153 Z_ReferenceId *referenceId; /* OPTIONAL */
154 int *requestedAction;
155 #define Z_TriggerResourceCtrl_resourceReport 1
156 #define Z_TriggerResourceCtrl_resourceControl 2
157 #define Z_TriggerResourceCtrl_cancel 3
158 Odr_oid *prefResourceReportFormat; /* OPTIONAL */
159 bool_t *resultSetWanted; /* OPTIONAL */
160 } Z_TriggerResourceControlRequest;
162 typedef struct Z_ResourceControlRequest
164 Z_ReferenceId *referenceId; /* OPTIONAL */
165 bool_t *suspendedFlag; /* OPTIONAL */
166 Odr_external *resourceReport; /* OPTIONAL */
167 int *partialResultsAvailable; /* OPTIONAL */
168 #define Z_ResourceControlRequest_subset 1
169 #define Z_ResourceControlRequest_interim 2
170 #define Z_ResourceControlRequest_none 3
171 bool_t *responseRequired;
172 bool_t *triggeredRequestFlag; /* OPTIONAL */
173 } Z_ResourceControlRequest;
175 typedef struct Z_ResourceControlResponse
177 Z_ReferenceId *referenceId; /* OPTIONAL */
178 bool_t *continueFlag;
179 bool_t *resultSetWanted; /* OPTIONAL */
180 } Z_ResourceControlResponse;
182 /* ------------------ SEARCH SERVICE ----------------*/
184 typedef Odr_oid Z_PreferredRecordSyntax;
186 typedef struct Z_DatabaseSpecificUnit
189 char *elementSetName;
190 } Z_DatabaseSpecificUnit;
192 typedef struct Z_DatabaseSpecific
195 Z_DatabaseSpecificUnit **elements;
196 } Z_DatabaseSpecific;
198 typedef struct Z_ElementSetNames
201 #define Z_ElementSetNames_generic 0
202 #define Z_ElementSetNames_databaseSpecific 1
206 Z_DatabaseSpecific *databaseSpecific;
210 /* ---------------------- RPN QUERY --------------------------- */
212 typedef struct Z_AttributeElement
216 } Z_AttributeElement;
221 typedef struct Z_Term
227 Z_Term_characterString,
231 Z_Term_integerAndUnit,
236 Odr_oct *general; /* this is required for v2 */
238 char *characterString;
241 Odr_external *external;
242 /* Z_IntUnit *integerAndUnit; */
249 typedef struct Z_AttributesPlusTerm
252 Z_AttributeElement **attributeList;
258 } Z_AttributesPlusTerm;
260 typedef struct Z_ProximityOperator
262 bool_t *exclusion; /* OPTIONAL */
268 Z_ProximityOperator_known,
269 Z_ProximityOperator_private
276 } Z_ProximityOperator;
278 typedef struct Z_Operator
289 void *and; /* these guys are nulls. */
292 Z_ProximityOperator *proximity;
296 typedef struct Z_Operand
299 #define Z_Operand_APT 0
300 #define Z_Operand_resultSetId 1
303 Z_AttributesPlusTerm *attributesPlusTerm;
304 Z_ResultSetId *resultSetId;
308 typedef struct Z_Complex
310 struct Z_RPNStructure *s1;
311 struct Z_RPNStructure *s2;
312 Z_Operator *operator;
315 typedef struct Z_RPNStructure
318 #define Z_RPNStructure_simple 0
319 #define Z_RPNStructure_complex 1
327 typedef struct Z_RPNQuery
329 Odr_oid *attributeSetId;
330 Z_RPNStructure *RPNStructure;
333 /* -------------------------- SEARCHREQUEST -------------------------- */
335 typedef struct Z_Query
338 #define Z_Query_type_1 1
339 #define Z_Query_type_2 2
347 typedef struct Z_SearchRequest
349 Z_ReferenceId *referenceId; /* OPTIONAL */
350 int *smallSetUpperBound;
351 int *largeSetLowerBound;
352 int *mediumSetPresentNumber;
353 bool_t *replaceIndicator;
355 int num_databaseNames;
356 char **databaseNames;
357 Z_ElementSetNames *smallSetElementSetNames; /* OPTIONAL */
358 Z_ElementSetNames *mediumSetElementSetNames; /* OPTIONAL */
359 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
363 /* ------------------------ RECORD -------------------------- */
365 typedef Odr_external Z_DatabaseRecord;
367 typedef struct Z_DiagRec
369 Odr_oid *diagnosticSetId;
374 typedef struct Z_NamePlusRecord
376 char *databaseName; /* OPTIONAL */
378 #define Z_NamePlusRecord_databaseRecord 0
379 #define Z_NamePlusRecord_surrogateDiagnostic 1
382 Z_DatabaseRecord *databaseRecord;
383 Z_DiagRec *surrogateDiagnostic;
387 typedef struct Z_NamePlusRecordList
390 Z_NamePlusRecord **records;
391 } Z_NamePlusRecordList;
393 typedef struct Z_Records
396 #define Z_Records_DBOSD 0
397 #define Z_Records_NSD 1
400 Z_NamePlusRecordList *databaseOrSurDiagnostics;
401 Z_DiagRec *nonSurrogateDiagnostic;
405 /* ------------------------ SEARCHRESPONSE ------------------ */
407 typedef struct Z_SearchResponse
409 Z_ReferenceId *referenceId; /* OPTIONAL */
411 int *numberOfRecordsReturned;
412 int *nextResultSetPosition;
413 bool_t *searchStatus;
414 int *resultSetStatus; /* OPTIONAL */
415 #define Z_RES_SUBSET 1
416 #define Z_RES_INTERIM 2
418 int *presentStatus; /* OPTIONAL */
419 #define Z_PRES_SUCCESS 0
420 #define Z_PRES_PARTIAL_1 1
421 #define Z_PRES_PARTIAL_2 2
422 #define Z_PRES_PARTIAL_3 3
423 #define Z_PRES_PARTIAL_4 4
424 #define Z_PRES_FAILURE 5
425 Z_Records *records; /* OPTIONAL */
428 /* ------------------------- PRESENT SERVICE -----------------*/
430 typedef struct Z_PresentRequest
432 Z_ReferenceId *referenceId; /* OPTIONAL */
433 Z_ResultSetId *resultSetId;
434 int *resultSetStartPoint;
435 int *numberOfRecordsRequested;
436 Z_ElementSetNames *elementSetNames; /* OPTIONAL */
437 Z_PreferredRecordSyntax *preferredRecordSyntax; /* OPTIONAL */
440 typedef struct Z_PresentResponse
442 Z_ReferenceId *referenceId; /* OPTIONAL */
443 int *numberOfRecordsReturned;
444 int *nextResultSetPosition;
449 /* ------------------------ APDU ---------------------------- */
451 typedef struct Z_APDU
454 #define Z_APDU_initRequest 0
455 #define Z_APDU_initResponse 1
456 #define Z_APDU_searchRequest 2
457 #define Z_APDU_searchResponse 3
458 #define Z_APDU_presentRequest 4
459 #define Z_APDU_presentResponse 5
462 Z_InitRequest *initRequest;
463 Z_InitResponse *initResponse;
464 Z_SearchRequest *searchRequest;
465 Z_SearchResponse *searchResponse;
466 Z_PresentRequest *presentRequest;
467 Z_PresentResponse *presentResponse;
471 int z_APDU(ODR o, Z_APDU **p, int opt);