2 * Copyright (c) 1995-1998, 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.23 1998-10-13 16:12:23 adam
28 * Added support for Surrogate Diagnostics for Scan Term entries.
30 * Revision 1.22 1998/09/02 12:41:51 adam
31 * Added decode stream in bend search structures.
33 * Revision 1.21 1998/07/20 12:38:41 adam
34 * Implemented delete result set service to server API.
36 * Revision 1.20 1998/05/27 16:57:06 adam
37 * Support for surrogate diagnostic records added for bend_fetch.
39 * Revision 1.19 1998/03/31 11:07:45 adam
40 * Furhter work on UNIverse resource report.
41 * Added Extended Services handling in frontend server.
43 * Revision 1.18 1998/02/10 11:03:56 adam
44 * Added support for extended handlers in backend server interface.
46 * Revision 1.17 1998/01/29 13:15:35 adam
47 * Implemented sort for the backend interface.
49 * Revision 1.16 1997/09/17 12:10:31 adam
65 typedef struct request *bend_request;
66 typedef struct association *bend_association;
68 /* old search request input */
71 char *setname; /* name to give to this set */
72 int replace_set; /* replace set, if it already exists */
73 int num_bases; /* number of databases in list */
74 char **basenames; /* databases to search */
75 Z_Query *query; /* query structure */
76 ODR stream; /* encoding stream */
77 ODR decode; /* decoding stream */
80 /* old search request output */
83 int hits; /* number of hits */
84 int errcode; /* 0==OK */
85 char *errstring; /* system error string or NULL */
88 /* extended search handler (rr = request response) */
90 char *setname; /* name to give to this set */
91 int replace_set; /* replace set, if it already exists */
92 int num_bases; /* number of databases in list */
93 char **basenames; /* databases to search */
94 Z_Query *query; /* query structure */
95 ODR stream; /* encode stream */
96 ODR decode; /* decode stream */
99 bend_association association;
101 int hits; /* number of hits */
102 int errcode; /* 0==OK */
103 char *errstring; /* system error string or NULL */
106 /* extended present handler. Does not replace bend_fetch. */
108 char *setname; /* set name */
110 int number; /* record number */
111 oid_value format; /* One of the CLASS_RECSYN members */
112 Z_RecordComposition *comp; /* Formatting instructions */
113 ODR stream; /* encoding stream - memory source if required */
114 bend_request request;
115 bend_association association;
117 int hits; /* number of hits */
118 int errcode; /* 0==OK */
119 char *errstring; /* system error string or NULL */
122 YAZ_EXPORT bend_searchresult *bend_search(void *handle, bend_searchrequest *r,
124 YAZ_EXPORT int bend_searchresponse(void *handle, bend_search_rr *bsrr);
128 char *setname; /* set name */
129 int number; /* record number */
130 oid_value format; /* One of the CLASS_RECSYN members */
131 Z_RecordComposition *comp; /* Formatting instructions */
132 ODR stream; /* encoding stream - memory source if req */
133 int surrogate_flag; /* surrogate diagnostic flag (rw) */
138 char *basename; /* name of database that provided record */
139 int len; /* length of record or -1 if structured */
140 char *record; /* record */
141 int last_in_set; /* is it? */
142 oid_value format; /* format */
143 int errcode; /* 0==success */
144 char *errstring; /* system error string or NULL */
147 YAZ_EXPORT bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *r,
149 YAZ_EXPORT bend_fetchresult *bend_fetchresponse(void *handle);
153 int num_bases; /* number of elements in databaselist */
154 char **basenames; /* databases to search */
155 oid_value attributeset;
156 Z_AttributesPlusTerm *term;
157 int term_position; /* desired index of term in result list */
158 int num_entries; /* number of entries requested */
159 ODR stream; /* encoding stream - memory source if required */
163 char *term; /* the returned scan term */
164 int occurrences; /* no of occurrences or -1 if error (see below) */
165 int errcode; /* Bib-1 diagnostic code; only used when occur.= -1 */
166 char *errstring; /* Additional string */
170 BEND_SCAN_SUCCESS, /* ok */
171 BEND_SCAN_PARTIAL /* not all entries could be found */
174 typedef struct bend_scanresult
177 struct scan_entry *entries;
179 bend_scan_status status;
184 YAZ_EXPORT bend_scanresult *bend_scan(void *handle, bend_scanrequest *r,
186 YAZ_EXPORT bend_scanresult *bend_scanresponse(void *handle);
189 typedef struct bend_delete_rr {
198 YAZ_EXPORT void bend_close(void *handle);
201 typedef struct bend_sort_rr
203 int num_input_setnames;
204 char **input_setnames;
205 char *output_setname;
206 Z_SortKeySpecList *sort_sequence;
214 /* extended services handler. Added in from DALI */
215 typedef struct bend_esrequest_rr
218 Z_ExtendedServicesRequest *esr;
219 ODR stream; /* encoding stream */
220 bend_request request;
221 bend_association association;
222 int errcode; /* 0==success */
223 char *errstring; /* system error string or NULL */
226 typedef struct bend_initrequest
229 Z_IdAuthentication *auth;
230 ODR stream; /* encoding stream */
232 int (*bend_sort) (void *handle, bend_sort_rr *rr);
233 int (*bend_search) (void *handle, bend_search_rr *rr);
234 int (*bend_present) (void *handle, bend_present_rr *rr);
235 int (*bend_esrequest) (void *handle, bend_esrequest_rr *rr);
236 int (*bend_delete)(void *handle, bend_delete_rr *rr);
239 typedef struct bend_initresult
241 int errcode; /* 0==OK */
242 char *errstring; /* system error string or NULL */
243 void *handle; /* private handle to the backend module */
246 YAZ_EXPORT bend_initresult *bend_init(bend_initrequest *r);
248 YAZ_EXPORT void bend_request_send (bend_association a, bend_request req,
251 YAZ_EXPORT bend_request bend_request_mk (bend_association a);
253 YAZ_EXPORT void bend_request_destroy (bend_request *req);
255 YAZ_EXPORT Z_ReferenceId *bend_request_getid (ODR odr, bend_request req);
256 YAZ_EXPORT int bend_backend_respond (bend_association a, bend_request req);
257 YAZ_EXPORT void bend_request_setdata(bend_request r, void *p);
258 YAZ_EXPORT void *bend_request_getdata(bend_request r);