added optional <zproxy> element to config file, containing any of these attribute...
[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_type
9 {
10     Metadata_sortkey_relevance,
11     Metadata_sortkey_numeric,       // Standard numerical sorting
12     Metadata_sortkey_skiparticle,   // Skip leading article when sorting
13     Metadata_sortkey_string         // Flat string
14 };
15
16 // Describes known metadata elements and how they are to be manipulated
17 // An array of these structure provides a 'map' against which discovered metadata
18 // elements are matched. It also governs storage, to minimize number of cycles needed
19 // at various tages of processing
20 struct conf_metadata 
21 {
22     char *name;  // The name of this element. Output by normalization stylesheet
23     int brief;   // Is this element to be returned in the brief format?
24     int termlist;// Is this field to be treated as a termlist for browsing?
25     int rank;    // Rank factor. 0 means don't use this field for ranking, 1 is default
26                  // values >1  give additional significance to a field
27     int sortkey_offset; // -1 if it's not a sortkey, otherwise index
28                         // into service/record_cluster->sortkey array
29     enum
30     {
31         Metadata_type_generic,          // Generic text field
32         Metadata_type_number,           // A number
33         Metadata_type_year              // A number
34     } type;
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_type type;
50 };
51
52 // It is conceivable that there will eventually be several 'services' offered
53 // from one server, with separate configuration -- possibly more than one services
54 // associated with the same port. For now, however, only a single service is possible.
55 struct conf_service
56 {
57     int num_metadata;
58     struct conf_metadata *metadata;
59     int num_sortkeys;
60     struct conf_sortkey *sortkeys;
61 };
62
63 struct conf_server
64 {
65     char *host;
66     int port;
67     char *proxy_host;
68     int proxy_port;
69     char *myurl;
70     char *zproxy_host;
71     int zproxy_port;
72     struct conf_service *service;
73     struct conf_server *next;
74 };
75
76 struct conf_queryprofile
77 {
78     int dummy;
79 };
80
81 struct conf_retrievalmap
82 {
83     enum {
84         Map_xslt
85     } type;
86     char *charset;
87     char *format;
88     xsltStylesheet *stylesheet;
89     struct conf_retrievalmap *next;
90 };
91
92 struct conf_retrievalprofile
93 {
94     char *requestsyntax;
95     enum {
96         Nativesyn_xml,
97         Nativesyn_iso2709
98     } native_syntax;
99     enum {
100         Nativeform_na,
101         Nativeform_marc21,
102     } native_format;
103     char *native_encoding;
104     enum {
105         Nativemapto_na,
106         Nativemapto_marcxml,
107         Nativemapto_marcxchange
108     } native_mapto;
109     yaz_marc_t yaz_marc;
110     struct conf_retrievalmap *maplist;
111     struct conf_retrievalprofile *next;
112 };
113
114 struct conf_targetprofiles
115 {
116     enum {
117         Targetprofiles_local
118     } type;
119     char *src;
120 };
121
122 struct conf_config
123 {
124     struct conf_server *servers;
125     struct conf_queryprofile *queryprofiles;
126     struct conf_targetprofiles *targetprofiles;
127     struct conf_retrievalprofile *retrievalprofiles;
128 };
129
130 #ifndef CONFIG_NOEXTERNS
131
132 extern struct conf_config *config;
133
134 #endif
135
136 int read_config(const char *fname);
137
138 #endif
139
140 /*
141  * Local variables:
142  * c-basic-offset: 4
143  * indent-tabs-mode: nil
144  * End:
145  * vim: shiftwidth=4 tabstop=8 expandtab
146  */