2 * Copyright (c) 1995-2000, Index Data.
4 * Permission to use, copy, modify, distribute, and sell this software and
5 * its documentation, in whole or in part, for any purpose, is hereby granted,
8 * 1. This copyright and permission notice appear in all copies of the
9 * software and its documentation. Notices of copyright or attribution
10 * which appear at the beginning of any file must remain unchanged.
12 * 2. The name of Index Data or the individual authors may not be used to
13 * endorse or promote products derived from this software without specific
14 * prior written permission.
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
18 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19 * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
20 * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
21 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
22 * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
27 * Revision 1.6 2000-03-20 19:06:25 adam
28 * Added Segment request for fronend server. Work on admin for client.
30 * Revision 1.5 2000/03/15 12:59:49 adam
31 * Added handle member to statserv_control.
33 * Revision 1.4 2000/02/28 11:20:06 adam
34 * Using autoconf. New definitions: YAZ_BEGIN_CDECL/YAZ_END_CDECL.
36 * Revision 1.3 2000/01/12 14:36:07 adam
37 * Added printing stream (ODR) for backend functions.
39 * Revision 1.2 1999/12/16 23:36:19 adam
40 * Implemented ILL protocol. Minor updates ASN.1 compiler.
42 * Revision 1.1 1999/11/30 13:47:11 adam
43 * Improved installation. Moved header files to include/yaz.
45 * Revision 1.28 1999/11/04 14:58:44 adam
46 * Added status elements for backend delete result set handler.
47 * Updated delete result result set command for client.
49 * Revision 1.27 1999/10/11 10:01:24 adam
50 * Implemented bend_sort_rr handler for frontend server.
52 * Revision 1.26 1999/06/17 10:54:44 adam
53 * Added facility to specify implementation version - and name
56 * Revision 1.25 1999/06/01 14:29:12 adam
57 * Work on Extended Services.
59 * Revision 1.24 1999/03/31 11:18:24 adam
60 * Implemented odr_strdup. Added Reference ID to backend server API.
62 * Revision 1.23 1998/10/13 16:12:23 adam
63 * Added support for Surrogate Diagnostics for Scan Term entries.
65 * Revision 1.22 1998/09/02 12:41:51 adam
66 * Added decode stream in bend search structures.
68 * Revision 1.21 1998/07/20 12:38:41 adam
69 * Implemented delete result set service to server API.
71 * Revision 1.20 1998/05/27 16:57:06 adam
72 * Support for surrogate diagnostic records added for bend_fetch.
74 * Revision 1.19 1998/03/31 11:07:45 adam
75 * Furhter work on UNIverse resource report.
76 * Added Extended Services handling in frontend server.
78 * Revision 1.18 1998/02/10 11:03:56 adam
79 * Added support for extended handlers in backend server interface.
81 * Revision 1.17 1998/01/29 13:15:35 adam
82 * Implemented sort for the backend interface.
84 * Revision 1.16 1997/09/17 12:10:31 adam
92 #include <yaz/yconfig.h>
93 #include <yaz/proto.h>
94 #include <yaz/statserv.h>
98 typedef struct request *bend_request;
99 typedef struct association *bend_association;
101 /* old search request input */
104 char *setname; /* name to give to this set */
105 int replace_set; /* replace set, if it already exists */
106 int num_bases; /* number of databases in list */
107 char **basenames; /* databases to search */
108 Z_ReferenceId *referenceId;/* reference ID */
109 Z_Query *query; /* query structure */
110 ODR stream; /* encoding stream */
111 ODR decode; /* decoding stream */
112 ODR print; /* printing stream */
113 } bend_searchrequest;
115 /* old search request output */
118 int hits; /* number of hits */
119 int errcode; /* 0==OK */
120 char *errstring; /* system error string or NULL */
123 /* extended search handler (rr = request response) */
125 char *setname; /* name to give to this set */
126 int replace_set; /* replace set, if it already exists */
127 int num_bases; /* number of databases in list */
128 char **basenames; /* databases to search */
129 Z_ReferenceId *referenceId;/* reference ID */
130 Z_Query *query; /* query structure */
131 ODR stream; /* encode stream */
132 ODR decode; /* decode stream */
133 ODR print; /* print stream */
135 bend_request request;
136 bend_association association;
138 int hits; /* number of hits */
139 int errcode; /* 0==OK */
140 char *errstring; /* system error string or NULL */
143 /* extended present handler. Does not replace bend_fetch. */
145 char *setname; /* set name */
147 int number; /* record number */
148 oid_value format; /* One of the CLASS_RECSYN members */
149 Z_ReferenceId *referenceId;/* reference ID */
150 Z_RecordComposition *comp; /* Formatting instructions */
151 ODR stream; /* encoding stream - memory source if required */
152 ODR print; /* printing stream */
153 bend_request request;
154 bend_association association;
156 int hits; /* number of hits */
157 int errcode; /* 0==OK */
158 char *errstring; /* system error string or NULL */
161 YAZ_EXPORT bend_searchresult *bend_search(void *handle, bend_searchrequest *r,
163 YAZ_EXPORT int bend_searchresponse(void *handle, bend_search_rr *bsrr);
167 char *setname; /* set name */
168 int number; /* record number */
169 Z_ReferenceId *referenceId;/* reference ID */
170 oid_value format; /* One of the CLASS_RECSYN members */
171 Z_RecordComposition *comp; /* Formatting instructions */
172 ODR stream; /* encoding stream - memory source if req */
173 ODR print; /* printing stream */
174 int surrogate_flag; /* surrogate diagnostic flag (rw) */
179 char *basename; /* name of database that provided record */
180 int len; /* length of record or -1 if structured */
181 char *record; /* record */
182 int last_in_set; /* is it? */
183 oid_value format; /* format */
184 int errcode; /* 0==success */
185 char *errstring; /* system error string or NULL */
188 YAZ_EXPORT bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *r,
190 YAZ_EXPORT bend_fetchresult *bend_fetchresponse(void *handle);
194 int num_bases; /* number of elements in databaselist */
195 char **basenames; /* databases to search */
196 oid_value attributeset;
197 Z_ReferenceId *referenceId; /* reference ID */
198 Z_AttributesPlusTerm *term;
199 int term_position; /* desired index of term in result list */
200 int num_entries; /* number of entries requested */
201 ODR stream; /* encoding stream - memory source if required */
202 ODR print; /* printing stream */
206 char *term; /* the returned scan term */
207 int occurrences; /* no of occurrences or -1 if error (see below) */
208 int errcode; /* Bib-1 diagnostic code; only used when occur.= -1 */
209 char *errstring; /* Additional string */
213 BEND_SCAN_SUCCESS, /* ok */
214 BEND_SCAN_PARTIAL /* not all entries could be found */
217 typedef struct bend_scanresult
220 struct scan_entry *entries;
222 bend_scan_status status;
227 typedef struct bend_scan_rr {
228 int num_bases; /* number of elements in databaselist */
229 char **basenames; /* databases to search */
230 oid_value attributeset;
231 Z_ReferenceId *referenceId; /* reference ID */
232 Z_AttributesPlusTerm *term;
233 ODR stream; /* encoding stream - memory source if required */
234 ODR print; /* printing stream */
236 int term_position; /* desired index of term in result list/returned */
237 int num_entries; /* number of entries requested/returned */
239 struct scan_entry *entries;
240 bend_scan_status status;
245 YAZ_EXPORT bend_scanresult *bend_scan(void *handle, bend_scanrequest *r,
247 YAZ_EXPORT bend_scanresult *bend_scanresponse(void *handle);
250 typedef struct bend_delete_rr {
254 Z_ReferenceId *referenceId;
255 int delete_status; /* status for the whole operation */
256 int *statuses; /* status each set - indexed as setnames */
262 YAZ_EXPORT void bend_close(void *handle);
265 typedef struct bend_sort_rr
267 int num_input_setnames;
268 char **input_setnames;
269 char *output_setname;
270 Z_SortKeySpecList *sort_sequence;
273 Z_ReferenceId *referenceId;/* reference ID */
280 typedef struct bend_esrequest_rr
283 Z_ExtendedServicesRequest *esr;
285 ODR stream; /* encoding stream */
286 ODR decode; /* decoding stream */
287 ODR print; /* printing stream */
288 Z_ReferenceId *referenceId;/* reference ID */
289 bend_request request;
290 bend_association association;
291 int errcode; /* 0==success, -1==accepted, >0 = failure */
292 char *errstring; /* system error string or NULL */
295 typedef struct bend_segment_rr {
300 bend_request request;
301 bend_association association;
304 typedef struct bend_initrequest
306 Z_IdAuthentication *auth;
307 ODR stream; /* encoding stream */
308 ODR print; /* printing stream */
309 Z_ReferenceId *referenceId;/* reference ID */
311 char *implementation_name;
312 char *implementation_version;
313 int (*bend_sort) (void *handle, bend_sort_rr *rr);
314 int (*bend_search) (void *handle, bend_search_rr *rr);
315 int (*bend_present) (void *handle, bend_present_rr *rr);
316 int (*bend_esrequest) (void *handle, bend_esrequest_rr *rr);
317 int (*bend_delete)(void *handle, bend_delete_rr *rr);
318 int (*bend_scan)(void *handle, bend_scan_rr *rr);
319 int (*bend_segment)(void *handle, bend_segment_rr *rr);
322 typedef struct bend_initresult
324 int errcode; /* 0==OK */
325 char *errstring; /* system error string or NULL */
326 void *handle; /* private handle to the backend module */
329 YAZ_EXPORT bend_initresult *bend_init(bend_initrequest *r);
331 YAZ_EXPORT void bend_request_send (bend_association a, bend_request req,
334 YAZ_EXPORT bend_request bend_request_mk (bend_association a);
336 YAZ_EXPORT void bend_request_destroy (bend_request *req);
338 YAZ_EXPORT Z_ReferenceId *bend_request_getid (ODR odr, bend_request req);
339 YAZ_EXPORT int bend_backend_respond (bend_association a, bend_request req);
340 YAZ_EXPORT void bend_request_setdata(bend_request r, void *p);
341 YAZ_EXPORT void *bend_request_getdata(bend_request r);