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