Prefix ZOOM_ instead of Z3950_. Documentation updates.
[yaz-moved-to-github.git] / zoom / zoom-p.h
1 /*
2  * Private C header for ZOOM C.
3  * $Id: zoom-p.h,v 1.5 2001-11-18 21:14:23 adam Exp $
4  */
5 #include <yaz/proto.h>
6 #include <yaz/comstack.h>
7 #include <yaz/wrbuf.h>
8 #include <yaz/zoom.h>
9
10 typedef struct ZOOM_Event_p *ZOOM_Event;
11
12 struct ZOOM_query_p {
13     Z_Query *query;
14     Z_SortKeySpecList *sort_spec;
15     int refcount;
16     ODR odr;
17 };
18
19 #define STATE_IDLE 0
20 #define STATE_CONNECTING 1
21 #define STATE_ESTABLISHED 2
22
23 #define ZOOM_SELECT_READ 1
24 #define ZOOM_SELECT_WRITE 2
25 #define ZOOM_SELECT_EXCEPT 4
26
27 struct ZOOM_connection_p {
28     COMSTACK cs;
29     char *host_port;
30     int error;
31     char *addinfo;
32     int state;
33     int mask;
34     ODR odr_in;
35     ODR odr_out;
36     char *buf_in;
37     int len_in;
38     char *buf_out;
39     int len_out;
40     char *proxy;
41     char *cookie_out;
42     char *cookie_in;
43     int async;
44     ZOOM_task tasks;
45     ZOOM_options options;
46     ZOOM_resultset resultsets;
47     ZOOM_Event m_queue_front;
48     ZOOM_Event m_queue_back;
49 };
50
51
52 struct ZOOM_options_entry {
53     char *name;
54     char *value;
55     struct ZOOM_options_entry *next;
56 };
57
58 struct ZOOM_options_p {
59     int refcount;
60     void *callback_handle;
61     ZOOM_options_callback callback_func;
62     struct ZOOM_options_entry *entries;
63     ZOOM_options parent;
64 };
65
66 typedef struct ZOOM_record_cache_p *ZOOM_record_cache;
67
68 struct ZOOM_resultset_p {
69     Z_Query *r_query;
70     Z_SortKeySpecList *r_sort_spec;
71     ZOOM_query search;
72     int refcount;
73     int size;
74     int start;
75     int count;
76     int piggyback;
77     ODR odr;
78     ZOOM_record_cache record_cache;
79     ZOOM_options options;
80     ZOOM_connection connection;
81     ZOOM_resultset next;
82 };
83
84 struct ZOOM_record_p {
85     ODR odr;
86     WRBUF wrbuf_marc;
87     Z_NamePlusRecord *npr;
88 };
89
90 struct ZOOM_record_cache_p {
91     struct ZOOM_record_p rec;
92     char *elementSetName;
93     int pos;
94     ZOOM_record_cache next;
95 };
96
97 struct ZOOM_task_p {
98     int running;
99     int which;
100     union {
101 #define ZOOM_TASK_SEARCH 1
102         ZOOM_resultset resultset;
103 #define ZOOM_TASK_RETRIEVE 2
104         /** also resultset here */
105 #define ZOOM_TASK_CONNECT 3
106     } u;
107     ZOOM_task next;
108 };
109
110 struct ZOOM_Event_p {
111     int kind;
112     ZOOM_Event next;
113     ZOOM_Event prev;
114 };
115
116
117 #ifndef YAZ_DATE
118 COMSTACK cs_create_host(const char *type_and_host, int blocking, void **vp);
119 Odr_oid *yaz_str_to_z3950oid (ODR o, int oid_class, const char *str);
120 Z_SortKeySpecList *yaz_sort_spec (ODR out, const char *arg);
121 #else
122 #include <yaz/sortspec.h>
123 #endif