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.19 1998-03-31 11:07:45 adam
28 * Furhter work on UNIverse resource report.
29 * Added Extended Services handling in frontend server.
31 * Revision 1.18 1998/02/10 11:03:56 adam
32 * Added support for extended handlers in backend server interface.
34 * Revision 1.17 1998/01/29 13:15:35 adam
35 * Implemented sort for the backend interface.
37 * Revision 1.16 1997/09/17 12:10:31 adam
53 typedef struct request *bend_request;
54 typedef struct association *bend_association;
56 /* old search request input */
59 char *setname; /* name to give to this set */
60 int replace_set; /* replace set, if it already exists */
61 int num_bases; /* number of databases in list */
62 char **basenames; /* databases to search */
63 Z_Query *query; /* query structure */
64 ODR stream; /* encoding stream */
67 /* old search request output */
70 int hits; /* number of hits */
71 int errcode; /* 0==OK */
72 char *errstring; /* system error string or NULL */
75 /* extended search handler (rr = request response) */
77 char *setname; /* name to give to this set */
78 int replace_set; /* replace set, if it already exists */
79 int num_bases; /* number of databases in list */
80 char **basenames; /* databases to search */
81 Z_Query *query; /* query structure */
82 ODR stream; /* encode stream */
85 bend_association association;
87 int hits; /* number of hits */
88 int errcode; /* 0==OK */
89 char *errstring; /* system error string or NULL */
92 /* extended present handler. Does not replace bend_fetch. */
94 char *setname; /* set name */
96 int number; /* record number */
97 oid_value format; /* One of the CLASS_RECSYN members */
98 Z_RecordComposition *comp; /* Formatting instructions */
99 ODR stream; /* encoding stream - memory source if required */
100 bend_request request;
101 bend_association association;
103 int hits; /* number of hits */
104 int errcode; /* 0==OK */
105 char *errstring; /* system error string or NULL */
108 YAZ_EXPORT bend_searchresult *bend_search(void *handle, bend_searchrequest *r,
110 YAZ_EXPORT int bend_searchresponse(void *handle, bend_search_rr *bsrr);
114 char *setname; /* set name */
115 int number; /* record number */
116 oid_value format; /* One of the CLASS_RECSYN members */
117 Z_RecordComposition *comp; /* Formatting instructions */
118 ODR stream; /* encoding stream - memory source if required */
123 char *basename; /* name of database that provided record */
124 int len; /* length of record or -1 if structured */
125 char *record; /* record */
126 int last_in_set; /* is it? */
127 oid_value format; /* format */
128 int errcode; /* 0==success */
129 char *errstring; /* system error string or NULL */
132 YAZ_EXPORT bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *r,
134 YAZ_EXPORT bend_fetchresult *bend_fetchresponse(void *handle);
138 int num_bases; /* number of elements in databaselist */
139 char **basenames; /* databases to search */
140 oid_value attributeset;
141 Z_AttributesPlusTerm *term;
142 int term_position; /* desired index of term in result list */
143 int num_entries; /* number of entries requested */
144 ODR stream; /* encoding stream - memory source if required */
153 BEND_SCAN_SUCCESS, /* ok */
154 BEND_SCAN_PARTIAL /* not all entries could be found */
157 typedef struct bend_scanresult
160 struct scan_entry *entries;
162 bend_scan_status status;
167 YAZ_EXPORT bend_scanresult *bend_scan(void *handle, bend_scanrequest *r,
169 YAZ_EXPORT bend_scanresult *bend_scanresponse(void *handle);
171 typedef struct bend_deleterequest
174 } bend_deleterequest;
176 typedef struct bend_deleteresult
178 int errcode; /* 0==success */
179 char *errstring; /* system error string or NULL */
182 YAZ_EXPORT bend_deleteresult *bend_delete(void *handle,
183 bend_deleterequest *r, int *fd);
184 YAZ_EXPORT bend_deleteresult *bend_deleteresponse(void *handle);
186 YAZ_EXPORT void bend_close(void *handle);
189 typedef struct bend_sort_rr
191 int num_input_setnames;
192 char **input_setnames;
193 char *output_setname;
194 Z_SortKeySpecList *sort_sequence;
202 /* extended services handler. Added in from DALI */
203 typedef struct bend_esrequest_rr
206 Z_ExtendedServicesRequest *esr;
207 ODR stream; /* encoding stream */
208 bend_request request;
209 bend_association association;
210 int errcode; /* 0==success */
211 char *errstring; /* system error string or NULL */
214 typedef struct bend_initrequest
217 Z_IdAuthentication *auth;
218 ODR stream; /* encoding stream */
220 int (*bend_sort) (void *handle, bend_sort_rr *rr);
221 int (*bend_search) (void *handle, bend_search_rr *rr);
222 int (*bend_present) (void *handle, bend_present_rr *rr);
223 int (*bend_esrequest) (void *handle, bend_esrequest_rr *rr);
226 typedef struct bend_initresult
228 int errcode; /* 0==OK */
229 char *errstring; /* system error string or NULL */
230 void *handle; /* private handle to the backend module */
233 YAZ_EXPORT bend_initresult *bend_init(bend_initrequest *r);
235 YAZ_EXPORT void bend_request_send (bend_association a, bend_request req,
238 YAZ_EXPORT bend_request bend_request_mk (bend_association a);
240 YAZ_EXPORT void bend_request_destroy (bend_request *req);
242 YAZ_EXPORT Z_ReferenceId *bend_request_getid (ODR odr, bend_request req);
243 YAZ_EXPORT int bend_backend_respond (bend_association a, bend_request req);
244 YAZ_EXPORT void bend_request_setdata(bend_request r, void *p);
245 YAZ_EXPORT void *bend_request_getdata(bend_request r);