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.3 2000-01-12 14:36:07 adam
28 * Added printing stream (ODR) for backend functions.
30 * Revision 1.2 1999/12/16 23:36:19 adam
31 * Implemented ILL protocol. Minor updates ASN.1 compiler.
33 * Revision 1.1 1999/11/30 13:47:11 adam
34 * Improved installation. Moved header files to include/yaz.
36 * Revision 1.28 1999/11/04 14:58:44 adam
37 * Added status elements for backend delete result set handler.
38 * Updated delete result result set command for client.
40 * Revision 1.27 1999/10/11 10:01:24 adam
41 * Implemented bend_sort_rr handler for frontend server.
43 * Revision 1.26 1999/06/17 10:54:44 adam
44 * Added facility to specify implementation version - and name
47 * Revision 1.25 1999/06/01 14:29:12 adam
48 * Work on Extended Services.
50 * Revision 1.24 1999/03/31 11:18:24 adam
51 * Implemented odr_strdup. Added Reference ID to backend server API.
53 * Revision 1.23 1998/10/13 16:12:23 adam
54 * Added support for Surrogate Diagnostics for Scan Term entries.
56 * Revision 1.22 1998/09/02 12:41:51 adam
57 * Added decode stream in bend search structures.
59 * Revision 1.21 1998/07/20 12:38:41 adam
60 * Implemented delete result set service to server API.
62 * Revision 1.20 1998/05/27 16:57:06 adam
63 * Support for surrogate diagnostic records added for bend_fetch.
65 * Revision 1.19 1998/03/31 11:07:45 adam
66 * Furhter work on UNIverse resource report.
67 * Added Extended Services handling in frontend server.
69 * Revision 1.18 1998/02/10 11:03:56 adam
70 * Added support for extended handlers in backend server interface.
72 * Revision 1.17 1998/01/29 13:15:35 adam
73 * Implemented sort for the backend interface.
75 * Revision 1.16 1997/09/17 12:10:31 adam
83 #include <yaz/yconfig.h>
84 #include <yaz/proto.h>
85 #include <yaz/statserv.h>
91 typedef struct request *bend_request;
92 typedef struct association *bend_association;
94 /* old search request input */
97 char *setname; /* name to give to this set */
98 int replace_set; /* replace set, if it already exists */
99 int num_bases; /* number of databases in list */
100 char **basenames; /* databases to search */
101 Z_ReferenceId *referenceId;/* reference ID */
102 Z_Query *query; /* query structure */
103 ODR stream; /* encoding stream */
104 ODR decode; /* decoding stream */
105 ODR print; /* printing stream */
106 } bend_searchrequest;
108 /* old search request output */
111 int hits; /* number of hits */
112 int errcode; /* 0==OK */
113 char *errstring; /* system error string or NULL */
116 /* extended search handler (rr = request response) */
118 char *setname; /* name to give to this set */
119 int replace_set; /* replace set, if it already exists */
120 int num_bases; /* number of databases in list */
121 char **basenames; /* databases to search */
122 Z_ReferenceId *referenceId;/* reference ID */
123 Z_Query *query; /* query structure */
124 ODR stream; /* encode stream */
125 ODR decode; /* decode stream */
126 ODR print; /* print stream */
128 bend_request request;
129 bend_association association;
131 int hits; /* number of hits */
132 int errcode; /* 0==OK */
133 char *errstring; /* system error string or NULL */
136 /* extended present handler. Does not replace bend_fetch. */
138 char *setname; /* set name */
140 int number; /* record number */
141 oid_value format; /* One of the CLASS_RECSYN members */
142 Z_ReferenceId *referenceId;/* reference ID */
143 Z_RecordComposition *comp; /* Formatting instructions */
144 ODR stream; /* encoding stream - memory source if required */
145 ODR print; /* printing stream */
146 bend_request request;
147 bend_association association;
149 int hits; /* number of hits */
150 int errcode; /* 0==OK */
151 char *errstring; /* system error string or NULL */
154 YAZ_EXPORT bend_searchresult *bend_search(void *handle, bend_searchrequest *r,
156 YAZ_EXPORT int bend_searchresponse(void *handle, bend_search_rr *bsrr);
160 char *setname; /* set name */
161 int number; /* record number */
162 Z_ReferenceId *referenceId;/* reference ID */
163 oid_value format; /* One of the CLASS_RECSYN members */
164 Z_RecordComposition *comp; /* Formatting instructions */
165 ODR stream; /* encoding stream - memory source if req */
166 ODR print; /* printing stream */
167 int surrogate_flag; /* surrogate diagnostic flag (rw) */
172 char *basename; /* name of database that provided record */
173 int len; /* length of record or -1 if structured */
174 char *record; /* record */
175 int last_in_set; /* is it? */
176 oid_value format; /* format */
177 int errcode; /* 0==success */
178 char *errstring; /* system error string or NULL */
181 YAZ_EXPORT bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *r,
183 YAZ_EXPORT bend_fetchresult *bend_fetchresponse(void *handle);
187 int num_bases; /* number of elements in databaselist */
188 char **basenames; /* databases to search */
189 oid_value attributeset;
190 Z_ReferenceId *referenceId; /* reference ID */
191 Z_AttributesPlusTerm *term;
192 int term_position; /* desired index of term in result list */
193 int num_entries; /* number of entries requested */
194 ODR stream; /* encoding stream - memory source if required */
195 ODR print; /* printing stream */
199 char *term; /* the returned scan term */
200 int occurrences; /* no of occurrences or -1 if error (see below) */
201 int errcode; /* Bib-1 diagnostic code; only used when occur.= -1 */
202 char *errstring; /* Additional string */
206 BEND_SCAN_SUCCESS, /* ok */
207 BEND_SCAN_PARTIAL /* not all entries could be found */
210 typedef struct bend_scanresult
213 struct scan_entry *entries;
215 bend_scan_status status;
220 typedef struct bend_scan_rr {
221 int num_bases; /* number of elements in databaselist */
222 char **basenames; /* databases to search */
223 oid_value attributeset;
224 Z_ReferenceId *referenceId; /* reference ID */
225 Z_AttributesPlusTerm *term;
226 ODR stream; /* encoding stream - memory source if required */
227 ODR print; /* printing stream */
229 int term_position; /* desired index of term in result list/returned */
230 int num_entries; /* number of entries requested/returned */
232 struct scan_entry *entries;
233 bend_scan_status status;
238 YAZ_EXPORT bend_scanresult *bend_scan(void *handle, bend_scanrequest *r,
240 YAZ_EXPORT bend_scanresult *bend_scanresponse(void *handle);
243 typedef struct bend_delete_rr {
247 Z_ReferenceId *referenceId;
248 int delete_status; /* status for the whole operation */
249 int *statuses; /* status each set - indexed as setnames */
255 YAZ_EXPORT void bend_close(void *handle);
258 typedef struct bend_sort_rr
260 int num_input_setnames;
261 char **input_setnames;
262 char *output_setname;
263 Z_SortKeySpecList *sort_sequence;
266 Z_ReferenceId *referenceId;/* reference ID */
273 typedef struct bend_esrequest_rr
276 Z_ExtendedServicesRequest *esr;
278 ODR stream; /* encoding stream */
279 ODR decode; /* decoding stream */
280 ODR print; /* printing stream */
281 Z_ReferenceId *referenceId;/* reference ID */
282 bend_request request;
283 bend_association association;
284 int errcode; /* 0==success, -1==accepted, >0 = failure */
285 char *errstring; /* system error string or NULL */
288 typedef struct bend_initrequest
291 Z_IdAuthentication *auth;
292 ODR stream; /* encoding stream */
293 ODR print; /* printing stream */
294 Z_ReferenceId *referenceId;/* reference ID */
296 char *implementation_name;
297 char *implementation_version;
298 int (*bend_sort) (void *handle, bend_sort_rr *rr);
299 int (*bend_search) (void *handle, bend_search_rr *rr);
300 int (*bend_present) (void *handle, bend_present_rr *rr);
301 int (*bend_esrequest) (void *handle, bend_esrequest_rr *rr);
302 int (*bend_delete)(void *handle, bend_delete_rr *rr);
303 int (*bend_scan)(void *handle, bend_scan_rr *rr);
306 typedef struct bend_initresult
308 int errcode; /* 0==OK */
309 char *errstring; /* system error string or NULL */
310 void *handle; /* private handle to the backend module */
313 YAZ_EXPORT bend_initresult *bend_init(bend_initrequest *r);
315 YAZ_EXPORT void bend_request_send (bend_association a, bend_request req,
318 YAZ_EXPORT bend_request bend_request_mk (bend_association a);
320 YAZ_EXPORT void bend_request_destroy (bend_request *req);
322 YAZ_EXPORT Z_ReferenceId *bend_request_getid (ODR odr, bend_request req);
323 YAZ_EXPORT int bend_backend_respond (bend_association a, bend_request req);
324 YAZ_EXPORT void bend_request_setdata(bend_request r, void *p);
325 YAZ_EXPORT void *bend_request_getdata(bend_request r);