Added Espec-1.
[yaz-moved-to-github.git] / include / prt-esp.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_ESP_H
29 #define PRT_ESP_H
30
31 #include <yconfig.h>
32
33 typedef struct Z_OccurValues
34 {
35     int *start;
36     int *howMany;                     /* OPTIONAL */
37 } Z_OccurValues;
38
39 typedef struct Z_Occurrences
40 {
41     enum
42     {
43         Z_Occurrences_all,
44         Z_Occurrences_last,
45         Z_Occurrences_values
46     } which;
47     union
48     {
49         Odr_null *all;
50         Odr_null *last;
51         Z_OccurValues *values;
52     } u;
53 } Z_Occurrences;
54
55 typedef struct Z_SpecificTag
56 {
57     int *tagType;                           /* OPTIONAL */
58     Z_StringOrNumeric *tagValue;
59     Z_Occurrences *occurrences;             /* OPTIONAL */
60 } Z_SpecificTag;
61
62 typedef struct Z_ETagUnit
63 {
64     enum
65     {
66         Z_ETagUnit_specificTag,
67         Z_ETagUnit_wildThing,
68         Z_ETagUnit_wildPath
69     } which;
70     union
71     {
72         Z_SpecificTag *specificTag;
73         Z_Occurrences *wildThing;
74         Odr_null *wildPath;
75     } u;
76 } Z_ETagUnit;
77
78 typedef struct Z_ETagPath
79 {
80     int num_tags;
81     Z_ETagUnit **tags;
82 } Z_ETagPath;
83
84 typedef struct Z_SimpleElement
85 {
86     Z_ETagPath *path;
87     Z_Variant *variantRequest;           /* OPTIONAL */
88 } Z_SimpleElement;
89
90 typedef struct Z_CompoPrimitives
91 {
92     int num_primitives;
93     char **primitives;
94 } Z_CompoPrimitives;
95
96 typedef struct Z_CompoSpecs
97 {
98     int num_specs;
99     Z_SimpleElement **specs;
100 } Z_CompoSpecs;
101
102 typedef struct Z_CompositeElement
103 {
104     enum
105     {
106         Z_CompoElement_primitives,
107         Z_CompoElement_specs
108     } which;
109     union
110     {
111         Z_CompoPrimitives *primitives;
112         Z_CompoSpecs *specs;
113     } elementList;
114     Z_ETagPath *deliveryTag;
115     Z_Variant *variantRequest;
116 } Z_CompositeElement;
117
118 typedef struct Z_ElementRequest
119 {
120     enum
121     {
122         Z_ERequest_simpleElement,
123         Z_ERequest_compositeElement
124     } which;
125     union
126     {
127         Z_SimpleElement *simpleElement;
128         Z_CompositeElement *compositeElement;
129     } u;
130 } Z_ElementRequest;
131
132 typedef struct Z_Espec1
133 {
134     int num_elementSetNames;
135     char **elementSetNames;               /* OPTIONAL */
136     Odr_oid *defaultVariantSetId;         /* OPTIONAL */
137     Z_Variant *defaultVariantRequest;     /* OPTIONAL */
138     int *defaultTagType;                  /* OPTIONAL */
139     int num_elements;
140     Z_ElementRequest *elements;           /* OPTIONAL */
141 } Z_Espec1;
142
143 int z_Espec1(ODR o, Z_Espec1 **p, int opt);
144
145 #endif