2 * Copyright (c) 1995-1999, 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.2 1999-12-16 23:36:19 adam
28 * Implemented ILL protocol. Minor updates ASN.1 compiler.
30 * Revision 1.1 1999/11/30 13:47:11 adam
31 * Improved installation. Moved header files to include/yaz.
33 * Revision 1.28 1999/11/04 14:58:44 adam
34 * Added status elements for backend delete result set handler.
35 * Updated delete result result set command for client.
37 * Revision 1.27 1999/10/11 10:01:24 adam
38 * Implemented bend_sort_rr handler for frontend server.
40 * Revision 1.26 1999/06/17 10:54:44 adam
41 * Added facility to specify implementation version - and name
44 * Revision 1.25 1999/06/01 14:29:12 adam
45 * Work on Extended Services.
47 * Revision 1.24 1999/03/31 11:18:24 adam
48 * Implemented odr_strdup. Added Reference ID to backend server API.
50 * Revision 1.23 1998/10/13 16:12:23 adam
51 * Added support for Surrogate Diagnostics for Scan Term entries.
53 * Revision 1.22 1998/09/02 12:41:51 adam
54 * Added decode stream in bend search structures.
56 * Revision 1.21 1998/07/20 12:38:41 adam
57 * Implemented delete result set service to server API.
59 * Revision 1.20 1998/05/27 16:57:06 adam
60 * Support for surrogate diagnostic records added for bend_fetch.
62 * Revision 1.19 1998/03/31 11:07:45 adam
63 * Furhter work on UNIverse resource report.
64 * Added Extended Services handling in frontend server.
66 * Revision 1.18 1998/02/10 11:03:56 adam
67 * Added support for extended handlers in backend server interface.
69 * Revision 1.17 1998/01/29 13:15:35 adam
70 * Implemented sort for the backend interface.
72 * Revision 1.16 1997/09/17 12:10:31 adam
80 #include <yaz/yconfig.h>
81 #include <yaz/proto.h>
82 #include <yaz/statserv.h>
88 typedef struct request *bend_request;
89 typedef struct association *bend_association;
91 /* old search request input */
94 char *setname; /* name to give to this set */
95 int replace_set; /* replace set, if it already exists */
96 int num_bases; /* number of databases in list */
97 char **basenames; /* databases to search */
98 Z_ReferenceId *referenceId;/* reference ID */
99 Z_Query *query; /* query structure */
100 ODR stream; /* encoding stream */
101 ODR decode; /* decoding stream */
102 } bend_searchrequest;
104 /* old search request output */
107 int hits; /* number of hits */
108 int errcode; /* 0==OK */
109 char *errstring; /* system error string or NULL */
112 /* extended search handler (rr = request response) */
114 char *setname; /* name to give to this set */
115 int replace_set; /* replace set, if it already exists */
116 int num_bases; /* number of databases in list */
117 char **basenames; /* databases to search */
118 Z_ReferenceId *referenceId;/* reference ID */
119 Z_Query *query; /* query structure */
120 ODR stream; /* encode stream */
121 ODR decode; /* decode stream */
123 bend_request request;
124 bend_association association;
126 int hits; /* number of hits */
127 int errcode; /* 0==OK */
128 char *errstring; /* system error string or NULL */
131 /* extended present handler. Does not replace bend_fetch. */
133 char *setname; /* set name */
135 int number; /* record number */
136 oid_value format; /* One of the CLASS_RECSYN members */
137 Z_ReferenceId *referenceId;/* reference ID */
138 Z_RecordComposition *comp; /* Formatting instructions */
139 ODR stream; /* encoding stream - memory source if required */
140 bend_request request;
141 bend_association association;
143 int hits; /* number of hits */
144 int errcode; /* 0==OK */
145 char *errstring; /* system error string or NULL */
148 YAZ_EXPORT bend_searchresult *bend_search(void *handle, bend_searchrequest *r,
150 YAZ_EXPORT int bend_searchresponse(void *handle, bend_search_rr *bsrr);
154 char *setname; /* set name */
155 int number; /* record number */
156 Z_ReferenceId *referenceId;/* reference ID */
157 oid_value format; /* One of the CLASS_RECSYN members */
158 Z_RecordComposition *comp; /* Formatting instructions */
159 ODR stream; /* encoding stream - memory source if req */
160 int surrogate_flag; /* surrogate diagnostic flag (rw) */
165 char *basename; /* name of database that provided record */
166 int len; /* length of record or -1 if structured */
167 char *record; /* record */
168 int last_in_set; /* is it? */
169 oid_value format; /* format */
170 int errcode; /* 0==success */
171 char *errstring; /* system error string or NULL */
174 YAZ_EXPORT bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *r,
176 YAZ_EXPORT bend_fetchresult *bend_fetchresponse(void *handle);
180 int num_bases; /* number of elements in databaselist */
181 char **basenames; /* databases to search */
182 oid_value attributeset;
183 Z_ReferenceId *referenceId; /* reference ID */
184 Z_AttributesPlusTerm *term;
185 int term_position; /* desired index of term in result list */
186 int num_entries; /* number of entries requested */
187 ODR stream; /* encoding stream - memory source if required */
191 char *term; /* the returned scan term */
192 int occurrences; /* no of occurrences or -1 if error (see below) */
193 int errcode; /* Bib-1 diagnostic code; only used when occur.= -1 */
194 char *errstring; /* Additional string */
198 BEND_SCAN_SUCCESS, /* ok */
199 BEND_SCAN_PARTIAL /* not all entries could be found */
202 typedef struct bend_scanresult
205 struct scan_entry *entries;
207 bend_scan_status status;
212 typedef struct bend_scan_rr {
213 int num_bases; /* number of elements in databaselist */
214 char **basenames; /* databases to search */
215 oid_value attributeset;
216 Z_ReferenceId *referenceId; /* reference ID */
217 Z_AttributesPlusTerm *term;
218 ODR stream; /* encoding stream - memory source if required */
220 int term_position; /* desired index of term in result list/returned */
221 int num_entries; /* number of entries requested/returned */
223 struct scan_entry *entries;
224 bend_scan_status status;
229 YAZ_EXPORT bend_scanresult *bend_scan(void *handle, bend_scanrequest *r,
231 YAZ_EXPORT bend_scanresult *bend_scanresponse(void *handle);
234 typedef struct bend_delete_rr {
238 Z_ReferenceId *referenceId;
239 int delete_status; /* status for the whole operation */
240 int *statuses; /* status each set - indexed as setnames */
245 YAZ_EXPORT void bend_close(void *handle);
248 typedef struct bend_sort_rr
250 int num_input_setnames;
251 char **input_setnames;
252 char *output_setname;
253 Z_SortKeySpecList *sort_sequence;
255 Z_ReferenceId *referenceId;/* reference ID */
262 typedef struct bend_esrequest_rr
265 Z_ExtendedServicesRequest *esr;
267 ODR stream; /* encoding stream */
268 ODR decode; /* decoding stream */
269 Z_ReferenceId *referenceId;/* reference ID */
270 bend_request request;
271 bend_association association;
272 int errcode; /* 0==success, -1==accepted, >0 = failure */
273 char *errstring; /* system error string or NULL */
276 typedef struct bend_initrequest
279 Z_IdAuthentication *auth;
280 ODR stream; /* encoding stream */
281 Z_ReferenceId *referenceId;/* reference ID */
283 char *implementation_name;
284 char *implementation_version;
285 int (*bend_sort) (void *handle, bend_sort_rr *rr);
286 int (*bend_search) (void *handle, bend_search_rr *rr);
287 int (*bend_present) (void *handle, bend_present_rr *rr);
288 int (*bend_esrequest) (void *handle, bend_esrequest_rr *rr);
289 int (*bend_delete)(void *handle, bend_delete_rr *rr);
290 int (*bend_scan)(void *handle, bend_scan_rr *rr);
293 typedef struct bend_initresult
295 int errcode; /* 0==OK */
296 char *errstring; /* system error string or NULL */
297 void *handle; /* private handle to the backend module */
300 YAZ_EXPORT bend_initresult *bend_init(bend_initrequest *r);
302 YAZ_EXPORT void bend_request_send (bend_association a, bend_request req,
305 YAZ_EXPORT bend_request bend_request_mk (bend_association a);
307 YAZ_EXPORT void bend_request_destroy (bend_request *req);
309 YAZ_EXPORT Z_ReferenceId *bend_request_getid (ODR odr, bend_request req);
310 YAZ_EXPORT int bend_backend_respond (bend_association a, bend_request req);
311 YAZ_EXPORT void bend_request_setdata(bend_request r, void *p);
312 YAZ_EXPORT void *bend_request_getdata(bend_request r);