a7e80d2f2ced59634a7a10c2502dd89a4cf35004
[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_Sort
154 {
155     int which;
156 #define Z_SortD_sequence 0
157 #define Z_SortD_noRsName 1
158 #define Z_SortD_tooMany 2
159 #define Z_SortD_incompatible 3
160 #define Z_SortD_generic 4
161 #define Z_SortD_dbSpecific 5
162 #define Z_SortD_sortElement 6
163 #define Z_SortD_key 7
164 #define Z_SortD_action 8
165 #define Z_SortD_illegal 9
166 #define Z_SortD_inputTooLarge 10
167 #define Z_SortD_aggregateTooLarge 11
168     union
169     {
170         Odr_null *sequence;
171         Odr_null *noRsName;
172         int *tooMany;
173         Odr_null *incompatible;
174         Odr_null *generic;
175         Odr_null *dbSpecific;
176 #if 0
177         Z_SortElement *sortElement;
178 #endif
179         int *key;
180 #define Z_SortKey_tooMany       1
181 #define Z_SortKey_duplicate     2
182         Odr_null *action;
183         int *illegal;
184 #define Z_SortIllegal_relation  1
185 #define Z_SortIllegal_case      2
186 #define Z_SortIllegal_action    3
187 #define Z_SortIllegal_sort      4
188         Z_StringList *inputTooLarge;
189         Odr_null *aggregateTooLarge;
190     } u;
191 } Z_Sort;
192
193 typedef struct Z_Segmentation
194 {
195     int which;
196 #define Z_SegmentationD_segments 0
197     union
198     {
199         Odr_null *segments;
200     } u;
201 } Z_Segmentation;
202
203 typedef struct Z_ExtServices
204 {
205     int which;
206 #define Z_ExtServicesD_req 0
207 #define Z_ExtServicesD_permission 1
208 #define Z_ExtServicesD_immediate 2
209     union
210     {
211         int *req;
212 #define Z_ExtSrvReq_nameInUse           1
213 #define Z_ExtSrvReq_noSuchname          2
214 #define Z_ExtSrvReq_quota               3
215 #define Z_ExtSrvReq_type                4
216         int *permission;
217 #define Z_ExtSrvPerm_id                 1
218 #define Z_ExtSrvPerm_modifyDelete       2
219         int *immediate;
220 #define Z_ExtSrvImm_failed              1
221 #define Z_ExtSrvImm_service             2
222 #define Z_ExtSrvImm_parameters          3
223     } u;
224 } Z_ExtServices;
225
226 typedef struct Z_OidList
227 {
228     int num_oids;
229     Odr_oid **oids;
230 } Z_OidList;
231
232 typedef struct Z_AccessCtrl
233 {
234     int which;
235 #define Z_AccessCtrlD_noUser 0
236 #define Z_AccessCtrlD_refused 1
237 #define Z_AccessCtrlD_simple 2
238 #define Z_AccessCtrlD_oid 3
239 #define Z_AccessCtrlD_alternative 4
240 #define Z_AccessCtrlD_pwdInv 5
241 #define Z_AccessCtrlD_pwdExp 6
242     union
243     {
244         Odr_null *noUser;
245         Odr_null *refused;
246         Odr_null *simple;
247         Z_OidList *oid;
248         Z_OidList *alternative;
249         Odr_null *pwdInv;
250         Odr_null *pwdExp;
251     } u;
252 } Z_AccessCtrl;
253
254 typedef struct Z_RecordSyntax
255 {
256     Odr_oid *unsupportedSyntax;
257     int num_suggestedAlternatives;           /* OPTIONAL */
258     Odr_oid **suggestedAlternatives;           /* OPTIONAL */
259 } Z_RecordSyntax;
260
261 typedef struct Z_DiagFormat
262 {
263     int which;
264 #define Z_DiagFormat_tooMany 0
265 #define Z_DiagFormat_badSpec 1
266 #define Z_DiagFormat_dbUnavail 2
267 #define Z_DiagFormat_unSupOp 3
268 #define Z_DiagFormat_attribute 4
269 #define Z_DiagFormat_attCombo 5
270 #define Z_DiagFormat_term 6
271 #define Z_DiagFormat_proximity 7
272 #define Z_DiagFormat_scan 8
273 #define Z_DiagFormat_sort 9
274 #define Z_DiagFormat_segmentation 10
275 #define Z_DiagFormat_extServices 11
276 #define Z_DiagFormat_accessCtrl 12
277 #define Z_DiagFormat_recordSyntax 13
278     union
279     {
280         Z_TooMany *tooMany;
281         Z_BadSpec *badSpec;
282         Z_DbUnavail *dbUnavail;
283         int *unSupOp;
284 #define Z_UnSupOp_and             0
285 #define Z_UnSupOp_or              1
286 #define Z_UnSupOp_and_not         2
287 #define Z_UnSupOp_prox            3
288         Z_Attribute *attribute;
289         Z_AttributeList *attCombo;
290         Z_DiagTerm *term;
291         Z_Proximity *proximity;
292         Z_Scan *scan;
293         Z_Sort *sort;
294         Z_Segmentation *segmentation;
295         Z_ExtServices *extServices;
296         Z_AccessCtrl *accessCtrl;
297         Z_RecordSyntax *recordSyntax;
298     } u;
299 } Z_DiagFormat;
300
301 typedef struct Z_Diagnostic
302 {
303     int which;
304 #define Z_Diagnostic_defaultDiagRec 0
305 #define Z_Diagnostic_explicitDiagnostic 1
306     union 
307     {
308         Z_DefaultDiagFormat *defaultDiagRec;
309         Z_DiagFormat *explicitDiagnostic;
310     } u;
311 } Z_Diagnostic;
312
313 typedef struct Z_DiagnosticUnit
314 {
315     Z_Diagnostic *diagnostic;                    /* OPTIONAL */
316     char *message;                               /* OPTIONAL */
317 } Z_DiagnosticUnit;
318
319 typedef struct Z_DiagnosticFormat
320 {
321     int num_diagnostics;
322     Z_DiagnosticUnit **diagnostics;
323 } Z_DiagnosticFormat;
324
325 int z_DiagnosticFormat(ODR o, Z_DiagnosticFormat **p, int opt);
326
327 #endif