Reinsert initialiser for __UNUSED_loglevel
[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.10 2006-03-01 23:24:26 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 typedef struct ZOOM_record_cache_p *ZOOM_record_cache;
96
97 struct ZOOM_resultset_p {
98     Z_SortKeySpecList *r_sort_spec;
99     ZOOM_query query;
100     int refcount;
101     int size;
102     int start;
103     int count;
104     int step;
105     int piggyback;
106     char *setname;
107     char *schema;
108     ODR odr;
109     ZOOM_record_cache record_cache;
110     ZOOM_options options;
111     ZOOM_connection connection;
112     ZOOM_resultset next;
113 };
114
115 struct ZOOM_record_p {
116     ODR odr;
117     WRBUF wrbuf_marc;
118     WRBUF wrbuf_iconv;
119     WRBUF wrbuf_opac;
120     Z_NamePlusRecord *npr;
121 };
122
123 struct ZOOM_record_cache_p {
124     struct ZOOM_record_p rec;
125     char *elementSetName;
126     char *syntax;
127     char *schema;
128     int pos;
129     ZOOM_record_cache next;
130 };
131
132 struct ZOOM_scanset_p {
133     int refcount;
134     ODR odr;
135     ZOOM_options options;
136     ZOOM_connection connection;
137     Z_AttributesPlusTerm *termListAndStartPoint;
138     Z_AttributeSetId *attributeSet;
139     Z_ScanResponse *scan_response;
140 };
141
142 struct ZOOM_package_p {
143     int refcount;
144     ODR odr_out;
145     ZOOM_options options;
146     ZOOM_connection connection;
147     char *buf_out;
148     int len_out;
149 };
150
151 struct ZOOM_task_p {
152     int running;
153     int which;
154     union {
155 #define ZOOM_TASK_SEARCH 1
156         struct {
157             ZOOM_resultset resultset;
158         } search;
159 #define ZOOM_TASK_RETRIEVE 2
160         struct {
161             int start;
162             ZOOM_resultset resultset;
163             int count;
164         } retrieve;
165 #define ZOOM_TASK_CONNECT 3
166 #define ZOOM_TASK_SCAN 4
167         struct {
168             ZOOM_scanset scan;
169         } scan;
170 #define ZOOM_TASK_PACKAGE 5
171         ZOOM_package package;
172 #define ZOOM_TASK_SORT 6
173         struct {
174             ZOOM_resultset resultset;
175             ZOOM_query q;
176         } sort;
177     } u;
178     ZOOM_task next;
179 };
180
181 struct ZOOM_Event_p {
182     int kind;
183     ZOOM_Event next;
184     ZOOM_Event prev;
185 };
186
187 void ZOOM_options_addref (ZOOM_options opt);
188 /*
189  * Local variables:
190  * c-basic-offset: 4
191  * indent-tabs-mode: nil
192  * End:
193  * vim: shiftwidth=4 tabstop=8 expandtab
194  */
195