Directive s=pw sets structure to phrase if term includes blank(s).
[yaz-moved-to-github.git] / asn / prt-dia.h
1 /*
2  * Copyright (c) 1995-1998, 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 <yaz/yconfig.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 typedef struct Z_TooMany
38 {
39     int *tooManyWhat;
40 #define Z_TooMany_argumentWords        1
41 #define Z_TooMany_truncatedWords       2
42 #define Z_TooMany_booleanOperators     3
43 #define Z_TooMany_incompleteSubfields  4
44 #define Z_TooMany_characters           5
45 #define Z_TooMany_recordsRetrieved     6
46 #define Z_TooMany_databasesSpecified   7
47 #define Z_TooMany_resultSetsCreated    8
48 #define Z_TooMany_indexTermsProcessed  9
49     int *max;                    /* OPTIONAL */
50 } Z_TooMany;
51
52 typedef struct Z_BadSpec
53 {
54     Z_Specification *spec;
55     char *db;                    /* OPTIONAL */
56     int num_goodOnes;
57     Z_Specification **goodOnes;  /* OPTIONAL */
58 } Z_BadSpec;
59
60 typedef struct Z_DbUnavailWhy
61 {
62     int *reasonCode;             /* OPTIONAL */
63 #define Z_DbUnavail_doesNotExist         0
64 #define Z_DbUnavail_existsButUnavail     1
65 #define Z_DbUnavail_locked               2
66 #define Z_DbUnavail_accessDenied         3
67     char *message;               /* OPTIONAL */
68 } Z_DbUnavailWhy;
69
70 typedef struct Z_DbUnavail
71 {
72     char *db;
73     Z_DbUnavailWhy *why;         /* OPTIONAL */
74 } Z_DbUnavail;
75
76 typedef struct Z_Attribute
77 {
78     Odr_oid *id;
79     int *type;                   /* OPTIONAL */
80     int *value;                  /* OPTIONAL */
81     Z_Term *term;                /* OPTIONAL */
82 } Z_Attribute;
83
84 typedef struct Z_AttCombo
85 {
86     Z_AttributeList *unsupportedCombination;
87     int num_alternatives;
88     Z_AttributeList **alternatives;    /* OPTIONAL */
89 } Z_AttCombo;
90
91 typedef struct Z_DiagTerm 
92 {
93     int *problem;                /* OPTIONAL */
94 #define Z_DiagtermProb_codedValue     1
95 #define Z_DiagtermProb_unparsable     2
96 #define Z_DiagtermProb_tooShort       3
97 #define Z_DiagtermProb_type           4
98     Z_Term *term;
99 } Z_DiagTerm;
100
101 typedef struct Z_Proximity
102 {
103     int which;
104 #define Z_Proximity_resultSets 0
105 #define Z_Proximity_badSet 1
106 #define Z_Proximity_relation 2
107 #define Z_Proximity_unit 3
108 #define Z_Proximity_distance 4
109 #define Z_Proximity_attributes 5
110 #define Z_Proximity_ordered 6
111 #define Z_Proximity_exclusion 7
112     union
113     {
114         Odr_null *resultSets;
115         char *badSet;
116         int *relation;
117         int *unit;
118         int *distance;
119         Z_AttributeList *attributes;
120         Odr_null *ordered;
121         Odr_null *exclusion;
122     } u;
123 } Z_Proximity;
124
125 typedef struct Z_AttrListList
126 {
127     int num_lists;
128     Z_AttributeList *lists;
129 } Z_AttrListList;
130
131 typedef struct Z_Scan
132 {
133     int which;
134 #define Z_ScanD_nonZeroStepSize 0
135 #define Z_ScanD_specifiedStepSize 1
136 #define Z_ScanD_termList1 2
137 #define Z_ScanD_termList2 3
138 #define Z_ScanD_posInResponse 4
139 #define Z_ScanD_resources 5
140 #define Z_ScanD_endOfList 6
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_Sort
158 {
159     int which;
160 #define Z_SortD_sequence 0
161 #define Z_SortD_noRsName 1
162 #define Z_SortD_tooMany 2
163 #define Z_SortD_incompatible 3
164 #define Z_SortD_generic 4
165 #define Z_SortD_dbSpecific 5
166 #define Z_SortD_sortElement 6
167 #define Z_SortD_key 7
168 #define Z_SortD_action 8
169 #define Z_SortD_illegal 9
170 #define Z_SortD_inputTooLarge 10
171 #define Z_SortD_aggregateTooLarge 11
172     union
173     {
174         Odr_null *sequence;
175         Odr_null *noRsName;
176         int *tooMany;
177         Odr_null *incompatible;
178         Odr_null *generic;
179         Odr_null *dbSpecific;
180         int *key;
181 #define Z_SortKey_tooMany       1
182 #define Z_SortKey_duplicate     2
183         Odr_null *action;
184         int *illegal;
185 #define Z_SortIllegal_relation  1
186 #define Z_SortIllegal_case      2
187 #define Z_SortIllegal_action    3
188 #define Z_SortIllegal_sort      4
189         Z_StringList *inputTooLarge;
190         Odr_null *aggregateTooLarge;
191     } u;
192 } Z_Sort;
193
194 typedef struct Z_Segmentation
195 {
196     int which;
197 #define Z_SegmentationD_segments 0
198     union
199     {
200         Odr_null *segments;
201     } u;
202 } Z_Segmentation;
203
204 typedef struct Z_ExtServices
205 {
206     int which;
207 #define Z_ExtServicesD_req 0
208 #define Z_ExtServicesD_permission 1
209 #define Z_ExtServicesD_immediate 2
210     union
211     {
212         int *req;
213 #define Z_ExtSrvReq_nameInUse           1
214 #define Z_ExtSrvReq_noSuchname          2
215 #define Z_ExtSrvReq_quota               3
216 #define Z_ExtSrvReq_type                4
217         int *permission;
218 #define Z_ExtSrvPerm_id                 1
219 #define Z_ExtSrvPerm_modifyDelete       2
220         int *immediate;
221 #define Z_ExtSrvImm_failed              1
222 #define Z_ExtSrvImm_service             2
223 #define Z_ExtSrvImm_parameters          3
224     } u;
225 } Z_ExtServices;
226
227 typedef struct Z_OidList
228 {
229     int num_oids;
230     Odr_oid **oids;
231 } Z_OidList;
232
233 typedef struct Z_AccessCtrl
234 {
235     int which;
236 #define Z_AccessCtrlD_noUser 0
237 #define Z_AccessCtrlD_refused 1
238 #define Z_AccessCtrlD_simple 2
239 #define Z_AccessCtrlD_oid 3
240 #define Z_AccessCtrlD_alternative 4
241 #define Z_AccessCtrlD_pwdInv 5
242 #define Z_AccessCtrlD_pwdExp 6
243     union
244     {
245         Odr_null *noUser;
246         Odr_null *refused;
247         Odr_null *simple;
248         Z_OidList *oid;
249         Z_OidList *alternative;
250         Odr_null *pwdInv;
251         Odr_null *pwdExp;
252     } u;
253 } Z_AccessCtrl;
254
255 typedef struct Z_RecordSyntax
256 {
257     Odr_oid *unsupportedSyntax;
258     int num_suggestedAlternatives;           /* OPTIONAL */
259     Odr_oid **suggestedAlternatives;           /* OPTIONAL */
260 } Z_RecordSyntax;
261
262 typedef struct Z_DiagFormat
263 {
264     int which;
265 #define Z_DiagFormat_tooMany 0
266 #define Z_DiagFormat_badSpec 1
267 #define Z_DiagFormat_dbUnavail 2
268 #define Z_DiagFormat_unSupOp 3
269 #define Z_DiagFormat_attribute 4
270 #define Z_DiagFormat_attCombo 5
271 #define Z_DiagFormat_term 6
272 #define Z_DiagFormat_proximity 7
273 #define Z_DiagFormat_scan 8
274 #define Z_DiagFormat_sort 9
275 #define Z_DiagFormat_segmentation 10
276 #define Z_DiagFormat_extServices 11
277 #define Z_DiagFormat_accessCtrl 12
278 #define Z_DiagFormat_recordSyntax 13
279     union
280     {
281         Z_TooMany *tooMany;
282         Z_BadSpec *badSpec;
283         Z_DbUnavail *dbUnavail;
284         int *unSupOp;
285 #define Z_UnSupOp_and             0
286 #define Z_UnSupOp_or              1
287 #define Z_UnSupOp_and_not         2
288 #define Z_UnSupOp_prox            3
289         Z_Attribute *attribute;
290         Z_AttributeList *attCombo;
291         Z_DiagTerm *term;
292         Z_Proximity *proximity;
293         Z_Scan *scan;
294         Z_Sort *sort;
295         Z_Segmentation *segmentation;
296         Z_ExtServices *extServices;
297         Z_AccessCtrl *accessCtrl;
298         Z_RecordSyntax *recordSyntax;
299     } u;
300 } Z_DiagFormat;
301
302 typedef struct Z_Diagnostic
303 {
304     int which;
305 #define Z_Diagnostic_defaultDiagRec 0
306 #define Z_Diagnostic_explicitDiagnostic 1
307     union 
308     {
309         Z_DefaultDiagFormat *defaultDiagRec;
310         Z_DiagFormat *explicitDiagnostic;
311     } u;
312 } Z_Diagnostic;
313
314 typedef struct Z_DiagnosticUnit
315 {
316     Z_Diagnostic *diagnostic;                    /* OPTIONAL */
317     char *message;                               /* OPTIONAL */
318 } Z_DiagnosticUnit;
319
320 typedef struct Z_DiagnosticFormat
321 {
322     int num_diagnostics;
323     Z_DiagnosticUnit **diagnostics;
324 } Z_DiagnosticFormat;
325
326 YAZ_EXPORT int z_DiagnosticFormat(ODR o, Z_DiagnosticFormat **p, int opt,
327                                   const char *name);
328
329 #ifdef __cplusplus
330 }
331 #endif
332
333 #endif