2b776d9739336b22eccfda96b8aa2f9ca3b6af3d
[yaz-moved-to-github.git] / zutil / zoom-p.h
1 /*
2  * Private C header for ZOOM C.
3  * $Id: zoom-p.h,v 1.5 2003-02-17 14:35:42 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 };
23
24 #define STATE_IDLE 0
25 #define STATE_CONNECTING 1
26 #define STATE_ESTABLISHED 2
27
28 #define ZOOM_SELECT_READ 1
29 #define ZOOM_SELECT_WRITE 2
30 #define ZOOM_SELECT_EXCEPT 4
31
32 struct ZOOM_connection_p {
33     enum oid_proto proto;
34     COMSTACK cs;
35     char *host_port;
36     char *path;
37     int error;
38     char *addinfo;
39     const char *diagset;
40     int state;
41     int mask;
42     int reconnect_ok;
43     ODR odr_in;
44     ODR odr_out;
45     char *buf_in;
46     int len_in;
47     char *buf_out;
48     int len_out;
49     char *proxy;
50     char *charset;
51     char *lang;
52     char *cookie_out;
53     char *cookie_in;
54     char *client_IP;
55     int async;
56     int support_named_resultsets;
57     int last_event;
58     ZOOM_task tasks;
59     ZOOM_options options;
60     ZOOM_resultset resultsets;
61     ZOOM_Event m_queue_front;
62     ZOOM_Event m_queue_back;
63 };
64
65
66 struct ZOOM_options_entry {
67     char *name;
68     char *value;
69     struct ZOOM_options_entry *next;
70 };
71
72 struct ZOOM_options_p {
73     int refcount;
74     void *callback_handle;
75     ZOOM_options_callback callback_func;
76     struct ZOOM_options_entry *entries;
77     ZOOM_options parent1;
78     ZOOM_options parent2;
79 };
80
81 typedef struct ZOOM_record_cache_p *ZOOM_record_cache;
82
83 struct ZOOM_resultset_p {
84     Z_Query *z_query;
85     Z_SortKeySpecList *r_sort_spec;
86     ZOOM_query search;
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);