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