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.18 1998-02-10 11:03:56 adam
28 * Added support for extended handlers in backend server interface.
30 * Revision 1.17 1998/01/29 13:15:35 adam
31 * Implemented sort for the backend interface.
33 * Revision 1.16 1997/09/17 12:10:31 adam
49 typedef struct request *bend_request;
50 typedef struct association *bend_association;
52 /* old search request input */
55 char *setname; /* name to give to this set */
56 int replace_set; /* replace set, if it already exists */
57 int num_bases; /* number of databases in list */
58 char **basenames; /* databases to search */
59 Z_Query *query; /* query structure */
60 ODR stream; /* encoding stream */
63 /* old search request output */
66 int hits; /* number of hits */
67 int errcode; /* 0==OK */
68 char *errstring; /* system error string or NULL */
71 /* extended search handler (rr = request response) */
73 char *setname; /* name to give to this set */
74 int replace_set; /* replace set, if it already exists */
75 int num_bases; /* number of databases in list */
76 char **basenames; /* databases to search */
77 Z_Query *query; /* query structure */
78 ODR stream; /* encode stream */
81 bend_association association;
83 int hits; /* number of hits */
84 int errcode; /* 0==OK */
85 char *errstring; /* system error string or NULL */
88 /* extended present handler. Does not replace bend_fetch. */
90 char *setname; /* set name */
92 int number; /* record number */
93 oid_value format; /* One of the CLASS_RECSYN members */
94 Z_RecordComposition *comp; /* Formatting instructions */
95 ODR stream; /* encoding stream - memory source if required */
97 bend_association association;
99 int hits; /* number of hits */
100 int errcode; /* 0==OK */
101 char *errstring; /* system error string or NULL */
104 YAZ_EXPORT bend_searchresult *bend_search(void *handle, bend_searchrequest *r,
106 YAZ_EXPORT int bend_searchresponse(void *handle, bend_search_rr *bsrr);
110 char *setname; /* set name */
111 int number; /* record number */
112 oid_value format; /* One of the CLASS_RECSYN members */
113 Z_RecordComposition *comp; /* Formatting instructions */
114 ODR stream; /* encoding stream - memory source if required */
119 char *basename; /* name of database that provided record */
120 int len; /* length of record or -1 if structured */
121 char *record; /* record */
122 int last_in_set; /* is it? */
123 oid_value format; /* format */
124 int errcode; /* 0==success */
125 char *errstring; /* system error string or NULL */
128 YAZ_EXPORT bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *r,
130 YAZ_EXPORT bend_fetchresult *bend_fetchresponse(void *handle);
134 int num_bases; /* number of elements in databaselist */
135 char **basenames; /* databases to search */
136 oid_value attributeset;
137 Z_AttributesPlusTerm *term;
138 int term_position; /* desired index of term in result list */
139 int num_entries; /* number of entries requested */
140 ODR stream; /* encoding stream - memory source if required */
149 BEND_SCAN_SUCCESS, /* ok */
150 BEND_SCAN_PARTIAL /* not all entries could be found */
153 typedef struct bend_scanresult
156 struct scan_entry *entries;
158 bend_scan_status status;
163 YAZ_EXPORT bend_scanresult *bend_scan(void *handle, bend_scanrequest *r,
165 YAZ_EXPORT bend_scanresult *bend_scanresponse(void *handle);
167 typedef struct bend_deleterequest
170 } bend_deleterequest;
172 typedef struct bend_deleteresult
174 int errcode; /* 0==success */
175 char *errstring; /* system error string or NULL */
178 YAZ_EXPORT bend_deleteresult *bend_delete(void *handle,
179 bend_deleterequest *r, int *fd);
180 YAZ_EXPORT bend_deleteresult *bend_deleteresponse(void *handle);
182 YAZ_EXPORT void bend_close(void *handle);
185 typedef struct bend_sort_rr
187 int num_input_setnames;
188 char **input_setnames;
189 char *output_setname;
190 Z_SortKeySpecList *sort_sequence;
198 typedef struct bend_initrequest
201 Z_IdAuthentication *auth;
202 ODR stream; /* encoding stream */
204 int (*bend_sort) (void *handle, bend_sort_rr *rr);
205 int (*bend_search) (void *handle, bend_search_rr *rr);
206 int (*bend_present) (void *handle, bend_present_rr *rr);
209 typedef struct bend_initresult
211 int errcode; /* 0==OK */
212 char *errstring; /* system error string or NULL */
213 void *handle; /* private handle to the backend module */
216 YAZ_EXPORT bend_initresult *bend_init(bend_initrequest *r);
218 YAZ_EXPORT void bend_request_send (bend_association a, bend_request req,
221 YAZ_EXPORT bend_request bend_request_mk (bend_association a);
223 YAZ_EXPORT void bend_request_destroy (bend_request *req);
225 YAZ_EXPORT Z_ReferenceId *bend_request_getid (ODR odr, bend_request req);
226 YAZ_EXPORT int bend_backend_respond (bend_association a, bend_request req);
227 YAZ_EXPORT void bend_request_setdata(bend_request r, void *p);
228 YAZ_EXPORT void *bend_request_getdata(bend_request r);