SRW, CQL, 2003
[yaz-moved-to-github.git] / zutil / zoom-p.h
1 /*
2  * Private C header for ZOOM C.
3  * $Id: zoom-p.h,v 1.3 2003-01-06 08:20:29 adam Exp $
4  */
5
6 #if HAVE_GSOAP
7 #include <yaz/srw-util.h>
8 #else
9 struct soap {
10     int dummy;
11 };
12 #endif
13
14 #include <yaz/proto.h>
15 #include <yaz/comstack.h>
16 #include <yaz/wrbuf.h>
17 #include <yaz/zoom.h>
18 #include <yaz/sortspec.h>
19 typedef struct ZOOM_Event_p *ZOOM_Event;
20
21 struct ZOOM_query_p {
22     Z_Query *z_query;
23     Z_SortKeySpecList *sort_spec;
24     int refcount;
25     ODR odr;
26 };
27
28 #define STATE_IDLE 0
29 #define STATE_CONNECTING 1
30 #define STATE_ESTABLISHED 2
31
32 #define ZOOM_SELECT_READ 1
33 #define ZOOM_SELECT_WRITE 2
34 #define ZOOM_SELECT_EXCEPT 4
35
36 struct ZOOM_connection_p {
37     struct soap *soap;
38     COMSTACK cs;
39     char *host_port;
40     int error;
41     char *addinfo;
42     const char *diagset;
43     int state;
44     int mask;
45     int reconnect_ok;
46     ODR odr_in;
47     ODR odr_out;
48     char *buf_in;
49     int len_in;
50     char *buf_out;
51     int len_out;
52     char *proxy;
53     char *charset;
54     char *lang;
55     char *cookie_out;
56     char *cookie_in;
57     char *client_IP;
58     int async;
59     int support_named_resultsets;
60     int last_event;
61     ZOOM_task tasks;
62     ZOOM_options options;
63     ZOOM_resultset resultsets;
64     ZOOM_Event m_queue_front;
65     ZOOM_Event m_queue_back;
66 };
67
68
69 struct ZOOM_options_entry {
70     char *name;
71     char *value;
72     struct ZOOM_options_entry *next;
73 };
74
75 struct ZOOM_options_p {
76     int refcount;
77     void *callback_handle;
78     ZOOM_options_callback callback_func;
79     struct ZOOM_options_entry *entries;
80     ZOOM_options parent1;
81     ZOOM_options parent2;
82 };
83
84 typedef struct ZOOM_record_cache_p *ZOOM_record_cache;
85
86 struct ZOOM_resultset_p {
87     Z_Query *z_query;
88     Z_SortKeySpecList *r_sort_spec;
89     ZOOM_query search;
90     int refcount;
91     int size;
92     int start;
93     int count;
94     int piggyback;
95     char *setname;
96     ODR odr;
97     ZOOM_record_cache record_cache;
98     ZOOM_options options;
99     ZOOM_connection connection;
100     ZOOM_resultset next;
101 };
102
103 struct ZOOM_record_p {
104     ODR odr;
105     WRBUF wrbuf_marc;
106     Z_NamePlusRecord *npr;
107 };
108
109 struct ZOOM_record_cache_p {
110     struct ZOOM_record_p rec;
111     char *elementSetName;
112     char *syntax;
113     int pos;
114     ZOOM_record_cache next;
115 };
116
117 struct ZOOM_scanset_p {
118     int refcount;
119     ODR odr;
120     ZOOM_options options;
121     ZOOM_connection connection;
122     Z_AttributesPlusTerm *termListAndStartPoint;
123     Z_AttributeSetId *attributeSet;
124     Z_ScanResponse *scan_response;
125 };
126
127 struct ZOOM_package_p {
128     int refcount;
129     ODR odr_out;
130     ZOOM_options options;
131     ZOOM_connection connection;
132     char *buf_out;
133     int len_out;
134 };
135
136 struct ZOOM_task_p {
137     int running;
138     int which;
139     union {
140 #define ZOOM_TASK_SEARCH 1
141         struct {
142             ZOOM_resultset resultset;
143         } search;
144 #define ZOOM_TASK_RETRIEVE 2
145         struct {
146             int start;
147             ZOOM_resultset resultset;
148             int count;
149         } retrieve;
150 #define ZOOM_TASK_CONNECT 3
151 #define ZOOM_TASK_SCAN 4
152         struct {
153             ZOOM_scanset scan;
154         } scan;
155 #define ZOOM_TASK_PACKAGE 5
156         ZOOM_package package;
157     } u;
158     ZOOM_task next;
159 };
160
161 struct ZOOM_Event_p {
162     int kind;
163     ZOOM_Event next;
164     ZOOM_Event prev;
165 };
166
167 void ZOOM_options_addref (ZOOM_options opt);