+/*
+ * Copyright (c) 1995, the EUROPAGATE consortium (see below).
+ *
+ * The EUROPAGATE consortium members are:
+ *
+ * University College Dublin
+ * Danmarks Teknologiske Videnscenter
+ * An Chomhairle Leabharlanna
+ * Consejo Superior de Investigaciones Cientificas
+ *
+ * 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 names of EUROPAGATE or the project partners may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * 3. Users of this software (implementors and gateway operators) agree to
+ * inform the EUROPAGATE consortium of their use of the software. This
+ * information will be used to evaluate the EUROPAGATE project and the
+ * software, and to plan further developments. The consortium may use
+ * the information in later publications.
+ *
+ * 4. Users of this software agree to make their best efforts, when
+ * documenting their use of the software, to acknowledge the EUROPAGATE
+ * consortium, and the role played by the software in their work.
+ *
+ * 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 THE EUROPAGATE CONSORTIUM OR ITS MEMBERS 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.
+ *
+ */
+/*
+ * Europagate, 1995
+ *
+ * $Log: zaccess.h,v $
+ * Revision 1.13 1995/05/16 09:39:40 adam
+ * LICENSE.
+ *
+ * Revision 1.12 1995/04/20 15:25:25 quinn
+ * Asynch. API
+ *
+ * Revision 1.11 1995/04/19 12:55:41 quinn
+ * Added auth
+ *
+ * Revision 1.10 1995/04/17 11:27:24 quinn
+ * Smallish
+ *
+ * Revision 1.9 1995/02/23 08:32:12 adam
+ * Changed header.
+ *
+ * Revision 1.7 1995/02/17 13:59:06 quinn
+ * Added header.
+ *
+ */
+
#ifndef ZACCESS_H
#define ZACCESS_H
#define ZASS_DEBUG GW_LOG_DEBUGN(9)
#define ZASS_TYPE "zass"
-#define ZASS_ID "EUROPAGATE/DTB/ID"
+#define ZASS_ID "EUROPAGATE/DTV/ID"
#define ZASS_NAME "EUROPAGATE E-mail/Z39.50 gateway"
-#define ZASS_VERSION "development 0.1"
+#define ZASS_VERSION "development 0.2"
-#define ZASS_MAXRECORDSIZE 10000
-#define ZASS_PREFERREDMESSAGESIZE 10000
+#define ZASS_MAXRECORDSIZE 40000
+#define ZASS_PREFERREDMESSAGESIZE 40000
typedef struct zass *ZASS;
+enum present_status
+{
+ ZASS_PRES_SUCCESS, /* all records available */
+ ZASS_PRES_PARTIAL_1, /* subset only 'cause of access control */
+ ZASS_PRES_PARTIAL_2, /* subset 'cause of max msg size constraints*/
+ ZASS_PRES_PARTIAL_3, /* subset 'cause of resource control org */
+ ZASS_PRES_PARTIAL_4, /* subset 'cause of resource control trg */
+ ZASS_PRES_FAILURE /* check errcode */
+};
+
typedef struct zass_searchent
{
int num; /* # hits */
- int status; /* status - boolean */
- int setstatus; /* consult if !status. Value according to Z proto */
+ int status; /* status - boolean - qualified by setstatus */
+ enum present_status setstatus; /* consult if status. Value according to Z proto */
- /* These two field provide info from a diagnostic rec returned with
+ /* These two fields provide info from a diagnostic rec returned with
response */
int errcode; /* bib 1 assumed here. -1 if none provided */
char errstring[512]; /* Additional info from diagnostic rec, or "" */
} zass_searchent;
-typedef struct zass_records
+typedef struct zass_record
{
- int which; /* 0 = diagnostic, others according to z3950v3 */
+ enum
+ {
+ ZASS_REC_UNKNOWN=-1,
+ ZASS_REC_DIAG=0,
+ ZASS_REC_USMARC=10
+ } which; /* 0 = diagnostic, others according to z3950v3 */
char *record; /* marc or other */
int errcode; /* Only valid if which == 0 */
- char addinfo[200];
-} zass_records;
+ char errstring[200];
+
+ struct zass_record *next;
+} zass_record;
typedef struct zass_presentent
{
int num; /* # of recs returned */
int nextpos; /* next resultset position. 1==first record */
- int presentstatus; /* status of set */
- int num_records;
- zass_records *records;
+ enum present_status presentstatus; /* status of set */
+ struct zass_record *records;
} zass_presentent;
-ZASS zass_open(char *host, int port);
+/*
+ * open a connection to the target. If complete is NULL, the connection
+ * will be blocking, and complete will be ignored by the following
+ * primitives. If complete is not null, the connection will be non-blocking.
+ * if the connection cannot be established immediately, *complete will
+ * be set to zero, and the user should call openresult when select signals
+ * that I/O is possible. Returns NULL on a fatal error in the connection
+ * establishment.
+ */
+ZASS zass_open(char *host, int port, int *complete, char *auth);
+
+/*
+ * second half of connection establishment in nonblocking mode.
+ * Returns:
+ * -1 with *complete == 0 : call again when select allows.
+ * -1 with *complete == 1 : fatal error. Abort connection.
+ * 0 : success.
+ */
+int zass_openresult(ZASS a, int *complete);
+
+/*
+ * Return the file handle of the association (for select() & other fun.
+ */
+int zass_fileno(ZASS a);
+
+/*
+ * Returns:
+ * NULL with *complete == 0 : call searchresult when select allows (nonbl. only)
+ * NULL with *complete == 1 : fatal error. Abort connection.
+ * non-null : operation complete.
+ */
const struct zass_searchent *zass_search(ZASS a, struct ccl_rpn_node *query,
- char *resname, char **databases, int num_bases);
-const struct zass_searchent *zass_present(ZASS a, char *resname, int start,
- int num);
+ char *resname, char *databases, int *complete);
+
+/*
+ * Returns:
+ * NULL with *complete == 0 : call again when select allows (nonbl. only)
+ * NULL with *complete == 1 : fatal error. Abort connection.
+ * non-null : operation complete.
+ */
+const struct zass_searchent *zass_searchresult(ZASS a, int *complete);
+
+/*
+ * Returns:
+ * NULL with *complete == 0 : call presentresult when select ok (nonbl. only)
+ * NULL with *complete == 1 : fatal error. Abort connection.
+ * non-null : operation complete.
+ */
+const struct zass_presentent *zass_present(ZASS a, char *resname, int start,
+ int num, int *complete);
+
+/*
+ * Returns:
+ * NULL with *complete == 0 : call again when select allows (nonbl. only)
+ * NULL with *complete == 1 : fatal error. Abort connection.
+ * non-null : operation complete.
+ */
+const struct zass_presentent *zass_presentresult(ZASS a, int *complete);
#endif