1 /* $Id: pazpar2.h,v 1.30 2007-04-20 15:36:48 quinn 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;
64 //yaz_marc_t yaz_marc;
65 struct database_retrievalmap *map;
68 // Normalization filter. Turns incoming record into internal representation
69 // Simple sequence of stylesheets run in series.
70 struct database_retrievalmap {
71 xsltStylesheet *stylesheet;
72 struct database_retrievalmap *next;
75 struct database_criterion_value {
77 struct database_criterion_value *next;
80 struct database_criterion {
82 struct database_criterion_value *values;
83 struct database_criterion *next;
86 // Represents a physical, reusable connection to a remote Z39.50 host
91 struct client *client;
99 struct connection *next;
102 // Represents client state for a connection to one search target
104 struct session_database *database;
105 struct connection *connection;
106 struct session *session;
107 char *pquery; // Current search
111 int requestid; // ID of current outstanding request
129 #define SESSION_WATCH_RECORDS 0
130 #define SESSION_WATCH_MAX 0
132 #define SESSION_MAX_TERMLISTS 10
134 typedef void (*session_watchfun)(void *data);
136 struct named_termlist
139 struct termlist *termlist;
142 // Represents a database as viewed from one session, possibly with settings overriden
144 struct session_database
146 struct database *database;
147 struct setting **settings;
149 struct database_retrievalmap *map;
150 struct session_database *next;
155 struct session_database *databases; // All databases, settings overriden
156 struct client *clients; // Clients connected for current search
158 NMEM session_nmem; // Nmem for session-permanent storage
159 NMEM nmem; // Nmem for each operation (i.e. search, result set, etc)
160 WRBUF wrbuf; // Wrbuf for scratch(i.e. search)
162 struct named_termlist termlists[SESSION_MAX_TERMLISTS];
163 struct relevance *relevance;
164 struct reclist *reclist;
167 session_watchfun fun;
168 } watchlist[SESSION_WATCH_MAX + 1];
169 int expected_maxrecs;
177 int num_no_connection;
179 int num_initializing;
189 struct hitsbytarget {
200 char proxy_override[128];
201 char listener_override[128];
202 char zproxy_override[128];
203 char settings_path_override[128];
204 struct conf_server *server;
206 int timeout; /* operations timeout, in seconds */
207 char implementationId[128];
208 char implementationName[128];
209 char implementationVersion[128];
210 int target_timeout; // seconds
218 struct hitsbytarget *hitsbytarget(struct session *s, int *count);
219 int select_targets(struct session *se, struct database_criterion *crit);
220 struct session *new_session(NMEM nmem);
221 void destroy_session(struct session *s);
222 int load_targets(struct session *s, const char *fn);
223 void statistics(struct session *s, struct statistics *stat);
224 char *search(struct session *s, char *query, char *filter);
225 struct record_cluster **show(struct session *s, struct reclist_sortparms *sp, int start,
226 int *num, int *total, int *sumhits, NMEM nmem_show);
227 struct record_cluster *show_single(struct session *s, int id);
228 struct termlist_score **termlist(struct session *s, const char *name, int *num);
229 void session_set_watch(struct session *s, int what, session_watchfun fun, void *data);
230 int session_active_clients(struct session *s);
231 void session_apply_setting(struct session *se, char *dbname, char *setting, char *value);
232 char *session_setting_oneval(struct session_database *db, int offset);
234 void start_http_listener(void);
235 void start_proxy(void);
236 void start_zproxy(void);
238 extern struct parameters global_parameters;
239 void pazpar2_add_channel(IOCHAN c);
240 void pazpar2_event_loop(void);
249 * indent-tabs-mode: nil
251 * vim: shiftwidth=4 tabstop=8 expandtab