Updated source file headers with new year and no CVS Id.
[pazpar2-moved-to-github.git] / src / zeerex.h
1 /* This file is part of Pazpar2.
2    Copyright (C) 2006-2008 Index Data
3
4 Pazpar2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
18 */
19
20 #ifndef ZEEREX_H
21 #define ZEEREX_H
22
23 // Structures representing a Zeerex record.
24
25 typedef enum zr_bool
26 {
27     Zr_bool_unknown,
28     Zr_bool_false,
29     Zr_bool_true
30 } Zr_bool;
31
32 typedef struct zr_langstr
33 {
34     Zr_bool primary;
35     char *lang;
36     char *str;
37     struct zr_langstr *next;
38 } Zr_langstr;
39
40 struct zr_authentication
41 {
42     char *type;
43     char *open;
44     char *user;
45     char *group;
46     char *password;
47 };
48
49 struct zr_serverInfo
50 {
51     char *protocol;
52     char *version;
53     char *transport;
54     char *method;
55     char *host;
56     int port;
57     char *database;
58     struct zr_authentication *authentication;
59 };
60
61 struct zr_agent
62 {
63     char *type;
64     char *identifier;
65     char *value;
66     struct zr_agent *next;
67 };
68
69 struct zr_link
70 {
71     char *type;
72     char *value;
73     struct zr_link *next;
74 };
75
76 struct zr_implementation
77 {
78     char *identifier;
79     char *version;
80     struct zr_agent *agents;
81     Zr_langstr *title;
82 };
83
84 struct zr_databaseInfo
85 {
86     Zr_langstr *title;
87     Zr_langstr *description;
88     Zr_langstr *history;
89     char *lastUpdate;
90     Zr_langstr *extent;
91     int numberOfRecords;
92     Zr_langstr *restrictions;
93     Zr_langstr *langUsage;
94     char *codes;
95     struct zr_agent *agents;
96     struct zr_implementation *implementation;
97     struct zr_link *links;
98 };
99
100 struct zr_metaInfo
101 {
102     char *dateModified;
103     char *dateAggregated;
104     char *aggregatedFrom;
105 };
106
107 struct zr_set
108 {
109     Zr_langstr *title;
110     char *name;
111     char *identifier;
112     struct zr_set *next;
113 };
114
115 struct zr_attr
116 {
117     int type;
118     char *set;
119     char *value;
120     struct zr_attr *next;
121 };
122
123 struct zr_map
124 {
125     Zr_bool primary;
126     char *lang;
127     char *name;
128     char *set;
129     struct zr_attr *attrs;
130     struct zr_map *next;
131 };
132
133 typedef struct zr_setting
134 {
135     char *type;
136     char *value;
137     struct zr_map *map;
138     struct zr_setting *next;
139 } Zr_setting;
140
141 struct zr_configInfo
142 {
143     Zr_setting *defaultv;
144     Zr_setting *setting;
145     Zr_setting *supports;
146 };
147
148 struct zr_index
149 {
150     Zr_bool search;
151     Zr_bool scan;
152     Zr_bool sort;
153     char *id;
154     Zr_langstr *title;
155     struct zr_map *maps;
156     struct zr_configInfo *configInfo;
157     struct zr_index *next;
158 };
159
160 struct zr_sortKeyword
161 {
162     char *value;
163     struct zr_sortKeyword *next;
164 };
165
166 struct zr_indexInfo
167 {
168     struct zr_set *sets;
169     struct zr_index *indexes;
170     struct zr_sortKeyword *sortKeywords;
171     struct zr_configInfo *configInfo;
172 };
173
174 struct zr_elementSet
175 {
176     char *name;
177     char *identifier;
178     Zr_langstr *title;
179     struct zr_elementSet *next;
180 };
181
182 struct zr_recordSyntax
183 {
184     char *name;
185     char *identifier;
186     struct zr_elementSet *elementSets;
187     struct zr_recordSyntax *next;
188 };
189
190 struct zr_recordInfo
191 {
192     struct zr_recordSyntax *recordSyntaxes;
193 };
194
195 struct zr_schema
196 {
197     char *name;
198     char *identifier;
199     Zr_bool retrieve;
200     Zr_bool sort;
201     char *location;
202     Zr_langstr *title;
203     struct zr_schema *next;
204 };
205
206 struct zr_schemaInfo
207 {
208     struct zr_schema *schemas;
209 };
210
211 struct zr_explain
212 {
213     struct zr_serverInfo *serverInfo;
214     struct zr_databaseInfo *databaseInfo;
215     struct zr_metaInfo *metaInfo;
216     struct zr_indexInfo *indexInfo;
217     struct zr_recordInfo *recordInfo;
218     struct zr_schemaInfo *schemaInfo;
219     struct zr_configInfo *configInfo;
220 };
221
222 struct zr_explain *zr_read_xml(NMEM m, xmlNode *n);
223 struct zr_explain *zr_read_file(NMEM m, const char *fn);
224 const char *zr_langstr(Zr_langstr *s, const char *lang);
225
226 /*
227  * Local variables:
228  * c-basic-offset: 4
229  * indent-tabs-mode: nil
230  * End:
231  * vim: shiftwidth=4 tabstop=8 expandtab
232  */
233
234 #endif