Changed enums in the ASN.1 .h files to #defines. Changed oident.class to oclass
[yaz-moved-to-github.git] / include / prt-dia.h
1 /*
2  * Copyright (c) 1995, Index Data.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and
5  * its documentation, in whole or in part, for any purpose, is hereby granted,
6  * provided that:
7  *
8  * 1. This copyright and permission notice appear in all copies of the
9  * software and its documentation. Notices of copyright or attribution
10  * which appear at the beginning of any file must remain unchanged.
11  *
12  * 2. The names of Index Data or the individual authors may not be used to
13  * endorse or promote products derived from this software without specific
14  * prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
18  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19  * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
20  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
21  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
22  * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24  * OF THIS SOFTWARE.
25  *
26  */
27
28 #ifndef PRT_DIA_H
29 #define PRT_DIA_H
30
31 #include <yconfig.h>
32
33 typedef struct Z_TooMany
34 {
35     int *tooManyWhat;
36 #define Z_TooMany_argumentWords        1
37 #define Z_TooMany_truncatedWords       2
38 #define Z_TooMany_booleanOperators     3
39 #define Z_TooMany_incompleteSubfields  4
40 #define Z_TooMany_characters           5
41 #define Z_TooMany_recordsRetrieved     6
42 #define Z_TooMany_databasesSpecified   7
43 #define Z_TooMany_resultSetsCreated    8
44 #define Z_TooMany_indexTermsProcessed  9
45     int *max;                    /* OPTIONAL */
46 } Z_TooMany;
47
48 typedef struct Z_BadSpec
49 {
50     Z_Specification *spec;
51     char *db;                    /* OPTIONAL */
52     int num_goodOnes;
53     Z_Specification **goodOnes;  /* OPTIONAL */
54 } Z_BadSpec;
55
56 typedef struct Z_DbUnavailWhy
57 {
58     int *reasonCode;             /* OPTIONAL */
59 #define Z_DbUnavail_doesNotExist         0
60 #define Z_DbUnavail_existsButUnavail     1
61 #define Z_DbUnavail_locked               2
62 #define Z_DbUnavail_accessDenied         3
63     char *message;               /* OPTIONAL */
64 } Z_DbUnavailWhy;
65
66 typedef struct Z_DbUnavail
67 {
68     char *db;
69     Z_DbUnavailWhy *why;         /* OPTIONAL */
70 } Z_DbUnavail;
71
72 typedef struct Z_Attribute
73 {
74     Odr_oid *id;
75     int *type;                   /* OPTIONAL */
76     int *value;                  /* OPTIONAL */
77     Z_Term *term;                /* OPTIONAL */
78 } Z_Attribute;
79
80 typedef struct Z_AttCombo
81 {
82     Z_AttributeList *unsupportedCombination;
83     int num_alternatives;
84     Z_AttributeList **alternatives;    /* OPTIONAL */
85 } Z_AttCombo;
86
87 typedef struct Z_DiagTerm 
88 {
89     int *problem;                /* OPTIONAL */
90 #define Z_DiagtermProb_codedValue     1
91 #define Z_DiagtermProb_unparsable     2
92 #define Z_DiagtermProb_tooShort       3
93 #define Z_DiagtermProb_type           4
94     Z_Term *term;
95 } Z_DiagTerm;
96
97 typedef struct Z_Proximity
98 {
99     int which;
100 #define Z_Proximity_resultSets 0
101 #define Z_Proximity_badSet 1
102 #define Z_Proximity_relation 2
103 #define Z_Proximity_unit 3
104 #define Z_Proximity_distance 4
105 #define Z_Proximity_attributes 5
106 #define Z_Proximity_ordered 6
107 #define Z_Proximity_exclusion 7
108     union
109     {
110         Odr_null *resultSets;
111         char *badSet;
112         int *relation;
113         int *unit;
114         int *distance;
115         Z_AttributeList *attributes;
116         Odr_null *ordered;
117         Odr_null *exclusion;
118     } u;
119 } Z_Proximity;
120
121 typedef struct Z_AttrListList
122 {
123     int num_lists;
124     Z_AttributeList *lists;
125 } Z_AttrListList;
126
127 typedef struct Z_Scan
128 {
129     int which;
130 #define Z_ScanD_nonZeroStepSize 0
131 #define Z_ScanD_specifiedStepSize 1
132 #define Z_ScanD_termList1 2
133 #define Z_ScanD_termList2 3
134 #define Z_ScanD_posInResponse 4
135 #define Z_ScanD_resources 5
136 #define Z_ScanD_endOfList 6
137     union
138     {
139         Odr_null *nonZeroStepSize;
140         Odr_null *specifiedStepSize;
141         Odr_null *termList1;
142         Z_AttrListList *termList2;
143         int *posInResponse;
144 #define Z_ScanPosInRsp_mustBeOne         1
145 #define Z_ScanPosInRsp_mustBePositive    2
146 #define Z_ScanPosInRsp_mustBeNonNegative 3
147 #define Z_ScanPosInRsp_other             4
148         Odr_null *resources;
149         Odr_null *endOfList;
150     } u;
151 } Z_Scan;
152
153 typedef struct Z_StringList
154 {
155     int num_strings;
156     char **strings;
157 } Z_StringList;
158
159 typedef struct Z_Sort
160 {
161     int which;
162 #define Z_SortD_sequence 0
163 #define Z_SortD_noRsName 1
164 #define Z_SortD_tooMany 2
165 #define Z_SortD_incompatible 3
166 #define Z_SortD_generic 4
167 #define Z_SortD_dbSpecific 5
168 #define Z_SortD_sortElement 6
169 #define Z_SortD_key 7
170 #define Z_SortD_action 8
171 #define Z_SortD_illegal 9
172 #define Z_SortD_inputTooLarge 10
173 #define Z_SortD_aggregateTooLarge 11
174     union
175     {
176         Odr_null *sequence;
177         Odr_null *noRsName;
178         int *tooMany;
179         Odr_null *incompatible;
180         Odr_null *generic;
181         Odr_null *dbSpecific;
182 #if 0
183         Z_SortElement *sortElement;
184 #endif
185         int *key;
186 #define Z_SortKey_tooMany       1
187 #define Z_SortKey_duplicate     2
188         Odr_null *action;
189         int *illegal;
190 #define Z_SortIllegal_relation  1
191 #define Z_SortIllegal_case      2
192 #define Z_SortIllegal_action    3
193 #define Z_SortIllegal_sort      4
194         Z_StringList *inputTooLarge;
195         Odr_null *aggregateTooLarge;
196     } u;
197 } Z_Sort;
198
199 typedef struct Z_Segmentation
200 {
201     int which;
202 #define Z_SegmentationD_segments 0
203     union
204     {
205         Odr_null *segments;
206     } u;
207 } Z_Segmentation;
208
209 typedef struct Z_ExtServices
210 {
211     int which;
212 #define Z_ExtServicesD_req 0
213 #define Z_ExtServicesD_permission 1
214 #define Z_ExtServicesD_immediate 2
215     union
216     {
217         int *req;
218 #define Z_ExtSrvReq_nameInUse           1
219 #define Z_ExtSrvReq_noSuchname          2
220 #define Z_ExtSrvReq_quota               3
221 #define Z_ExtSrvReq_type                4
222         int *permission;
223 #define Z_ExtSrvPerm_id                 1
224 #define Z_ExtSrvPerm_modifyDelete       2
225         int *immediate;
226 #define Z_ExtSrvImm_failed              1
227 #define Z_ExtSrvImm_service             2
228 #define Z_ExtSrvImm_parameters          3
229     } u;
230 } Z_ExtServices;
231
232 typedef struct Z_OidList
233 {
234     int num_oids;
235     Odr_oid **oids;
236 } Z_OidList;
237
238 typedef struct Z_AccessCtrl
239 {
240     int which;
241 #define Z_AccessCtrlD_noUser 0
242 #define Z_AccessCtrlD_refused 1
243 #define Z_AccessCtrlD_simple 2
244 #define Z_AccessCtrlD_oid 3
245 #define Z_AccessCtrlD_alternative 4
246 #define Z_AccessCtrlD_pwdInv 5
247 #define Z_AccessCtrlD_pwdExp 6
248     union
249     {
250         Odr_null *noUser;
251         Odr_null *refused;
252         Odr_null *simple;
253         Z_OidList *oid;
254         Z_OidList *alternative;
255         Odr_null *pwdInv;
256         Odr_null *pwdExp;
257     } u;
258 } Z_AccessCtrl;
259
260 typedef struct Z_RecordSyntax
261 {
262     Odr_oid *unsupportedSyntax;
263     int num_suggestedAlternatives;           /* OPTIONAL */
264     Odr_oid **suggestedAlternatives;           /* OPTIONAL */
265 } Z_RecordSyntax;
266
267 typedef struct Z_DiagFormat
268 {
269     int which;
270 #define Z_DiagFormat_tooMany 0
271 #define Z_DiagFormat_badSpec 1
272 #define Z_DiagFormat_dbUnavail 2
273 #define Z_DiagFormat_unSupOp 3
274 #define Z_DiagFormat_attribute 4
275 #define Z_DiagFormat_attCombo 5
276 #define Z_DiagFormat_term 6
277 #define Z_DiagFormat_proximity 7
278 #define Z_DiagFormat_scan 8
279 #define Z_DiagFormat_sort 9
280 #define Z_DiagFormat_segmentation 10
281 #define Z_DiagFormat_extServices 11
282 #define Z_DiagFormat_accessCtrl 12
283 #define Z_DiagFormat_recordSyntax 13
284     union
285     {
286         Z_TooMany *tooMany;
287         Z_BadSpec *badSpec;
288         Z_DbUnavail *dbUnavail;
289         int *unSupOp;
290 #define Z_UnSupOp_and             0
291 #define Z_UnSupOp_or              1
292 #define Z_UnSupOp_and_not         2
293 #define Z_UnSupOp_prox            3
294         Z_Attribute *attribute;
295         Z_AttributeList *attCombo;
296         Z_DiagTerm *term;
297         Z_Proximity *proximity;
298         Z_Scan *scan;
299         Z_Sort *sort;
300         Z_Segmentation *segmentation;
301         Z_ExtServices *extServices;
302         Z_AccessCtrl *accessCtrl;
303         Z_RecordSyntax *recordSyntax;
304     } u;
305 } Z_DiagFormat;
306
307 typedef struct Z_Diagnostic
308 {
309     int which;
310 #define Z_Diagnostic_defaultDiagRec 0
311 #define Z_Diagnostic_explicitDiagnostic 1
312     union 
313     {
314         Z_DefaultDiagFormat *defaultDiagRec;
315         Z_DiagFormat *explicitDiagnostic;
316     } u;
317 } Z_Diagnostic;
318
319 typedef struct Z_DiagnosticUnit
320 {
321     Z_Diagnostic *diagnostic;                    /* OPTIONAL */
322     char *message;                               /* OPTIONAL */
323 } Z_DiagnosticUnit;
324
325 typedef struct Z_DiagnosticFormat
326 {
327     int num_diagnostics;
328     Z_DiagnosticUnit **diagnostics;
329 } Z_DiagnosticFormat;
330
331 int z_DiagnosticFormat(ODR o, Z_DiagnosticFormat **p, int opt);
332
333 #endif