b7991632129de888dc1f8da154a930c3cf9fbd6f
[pazpar2-moved-to-github.git] / src / zeerex.h
1 #ifndef ZEEREX_H
2 #define ZEEREX_H
3
4 // Structures representing a Zeerex record.
5
6 typedef enum zr_bool
7 {
8     Zr_bool_unknown,
9     Zr_bool_false,
10     Zr_bool_true
11 } Zr_bool;
12
13 typedef struct zr_langstr
14 {
15     Zr_bool primary;
16     char *lang;
17     char *str;
18     struct zr_langstr *next;
19 } Zr_langstr;
20
21 struct zr_authentication
22 {
23     char *type;
24     char *open;
25     char *user;
26     char *group;
27     char *password;
28 };
29
30 struct zr_serverInfo
31 {
32     char *protocol;
33     char *version;
34     char *transport;
35     char *method;
36     char *host;
37     int port;
38     char *database;
39     struct zr_authentication *authentication;
40 };
41
42 struct zr_agent
43 {
44     char *type;
45     char *identifier;
46     char *value;
47     struct zr_agent *next;
48 };
49
50 struct zr_link
51 {
52     char *type;
53     char *value;
54     struct zr_link *next;
55 };
56
57 struct zr_implementation
58 {
59     char *identifier;
60     char *version;
61     struct zr_agent *agents;
62     Zr_langstr *title;
63 };
64
65 struct zr_databaseInfo
66 {
67     Zr_langstr *title;
68     Zr_langstr *description;
69     Zr_langstr *history;
70     char *lastUpdate;
71     Zr_langstr *extent;
72     int numberOfRecords;
73     Zr_langstr *restrictions;
74     Zr_langstr *langUsage;
75     char *codes;
76     struct zr_agent *agents;
77     struct zr_implementation *implementation;
78     struct zr_link *links;
79 };
80
81 struct zr_metaInfo
82 {
83     char *dateModified;
84     char *dateAggregated;
85     char *aggregatedFrom;
86 };
87
88 struct zr_set
89 {
90     Zr_langstr *title;
91     char *name;
92     char *identifier;
93     struct zr_set *next;
94 };
95
96 struct zr_attr
97 {
98     int type;
99     char *set;
100     char *value;
101     struct zr_attr *next;
102 };
103
104 struct zr_map
105 {
106     Zr_bool primary;
107     char *lang;
108     char *name;
109     char *set;
110     struct zr_attr *attrs;
111     struct zr_map *next;
112 };
113
114 typedef struct zr_setting
115 {
116     char *type;
117     char *value;
118     struct zr_map *map;
119     struct zr_setting *next;
120 } Zr_setting;
121
122 struct zr_configInfo
123 {
124     Zr_setting *defaultv;
125     Zr_setting *setting;
126     Zr_setting *supports;
127 };
128
129 struct zr_index
130 {
131     Zr_bool search;
132     Zr_bool scan;
133     Zr_bool sort;
134     char *id;
135     Zr_langstr *title;
136     struct zr_map *maps;
137     struct zr_configInfo *configInfo;
138     struct zr_index *next;
139 };
140
141 struct zr_sortKeyword
142 {
143     char *value;
144     struct zr_sortKeyword *next;
145 };
146
147 struct zr_indexInfo
148 {
149     struct zr_set *sets;
150     struct zr_index *indexes;
151     struct zr_sortKeyword *sortKeywords;
152     struct zr_configInfo *configInfo;
153 };
154
155 struct zr_elementSet
156 {
157     char *name;
158     char *identifier;
159     Zr_langstr *title;
160     struct zr_elementSet *next;
161 };
162
163 struct zr_recordSyntax
164 {
165     char *name;
166     char *identifier;
167     struct zr_elementSet *elementSets;
168     struct zr_recordSyntax *next;
169 };
170
171 struct zr_recordInfo
172 {
173     struct zr_recordSyntax *recordSyntaxes;
174 };
175
176 struct zr_schema
177 {
178     char *name;
179     char *identifier;
180     Zr_bool retrieve;
181     Zr_bool sort;
182     char *location;
183     Zr_langstr *title;
184     struct zr_schema *next;
185 };
186
187 struct zr_schemaInfo
188 {
189     struct zr_schema *schemas;
190 };
191
192 struct zr_explain
193 {
194     struct zr_serverInfo *serverInfo;
195     struct zr_databaseInfo *databaseInfo;
196     struct zr_metaInfo *metaInfo;
197     struct zr_indexInfo *indexInfo;
198     struct zr_recordInfo *recordInfo;
199     struct zr_schemaInfo *schemaInfo;
200     struct zr_configInfo *configInfo;
201 };
202
203 struct zr_explain *zr_read_xml(NMEM m, xmlNode *n);
204 struct zr_explain *zr_read_file(NMEM m, const char *fn);
205 const char *zr_langstr(Zr_langstr *s, const char *lang);
206
207 /*
208  * Local variables:
209  * c-basic-offset: 4
210  * indent-tabs-mode: nil
211  * End:
212  * vim: shiftwidth=4 tabstop=8 expandtab
213  */
214
215 #endif