YAZ version 1.4.
[yaz-moved-to-github.git] / include / backend.h
index 78d670a..b4ffc12 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, Index Data.
+ * Copyright (c) 1995-1997, 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,
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
+ * $Log: backend.h,v $
+ * Revision 1.16  1997-09-17 12:10:31  adam
+ * YAZ version 1.4.
+ *
  */
 
 #ifndef BACKEND_H
 #define BACKEND_H
 
+#include <yconfig.h>
 #include <proto.h>
 #include <statserv.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct bend_initrequest
 {
     char *configname;
     Z_IdAuthentication *auth;
+    ODR stream;                /* encoding stream */
 } bend_initrequest;
 
 typedef struct bend_initresult
@@ -44,6 +54,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 */
@@ -51,35 +63,9 @@ typedef struct bend_searchrequest
     int num_bases;             /* number of databases in list */
     char **basenames;          /* databases to search */
     Z_Query *query;            /* query structure */
+    ODR stream;                /* encoding stream */
 } bend_searchrequest;
 
-typedef struct bend_scanrequest
-{
-    int num_bases;      /* number of elements in databaselist */
-    char **basenames;   /* databases to search */
-    Z_AttributesPlusTerm *term;
-    int term_position;  /* desired index of term in result list */
-    int num_entries;    /* number of entries requested */
-} bend_scanrequest;
-
-typedef struct bend_scanresult
-{
-    int num_entries;
-    struct scan_entry
-    {
-       char *term;
-       int occurrences;
-    } *entries;
-    int term_position;
-    enum
-    {
-       BEND_SCAN_SUCCESS,   /* ok */
-       BEND_SCAN_PARTIAL   /* not all entries could be found */
-    } status;
-    int errcode;
-    char *errstring;
-} bend_scanresult;
-
 typedef struct bend_searchresult
 {
     int hits;                  /* number of hits */
@@ -87,22 +73,69 @@ typedef struct bend_searchresult
     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 */
+    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 */
+    ODR stream;         /* encoding stream - memory source if required */
+} bend_scanrequest;
+
+struct scan_entry {
+    char *term;
+    int occurrences;
+};
+
+typedef enum {
+    BEND_SCAN_SUCCESS,   /* ok */
+    BEND_SCAN_PARTIAL   /* not all entries could be found */
+} bend_scan_status;
+
+typedef struct bend_scanresult
+{
+    int num_entries;
+    struct scan_entry *entries;
+    int term_position;
+    bend_scan_status status;
+    int errcode;
+    char *errstring;
+} bend_scanresult;
+
+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
 {
     char *setname;
@@ -114,20 +147,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);
-
-bend_fetchresult *bend_fetch(void *handle, bend_fetchrequest *r, int *fd);
-bend_fetchresult *bend_fetchresponse(void *handle);
+YAZ_EXPORT bend_deleteresult *bend_delete(void *handle,
+                                          bend_deleterequest *r, int *fd);
+YAZ_EXPORT bend_deleteresult *bend_deleteresponse(void *handle);
 
-bend_scanresult *bend_scan(void *handle, bend_scanrequest *r, int *fd);
-bend_scanresult *bend_scanresponse(void *handle);
+YAZ_EXPORT void bend_close(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