Removed Z3950_connection_host.
[yaz-moved-to-github.git] / include / yaz / zoom.h
index 67e389e..c7df143 100644 (file)
@@ -1,15 +1,21 @@
 /*
  * Public header for ZOOM C.
- * $Id: zoom.h,v 1.1 2001-10-23 21:00:19 adam Exp $
+ * $Id: zoom.h,v 1.6 2001-11-16 09:52:39 adam Exp $
  */
-/* the types we use */
 
 #include <yaz/yconfig.h>
 
-YAZ_BEGIN_CDECL
+#define ZOOM_EXPORT YAZ_EXPORT
+#define ZOOM_BEGIN_CDECL YAZ_BEGIN_CDECL
+#define ZOOM_END_CDECL YAZ_END_CDECL
+
+ZOOM_BEGIN_CDECL
+
+/* ----------------------------------------------------------- */
+/* the types we use */
 
 typedef struct Z3950_options_p *Z3950_options;
-typedef struct Z3950_search_p *Z3950_search;
+typedef struct Z3950_query_p *Z3950_query;
 typedef struct Z3950_connection_p *Z3950_connection;
 typedef        struct Z3950_resultset_p *Z3950_resultset;
 typedef struct Z3950_task_p *Z3950_task;
@@ -20,35 +26,45 @@ typedef struct Z3950_record_p *Z3950_record;
 
 /* create connection, connect to host, if portnum is 0, then port is
 read from host string (e.g. myhost:9821) */
+ZOOM_EXPORT
 Z3950_connection Z3950_connection_new (const char *host, int portnum);
 
 /* create connection, don't connect, apply options */
+ZOOM_EXPORT
 Z3950_connection Z3950_connection_create (Z3950_options options);
 
 /* connect given existing connection */
+ZOOM_EXPORT
 void Z3950_connection_connect(Z3950_connection c, const char *host,
                              int portnum);
 
-/* destroy connection (close connection also *) */
+/* destroy connection (close connection also) */
+ZOOM_EXPORT
 void Z3950_connection_destroy (Z3950_connection c);
 
-/* set option for connection */
-const char *Z3950_connection_option (Z3950_connection c, const char *key,
-                                    const char *val);
-/* return host for connection */
-const char *Z3950_connection_host (Z3950_connection c);
+/* get/set option for connection */
+ZOOM_EXPORT
+const char *Z3950_connection_option_get (Z3950_connection c, const char *key);
+
+ZOOM_EXPORT
+void Z3950_connection_option_set (Z3950_connection c, const char *key,
+                                  const char *val);
 
 /* return error code (0 == success, failure otherwise). cp
    holds error string on failure, addinfo holds addititional info (if any)
 */
+ZOOM_EXPORT
 int Z3950_connection_error (Z3950_connection c, const char **cp,
                            const char **addinfo);
 
 /* returns error code */
+ZOOM_EXPORT
 int Z3950_connection_errcode (Z3950_connection c);
 /* returns error message */
+ZOOM_EXPORT
 const char *Z3950_connection_errmsg (Z3950_connection c);
 /* returns additional info */
+ZOOM_EXPORT
 const char *Z3950_connection_addinfo (Z3950_connection c);
 
 #define Z3950_ERROR_NONE 0
@@ -65,68 +81,100 @@ const char *Z3950_connection_addinfo (Z3950_connection c);
 /* result sets */
 
 /* create result set given a search */
-Z3950_resultset Z3950_connection_search(Z3950_connection, Z3950_search q);
+ZOOM_EXPORT
+Z3950_resultset Z3950_connection_search(Z3950_connection, Z3950_query q);
 /* create result set given PQF query */
+ZOOM_EXPORT
 Z3950_resultset Z3950_connection_search_pqf(Z3950_connection c, const char *q);
 
 /* destroy result set */
+ZOOM_EXPORT
 void Z3950_resultset_destroy(Z3950_resultset r);
 
 /* result set option */
