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