Work on Explain
[yaz-moved-to-github.git] / include / prt-exp.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_EXP_H
29 #define PRT_EXP_H
30
31 #include <yconfig.h>
32
33 #define multipleDbSearch multipleDBsearch
34
35 typedef struct Z_CommonInfo
36 {
37     char *dateAdded;           /* OPTIONAL */
38     char *dateChanged;         /* OPTIONAL */
39     char *expiry;              /* OPTIONAL */
40     char *humanStringLanguage;    /* OPTIONAL */
41     Z_OtherInformation *otherInfo;          /* OPTIONAL */
42 } Z_CommonInfo;
43
44 typedef struct Z_HumanStringUnit
45 {
46     char *language;               /* OPTIONAL */
47     char *text;
48 } Z_HumanStringUnit;
49
50 typedef struct Z_HumanString
51 {
52     int num_strings;
53     Z_HumanStringUnit **strings;
54 } Z_HumanString;
55
56 typedef struct Z_IconObjectUnit
57 {
58     enum
59     {
60         Z_IconObject_ianaType,
61         Z_IconObject_z3950type,
62         Z_IconObject_otherType
63     } which;
64     char *bodyType;
65     Odr_oct *content;
66 } Z_IconObjectUnit;
67
68 typedef struct Z_IconObject
69 {
70     int num_iconUnits;
71     Z_IconObjectUnit **iconUnits;
72 } Z_IconObject;
73
74 typedef struct Z_ContactInfo
75 {
76     char *name;                             /* OPTIONAL */
77     Z_HumanString *description;             /* OPTIONAL */
78     Z_HumanString *address;                 /* OPTIONAL */
79     char *email;                            /* OPTIONAL */
80     char *phone;                            /* OPTIONAL */
81 } Z_ContactInfo;
82
83 typedef struct Z_NetworkAddressIA
84 {
85     char *hostAddress;
86     int *port;
87 } Z_NetworkAddressIA;
88
89 typedef struct Z_NetworkAddressOPA
90 {
91     char *pSel;
92     char *sSel;                  /* OPTIONAL */
93     char *tSel;                  /* OPTIONAL */
94     char *nSap;
95 } Z_NetworkAddressOPA;
96
97 typedef struct Z_NetworkAddressOther
98 {
99     char *type;
100     char *address;
101 } Z_NetworkAddressOther;
102
103 typedef struct Z_NetworkAddress
104 {
105     enum
106     {
107         Z_NetworkAddress_iA,
108         Z_NetworkAddress_oPA,
109         Z_NetworkAddress_other
110     } which;
111     union
112     {
113         Z_NetworkAddressIA *internetAddress;
114         Z_NetworkAddressOPA *osiPresentationAddress;
115         Z_NetworkAddressOther *other;
116     } u;
117 } Z_NetworkAddress;
118
119 typedef struct Z_PrivateCapOperator
120 {
121     char *operator;
122     Z_HumanString *description;             /* OPTIONAL */
123 } Z_PrivateCapOperator;
124     
125 typedef struct Z_SearchKey
126 {
127     char *searchKey;
128     Z_HumanString *description;             /* OPTIONAL */
129 } Z_SearchKey;
130
131 typedef struct Z_PrivateCapabilities
132 {
133     int num_operators;
134     Z_PrivateCapOperator **operators;      /* OPTIONAL */
135     int num_searchKeys;
136     Z_SearchKey **searchKeys;               /* OPTIONAL */
137     int num_description;
138     Z_HumanString **description;            /* OPTIONAL */
139 } Z_PrivateCapabilities;
140
141 typedef struct Z_ProxSupportPrivate
142 {
143     int *unit;
144     Z_HumanString *description;             /* OPTIONAL */
145 } Z_ProxSupportPrivate;
146
147 typedef struct Z_ProxSupportUnit
148 {
149     enum
150     {
151         Z_ProxSupportUnit_known,
152         Z_ProxSupportUnit_private
153     } which;
154     union
155     {
156         int known;
157         Z_ProxSupportPrivate *private;
158     } u;
159 } Z_ProxSupportUnit;
160
161 typedef struct Z_ProximitySupport
162 {
163     bool_t *anySupport;
164     int num_unitsSupported;
165     Z_ProxSupportUnit **unitsSupported;     /* OPTIONAL */
166 } Z_ProximitySupport;
167
168 typedef struct Z_RpnCapabilities
169 {
170     int num_operators;
171     int **operators;                        /* OPTIONAL */
172     bool_t *resultSetAsOperandSupported;
173     bool_t *restrictionOperandSupported;
174     Z_ProximitySupport *proximity;          /* OPTIONAL */
175 } Z_RpnCapabilities;
176
177 typedef struct Z_Iso8777Capabilities
178 {
179     int num_searchKeys;
180     Z_SearchKey **searchKeys;
181     Z_HumanString *restrictions;            /* OPTIONAL */
182 } Z_Iso8777Capabilities;
183
184 typedef struct Z_QueryTypeDetails
185 {
186     enum
187     {
188         Z_QueryTypeDetails_private,
189         Z_QueryTypeDetails_rpn,
190         Z_QueryTypeDetails_iso8777,
191         Z_QueryTypeDetails_z3958,
192         Z_QueryTypeDetails_erpn,
193         Z_QueryTypeDetails_rankedList
194     } which;
195     union
196     {
197         Z_PrivateCapabilities *private;
198         Z_RpnCapabilities *rpn;
199         Z_Iso8777Capabilities *iso8777;
200         Z_HumanString *z3958;
201         Z_RpnCapabilities *erpn;
202         Z_HumanString *rankedList;
203     } u;
204 } Z_QueryTypeDetails;
205
206 typedef struct Z_AccessRestrictionsUnit
207 {
208     int *accessType;
209 #define Z_AccessRestrictions_any                 0
210 #define Z_AccessRestrictions_search              1
211 #define Z_AccessRestrictions_present             2
212 #define Z_AccessRestrictions_specific_elements   3
213 #define Z_AccessRestrictions_extended_services   4
214 #define Z_AccessRestrictions_by_database         5
215     Z_HumanString *accessText;              /* OPTIONAL */
216     int num_accessChallenges;
217     Odr_oid **accessChallenges;             /* OPTIONAL */
218 } Z_AccessRestrictionsUnit;
219
220 typedef struct Z_AccessRestrictions
221 {
222     int num_restrictions;
223     Z_AccessRestrictionsUnit **restrictions;
224 } Z_AccessRestrictions;
225
226 typedef struct Z_Charge
227 {
228     Z_IntUnit *cost;
229     Z_Unit *perWhat;                        /* OPTIONAL */
230     Z_HumanString *text;                    /* OPTIONAL */
231 } Z_Charge;
232
233 typedef struct Z_CostsOtherCharge
234 {
235     Z_HumanString *forWhat;
236     Z_Charge *charge;
237 } Z_CostsOtherCharge;
238
239 typedef struct Z_Costs
240 {
241     Z_Charge *connectCharge;                /* OPTIONAL */
242     Z_Charge *connectTime;                  /* OPTIONAL */
243     Z_Charge *displayCharge;                /* OPTIONAL */
244     Z_Charge *searchCharge;                 /* OPTIONAL */
245     Z_Charge *subscriptCharge;              /* OPTIONAL */
246     int num_otherCharges;
247     Z_CostsOtherCharge **otherCharges;      /* OPTIONAL */
248 } Z_Costs;
249
250 typedef struct Z_AccessInfo
251 {
252     int num_queryTypesSupported;
253     Z_QueryTypeDetails **queryTypesSupported;  /* OPTIONAL */
254     int num_diagnosticsSets;
255     Odr_oid **diagnosticsSets;              /* OPTIONAL */
256     int num_attributeSetIds;
257     Odr_oid **attributeSetIds;     /* OPTIONAL */
258     int num_schemas;
259     Odr_oid **schemas;                      /* OPTIONAL */
260     int num_recordSyntaxes;
261     Odr_oid **recordSyntaxes;               /* OPTIONAL */
262     int num_resourceChallenges;
263     Odr_oid **resourceChallenges;           /* OPTIONAL */
264     Z_AccessRestrictions *restrictedAccess;  /* OPTIONAL */
265     Z_Costs *costInfo;                      /* OPTIONAL */
266     int num_variantSets;
267     Odr_oid **variantSets;                  /* OPTIONAL */
268     int num_elementSetNames;
269     char **elementSetNames;     /* OPTIONAL */
270     int num_unitSystems;
271     char **unitSystems;
272 } Z_AccessInfo;
273
274 typedef struct Z_DatabaseList
275 {
276     int num_databases;
277     Z_DatabaseName **databases;
278 } Z_DatabaseList;
279
280 typedef struct Z_AttributeValueList
281 {
282     int num_attributes;
283     Z_StringOrNumeric **attributes;
284 } Z_AttributeValueList;
285
286 typedef struct Z_AttributeOccurrence
287 {
288     Odr_oid *attributeSet;         /* OPTIONAL */
289     int *attributeType;
290     Odr_null *mustBeSupplied;               /* OPTIONAL */
291     enum
292     {
293         Z_AttributeOcc_anyOrNone,
294         Z_AttributeOcc_specific
295     } which;
296     union
297     {
298         Odr_null *anyOrNone;
299         Z_AttributeValueList *specific;
300     } *attributeValues;
301 } Z_AttributeOccurrence;
302
303 typedef struct Z_AttributeCombination
304 {
305     int num_occurrences;
306     Z_AttributeOccurrence **occurrences;
307 } Z_AttributeCombination;
308
309 typedef struct Z_AttributeCombinations
310 {
311     Odr_oid *defaultAttributeSet;
312     int num_legalCombinations;
313     Z_AttributeCombination **legalCombinations;
314 } Z_AttributeCombinations;
315
316 typedef struct Z_AttributeValue
317 {
318     Z_StringOrNumeric *value;
319     Z_HumanString *description;             /* OPTIONAL */
320     int num_subAttributes;
321     Z_StringOrNumeric **subAttributes;      /* OPTIONAL */
322     int num_superAttributes;
323     Z_StringOrNumeric **superAttributes;    /* OPTIONAL */
324     Odr_null *partialSupport;               /* OPTIONAL */
325 } Z_AttributeValue;
326
327 typedef struct Z_TargetInfo
328 {
329     Z_CommonInfo *commonInfo;               /* OPTIONAL */
330     /*
331      * key elements
332      */
333     char *name;
334     /*
335      * non-key brief elements
336      */
337     Z_HumanString *recentNews;             /* OPTIONAL */
338     Z_IconObject *icon;                     /* OPTIONAL */
339     bool_t *namedResultSets;
340     bool_t *multipleDbSearch;
341     int *maxResultSets;                     /* OPTIONAL */
342     int *maxResultSize;                     /* OPTIONAL */
343     int *maxTerms;                          /* OPTIONAL */
344     Z_IntUnit *timeoutInterval;             /* OPTIONAL */
345     Z_HumanString *welcomeMessage;          /* OPTIONAL */
346     /*
347      * non-brief elements
348      */
349     Z_ContactInfo *contactInfo;             /* OPTIONAL */
350     Z_HumanString *description;             /* OPTIONAL */
351     int num_nicknames;
352     char **nicknames;
353     Z_HumanString *usageRest;              /* OPTIONAL */
354     Z_HumanString *paymentAddr;             /* OPTIONAL */
355     Z_HumanString *hours;                   /* OPTIONAL */
356     int num_dbCombinations;
357     Z_DatabaseList **dbCombinations;        /* OPTIONAL */
358     int num_addresses;
359     Z_NetworkAddress **addresses;           /* OPTIONAL */
360     Z_AccessInfo *commonAccessInfo;         /* OPTIONAL */
361 } Z_TargetInfo;
362
363 typedef struct Z_DatabaseInfo
364 {
365     Z_CommonInfo *commonInfo;               /* OPTIONAL */
366     /*
367      * Key elements
368      */
369     Z_DatabaseName *name;
370     /* 
371      * Non-key elements.
372      */
373     Odr_null *explainDatabase;              /* OPTIONAL */
374     int num_nicknames;
375     Z_DatabaseName **nicknames;             /* OPTIONAL */
376     Z_IconObject *icon;                     /* OPTIONAL */
377     bool_t *userFee;
378     bool_t *available;
379     Z_HumanString *titleString;             /* OPTIONAL */
380     /*
381      * Non-brief elements.
382      */
383     int num_keywords;
384     Z_HumanString **keywords;               /* OPTIONAL */
385     Z_HumanString *description;             /* OPTIONAL */
386     Z_DatabaseList *associatedDbs;          /* OPTIONAL */
387     Z_DatabaseList *subDbs;                 /* OPTIONAL */
388     Z_HumanString *disclaimers;             /* OPTIONAL */
389     Z_HumanString *news;                    /* OPTIONAL */
390     enum
391     {
392         Z_Exp_RecordCount_actualNumber,
393         Z_Exp_RecordCount_approxNumber
394     } recordCount_which;
395     int *recordCount;                       /* OPTIONAL */
396     Z_HumanString *defaultOrder;            /* OPTIONAL */
397     int *avRecordSize;                      /* OPTIONAL */
398     int *maxRecordSize;                     /* OPTIONAL */
399     Z_HumanString *hours;                   /* OPTIONAL */
400     Z_HumanString *bestTime;                /* OPTIONAL */
401     char *lastUpdate;          /* OPTIONAL */
402     Z_IntUnit *updateInterval;              /* OPTIONAL */
403     Z_HumanString *coverage;                /* OPTIONAL */
404     bool_t *proprietary;                    /* OPTIONAL */
405     Z_HumanString *copyrightText;           /* OPTIONAL */
406     Z_HumanString *copyrightNotice;         /* OPTIONAL */
407     Z_ContactInfo *producerContactInfo;     /* OPTIONAL */
408     Z_ContactInfo *supplierContactInfo;     /* OPTIONAL */
409     Z_ContactInfo *submissionContactInfo;   /* OPTIONAL */
410     Z_AccessInfo *accessInfo;               /* OPTIONAL */
411 } Z_DatabaseInfo;
412
413 typedef struct Z_TagTypeMapping
414 {
415     int *tagType;
416     Odr_oid *tagSet;                        /* OPTIONAL */
417     Odr_null *defaultTagType;               /* OPTIONAL */
418 } Z_TagTypeMapping;
419
420 typedef struct Z_PathUnit
421 {
422     int *tagType;
423     Z_StringOrNumeric *tagValue;
424 } Z_PathUnit;
425
426 typedef struct Z_Path
427 {
428     int num;
429     Z_PathUnit **list;
430 } Z_Path;
431
432 struct Z_ElementDataType;
433 typedef struct Z_ElementDataType Z_ElementDataType;
434
435 typedef struct Z_ElementInfo
436 {
437     char *elementName;
438     Z_Path *elementTagPath;
439     Z_ElementDataType *dataType;            /* OPTIONAL */
440     bool_t *required;
441     bool_t *repeatable;
442     Z_HumanString *description;             /* OPTIONAL */
443 } Z_ElementInfo;
444
445 typedef struct Z_ElementInfoList
446 {
447     int num;
448     Z_ElementInfo **list;
449 } Z_ElementInfoList;
450
451 struct Z_ElementDataType
452 {
453     enum
454     {
455         Z_ElementDataType_primitive,
456         Z_ElementDataType_structured
457     } which;
458     union
459     {
460         int *primitive;
461 #define Z_PrimitiveElement_octetString         0
462 #define Z_PrimitiveElement_numeric             1
463 #define Z_PrimitiveElement_date                2
464 #define Z_PrimitiveElement_external            3
465 #define Z_PrimitiveElement_string              4
466 #define Z_PrimitiveElement_trueOrFalse         5
467 #define Z_PrimitiveElement_oid                 6
468 #define Z_PrimitiveElement_intUnit             7
469 #define Z_PrimitiveElement_empty               8
470 #define Z_PrimitiveElement_noneOfTheAbove      100
471         Z_ElementInfoList *structured;
472     } u;
473 };
474
475 typedef struct Z_TagSetInfoElements
476 {
477     char *elementName;
478     int num_nicknames;
479     char **nicknames;                       /* OPTIONAL */
480     Z_StringOrNumeric *elementTag;
481     Z_HumanString *description;             /* OPTIONAL */
482     int *dataType;                          /* OPTIONAL */
483     /* (value as in Z_PrimitiveElement) */
484     Z_OtherInformation *otherTagInfo;       /* OPTIONAL */
485 } Z_TagSetInfoElements;
486
487 typedef struct Z_SchemaInfo
488 {
489     Z_CommonInfo *commonInfo;               /* OPTIONAL */
490     /*
491      * Key elements
492      */
493     Odr_oid *schema;
494     /*
495      * Non-key elements
496      */
497     char *name;
498     /*
499      * Non-brief elements
500      */
501     Z_HumanString *description;             /* OPTIONAL */
502     int num_tagTypeMapping;
503     Z_TagTypeMapping **tagTypeMapping;      /* OPTIONAL */
504     int num_recordStructure;
505     Z_ElementInfo **recordStructure;        /* OPTIONAL */
506 } Z_SchemaInfo;
507
508
509 typedef struct Z_TagSetInfo
510 {
511     Z_CommonInfo *commonInfo;               /* OPTIONAL */
512     /*
513      * Key elements
514      */
515     Odr_oid *tagSet;
516     /*
517      * Non-key elements
518      */
519     char *name;
520     /*
521      * Non-brief elements
522      */
523     Z_HumanString *description;             /* OPTIONAL */
524     int num_elements;
525     Z_TagSetInfoElements **elements;        /* OPTIONAL */
526 } Z_TagSetInfo;
527
528 typedef struct Z_RecordSyntaxInfo
529 {
530     Z_CommonInfo *commonInfo;               /* OPTIONAL */
531     /*
532      * Key elements
533      */
534     Odr_oid *recordSyntax;
535     /*
536      * Non-key elements
537      */
538     char *name;
539     /*
540      * Non-brief elements
541      */
542     int num_transferSyntaxes;
543     Odr_oid **transferSyntaxes;             /* OPTIONAL */
544     Z_HumanString *description;             /* OPTIONAL */
545     char *asn1Module;                       /* OPTIONAL */
546     int num_abstractStructure;
547     Z_ElementInfo **abstractStructure;      /* OPTIONAL */
548 } Z_RecordSyntaxInfo;
549
550 typedef struct Z_AttributeDescription
551 {
552     char *name;                             /* OPTIONAL */
553     Z_HumanString *description;             /* OPTIONAL */
554     Z_StringOrNumeric *attributeValue;
555     int num_equivalentAttributes;
556     Z_StringOrNumeric **equivalentAttributes; /* OPTIONAL */
557 } Z_AttributeDescription;
558
559 typedef struct Z_AttributeType
560 {
561     char *name;                             /* OPTIONAL */
562     Z_HumanString *description;             /* OPTIONAL */
563     int *attributeType;
564     int num_attributeValues;
565     Z_AttributeDescription **attributeValues;
566 } Z_AttributeType;
567
568 typedef struct Z_AttributeSetInfo
569 {
570     Z_CommonInfo *commonInfo;               /* OPTIONAL */
571     /*
572      * Key elements
573      */
574     Odr_oid *attributeSet;
575     /*
576      * Non-key elements
577      */
578     char *name;
579     /*
580      * Non-brief elements
581      */
582     int num_attributes;
583     Z_AttributeType **attributes;           /* OPTIONAL */
584     Z_HumanString *description;             /* OPTIONAL */
585 } Z_AttributeSetInfo;
586
587 typedef struct Z_TermListElement
588 {
589     char *name;
590     Z_HumanString *title;                   /* OPTIONAL */
591     int *searchCost;                        /* OPTIONAL */
592 #define Z_TermListInfo_optimized           0
593 #define Z_TermListInfo_normal              1
594 #define Z_TermListInfo_expensive           2
595 #define Z_TermListInfo_filter              3
596     bool_t *scanable;
597     int num_broader;
598     char **broader;                         /* OPTIONAL */
599     int num_narrower;
600     char **narrower;                        /* OPTIONAL */
601 } Z_TermListElement;
602
603 typedef struct Z_TermListInfo
604 {
605     Z_CommonInfo *commonInfo;               /* OPTIONAL */
606     /*
607      * Key elements
608      */
609     Z_DatabaseName *databaseName;
610     /*
611      * Non-key elements
612      */
613     int num_termLists;
614     Z_TermListElement **termLists;
615 } Z_TermListInfo;
616
617 typedef struct Z_ExtendedServicesInfo
618 {
619     Z_CommonInfo *commonInfo;               /* OPTIONAL */
620     /*
621      * Key elements
622      */
623     Odr_oid *type;
624     /*
625      * Non-key elements
626      */
627     char *name;                             /* OPTIONAL */
628     bool_t *privateType;
629     bool_t *restrictionsApply;
630     bool_t *feeApply;
631     bool_t *available;
632     bool_t *retentionSupported;
633     int *waitAction;
634 #define Z_ExtendedServicesInfo_waitSupported       1
635 #define Z_ExtendedServicesInfo_waitAlways          2
636 #define Z_ExtendedServicesInfo_waitNotSupported    3
637 #define Z_ExtendedServicesInfo_depends             4
638 #define Z_ExtendedServicesInfo_notSaying           5
639     /*
640      * Non-brief elements
641      */
642     Z_HumanString *description;             /* OPTIONAL */
643     Z_External *specificExplain;          /* OPTIONAL */
644     char *esASN;                            /* OPTIONAL */
645 } Z_ExtendedServicesInfo;
646
647 typedef struct Z_OmittedAttributeInterpretation
648 {
649     Z_StringOrNumeric *defaultValue;        /* OPTIONAL */
650     Z_HumanString *defaultDescription;      /* OPTIONAL */
651 } Z_OmittedAttributeInterpretation;
652
653 typedef struct Z_AttributeTypeDetails
654 {
655     int *attributeType;
656     Z_OmittedAttributeInterpretation *optionalType;  /* OPTIONAL */
657     int num_attributeValues;
658     Z_AttributeValue **attributeValues;     /* OPTIONAL */
659 } Z_AttributeTypeDetails;
660
661 typedef struct Z_AttributeSetDetails
662 {
663     Odr_oid *attributeSet;
664     int num_attributesByType;
665     Z_AttributeTypeDetails **attributesByType;
666 } Z_AttributeSetDetails;
667
668 typedef struct Z_AttributeDetails
669 {
670     Z_CommonInfo *commonInfo;               /* OPTIONAL */
671     /*
672      * Key details
673      */
674     Z_DatabaseName *databaseName;
675     /*
676      * Non-brief elements
677      */
678     int num_attributesBySet;
679     Z_AttributeSetDetails **attributesBySet;  /* OPTIONAL */
680     Z_AttributeCombinations *attributeCombinations;  /* OPTIONAL */
681 } Z_AttributeDetails;
682
683 typedef struct Z_EScanInfo
684 {
685     int *maxStepSize;                       /* OPTIONAL */
686     Z_HumanString *collatingSequence;       /* OPTIONAL */
687     bool_t *increasing;                     /* OPTIONAL */
688 } Z_EScanInfo;
689
690 typedef struct Z_TermListDetails
691 {
692     Z_CommonInfo *commonInfo;               /* OPTIONAL */
693     /*
694      * Key elements
695      */
696     char *termListName;
697     /*
698      * Non-brief elements
699      */
700     Z_HumanString *description;             /* OPTIONAL */
701     Z_AttributeCombinations *attributes;    /* OPTIONAL */
702     Z_EScanInfo *scanInfo;                  /* OPTIONAL */
703     int *estNumberTerms;                    /* OPTIONAL */
704     int num_sampleTerms;
705     Z_Term **sampleTerms;                   /* OPTIONAL */
706 } Z_TermListDetails;
707
708 typedef struct Z_RecordTag
709 {
710     Z_StringOrNumeric *qualifier;           /* OPTIONAL */
711     Z_StringOrNumeric *tagValue;
712 } Z_RecordTag;
713
714 typedef struct Z_PerElementDetails
715 {
716     char *name;                             /* OPTIONAL */
717     Z_RecordTag *recordTag;                 /* OPTIONAL */
718     int num_schemaTags;
719     Z_Path **schemaTags;                    /* OPTIONAL */
720     int *maxSize;                           /* OPTIONAL */
721     int *minSize;                           /* OPTIONAL */
722     int *avgSize;                           /* OPTIONAL */
723     int *fixedSize;                         /* OPTIONAL */
724     bool_t *repeatable;
725     bool_t *required;
726     Z_HumanString *description;             /* OPTIONAL */
727     Z_HumanString *contents;                /* OPTIONAL */
728     Z_HumanString *billingInfo;             /* OPTIONAL */
729     Z_HumanString *restrictions;            /* OPTIONAL */
730     int num_alternateNames;
731     char **alternateNames;                  /* OPTIONAL */
732     int num_genericNames;
733     char **genericNames;                    /* OPTIONAL */
734     Z_AttributeCombinations *searchAccess;  /* OPTIONAL */
735 } Z_PerElementDetails;
736
737 typedef struct Z_ElementSetDetails
738 {
739     Z_CommonInfo *commonInfo;               /* OPTIONAL */
740     /*
741      * Key elements
742      */
743     Z_DatabaseName *databaseName;
744     char *elementSetName;
745     Odr_oid *recordSyntax;
746     /*
747      * Brief elements
748      */
749     Odr_oid *schema;
750     /*
751      * Non-brief elements
752      */
753     Z_HumanString *description;             /* OPTIONAL */
754     int num_detailsPerElement;
755     Z_PerElementDetails **detailsPerElement;  /* OPTIONAL */
756 } Z_ElementSetDetails;
757
758 typedef struct Z_RetrievalRecordDetails
759 {
760     Z_CommonInfo *commonInfo;               /* OPTIONAL */
761     /*
762      * Key elements
763      */
764     Z_DatabaseName *databaseName;
765     Odr_oid *schema;
766     Odr_oid *recordSyntax;
767     /*
768      * Non-brief elements
769      */
770     Z_HumanString *description;             /* OPTIONAL */
771     int num_detailsPerElement;
772     Z_PerElementDetails **detailsPerElement;  /* OPTIONAL */
773 } Z_RetrievalRecordDetails;
774
775 typedef struct Z_SortKeyDetailsSortType
776 {
777     enum
778     {
779         Z_SortKeyDetailsSortType_character,
780         Z_SortKeyDetailsSortType_numeric,
781         Z_SortKeyDetailsSortType_structured
782     } which;
783     union
784     {
785         Odr_null *character;
786         Odr_null *numeric;
787         Z_HumanString *structured;
788     } u;
789 } Z_SortKeyDetailsSortType;
790
791 typedef struct Z_SortKeyDetails
792 {
793     Z_HumanString *description;                        /* OPTIONAL */
794     int num_elementSpecifications;
795     Z_Specification **elementSpecifications;           /* OPTIONAL */
796     Z_AttributeCombinations *attributeSpecifications;  /* OPTIONAL */
797     Z_SortKeyDetailsSortType *sortType;                /* OPTIONAL */
798     int *caseSensitivity;                              /* OPTIONAL */
799 #define Z_SortKeyDetails_always              0
800 #define Z_SortKeyDetails_never               1
801 #define Z_SortKeyDetails_defaultYes          2
802 #define Z_SortKeyDetails_defaultNo           3
803 } Z_SortKeyDetails;
804
805 typedef struct Z_SortDetails
806 {
807     Z_CommonInfo *commonInfo;               /* OPTIONAL */
808     /*
809      * Key elements
810      */
811     Z_DatabaseName *databaseName;
812     /* 
813      * Non-brief elements
814      */
815     int num_sortKeys;
816     Z_SortKeyDetails **sortKeys;            /* OPTIONAL */
817 } Z_SortDetails;
818
819 typedef struct Z_ProcessingInformation
820 {
821     Z_CommonInfo *commonInfo;               /* OPTIONAL */
822     /*
823      * Key elements
824      */
825     Z_DatabaseName *databaseName;
826     int *processingContext;
827 #define Z_ProcessingInformation_access              0
828 #define Z_ProcessingInformation_search              1
829 #define Z_ProcessingInformation_retrieval           2
830 #define Z_ProcessingInformation_recordPresentation  3
831 #define Z_ProcessingInformation_recordHandling      4
832     char *name;
833     Odr_oid *oid;
834     /*
835      * Non-brief elements
836      */
837     Z_HumanString *description;             /* OPTIONAL */
838     Z_External *instructions;             /* OPTIONAL */
839 } Z_ProcessingInformation;
840
841 typedef struct Z_ValueDescription
842 {
843     enum
844     {
845         Z_ValueDescription_integer,
846         Z_ValueDescription_string,
847         Z_ValueDescription_octets,
848         Z_ValueDescription_oid,
849         Z_ValueDescription_unit,
850         Z_ValueDescription_valueAndUnit
851     } which;
852     union
853     {
854         int *integer;
855         char *string;
856         Odr_oct *octets;
857         Odr_oid *oid;
858         Z_Unit *unit;
859         Z_IntUnit *valueAndUnit;
860     } u;
861 } Z_ValueDescription;
862
863 typedef struct Z_ValueRange
864 {
865     Z_ValueDescription *lower;              /* OPTIONAL */
866     Z_ValueDescription *upper;              /* OPTIONAL */
867 } Z_ValueRange;
868
869 typedef struct Z_ValueSetEnumerated
870 {
871     int num_enumerated;
872     Z_ValueDescription **enumerated;
873 } Z_ValueSetEnumerated;
874
875 typedef struct Z_ValueSet
876 {
877     enum
878     {
879         Z_ValueSet_range,
880         Z_ValueSet_enumerated
881     } which;
882     union
883     {
884         Z_ValueRange *range;
885         Z_ValueSetEnumerated *enumerated;
886     } u;
887 } Z_ValueSet;
888
889 typedef struct Z_VariantValue
890 {
891     int *dataType;
892     Z_ValueSet *values;                     /* OPTIONAL */
893 } Z_VariantValue;
894
895 typedef struct Z_VariantType
896 {
897     char *name;                             /* OPTIONAL */
898     Z_HumanString *description;             /* OPTIONAL */
899     int *variantType;
900     Z_VariantValue *variantValue;           /* OPTIONAL */
901 } Z_VariantType;
902
903 typedef struct Z_VariantClass
904 {
905     char *name;                             /* OPTIONAL */
906     Z_HumanString *description;             /* OPTIONAL */
907     int *variantClass;
908     int num_variantTypes;
909     Z_VariantType **variantTypes;
910 } Z_VariantClass;
911
912 typedef struct Z_VariantSetInfo
913 {
914     Z_CommonInfo *commonInfo;               /* OPTIONAL */
915     /*
916      * Key elements
917      */
918     Odr_oid *variantSet;
919     /*
920      * Brief elements
921      */
922     char *name;
923     /*
924      * Non-brief elements
925      */
926     int num_variants;
927     Z_VariantClass **variants;              /* OPTIONAL */
928 } Z_VariantSetInfo;
929
930 typedef struct Z_Units
931 {
932     char *name;                             /* OPTIONAL */
933     Z_HumanString *description;             /* OPTIONAL */
934     Z_StringOrNumeric *unit;
935 } Z_Units;
936
937 typedef struct Z_UnitType
938 {
939     char *name;                             /* OPTIONAL */
940     Z_HumanString *description;             /* OPTIONAL */
941     Z_StringOrNumeric *unitType;
942     int num_units;
943     Z_Units **units;
944 } Z_UnitType;
945
946 typedef struct Z_UnitInfo
947 {
948     Z_CommonInfo *commonInfo;               /* OPTIONAL */
949     /*
950      * Key elements
951      */
952     char *unitSystem;
953     /*
954      * Non-brief elements
955      */
956     Z_HumanString *description;             /* OPTIONAL */
957     int num_units;
958     Z_UnitType **units;                     /* OPTIONAL */
959 } Z_UnitInfo;
960
961 typedef struct Z_CategoryInfo
962 {
963     char *category;
964     char *originalCategory;                 /* OPTIONAL */
965     Z_HumanString *description;             /* OPTIONAL */
966     char *asn1Module;                       /* OPTIONAL */
967 } Z_CategoryInfo;
968
969 typedef struct Z_CategoryList
970 {
971     Z_CommonInfo *commonInfo;               /* OPTIONAL */
972     int num_categories;
973     Z_CategoryInfo **categories;
974 } Z_CategoryList;
975
976 typedef struct Z_ExplainRecord
977 {
978     enum
979     {
980         Z_Explain_targetInfo,
981         Z_Explain_databaseInfo,
982         Z_Explain_schemaInfo,
983         Z_Explain_tagSetInfo,
984         Z_Explain_recordSyntaxInfo,
985         Z_Explain_attributeSetInfo,
986         Z_Explain_termListInfo,
987         Z_Explain_extendedServicesInfo,
988         Z_Explain_attributeDetails,
989         Z_Explain_termListDetails,
990         Z_Explain_elementSetDetails,
991         Z_Explain_retrievalRecordDetails,
992         Z_Explain_sortDetails,
993         Z_Explain_processing,
994         Z_Explain_variants,
995         Z_Explain_units,
996         Z_Explain_categoryList
997     } which;
998     union
999     {
1000         Z_TargetInfo *targetInfo;
1001         Z_DatabaseInfo *databaseInfo;
1002         Z_SchemaInfo *schemaInfo;
1003         Z_TagSetInfo *tagSetInfo;
1004         Z_RecordSyntaxInfo *recordSyntaxInfo;
1005         Z_AttributeSetInfo *attributeSetInfo;
1006         Z_TermListInfo *termListInfo;
1007         Z_ExtendedServicesInfo *extendedServicesInfo;
1008         Z_AttributeDetails *attributeDetails;
1009         Z_TermListDetails *termListDetails;
1010         Z_ElementSetDetails *elementSetDetails;
1011         Z_RetrievalRecordDetails *retrievalRecordDetails;
1012         Z_SortDetails *sortDetails;
1013         Z_ProcessingInformation *processing;
1014         Z_VariantSetInfo *variants;
1015         Z_UnitInfo *units;
1016         Z_CategoryList *categoryList;
1017     } u;
1018 } Z_ExplainRecord;
1019
1020 int z_ExplainRecord(ODR o, Z_ExplainRecord **p, int opt);
1021
1022 #endif