Fix mistake: fuzzy matching is 5=103, not 5=102
[yaz-moved-to-github.git] / src / zoom-p.h
1 /*
2  * Copyright (C) 1995-2005, Index Data ApS
3  * See the file LICENSE for details.
4  *
5  * $Id: zoom-p.h,v 1.11 2006-05-10 07:34:38 adam Exp $
6  */
7 /**
8  * \file zoom-p.h
9  * \brief Internal header for ZOOM implementation
10  */
11
12 #include <yaz/proto.h>
13 #include <yaz/comstack.h>
14 #include <yaz/wrbuf.h>
15 #include <yaz/zoom.h>
16 #include <yaz/sortspec.h>
17 typedef struct ZOOM_Event_p *ZOOM_Event;
18
19 struct ZOOM_query_p {
20     Z_Query *z_query;
21     Z_SortKeySpecList *sort_spec;
22     int refcount;
23     ODR odr;
24     char *query_string;
25 };
26
27 typedef enum {
28     zoom_sru_error,
29     zoom_sru_soap,
30     zoom_sru_get,
31     zoom_sru_post,
32 } zoom_sru_mode;
33     
34
35 typedef struct ZOOM_task_p *ZOOM_task;
36
37 #define STATE_IDLE 0
38 #define STATE_CONNECTING 1
39 #define STATE_ESTABLISHED 2
40
41 #define ZOOM_SELECT_READ 1
42 #define ZOOM_SELECT_WRITE 2
43 #define ZOOM_SELECT_EXCEPT 4
44
45 struct ZOOM_connection_p {
46     enum oid_proto proto;
47     COMSTACK cs;
48     char *host_port;
49     char *path;
50     int error;
51     char *addinfo;
52     char *diagset;
53     int state;
54     int mask;
55     int reconnect_ok;
56     ODR odr_in;
57     ODR odr_out;
58     char *buf_in;
59     int len_in;
60     char *buf_out;
61     int len_out;
62     char *proxy;
63     char *charset;
64     char *lang;
65     char *cookie_out;
66     char *cookie_in;
67     char *client_IP;
68     int async;
69     int support_named_resultsets;
70     int last_event;
71     ZOOM_task tasks;
72     ZOOM_options options;
73     ZOOM_resultset resultsets;
74     ZOOM_Event m_queue_front;
75     ZOOM_Event m_queue_back;
76     zoom_sru_mode sru_mode;
77 };
78
79 struct ZOOM_options_entry {
80     char *name;
81     char *value;
82     int len;                  /* of `value', which may contain NULs */
83     struct ZOOM_options_entry *next;
84 };
85
86 struct ZOOM_options_p {
87     int refcount;
88     void *callback_handle;
89     ZOOM_options_callback callback_func;
90     struct ZOOM_options_entry *entries;
91     ZOOM_options parent1;
92     ZOOM_options parent2;
93 };
94
95
96 typedef struct ZOOM_record_cache_p *ZOOM_record_cache;
97
98 #define RECORD_HASH_SIZE  131
99
100 struct ZOOM_resultset_p {
101     Z_SortKeySpecList *r_sort_spec;
102     ZOOM_query query;
103     int refcount;
104     int size;
105     int start;
106     int count;
107     int step;
108     int piggyback;
109     char *setname;
110     char *schema;
111     ODR odr;
112     ZOOM_record_cache record_hash[RECORD_HASH_SIZE];
113     ZOOM_options options;
114     ZOOM_connection connection;
115     ZOOM_resultset next;
116 };
117
118 struct ZOOM_record_p {
119     ODR odr;
120     WRBUF wrbuf_marc;
121     WRBUF wrbuf_iconv;
122     WRBUF wrbuf_opac;
123     Z_NamePlusRecord *npr;
124 };
125
126 struct ZOOM_record_cache_p {
127     struct ZOOM_record_p rec;
128     char *elementSetName;
129     char *syntax;
130     char *schema;
131     int pos;
132     ZOOM_record_cache next;
133 };
134
135 struct ZOOM_scanset_p {
136     int refcount;
137     ODR odr;
138     ZOOM_options options;
139     ZOOM_connection connection;
140     Z_AttributesPlusTerm *termListAndStartPoint;
141     Z_AttributeSetId *attributeSet;
142     Z_ScanResponse *scan_response;
143 };
144
145 struct ZOOM_package_p {
146     int refcount;
147     ODR odr_out;
148     ZOOM_options options;
149     ZOOM_connection connection;
150     char *buf_out;
151     int len_out;
152 };
153
154 struct ZOOM_task_p {
155     int running;
156     int which;
157     union {
158 #define ZOOM_TASK_SEARCH 1
159         struct {
160             ZOOM_resultset resultset;
161         } search;
162 #define ZOOM_TASK_RETRIEVE 2
163         struct {
164             int start;
165             ZOOM_resultset resultset;
166             int count;
167         } retrieve;
168 #define ZOOM_TASK_CONNECT 3
169 #define ZOOM_TASK_SCAN 4
170         struct {
171             ZOOM_scanset scan;
172         } scan;
173 #define ZOOM_TASK_PACKAGE 5
174         ZOOM_package package;
175 #define ZOOM_TASK_SORT 6
176         struct {
177             ZOOM_resultset resultset;
178             ZOOM_query q;
179         } sort;
180     } u;
181     ZOOM_task next;
182 };
183
184 struct ZOOM_Event_p {
185     int kind;
186     ZOOM_Event next;
187     ZOOM_Event prev;
188 };
189
190 void ZOOM_options_addref (ZOOM_options opt);
191 /*
192  * Local variables:
193  * c-basic-offset: 4
194  * indent-tabs-mode: nil
195  * End:
196  * vim: shiftwidth=4 tabstop=8 expandtab
197  */
198