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