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.22 1998-09-02 12:41:51 adam
28 * Added decode stream in bend search structures.
30 * Revision 1.21 1998/07/20 12:38:41 adam
31 * Implemented delete result set service to server API.
33 * Revision 1.20 1998/05/27 16:57:06 adam
34 * Support for surrogate diagnostic records added for bend_fetch.
36 * Revision 1.19 1998/03/31 11:07:45 adam
37 * Furhter work on UNIverse resource report.
38 * Added Extended Services handling in frontend server.
40 * Revision 1.18 1998/02/10 11:03:56 adam
41 * Added support for extended handlers in backend server interface.
43 * Revision 1.17 1998/01/29 13:15:35 adam
44 * Implemented sort for the backend interface.
46 * Revision 1.16 1997/09/17 12:10:31 adam
62 typedef struct request *bend_request;
63 typedef struct association *bend_association;
65 /* old search request input */
68 char *setname; /* name to give to this set */
69 int replace_set; /* replace set, if it already exists */
70 int num_bases; /* number of databases in list */
71 char **basenames; /* databases to search */
72 Z_Query *query; /* query structure */
73 ODR stream; /* encoding stream */
74 ODR decode; /* decoding stream */
77 /* old search request output */
80 int hits; /* number of hits */
81 int errcode; /* 0==OK */
82 char *errstring; /* system error string or NULL */
85 /* extended search handler (rr = request response) */
87 char *setname; /* name to give to this set */
88 int replace_set; /* replace set, if it already exists */
89 int num_bases; /* number of databases in list */
90 char **basenames; /* databases to search */
91 Z_Query *query; /* query structure */
92 ODR stream; /* encode stream */
93 ODR decode; /* decode stream */
96 bend_association association;
98 int hits; /* number of hits */
99 int errcode; /* 0==OK */
100 char *errstring; /* system error string or NULL */
103 /* extended present handler. Does not replace bend_fetch. */
105 char *setname; /* set name */
107 int number; /* record number */
108 oid_value format; /* One of the CLASS_RECSYN members */
109 Z_RecordComposition *comp; /* Formatting instructions */
110 ODR stream; /* encoding stream - memory source if required */
111 bend_request request;
112 bend_association association;
114 int hits; /* number of hits */
115 int errcode; /* 0==OK */
116 char *errstring; /* system error string or NULL */
119 YAZ_EXPORT bend_searchresult *bend_search(void *handle, bend_searchrequest *r,
121 YAZ_EXPORT int bend_searchresponse(void *handle, bend_search_rr *bsrr);
125 char *setname; /* set name */
126 int number; /* record number */
127 oid_value format; /* One of the CLASS_RECSYN members */
128 Z_RecordComposition *comp; /* Formatting instructions */
129 ODR stream; /* encoding stream - memory source if req */
130 int surrogate_flag; /* surrogate diagnostic flag (rw) */
135 char *basename; /* name of database that provided record */
136 int len; /* length of record or -1 if structured */
137 char *record; /* record */
138 int last_in_set; /* is it? */
139 oid_value format; /* format */
140 int errcode; /* 0==success */
141 char *errstring; /* system error string or NULL */
144 YAZ_EXPORT bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *r,
146 YAZ_EXPORT bend_fetchresult *bend_fetchresponse(void *handle);
150 int num_bases; /* number of elements in databaselist */
151 char **basenames; /* databases to search */
152 oid_value attributeset;
153 Z_AttributesPlusTerm *term;
154 int term_position; /* desired index of term in result list */
155 int num_entries; /* number of entries requested */
156 ODR stream; /* encoding stream - memory source if required */
165 BEND_SCAN_SUCCESS, /* ok */
166 BEND_SCAN_PARTIAL /* not all entries could be found */
169 typedef struct bend_scanresult
172 struct scan_entry *entries;
174 bend_scan_status status;
179 YAZ_EXPORT bend_scanresult *bend_scan(void *handle, bend_scanrequest *r,
181 YAZ_EXPORT bend_scanresult *bend_scanresponse(void *handle);
184 typedef struct bend_delete_rr {
193 YAZ_EXPORT void bend_close(void *handle);
196 typedef struct bend_sort_rr
198 int num_input_setnames;
199 char **input_setnames;
200 char *output_setname;
201 Z_SortKeySpecList *sort_sequence;
209 /* extended services handler. Added in from DALI */
210 typedef struct bend_esrequest_rr
213 Z_ExtendedServicesRequest *esr;
214 ODR stream; /* encoding stream */
215 bend_request request;
216 bend_association association;
217 int errcode; /* 0==success */
218 char *errstring; /* system error string or NULL */
221 typedef struct bend_initrequest
224 Z_IdAuthentication *auth;
225 ODR stream; /* encoding stream */
227 int (*bend_sort) (void *handle, bend_sort_rr *rr);
228 int (*bend_search) (void *handle, bend_search_rr *rr);
229 int (*bend_present) (void *handle, bend_present_rr *rr);
230 int (*bend_esrequest) (void *handle, bend_esrequest_rr *rr);
231 int (*bend_delete)(void *handle, bend_delete_rr *rr);
234 typedef struct bend_initresult
236 int errcode; /* 0==OK */
237 char *errstring; /* system error string or NULL */
238 void *handle; /* private handle to the backend module */
241 YAZ_EXPORT bend_initresult *bend_init(bend_initrequest *r);
243 YAZ_EXPORT void bend_request_send (bend_association a, bend_request req,
246 YAZ_EXPORT bend_request bend_request_mk (bend_association a);
248 YAZ_EXPORT void bend_request_destroy (bend_request *req);
250 YAZ_EXPORT Z_ReferenceId *bend_request_getid (ODR odr, bend_request req);
251 YAZ_EXPORT int bend_backend_respond (bend_association a, bend_request req);
252 YAZ_EXPORT void bend_request_setdata(bend_request r, void *p);
253 YAZ_EXPORT void *bend_request_getdata(bend_request r);