1 /* $Id: pazpar2.h,v 1.29 2007-04-20 13:03:22 marc 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;
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
143 // for that session (to support authorization/authentication)
144 struct session_database
146 struct database *database;
147 struct setting **settings;
148 struct session_database *next;
153 struct session_database *databases; // All databases, settings overriden
154 struct client *clients; // Clients connected for current search
156 NMEM session_nmem; // Nmem for session-permanent storage
157 NMEM nmem; // Nmem for each operation (i.e. search, result set, etc)
158 WRBUF wrbuf; // Wrbuf for scratch(i.e. search)
160 struct named_termlist termlists[SESSION_MAX_TERMLISTS];
161 struct relevance *relevance;
162 struct reclist *reclist;
165 session_watchfun fun;
166 } watchlist[SESSION_WATCH_MAX + 1];
167 int expected_maxrecs;
175 int num_no_connection;
177 int num_initializing;
187 struct hitsbytarget {
198 char proxy_override[128];
199 char listener_override[128];
200 char zproxy_override[128];
201 char settings_path_override[128];
202 struct conf_server *server;
204 int timeout; /* operations timeout, in seconds */
205 char implementationId[128];
206 char implementationName[128];
207 char implementationVersion[128];
208 int target_timeout; // seconds
216 struct hitsbytarget *hitsbytarget(struct session *s, int *count);
217 int select_targets(struct session *se, struct database_criterion *crit);
218 struct session *new_session(NMEM nmem);
219 void destroy_session(struct session *s);
220 int load_targets(struct session *s, const char *fn);
221 void statistics(struct session *s, struct statistics *stat);
222 char *search(struct session *s, char *query, char *filter);
223 struct record_cluster **show(struct session *s, struct reclist_sortparms *sp, int start,
224 int *num, int *total, int *sumhits, NMEM nmem_show);
225 struct record_cluster *show_single(struct session *s, int id);
226 struct termlist_score **termlist(struct session *s, const char *name, int *num);
227 void session_set_watch(struct session *s, int what, session_watchfun fun, void *data);
228 int session_active_clients(struct session *s);
229 void session_apply_setting(struct session *se, char *dbname, char *setting, char *value);
230 char *session_setting_oneval(struct session_database *db, int offset);
232 void start_http_listener(void);
233 void start_proxy(void);
234 void start_zproxy(void);
236 extern struct parameters global_parameters;
237 void pazpar2_add_channel(IOCHAN c);
238 void pazpar2_event_loop(void);
247 * indent-tabs-mode: nil
249 * vim: shiftwidth=4 tabstop=8 expandtab