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