Avoid empty struct becuase some compilers dont like it.
[pazpar2-moved-to-github.git] / src / config.h
1 #ifndef CONFIG_H
2 #define CONFIG_H
3
4 #include <libxslt/xslt.h>
5 #include <libxslt/transform.h>
6 #include <libxslt/xsltutils.h>
7
8 // Describes known metadata elements and how they are to be manipulated
9 struct conf_metadata 
10 {
11     char *name;  // The name of this element. Output by normalization stylesheet
12     int brief;   // Is this element to be returned in the brief format?
13     int termlist;// Is this field to be treated as a termlist for browsing?
14     int rank;    // Rank factor. 0 means don't use this field for ranking, 1 is default
15     enum
16     {
17         Metadata_type_generic,          // Generic text field
18         Metadata_type_integer,          // Integer type
19         Metadata_type_year              // A year
20     } type;
21     enum
22     {
23         Metadata_sortkey_no,            // This is not to be used as a sortkey
24         Metadata_sortkey_numeric,       // Standard numerical sorting
25         Metadata_sortkey_range,         // Range sorting (pick lowest or highest)
26         Metadata_sortkey_skiparticle    // Skip leading article when sorting
27     } sortkey;
28     enum
29     {
30         Metadata_merge_no,              // Don't merge
31         Metadata_merge_unique,          // Include unique elements in merged block
32         Metadata_merge_longest,         // Include the longest (strlen) value
33         Metadata_merge_range,           // Store value as a range of lowest-highest
34         Metadata_merge_all              // Just include all elements found
35     } merge;
36 };
37
38 struct conf_service
39 {
40     int num_metadata;
41     struct conf_metadata *metadata;
42 };
43
44 struct conf_server
45 {
46     char *host;
47     int port;
48     char *proxy_host;
49     int proxy_port;
50     struct conf_service *service;
51     struct conf_server *next;
52 };
53
54 struct conf_queryprofile
55 {
56     int dummy;
57 };
58
59 struct conf_retrievalmap
60 {
61     enum {
62         Map_xslt
63     } type;
64     char *charset;
65     char *format;
66     xsltStylesheet *stylesheet;
67     struct conf_retrievalmap *next;
68 };
69
70 struct conf_retrievalprofile
71 {
72     char *requestsyntax;
73     enum {
74         Nativesyn_xml,
75         Nativesyn_iso2709
76     } native_syntax;
77     enum {
78         Nativeform_na,
79         Nativeform_marc21,
80     } native_format;
81     char *native_encoding;
82     enum {
83         Nativemapto_na,
84         Nativemapto_marcxml,
85         Nativemapto_marcxchange
86     } native_mapto;
87     yaz_marc_t yaz_marc;
88     struct conf_retrievalmap *maplist;
89     struct conf_retrievalprofile *next;
90 };
91
92 struct conf_config
93 {
94     struct conf_server *servers;
95     struct conf_queryprofile *queryprofiles;
96     struct conf_retrievalprofile *retrievalprofiles;
97 };
98
99 #ifndef CONFIG_NOEXTERNS
100
101 extern struct conf_config *config;
102
103 #endif
104
105 int read_config(const char *fname);
106
107 #endif
108
109 /*
110  * Local variables:
111  * c-basic-offset: 4
112  * indent-tabs-mode: nil
113  * End:
114  * vim: shiftwidth=4 tabstop=8 expandtab
115  */