YAZ  4.2.57
zoom-p.h
Go to the documentation of this file.
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) 1995-2013 Index Data.
3  * All rights reserved.
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
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.
15  *
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.
26  */
31 #include <yaz/proto.h>
32 #include <yaz/oid_db.h>
33 #include <yaz/comstack.h>
34 #include <yaz/wrbuf.h>
35 #include <yaz/zoom.h>
36 #include <yaz/srw.h>
37 #include <yaz/mutex.h>
38 
39 #define SHPTR 1
40 #define ZOOM_RESULT_LISTS 0
41 
42 typedef struct ZOOM_Event_p *ZOOM_Event;
43 
44 typedef enum {
51 
52 
53 typedef struct ZOOM_task_p *ZOOM_task;
54 
55 #define STATE_IDLE 0
56 #define STATE_CONNECTING 1
57 #define STATE_ESTABLISHED 2
58 
59 #if ZOOM_RESULT_LISTS
60 typedef struct ZOOM_resultsets_p *ZOOM_resultsets;
61 #endif
62 
66  char *host_port;
67  int error;
68  char *addinfo;
69  char *diagset;
70  int state;
71  int mask;
77 
78  char *buf_in;
79  int len_in;
80  char *buf_out;
81  int len_out;
82  char *proxy;
83  char *tproxy;
84  char *charset;
85  char *lang;
86  char *cookie_out;
87  char *cookie_in;
88  char *client_IP;
89  char *sru_version;
90 
91  char *user;
92  char *group;
93  char *password;
94 
95  int async;
98 
101 
102  ZOOM_task tasks;
104 #if ZOOM_RESULT_LISTS
105  ZOOM_resultsets resultsets;
106 #else
108 #endif
109  ZOOM_Event m_queue_front;
110  ZOOM_Event m_queue_back;
112  int no_redirects; /* 0 for no redirects. >0 for number of redirects */
113 
115  int log_api;
117 };
118 
119 #if ZOOM_RESULT_LISTS
120 struct ZOOM_resultsets_p {
121  ZOOM_resultset resultset;
122  ZOOM_resultsets next;
123 };
124 #endif
125 
127 
128 #define RECORD_HASH_SIZE 131
129 
133  int refcount;
135  int step;
137  char *setname;
138  char *schema;
140  ZOOM_record_cache record_hash[RECORD_HASH_SIZE];
146 #if SHPTR
147  struct WRBUF_shptr *record_wrbuf;
148 #endif
149 #if ZOOM_RESULT_LISTS
150 #else
152 #endif
155  char **facets_names;
156 };
157 
158 struct facet_term_p {
159  char *term;
161 };
162 
164  char *facet_name;
167 };
168 
170  int refcount;
177 
180 };
181 
183  int refcount;
187  char *buf_out;
188  int len_out;
189 };
190 
191 struct ZOOM_task_p {
192  int running;
193  int which;
194  union {
195 #define ZOOM_TASK_SEARCH 1
196  struct {
197  int count;
198  int start;
200  char *syntax;
203  } search;
204 #define ZOOM_TASK_RETRIEVE 2
205  struct {
206  int start;
208  int count;
209  char *syntax;
210  char *elementSetName;
211  } retrieve;
212 #define ZOOM_TASK_CONNECT 3
213 #define ZOOM_TASK_SCAN 4
214  struct {
216  } scan;
217 #define ZOOM_TASK_PACKAGE 5
219 #define ZOOM_TASK_SORT 6
220  struct {
223  } sort;
224  } u;
225  ZOOM_task next;
226 };
227 
228 typedef enum {
231 } zoom_ret;
232 
234 
236 
237 void ZOOM_set_dset_error(ZOOM_connection c, int error,
238  const char *dset,
239  const char *addinfo, const char *addinfo2);
240 
241 void ZOOM_set_error(ZOOM_connection c, int error, const char *addinfo);
242 
243 ZOOM_Event ZOOM_Event_create(int kind);
244 void ZOOM_connection_put_event(ZOOM_connection c, ZOOM_Event event);
245 
252  int *num, ODR odr);
254 
255 ZOOM_task ZOOM_connection_add_task(ZOOM_connection c, int which);
258 
260  const char *syntax,
261  const char *elementSetName);
263  int pos,
264  const char *syntax, const char *elementSetName,
265  const char *schema,
266  Z_SRW_diagnostic *diag);
267 
271 const char *ZOOM_query_get_sru11(ZOOM_query s);
272 
273 int ZOOM_uri_to_code(const char *uri);
274 
277 
279  zoom_ret *cret, char **addinfo);
280 
281 void ZOOM_set_HTTP_error(ZOOM_connection c, int error,
282  const char *addinfo, const char *addinfo2);
283 
286 void ZOOM_Event_destroy(ZOOM_Event event);
289 
290 /*
291  * Local variables:
292  * c-basic-offset: 4
293  * c-file-style: "Stroustrup"
294  * indent-tabs-mode: nil
295  * End:
296  * vim: shiftwidth=4 tabstop=8 expandtab
297  */
298