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.20 1998-05-27 16:57:06 adam
28 * Support for surrogate diagnostic records added for bend_fetch.
30 * Revision 1.19 1998/03/31 11:07:45 adam
31 * Furhter work on UNIverse resource report.
32 * Added Extended Services handling in frontend server.
34 * Revision 1.18 1998/02/10 11:03:56 adam
35 * Added support for extended handlers in backend server interface.
37 * Revision 1.17 1998/01/29 13:15:35 adam
38 * Implemented sort for the backend interface.
40 * Revision 1.16 1997/09/17 12:10:31 adam
56 typedef struct request *bend_request;
57 typedef struct association *bend_association;
59 /* old search request input */
62 char *setname; /* name to give to this set */
63 int replace_set; /* replace set, if it already exists */
64 int num_bases; /* number of databases in list */
65 char **basenames; /* databases to search */
66 Z_Query *query; /* query structure */
67 ODR stream; /* encoding stream */
70 /* old search request output */
73 int hits; /* number of hits */
74 int errcode; /* 0==OK */
75 char *errstring; /* system error string or NULL */
78 /* extended search handler (rr = request response) */
80 char *setname; /* name to give to this set */
81 int replace_set; /* replace set, if it already exists */
82 int num_bases; /* number of databases in list */
83 char **basenames; /* databases to search */
84 Z_Query *query; /* query structure */
85 ODR stream; /* encode stream */
88 bend_association association;
90 int hits; /* number of hits */
91 int errcode; /* 0==OK */
92 char *errstring; /* system error string or NULL */
95 /* extended present handler. Does not replace bend_fetch. */
97 char *setname; /* set name */
99 int number; /* record number */
100 oid_value format; /* One of the CLASS_RECSYN members */
101 Z_RecordComposition *comp; /* Formatting instructions */
102 ODR stream; /* encoding stream - memory source if required */
103 bend_request request;
104 bend_association association;
106 int hits; /* number of hits */
107 int errcode; /* 0==OK */
108 char *errstring; /* system error string or NULL */
111 YAZ_EXPORT bend_searchresult *bend_search(void *handle, bend_searchrequest *r,
113 YAZ_EXPORT int bend_searchresponse(void *handle, bend_search_rr *bsrr);
117 char *setname; /* set name */
118 int number; /* record number */
119 oid_value format; /* One of the CLASS_RECSYN members */
120 Z_RecordComposition *comp; /* Formatting instructions */
121 ODR stream; /* encoding stream - memory source if req */
122 int surrogate_flag; /* surrogate diagnostic flag (rw) */
127 char *basename; /* name of database that provided record */
128 int len; /* length of record or -1 if structured */
129 char *record; /* record */
130 int last_in_set; /* is it? */
131 oid_value format; /* format */
132 int errcode; /* 0==success */
133 char *errstring; /* system error string or NULL */
136 YAZ_EXPORT bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *r,
138 YAZ_EXPORT bend_fetchresult *bend_fetchresponse(void *handle);
142 int num_bases; /* number of elements in databaselist */
143 char **basenames; /* databases to search */
144 oid_value attributeset;
145 Z_AttributesPlusTerm *term;
146 int term_position; /* desired index of term in result list */
147 int num_entries; /* number of entries requested */
148 ODR stream; /* encoding stream - memory source if required */
157 BEND_SCAN_SUCCESS, /* ok */
158 BEND_SCAN_PARTIAL /* not all entries could be found */
161 typedef struct bend_scanresult
164 struct scan_entry *entries;
166 bend_scan_status status;
171 YAZ_EXPORT bend_scanresult *bend_scan(void *handle, bend_scanrequest *r,
173 YAZ_EXPORT bend_scanresult *bend_scanresponse(void *handle);
175 typedef struct bend_deleterequest
178 } bend_deleterequest;
180 typedef struct bend_deleteresult
182 int errcode; /* 0==success */
183 char *errstring; /* system error string or NULL */
186 YAZ_EXPORT bend_deleteresult *bend_delete(void *handle,
187 bend_deleterequest *r, int *fd);
188 YAZ_EXPORT bend_deleteresult *bend_deleteresponse(void *handle);
190 YAZ_EXPORT void bend_close(void *handle);
193 typedef struct bend_sort_rr
195 int num_input_setnames;
196 char **input_setnames;
197 char *output_setname;
198 Z_SortKeySpecList *sort_sequence;
206 /* extended services handler. Added in from DALI */
207 typedef struct bend_esrequest_rr
210 Z_ExtendedServicesRequest *esr;
211 ODR stream; /* encoding stream */
212 bend_request request;
213 bend_association association;
214 int errcode; /* 0==success */
215 char *errstring; /* system error string or NULL */
218 typedef struct bend_initrequest
221 Z_IdAuthentication *auth;
222 ODR stream; /* encoding stream */
224 int (*bend_sort) (void *handle, bend_sort_rr *rr);
225 int (*bend_search) (void *handle, bend_search_rr *rr);
226 int (*bend_present) (void *handle, bend_present_rr *rr);
227 int (*bend_esrequest) (void *handle, bend_esrequest_rr *rr);
230 typedef struct bend_initresult
232 int errcode; /* 0==OK */
233 char *errstring; /* system error string or NULL */
234 void *handle; /* private handle to the backend module */
237 YAZ_EXPORT bend_initresult *bend_init(bend_initrequest *r);
239 YAZ_EXPORT void bend_request_send (bend_association a, bend_request req,
242 YAZ_EXPORT bend_request bend_request_mk (bend_association a);
244 YAZ_EXPORT void bend_request_destroy (bend_request *req);
246 YAZ_EXPORT Z_ReferenceId *bend_request_getid (ODR odr, bend_request req);
247 YAZ_EXPORT int bend_backend_respond (bend_association a, bend_request req);
248 YAZ_EXPORT void bend_request_setdata(bend_request r, void *p);
249 YAZ_EXPORT void *bend_request_getdata(bend_request r);