WIN32 updates: ZOOM runs, nmem_init/nmem_exit called in DllMain.
[yaz-moved-to-github.git] / zoom / zoom-p.h
1 /*
2  * Private C header for ZOOM C.
3  * $Id: zoom-p.h,v 1.2 2001-10-24 12:24:43 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 struct Z3950_search_p {
11     Z_Query *query;
12     Z_SortKeySpecList *sort_spec;
13     int refcount;
14     ODR odr;
15 };
16
17 #define STATE_IDLE 0
18 #define STATE_CONNECTING 1
19 #define STATE_ESTABLISHED 2
20
21 #define Z3950_SELECT_READ 1
22 #define Z3950_SELECT_WRITE 2
23 #define Z3950_SELECT_EXCEPT 4
24
25 struct Z3950_connection_p {
26     COMSTACK cs;
27     char *host_port;
28     int error;
29     char *addinfo;
30     int state;
31     int mask;
32     ODR odr_in;
33     ODR odr_out;
34     char *buf_in;
35     int len_in;
36     char *buf_out;
37     int len_out;
38     char *proxy;
39     char *cookie_out;
40     char *cookie_in;
41     int async;
42     int event_pending;
43     Z3950_task tasks;
44     Z3950_options options;
45     Z3950_resultset resultsets;
46 };
47
48
49 struct Z3950_options_entry {
50     char *name;
51     char *value;
52     struct Z3950_options_entry *next;
53 };
54
55 struct Z3950_options_p {
56     int refcount;
57     void *callback_handle;
58     Z3950_options_callback callback_func;
59     struct Z3950_options_entry *entries;
60     Z3950_options parent;
61 };
62
63 typedef struct Z3950_record_cache_p *Z3950_record_cache;
64
65 struct Z3950_resultset_p {
66     Z_Query *r_query;
67     Z_SortKeySpecList *r_sort_spec;
68     Z3950_search search;
69     int refcount;
70     int size;
71     int start;
72     int count;
73     int piggyback;
74     ODR odr;
75     Z3950_record_cache record_cache;
76     Z3950_options options;
77     Z3950_connection connection;
78     Z3950_resultset next;
79 };
80
81 struct Z3950_record_p {
82     ODR odr;
83     WRBUF wrbuf_marc;
84     Z_NamePlusRecord *npr;
85 };
86
87 struct Z3950_record_cache_p {
88     struct Z3950_record_p rec;
89     char *elementSetName;
90     int pos;
91     Z3950_record_cache next;
92 };
93
94 struct Z3950_task_p {
95     int running;
96     int which;
97     union {
98 #define Z3950_TASK_SEARCH 1
99         Z3950_resultset resultset;
100 #define Z3950_TASK_RETRIEVE 2
101         /** also resultset here */
102
103     } u;
104     Z3950_task next;
105 };
106
107 #ifndef YAZ_DATE
108 COMSTACK cs_create_host(const char *type_and_host, int blocking, void **vp);
109 Odr_oid *yaz_str_to_z3950oid (ODR o, int oid_class, const char *str);
110 Z_SortKeySpecList *yaz_sort_spec (ODR out, const char *arg);
111 #else
112 #include <yaz/sortspec.h>
113 #endif