PQF native support for SRW ;)
[yaz-moved-to-github.git] / zutil / zoom-p.h
1 /*
2  * Private C header for ZOOM C.
3  * $Id: zoom-p.h,v 1.6 2003-02-20 15:11: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 piggyback;
92     char *setname;
93     char *schema;
94     ODR odr;
95     ZOOM_record_cache record_cache;
96     ZOOM_options options;
97     ZOOM_connection connection;
98     ZOOM_resultset next;
99 };
100
101 struct ZOOM_record_p {
102     ODR odr;
103     WRBUF wrbuf_marc;
104     Z_NamePlusRecord *npr;
105 };
106
107 struct ZOOM_record_cache_p {
108     struct ZOOM_record_p rec;
109     char *elementSetName;
110     char *syntax;
111     char *schema;
112     int pos;
113     ZOOM_record_cache next;
114 };
115
116 struct ZOOM_scanset_p {
117     int refcount;
118     ODR odr;
119     ZOOM_options options;
120     ZOOM_connection connection;
121     Z_AttributesPlusTerm *termListAndStartPoint;
122     Z_AttributeSetId *attributeSet;
123     Z_ScanResponse *scan_response;
124 };
125
126 struct ZOOM_package_p {
127     int refcount;
128     ODR odr_out;
129     ZOOM_options options;
130     ZOOM_connection connection;
131     char *buf_out;
132     int len_out;
133 };
134
135 struct ZOOM_task_p {
136     int running;
137     int which;
138     union {
139 #define ZOOM_TASK_SEARCH 1
140         struct {
141             ZOOM_resultset resultset;
142         } search;
143 #define ZOOM_TASK_RETRIEVE 2
144         struct {
145             int start;
146             ZOOM_resultset resultset;
147             int count;
148         } retrieve;
149 #define ZOOM_TASK_CONNECT 3
150 #define ZOOM_TASK_SCAN 4
151         struct {
152             ZOOM_scanset scan;
153         } scan;
154 #define ZOOM_TASK_PACKAGE 5
155         ZOOM_package package;
156     } u;
157     ZOOM_task next;
158 };
159
160 struct ZOOM_Event_p {
161     int kind;
162     ZOOM_Event next;
163     ZOOM_Event prev;
164 };
165
166 void ZOOM_options_addref (ZOOM_options opt);