Read HTTP listener and proxy address from config file (-h and -p still override).
[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                  // values >1  give additional significance to a field
16     enum
17     {
18         Metadata_type_generic,          // Generic text field
19         Metadata_type_integer,          // Integer type
20         Metadata_type_year              // A year
21     } type;
22     enum
23     {
24         Metadata_sortkey_no,            // This is not to be used as a sortkey
25         Metadata_sortkey_numeric,       // Standard numerical sorting
26         Metadata_sortkey_range,         // Range sorting (pick lowest or highest)
27         Metadata_sortkey_skiparticle,   // Skip leading article when sorting
28         Metadata_sortkey_string
29     } sortkey;
30     enum
31     {
32         Metadata_merge_no,              // Don't merge
33         Metadata_merge_unique,          // Include unique elements in merged block
34         Metadata_merge_longest,         // Include the longest (strlen) value
35         Metadata_merge_range,           // Store value as a range of lowest-highest
36         Metadata_merge_all              // Just include all elements found
37     } merge;
38 };
39
40 struct conf_service
41 {
42     int num_metadata;
43     struct conf_metadata *metadata;
44 };
45
46 struct conf_server
47 {
48     char *host;
49     int port;
50     char *proxy_host;
51     int proxy_port;
52     struct conf_service *service;
53     struct conf_server *next;
54 };
55
56 struct conf_queryprofile
57 {
58     int dummy;
59 };
60
61 struct conf_retrievalmap
62 {
63     enum {
64         Map_xslt
65     } type;
66     char *charset;
67     char *format;
68     xsltStylesheet *stylesheet;
69     struct conf_retrievalmap *next;
70 };
71
72 struct conf_retrievalprofile
73 {
74     char *requestsyntax;
75     enum {
76         Nativesyn_xml,
77         Nativesyn_iso2709
78     } native_syntax;
79     enum {
80         Nativeform_na,
81         Nativeform_marc21,
82     } native_format;
83     char *native_encoding;
84     enum {
85         Nativemapto_na,
86         Nativemapto_marcxml,
87         Nativemapto_marcxchange
88     } native_mapto;
89     yaz_marc_t yaz_marc;
90     struct conf_retrievalmap *maplist;
91     struct conf_retrievalprofile *next;
92 };
93
94 struct conf_config
95 {
96     struct conf_server *servers;
97     struct conf_queryprofile *queryprofiles;
98     struct conf_retrievalprofile *retrievalprofiles;
99 };
100
101 #ifndef CONFIG_NOEXTERNS
102
103 extern struct conf_config *config;
104
105 #endif
106
107 int read_config(const char *fname);
108
109 #endif
110
111 /*
112  * Local variables:
113  * c-basic-offset: 4
114  * indent-tabs-mode: nil
115  * End:
116  * vim: shiftwidth=4 tabstop=8 expandtab
117  */