*** empty log message ***
[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 enum conf_sortkey_types
9 {
10     Metadata_sortkey_no,            // This is not to be used as a sortkey
11     Metadata_sortkey_numeric,       // Standard numerical sorting
12     Metadata_sortkey_range,         // Range sorting (pick lowest or highest)
13     Metadata_sortkey_skiparticle,   // Skip leading article when sorting
14     Metadata_sortkey_string
15 };
16
17 // Describes known metadata elements and how they are to be manipulated
18 // An array of these structure provides a 'map' against which discovered metadata
19 // elements are matched. It also governs storage, to minimize number of cycles needed
20 // at various tages of processing
21 struct conf_metadata 
22 {
23     char *name;  // The name of this element. Output by normalization stylesheet
24     int brief;   // Is this element to be returned in the brief format?
25     int termlist;// Is this field to be treated as a termlist for browsing?
26     int rank;    // Rank factor. 0 means don't use this field for ranking, 1 is default
27                  // values >1  give additional significance to a field
28     enum
29     {
30         Metadata_type_generic,          // Generic text field
31         Metadata_type_integer,          // Integer type
32         Metadata_type_year              // A year
33     } type;
34     enum conf_sortkey_types sortkey;
35     enum
36     {
37         Metadata_merge_no,              // Don't merge
38         Metadata_merge_unique,          // Include unique elements in merged block
39         Metadata_merge_longest,         // Include the longest (strlen) value
40         Metadata_merge_range,           // Store value as a range of lowest-highest
41         Metadata_merge_all              // Just include all elements found
42     } merge;
43 };
44
45 // Controls sorting
46 struct conf_sortkey
47 {
48     char *name;
49     enum conf_sortkey_types type;
50 };
51
52 struct conf_service
53 {
54     int num_metadata;
55     struct conf_metadata *metadata;
56     int num_sortkeys;
57     struct conf_sortkey *sortkeys;
58 };
59
60 struct conf_server
61 {
62     char *host;
63     int port;
64     char *proxy_host;
65     int proxy_port;
66     struct conf_service *service;
67     struct conf_server *next;
68 };
69
70 struct conf_queryprofile
71 {
72     int dummy;
73 };
74
75 struct conf_retrievalmap
76 {
77     enum {
78         Map_xslt
79     } type;
80     char *charset;
81     char *format;
82     xsltStylesheet *stylesheet;
83     struct conf_retrievalmap *next;
84 };
85
86 struct conf_retrievalprofile
87 {
88     char *requestsyntax;
89     enum {
90         Nativesyn_xml,
91         Nativesyn_iso2709
92     } native_syntax;
93     enum {
94         Nativeform_na,
95         Nativeform_marc21,
96     } native_format;
97     char *native_encoding;
98     enum {
99         Nativemapto_na,
100         Nativemapto_marcxml,
101         Nativemapto_marcxchange
102     } native_mapto;
103     yaz_marc_t yaz_marc;
104     struct conf_retrievalmap *maplist;
105     struct conf_retrievalprofile *next;
106 };
107
108 struct conf_config
109 {
110     struct conf_server *servers;
111     struct conf_queryprofile *queryprofiles;
112     struct conf_retrievalprofile *retrievalprofiles;
113 };
114
115 #ifndef CONFIG_NOEXTERNS
116
117 extern struct conf_config *config;
118
119 #endif
120
121 int read_config(const char *fname);
122
123 #endif
124
125 /*
126  * Local variables:
127  * c-basic-offset: 4
128  * indent-tabs-mode: nil
129  * End:
130  * vim: shiftwidth=4 tabstop=8 expandtab
131  */