pretty-formattting comments , now not exeeding 80 chars
[pazpar2-moved-to-github.git] / src / config.h
1 /* $Id: config.h,v 1.17 2007-04-18 15:09:51 marc Exp $
2    Copyright (c) 2006-2007, Index Data.
3
4 This file is part of Pazpar2.
5
6 Pazpar2 is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Pazpar2; see the file LICENSE.  If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA.
20  */
21
22 #ifndef CONFIG_H
23 #define CONFIG_H
24
25 #include <libxslt/xslt.h>
26 #include <libxslt/transform.h>
27 #include <libxslt/xsltutils.h>
28
29 enum conf_sortkey_type
30 {
31     Metadata_sortkey_relevance,
32     Metadata_sortkey_numeric,       // Standard numerical sorting
33     Metadata_sortkey_skiparticle,   // Skip leading article when sorting
34     Metadata_sortkey_string         // Flat string
35 };
36
37 // Describes known metadata elements and how they are to be manipulated
38 // An array of these structure provides a 'map' against which
39 // discovered metadata elements are matched. It also governs storage,
40 // to minimize number of cycles needed at various tages of processing
41 struct conf_metadata 
42 {
43     char *name;  // The field name. Output by normalization stylesheet
44     int brief;   // Is this element to be returned in the brief format?
45     int termlist;// Is this field to be treated as a termlist for browsing?
46     int rank;    // Rank factor. 0 means don't use this field for ranking, 
47                  // 1 is default
48                  // values >1  give additional significance to a field
49     int sortkey_offset; // -1 if it's not a sortkey, otherwise index
50                         // into service/record_cluster->sortkey array
51     enum
52     {
53         Metadata_type_generic,    // Generic text field
54         Metadata_type_number,     // A number
55         Metadata_type_year        // A number
56     } type;
57     enum
58     {
59         Metadata_merge_no,        // Don't merge
60         Metadata_merge_unique,    // Include unique elements in merged block
61         Metadata_merge_longest,   // Include the longest (strlen) value
62         Metadata_merge_range,     // Store value as a range of lowest-highest
63         Metadata_merge_all        // Just include all elements found
64     } merge;
65 };
66
67 // Controls sorting
68 struct conf_sortkey
69 {
70     char *name;
71     enum conf_sortkey_type type;
72 };
73
74 // It is conceivable that there will eventually be several 'services'
75 // offered from one server, with separate configuration -- possibly
76 // more than one services associated with the same port. For now,
77 // however, only a single service is possible.
78 struct conf_service
79 {
80     int num_metadata;
81     struct conf_metadata *metadata;
82     int num_sortkeys;
83     struct conf_sortkey *sortkeys;
84 };
85
86 struct conf_server
87 {
88     char *host;
89     int port;
90     char *proxy_host;
91     int proxy_port;
92     char *myurl;
93     char *zproxy_host;
94     int zproxy_port;
95     char *settings;
96     struct conf_service *service;
97     struct conf_server *next;
98 };
99
100 struct conf_targetprofiles
101 {
102     enum {
103         Targetprofiles_local
104     } type;
105     char *src;
106 };
107
108 struct conf_config
109 {
110     struct conf_server *servers;
111     struct conf_targetprofiles *targetprofiles;
112 };
113
114 #ifndef CONFIG_NOEXTERNS
115
116 extern struct conf_config *config;
117
118 #endif
119
120 int read_config(const char *fname);
121 xsltStylesheet *conf_load_stylesheet(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  */