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