-const char *Z3950_resultset_option (Z3950_resultset r, const char *key,
-                                   const char *val);
-/* return size of result set (hit count, AKA resultCount) */
-int Z3950_resultset_size (Z3950_resultset r);
-
-/* return record at pos (starting from ), render given spec in type */
-void *Z3950_resultset_get (Z3950_resultset s, int pos, const char *type,
-                          int *len);
+ZOOM_EXPORT
+const char *Z3950_resultset_option_get (Z3950_resultset r, const char *key);
+ZOOM_EXPORT
+void Z3950_resultset_option_set (Z3950_resultset r, const char *key, const char *val);
+
+/* return size of result set (alias hit count AKA result count) */
+ZOOM_EXPORT
+size_t Z3950_resultset_size (Z3950_resultset r);
+
 /* retrieve records */
+ZOOM_EXPORT
 void Z3950_resultset_records (Z3950_resultset r, Z3950_record *recs,
-                             size_t *cnt);
+                             size_t start, size_t count);
 
 /* return record object at pos. Returns 0 if unavailable */
-Z3950_record Z3950_resultset_record (Z3950_resultset s, int pos);
+ZOOM_EXPORT
+Z3950_record Z3950_resultset_record (Z3950_resultset s, size_t pos);
 
 /* like Z3950_resultset_record - but never blocks .. */
-Z3950_record Z3950_resultset_record_immediate (Z3950_resultset s, int pos);
+ZOOM_EXPORT
+Z3950_record Z3950_resultset_record_immediate (Z3950_resultset s, size_t pos);
 
 /* ----------------------------------------------------------- */
 /* records */
 
-/* Get record information, in a form given by type */
-void *Z3950_record_get (Z3950_record rec, const char *type, int *len);
+/* get record information, in a form given by type */
+ZOOM_EXPORT
+void *Z3950_record_get (Z3950_record rec, const char *type, size_t *len);
 
-/* Destroy record */
+/* destroy record */
+ZOOM_EXPORT
 void Z3950_record_destroy (Z3950_record rec);
 
+/* return copy of record */
+ZOOM_EXPORT
+Z3950_record Z3950_record_dup (Z3950_record srec);
+
 /* ----------------------------------------------------------- */
 /* searches */
 
 /* create search object */
-Z3950_search Z3950_search_create(void);
+ZOOM_EXPORT
+Z3950_query Z3950_query_create(void);
 /* destroy it */
-void Z3950_search_destroy(Z3950_search s);
+ZOOM_EXPORT
+void Z3950_query_destroy(Z3950_query s);
 /* specify prefix query for search */
-int Z3950_search_prefix(Z3950_search s, const char *str);
+ZOOM_EXPORT
+int Z3950_query_prefix(Z3950_query s, const char *str);
 /* specify sort criteria for search */
-int Z3950_search_sortby(Z3950_search s, const char *criteria);
-
+ZOOM_EXPORT
+int Z3950_query_sortby(Z3950_query s, const char *criteria);
 
 /* ----------------------------------------------------------- */
 /* options */
 typedef const char *(*Z3950_options_callback)(void *handle, const char *name);
 
+ZOOM_EXPORT
 Z3950_options_callback Z3950_options_set_callback (Z3950_options opt,
                                                   Z3950_options_callback c,
                                                   void *handle);
+ZOOM_EXPORT
 Z3950_options Z3950_options_create (void);
+
+ZOOM_EXPORT
 Z3950_options Z3950_options_create_with_parent (Z3950_options parent);
+
+ZOOM_EXPORT
 const char *Z3950_options_get (Z3950_options opt, const char *name);
+
+ZOOM_EXPORT
 void Z3950_options_set (Z3950_options opt, const char *name, const char *v);
+
+ZOOM_EXPORT
 void Z3950_options_destroy (Z3950_options opt);
+
+ZOOM_EXPORT
 int Z3950_options_get_bool (Z3950_options opt, const char *name, int defa);
+
+ZOOM_EXPORT
 int Z3950_options_get_int (Z3950_options opt, const char *name, int defa);
+
+ZOOM_EXPORT
 void Z3950_options_addref (Z3950_options opt);
 
 /* ----------------------------------------------------------- */
@@ -136,6 +184,7 @@ void Z3950_options_addref (Z3950_options opt);
    events are pending. The positive integer specifies the
    connection for which the event occurred. There's no way to get
    the details yet, sigh. */
+ZOOM_EXPORT
 int Z3950_event (int no, Z3950_connection *cs);
 
-YAZ_END_CDECL
+ZOOM_END_CDECL