1 /* $Id: pazpar2.h,v 1.33 2007-04-22 16:41:42 adam Exp $
2 Copyright (c) 2006-2007, Index Data.
4 This file is part of Pazpar2.
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
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
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
28 #include <libxslt/xsltutils.h>
29 #include <libxslt/transform.h>
31 #include <yaz/comstack.h>
32 #include <yaz/pquery.h>
34 #include <yaz/yaz-ccl.h>
36 #include "termlists.h"
37 #include "relevance.h"
47 // Represents a host (irrespective of databases)
51 struct connection *connections; // All connections to this
55 // Represents a (virtual) database on a host
61 struct zr_explain *explain;
62 struct setting **settings;
63 struct database *next;
66 struct database_criterion_value {
68 struct database_criterion_value *next;
71 struct database_criterion {
73 struct database_criterion_value *values;
74 struct database_criterion *next;
77 // Represents a physical, reusable connection to a remote Z39.50 host
82 struct client *client;
91 struct connection *next;
94 // Represents client state for a connection to one search target
96 struct session_database *database;
97 struct connection *connection;
98 struct session *session;
99 char *pquery; // Current search
103 int requestid; // ID of current outstanding request
121 // Normalization filter. Turns incoming record into internal representation
122 // Simple sequence of stylesheets run in series.
123 struct database_retrievalmap {
124 xsltStylesheet *stylesheet;
125 struct database_retrievalmap *next;
128 // Represents a database as viewed from one session, possibly with settings overriden
130 struct session_database
132 struct database *database;
133 struct setting **settings;
135 struct database_retrievalmap *map;
136 struct session_database *next;
139 #define SESSION_WATCH_RECORDS 0
140 #define SESSION_WATCH_MAX 0
142 #define SESSION_MAX_TERMLISTS 10
144 typedef void (*session_watchfun)(void *data);
146 struct named_termlist
149 struct termlist *termlist;
154 struct session_database *databases; // All databases, settings overriden
155 struct client *clients; // Clients connected for current search
157 NMEM session_nmem; // Nmem for session-permanent storage
158 NMEM nmem; // Nmem for each operation (i.e. search, result set, etc)
159 WRBUF wrbuf; // Wrbuf for scratch(i.e. search)
161 struct named_termlist termlists[SESSION_MAX_TERMLISTS];
162 struct relevance *relevance;
163 struct reclist *reclist;
166 session_watchfun fun;
167 } watchlist[SESSION_WATCH_MAX + 1];
168 int expected_maxrecs;
176 int num_no_connection;
178 int num_initializing;
188 struct hitsbytarget {
199 char proxy_override[128];
200 char listener_override[128];
201 char zproxy_override[128];
202 char settings_path_override[128];
203 struct conf_server *server;
205 int timeout; /* operations timeout, in seconds */
206 char implementationId[128];
207 char implementationName[128];
208 char implementationVersion[128];
209 int target_timeout; // seconds
217 struct hitsbytarget *hitsbytarget(struct session *s, int *count);
218 int select_targets(struct session *se, struct database_criterion *crit);
219 struct session *new_session(NMEM nmem);
220 void destroy_session(struct session *s);
221 int load_targets(struct session *s, const char *fn);
222 void statistics(struct session *s, struct statistics *stat);
223 char *search(struct session *s, char *query, char *filter);
224 struct record_cluster **show(struct session *s, struct reclist_sortparms *sp, int start,
225 int *num, int *total, int *sumhits, NMEM nmem_show);
226 struct record_cluster *show_single(struct session *s, int id);
227 struct termlist_score **termlist(struct session *s, const char *name, int *num);
228 void session_set_watch(struct session *s, int what, session_watchfun fun, void *data);
229 int session_active_clients(struct session *s);
230 void session_apply_setting(struct session *se, char *dbname, char *setting, char *value);
231 char *session_setting_oneval(struct session_database *db, int offset);
233 void start_http_listener(void);
234 void start_proxy(void);
235 void start_zproxy(void);
237 extern struct parameters global_parameters;
238 void pazpar2_add_channel(IOCHAN c);
239 void pazpar2_event_loop(void);
241 int host_getaddrinfo(struct host *host);
242 void connect_resolver_host(struct host *host);
249 * indent-tabs-mode: nil
251 * vim: shiftwidth=4 tabstop=8 expandtab