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