Source restructure. yaz-marcdump part of installation
[yaz-moved-to-github.git] / src / zoom-p.h
1 /*
2  * Private C header for ZOOM C.
3  * $Id: zoom-p.h,v 1.1 2003-10-27 12:21:36 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     char *query_string;
23 };
24
25 #define STATE_IDLE 0
26 #define STATE_CONNECTING 1
27 #define STATE_ESTABLISHED 2
28
29 #define ZOOM_SELECT_READ 1
30 #define ZOOM_SELECT_WRITE 2
31 #define ZOOM_SELECT_EXCEPT 4
32
33 struct ZOOM_connection_p {
34     enum oid_proto proto;
35     COMSTACK cs;
36     char *host_port;
37     char *path;
38     int error;
39     char *addinfo;
40     const char *diagset;
41     int state;
42     int mask;
43     int reconnect_ok;
44     ODR odr_in;
45     ODR odr_out;
46     char *buf_in;
47     int len_in;
48     char *buf_out;
49     int len_out;
50     char *proxy;
51     char *charset;
52     char *lang;
53     char *cookie_out;
54     char *cookie_in;
55     char *client_IP;
56     int async;
57     int support_named_resultsets;
58     int last_event;
59     ZOOM_task tasks;
60     ZOOM_options options;
61     ZOOM_resultset resultsets;
62     ZOOM_Event m_queue_front;
63     ZOOM_Event m_queue_back;
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_SortKeySpecList *r_sort_spec;
85     ZOOM_query query;
86     int refcount;
87     int size;
88     int start;
89     int count;
90     int step;
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     WRBUF wrbuf_iconv;
105     WRBUF wrbuf_opac;
106     Z_NamePlusRecord *npr;
107 };
108
109 struct ZOOM_record_cache_p {
110     struct ZOOM_record_p rec;
111     char *elementSetName;
112     char *syntax;
113     char *schema;
114     int pos;
115     ZOOM_record_cache next;
116 };
117
118 struct ZOOM_scanset_p {
119     int refcount;
120     ODR odr;
121     ZOOM_options options;
122     ZOOM_connection connection;
123     Z_AttributesPlusTerm *termListAndStartPoint;
124     Z_AttributeSetId *attributeSet;
125     Z_ScanResponse *scan_response;
126 };
127
128 struct ZOOM_package_p {
129     int refcount;
130     ODR odr_out;
131     ZOOM_options options;
132     ZOOM_connection connection;
133     char *buf_out;
134     int len_out;
135 };
136
137 struct ZOOM_task_p {
138     int running;
139     int which;
140     union {
141 #define ZOOM_TASK_SEARCH 1
142         struct {
143             ZOOM_resultset resultset;
144         } search;
145 #define ZOOM_TASK_RETRIEVE 2
146         struct {
147             int start;
148             ZOOM_resultset resultset;
149             int count;
150         } retrieve;
151 #define ZOOM_TASK_CONNECT 3
152 #define ZOOM_TASK_SCAN 4
153         struct {
154             ZOOM_scanset scan;
155         } scan;
156 #define ZOOM_TASK_PACKAGE 5
157         ZOOM_package package;
158     } u;
159     ZOOM_task next;
160 };
161
162 struct ZOOM_Event_p {
163     int kind;
164     ZOOM_Event next;
165     ZOOM_Event prev;
166 };
167
168 void ZOOM_options_addref (ZOOM_options opt);