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