More on scansets.
[yaz-moved-to-github.git] / zoom / zoom-p.h
1 /*
2  * Private C header for ZOOM C.
3  * $Id: zoom-p.h,v 1.8 2001-12-30 22:21:11 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     ODR odr_in;
36     ODR odr_out;
37     char *buf_in;
38     int len_in;
39     char *buf_out;
40     int len_out;
41     char *proxy;
42     char *cookie_out;
43     char *cookie_in;
44     int async;
45     int support_named_resultsets;
46     int last_event;
47     ZOOM_task tasks;
48     ZOOM_options options;
49     ZOOM_resultset resultsets;
50     ZOOM_Event m_queue_front;
51     ZOOM_Event m_queue_back;
52 };
53
54
55 struct ZOOM_options_entry {
56     char *name;
57     char *value;
58     struct ZOOM_options_entry *next;
59 };
60
61 struct ZOOM_options_p {
62     int refcount;
63     void *callback_handle;
64     ZOOM_options_callback callback_func;
65     struct ZOOM_options_entry *entries;
66     ZOOM_options parent;
67 };
68
69 typedef struct ZOOM_record_cache_p *ZOOM_record_cache;
70
71 struct ZOOM_resultset_p {
72     Z_Query *r_query;
73     Z_SortKeySpecList *r_sort_spec;
74     ZOOM_query search;
75     int refcount;
76     int size;
77     int start;
78     int count;
79     int piggyback;
80     char *setname;
81     ODR odr;
82     ZOOM_record_cache record_cache;
83     ZOOM_options options;
84     ZOOM_connection connection;
85     ZOOM_resultset next;
86 };
87
88 struct ZOOM_record_p {
89     ODR odr;
90     WRBUF wrbuf_marc;
91     Z_NamePlusRecord *npr;
92 };
93
94 struct ZOOM_record_cache_p {
95     struct ZOOM_record_p rec;
96     char *elementSetName;
97     int pos;
98     ZOOM_record_cache next;
99 };
100
101 struct ZOOM_scanset_p {
102     int refcount;
103     ODR odr;
104     ZOOM_options options;
105     ZOOM_connection connection;
106     Z_AttributesPlusTerm *termListAndStartPoint;
107     Z_AttributeSetId *attributeSet;
108     Z_ScanResponse *scan_response;
109 };
110
111 struct ZOOM_task_p {
112     int running;
113     int which;
114     union {
115 #define ZOOM_TASK_SEARCH 1
116         struct {
117             ZOOM_resultset resultset;
118         } search;
119 #define ZOOM_TASK_RETRIEVE 2
120         struct {
121             int start;
122             ZOOM_resultset resultset;
123             int count;
124         } retrieve;
125 #define ZOOM_TASK_CONNECT 3
126 #define ZOOM_TASK_SCAN 4
127         struct {
128             ZOOM_scanset scan;
129         } scan;
130     } u;
131     ZOOM_task next;
132 };
133
134 struct ZOOM_Event_p {
135     int kind;
136     ZOOM_Event next;
137     ZOOM_Event prev;
138 };
139
140