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