X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=include%2Fbackend.h;h=dafafad9399321c696f275ad2b8f6f06c7b719ed;hb=9a2b41f58cf220c9583b654ff77776a18e958b44;hp=50978bc6cfadb561b8efa1f1d9bdfd5e54718baa;hpb=f16b3e60529eece2026d584d1f420555690488a6;p=yaz-moved-to-github.git diff --git a/include/backend.h b/include/backend.h index 50978bc..dafafad 100644 --- a/include/backend.h +++ b/include/backend.h @@ -1,11 +1,45 @@ +/* + * Copyright (c) 1995, Index Data. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation, in whole or in part, for any purpose, is hereby granted, + * provided that: + * + * 1. This copyright and permission notice appear in all copies of the + * software and its documentation. Notices of copyright or attribution + * which appear at the beginning of any file must remain unchanged. + * + * 2. The name of Index Data or the individual authors may not be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR + * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + * + */ + #ifndef BACKEND_H #define BACKEND_H +#include #include +#include + +#ifdef __cplusplus +extern "C" { +#endif typedef struct bend_initrequest { char *configname; + Z_IdAuthentication *auth; } bend_initrequest; typedef struct bend_initresult @@ -15,6 +49,8 @@ typedef struct bend_initresult void *handle; /* private handle to the backend module */ } bend_initresult; +YAZ_EXPORT bend_initresult MDF *bend_init(bend_initrequest *r); + typedef struct bend_searchrequest { char *setname; /* name to give to this set */ @@ -24,10 +60,46 @@ typedef struct bend_searchrequest Z_Query *query; /* query structure */ } bend_searchrequest; +typedef struct bend_searchresult +{ + int hits; /* number of hits */ + int errcode; /* 0==OK */ + char *errstring; /* system error string or NULL */ +} bend_searchresult; + +YAZ_EXPORT bend_searchresult *bend_search(void *handle, bend_searchrequest *r, + int *fd); +YAZ_EXPORT bend_searchresult *bend_searchresponse(void *handle); + +typedef struct bend_fetchrequest +{ + char *setname; /* set name */ + int number; /* record number */ + oid_value format; /* One of the CLASS_RECSYN members */ + Z_RecordComposition *comp; /* Formatting instructions */ + ODR stream; /* encoding stream - memory source if required */ +} bend_fetchrequest; + +typedef struct bend_fetchresult +{ + char *basename; /* name of database that provided record */ + int len; /* length of record or -1 if structured */ + char *record; /* record */ + int last_in_set; /* is it? */ + oid_value format; /* format */ + int errcode; /* 0==success */ + char *errstring; /* system error string or NULL */ +} bend_fetchresult; + +YAZ_EXPORT bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *r, + int *fd); +YAZ_EXPORT bend_fetchresult *bend_fetchresponse(void *handle); + typedef struct bend_scanrequest { int num_bases; /* number of elements in databaselist */ char **basenames; /* databases to search */ + oid_value attributeset; Z_AttributesPlusTerm *term; int term_position; /* desired index of term in result list */ int num_entries; /* number of entries requested */ @@ -51,28 +123,9 @@ typedef struct bend_scanresult char *errstring; } bend_scanresult; -typedef struct bend_searchresult -{ - int hits; /* number of hits */ - int errcode; /* 0==OK */ - char *errstring; /* system error string or NULL */ -} bend_searchresult; - -typedef struct bend_fetchrequest -{ - char *setname; /* set name */ - int number; /* record number */ -} bend_fetchrequest; - -typedef struct bend_fetchresult -{ - char *basename; /* name of database that provided record */ - int len; /* length of record */ - char *record; /* record */ - int last_in_set; /* is it? */ - int errcode; /* 0==success */ - char *errstring; /* system error string or NULL */ -} bend_fetchresult; +YAZ_EXPORT bend_scanresult *bend_scan(void *handle, bend_scanrequest *r, + int *fd); +YAZ_EXPORT bend_scanresult *bend_scanresponse(void *handle); typedef struct bend_deleterequest { @@ -85,20 +138,14 @@ typedef struct bend_deleteresult char *errstring; /* system error string or NULL */ } bend_deleteresult; -bend_initresult *bend_init(bend_initrequest *r); - -bend_searchresult *bend_search(void *handle, bend_searchrequest *r, int *fd); -bend_searchresult *bend_searchresponse(void *handle); +YAZ_EXPORT bend_deleteresult *bend_delete(void *handle, + bend_deleterequest *r, int *fd); +YAZ_EXPORT bend_deleteresult *bend_deleteresponse(void *handle); -bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *r, int *fd); -bend_fetchresult *bend_fetchresponse(void *handle); +YAZ_EXPORT void bend_close(void *handle); -bend_scanresult *bend_scan(void *handle, bend_scanrequest *r, int *fd); -bend_scanresult *bend_scanresponse(void *handle); - -bend_deleteresult *bend_delete(void *handle, bend_deleterequest *r, int *fd); -bend_deleteresult *bend_deleteresponse(void *handle); - -void bend_close(void *handle); +#ifdef __cplusplus +} +#endif #endif