Move ZOOM_task definition to private ZOOM header
[yaz-moved-to-github.git] / src / zoom-p.h
1 /*
2  * Copyright (C) 1995-2005, Index Data ApS
3  * See the file LICENSE for details.
4  *
5  * $Id: zoom-p.h,v 1.8 2005-10-11 18:24:33 adam Exp $
6  */
7 /**
8  * \file zoom-p.h
9  * \brief Internal header for ZOOM implementation
10  */
11
12 #include <yaz/proto.h>
13 #include <yaz/comstack.h>
14 #include <yaz/wrbuf.h>
15 #include <yaz/zoom.h>
16 #include <yaz/sortspec.h>
17 typedef struct ZOOM_Event_p *ZOOM_Event;
18
19 struct ZOOM_query_p {
20     Z_Query *z_query;
21     Z_SortKeySpecList *sort_spec;
22     int refcount;
23     ODR odr;
24     char *query_string;
25 };
26
27 typedef struct ZOOM_task_p *ZOOM_task;
28
29 #define STATE_IDLE 0
30 #define STATE_CONNECTING 1
31 #define STATE_ESTABLISHED 2
32
33 #define ZOOM_SELECT_READ 1
34 #define ZOOM_SELECT_WRITE 2
35 #define ZOOM_SELECT_EXCEPT 4
36
37 struct ZOOM_connection_p {
38     enum oid_proto proto;
39     COMSTACK cs;
40     char *host_port;
41     char *path;
42     int error;
43     char *addinfo;
44     char *diagset;
45     int state;
46     int mask;
47     int reconnect_ok;
48     ODR odr_in;
49     ODR odr_out;
50     char *buf_in;
51     int len_in;
52     char *buf_out;
53     int len_out;
54     char *proxy;
55     char *charset;
56     char *lang;
57     char *cookie_out;
58     char *cookie_in;
59     char *client_IP;
60     int async;
61     int support_named_resultsets;
62     int last_event;
63     ZOOM_task tasks;
64     ZOOM_options options;
65     ZOOM_resultset resultsets;
66     ZOOM_Event m_queue_front;
67     ZOOM_Event m_queue_back;
68 };
69
70 struct ZOOM_options_entry {
71     char *name;
72     char *value;
73     struct ZOOM_options_entry *next;
74 };
75
76 struct ZOOM_options_p {
77     int refcount;
78     void *callback_handle;
79     ZOOM_options_callback callback_func;
80     struct ZOOM_options_entry *entries;
81     ZOOM_options parent1;
82     ZOOM_options parent2;
83 };
84
85 typedef struct ZOOM_record_cache_p *ZOOM_record_cache;
86
87 struct ZOOM_resultset_p {
88     Z_SortKeySpecList *r_sort_spec;
89     ZOOM_query query;
90     int refcount;
91     int size;
92     int start;
93     int count;
94     int step;
95     int piggyback;
96     char *setname;
97     char *schema;
98     ODR odr;
99     ZOOM_record_cache record_cache;
100     ZOOM_options options;
101     ZOOM_connection connection;
102     ZOOM_resultset next;
103 };
104
105 struct ZOOM_record_p {
106     ODR odr;
107     WRBUF wrbuf_marc;
108     WRBUF wrbuf_iconv;
109     WRBUF wrbuf_opac;
110     Z_NamePlusRecord *npr;
111 };
112
113 struct ZOOM_record_cache_p {
114     struct ZOOM_record_p rec;
115     char *elementSetName;
116     char *syntax;
117     char *schema;
118     int pos;
119     ZOOM_record_cache next;
120 };
121
122 struct ZOOM_scanset_p {
123     int refcount;
124     ODR odr;
125     ZOOM_options options;
126     ZOOM_connection connection;
127     Z_AttributesPlusTerm *termListAndStartPoint;
128     Z_AttributeSetId *attributeSet;
129     Z_ScanResponse *scan_response;
130 };
131
132 struct ZOOM_package_p {
133     int refcount;
134     ODR odr_out;
135     ZOOM_options options;
136     ZOOM_connection connection;
137     char *buf_out;
138     int len_out;
139 };
140
141 struct ZOOM_task_p {
142     int running;
143     int which;
144     union {
145 #define ZOOM_TASK_SEARCH 1
146         struct {
147             ZOOM_resultset resultset;
148         } search;
149 #define ZOOM_TASK_RETRIEVE 2
150         struct {
151             int start;
152             ZOOM_resultset resultset;
153             int count;
154         } retrieve;
155 #define ZOOM_TASK_CONNECT 3
156 #define ZOOM_TASK_SCAN 4
157         struct {
158             ZOOM_scanset scan;
159         } scan;
160 #define ZOOM_TASK_PACKAGE 5
161         ZOOM_package package;
162 #define ZOOM_TASK_SORT 6
163         struct {
164             ZOOM_resultset resultset;
165             ZOOM_query q;
166         } sort;
167     } u;
168     ZOOM_task next;
169 };
170
171 struct ZOOM_Event_p {
172     int kind;
173     ZOOM_Event next;
174     ZOOM_Event prev;
175 };
176
177 void ZOOM_options_addref (ZOOM_options opt);
178 /*
179  * Local variables:
180  * c-basic-offset: 4
181  * indent-tabs-mode: nil
182  * End:
183  * vim: shiftwidth=4 tabstop=8 expandtab
184  */
185