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