Modified function heads & prototypes.
[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     enum
100     {
101         Z_Proximity_resultSets,
102         Z_Proximity_badSet,
103         Z_Proximity_relation,
104         Z_Proximity_unit,
105         Z_Proximity_distance,
106         Z_Proximity_attributes,
107         Z_Proximity_ordered,
108         Z_Proximity_exclusion
109     } which;
110     union
111     {
112         Odr_null *resultSets;
113         char *badSet;
114         int *relation;
115         int *unit;
116         int *distance;
117         Z_AttributeList *attributes;
118         Odr_null *ordered;
119         Odr_null *exclusion;
120     } u;
121 } Z_Proximity;
122
123 typedef struct Z_AttrListList
124 {
125     int num_lists;
126     Z_AttributeList *lists;
127 } Z_AttrListList;
128
129 typedef struct Z_Scan
130 {
131     enum
132     {
133         Z_ScanD_nonZeroStepSize,
134         Z_ScanD_specifiedStepSize,
135         Z_ScanD_termList1,
136         Z_ScanD_termList2,
137         Z_ScanD_posInResponse,
138         Z_ScanD_resources,
139         Z_ScanD_endOfList
140     } which;
141     union
142     {
143         Odr_null *nonZeroStepSize;
144         Odr_null *specifiedStepSize;
145         Odr_null *termList1;
146         Z_AttrListList *termList2;
147         int *posInResponse;
148 #define Z_ScanPosInRsp_mustBeOne         1
149 #define Z_ScanPosInRsp_mustBePositive    2
150 #define Z_ScanPosInRsp_mustBeNonNegative 3
151 #define Z_ScanPosInRsp_other             4
152         Odr_null *resources;
153         Odr_null *endOfList;
154     } u;
155 } Z_Scan;
156
157 typedef struct Z_StringList
158 {
159     int num_strings;
160     char **strings;
161 } Z_StringList;
162
163 typedef struct Z_Sort
164 {
165     enum
166     {
167         Z_SortD_sequence,
168         Z_SortD_noRsName,
169         Z_SortD_tooMany,
170         Z_SortD_incompatible,
171         Z_SortD_generic,
172         Z_SortD_dbSpecific,
173         Z_SortD_sortElement,
174         Z_SortD_key,
175         Z_SortD_action,
176         Z_SortD_illegal,
177         Z_SortD_inputTooLarge,
178         Z_SortD_aggregateTooLarge
179     } which;
180     union
181     {
182         Odr_null *sequence;
183         Odr_null *noRsName;
184         int *tooMany;
185         Odr_null *incompatible;
186         Odr_null *generic;
187         Odr_null *dbSpecific;
188 #if 0
189         Z_SortElement *sortElement;
190 #endif
191         int *key;
192 #define Z_SortKey_tooMany       1
193 #define Z_SortKey_duplicate     2
194         Odr_null *action;
195         int *illegal;
196 #define Z_SortIllegal_relation  1
197 #define Z_SortIllegal_case      2
198 #define Z_SortIllegal_action    3
199 #define Z_SortIllegal_sort      4
200         Z_StringList *inputTooLarge;
201         Odr_null *aggregateTooLarge;
202     } u;
203 } Z_Sort;
204
205 typedef struct Z_Segmentation
206 {
207     enum
208     {
209         Z_SegmentationD_segments
210     } which;
211     union
212     {
213         Odr_null *segments;
214     } u;
215 } Z_Segmentation;
216
217 typedef struct Z_ExtServices
218 {
219     enum
220     {
221         Z_ExtServicesD_req,
222         Z_ExtServicesD_permission,
223         Z_ExtServicesD_immediate
224     } which;
225     union
226     {
227         int *req;
228 #define Z_ExtSrvReq_nameInUse           1
229 #define Z_ExtSrvReq_noSuchname          2
230 #define Z_ExtSrvReq_quota               3
231 #define Z_ExtSrvReq_type                4
232         int *permission;
233 #define Z_ExtSrvPerm_id                 1
234 #define Z_ExtSrvPerm_modifyDelete       2
235         int *immediate;
236 #define Z_ExtSrvImm_failed              1
237 #define Z_ExtSrvImm_service             2
238 #define Z_ExtSrvImm_parameters          3
239     } u;
240 } Z_ExtServices;
241
242 typedef struct Z_OidList
243 {
244     int num_oids;
245     Odr_oid **oids;
246 } Z_OidList;
247
248 typedef struct Z_AccessCtrl
249 {
250     enum
251     {
252         Z_AccessCtrlD_noUser,
253         Z_AccessCtrlD_refused,
254         Z_AccessCtrlD_simple,
255         Z_AccessCtrlD_oid,
256         Z_AccessCtrlD_alternative,
257         Z_AccessCtrlD_pwdInv,
258         Z_AccessCtrlD_pwdExp
259     } which;
260     union
261     {
262         Odr_null *noUser;
263         Odr_null *refused;
264         Odr_null *simple;
265         Z_OidList *oid;
266         Z_OidList *alternative;
267         Odr_null *pwdInv;
268         Odr_null *pwdExp;
269     } u;
270 } Z_AccessCtrl;
271
272 typedef struct Z_RecordSyntax
273 {
274     Odr_oid *unsupportedSyntax;
275     int num_suggestedAlternatives;           /* OPTIONAL */
276     Odr_oid **suggestedAlternatives;           /* OPTIONAL */
277 } Z_RecordSyntax;
278
279 typedef struct Z_DiagFormat
280 {
281     enum
282     {
283         Z_DiagFormat_tooMany,
284         Z_DiagFormat_badSpec,
285         Z_DiagFormat_dbUnavail,
286         Z_DiagFormat_unSupOp,
287         Z_DiagFormat_attribute,
288         Z_DiagFormat_attCombo,
289         Z_DiagFormat_term,
290         Z_DiagFormat_proximity,
291         Z_DiagFormat_scan,
292         Z_DiagFormat_sort,
293         Z_DiagFormat_segmentation,
294         Z_DiagFormat_extServices,
295         Z_DiagFormat_accessCtrl,
296         Z_DiagFormat_recordSyntax
297     } which;
298     union
299     {
300         Z_TooMany *tooMany;
301         Z_BadSpec *badSpec;
302         Z_DbUnavail *dbUnavail;
303         int *unSupOp;
304 #define Z_UnSupOp_and             0
305 #define Z_UnSupOp_or              1
306 #define Z_UnSupOp_and_not         2
307 #define Z_UnSupOp_prox            3
308         Z_Attribute *attribute;
309         Z_AttributeList *attCombo;
310         Z_DiagTerm *term;
311         Z_Proximity *proximity;
312         Z_Scan *scan;
313         Z_Sort *sort;
314         Z_Segmentation *segmentation;
315         Z_ExtServices *extServices;
316         Z_AccessCtrl *accessCtrl;
317         Z_RecordSyntax *recordSyntax;
318     } u;
319 } Z_DiagFormat;
320
321 typedef struct Z_Diagnostic
322 {
323     enum
324     {
325         Z_Diagnostic_defaultDiagRec,
326         Z_Diagnostic_explicitDiagnostic
327     } which;
328     union 
329     {
330         Z_DefaultDiagFormat *defaultDiagRec;
331         Z_DiagFormat *explicitDiagnostic;
332     } u;
333 } Z_Diagnostic;
334
335 typedef struct Z_DiagnosticUnit
336 {
337     Z_Diagnostic *diagnostic;                    /* OPTIONAL */
338     char *message;                               /* OPTIONAL */
339 } Z_DiagnosticUnit;
340
341 typedef struct Z_DiagnosticFormat
342 {
343     int num_diagnostics;
344     Z_DiagnosticUnit **diagnostics;
345 } Z_DiagnosticFormat;
346
347 int MDF z_DiagnosticFormat(ODR o, Z_DiagnosticFormat **p, int opt);
348
349 #endif