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