Default timeout is 25 seconds
[yaz-moved-to-github.git] / zoom / zoom-p.h
1 /*
2  * Private C header for ZOOM C.
3  * $Id: zoom-p.h,v 1.11 2002-06-02 21:27:17 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     int pos;
103     ZOOM_record_cache next;
104 };
105
106 struct ZOOM_scanset_p {
107     int refcount;
108     ODR odr;
109     ZOOM_options options;
110     ZOOM_connection connection;
111     Z_AttributesPlusTerm *termListAndStartPoint;
112     Z_AttributeSetId *attributeSet;
113     Z_ScanResponse *scan_response;
114 };
115
116 struct ZOOM_package_p {
117     int refcount;
118     ODR odr_out;
119     ZOOM_options options;
120     ZOOM_connection connection;
121     char *buf_out;
122     int len_out;
123 };
124
125 struct ZOOM_task_p {
126     int running;
127     int which;
128     union {
129 #define ZOOM_TASK_SEARCH 1
130         struct {
131             ZOOM_resultset resultset;
132         } search;
133 #define ZOOM_TASK_RETRIEVE 2
134         struct {
135             int start;
136             ZOOM_resultset resultset;
137             int count;
138         } retrieve;
139 #define ZOOM_TASK_CONNECT 3
140 #define ZOOM_TASK_SCAN 4
141         struct {
142             ZOOM_scanset scan;
143         } scan;
144 #define ZOOM_TASK_PACKAGE 5
145         ZOOM_package package;
146     } u;
147     ZOOM_task next;
148 };
149
150 struct ZOOM_Event_p {
151     int kind;
152     ZOOM_Event next;
153     ZOOM_Event prev;
154 };
155
156 void ZOOM_options_addref (ZOOM_options opt);