1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2010 Index Data.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of Index Data nor the names of its contributors
13 * may be used to endorse or promote products derived from this
14 * software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 * \brief Internal header for ZOOM implementation
31 #include <yaz/proto.h>
32 #include <yaz/oid_db.h>
33 #include <yaz/comstack.h>
34 #include <yaz/wrbuf.h>
36 #include <yaz/sortspec.h>
38 #include <yaz/mutex.h>
41 #define ZOOM_RESULT_LISTS 0
43 typedef struct ZOOM_Event_p *ZOOM_Event;
47 Z_SortKeySpecList *sort_spec;
61 typedef struct ZOOM_task_p *ZOOM_task;
64 #define STATE_CONNECTING 1
65 #define STATE_ESTABLISHED 2
68 typedef struct ZOOM_resultsets_p *ZOOM_resultsets;
71 struct ZOOM_connection_p {
102 int support_named_resultsets;
105 int maximum_record_size;
106 int preferred_message_size;
109 ZOOM_options options;
110 #if ZOOM_RESULT_LISTS
111 ZOOM_resultsets resultsets;
113 ZOOM_resultset resultsets;
115 ZOOM_Event m_queue_front;
116 ZOOM_Event m_queue_back;
117 zoom_sru_mode sru_mode;
118 int no_redirects; /* 0 for no redirects. >0 for number of redirects */
121 #if ZOOM_RESULT_LISTS
122 struct ZOOM_resultsets_p {
123 ZOOM_resultset resultset;
124 ZOOM_resultsets next;
128 struct ZOOM_options_entry {
131 int len; /* of `value', which may contain NULs */
132 struct ZOOM_options_entry *next;
135 struct ZOOM_options_p {
137 void *callback_handle;
138 ZOOM_options_callback callback_func;
139 struct ZOOM_options_entry *entries;
140 ZOOM_options parent1;
141 ZOOM_options parent2;
145 typedef struct ZOOM_record_cache_p *ZOOM_record_cache;
147 #define RECORD_HASH_SIZE 131
149 struct ZOOM_resultset_p {
150 Z_SortKeySpecList *r_sort_spec;
159 ZOOM_record_cache record_hash[RECORD_HASH_SIZE];
160 ZOOM_options options;
161 ZOOM_connection connection;
162 char **databaseNames;
163 int num_databaseNames;
166 struct WRBUF_shptr *record_wrbuf;
168 #if ZOOM_RESULT_LISTS
172 ZOOM_facet_field *facets;
177 struct ZOOM_record_p {
180 struct WRBUF_shptr *record_wrbuf;
185 Z_NamePlusRecord *npr;
188 const char *diag_uri;
189 const char *diag_message;
190 const char *diag_details;
191 const char *diag_set;
194 struct facet_term_p {
199 struct ZOOM_facet_field_p {
202 struct facet_term_p *facet_terms;
206 struct ZOOM_record_cache_p {
207 struct ZOOM_record_p rec;
208 char *elementSetName;
212 ZOOM_record_cache next;
215 struct ZOOM_scanset_p {
218 ZOOM_options options;
219 ZOOM_connection connection;
221 Z_ScanResponse *scan_response;
222 Z_SRW_scanResponse *srw_scan_response;
224 char **databaseNames;
225 int num_databaseNames;
228 struct ZOOM_package_p {
231 ZOOM_options options;
232 ZOOM_connection connection;
241 #define ZOOM_TASK_SEARCH 1
245 ZOOM_resultset resultset;
247 char *elementSetName;
248 int recv_search_fired;
250 #define ZOOM_TASK_RETRIEVE 2
253 ZOOM_resultset resultset;
256 char *elementSetName;
258 #define ZOOM_TASK_CONNECT 3
259 #define ZOOM_TASK_SCAN 4
263 #define ZOOM_TASK_PACKAGE 5
264 ZOOM_package package;
265 #define ZOOM_TASK_SORT 6
267 ZOOM_resultset resultset;
274 struct ZOOM_Event_p {
280 void ZOOM_options_addref (ZOOM_options opt);
285 * c-file-style: "Stroustrup"
286 * indent-tabs-mode: nil
288 * vim: shiftwidth=4 tabstop=8 expandtab