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