2 * Copyright (c) 1995, the EUROPAGATE consortium (see below).
4 * The EUROPAGATE consortium members are:
6 * University College Dublin
7 * Danmarks Teknologiske Videnscenter
8 * An Chomhairle Leabharlanna
9 * Consejo Superior de Investigaciones Cientificas
11 * Permission to use, copy, modify, distribute, and sell this software and
12 * its documentation, in whole or in part, for any purpose, is hereby granted,
15 * 1. This copyright and permission notice appear in all copies of the
16 * software and its documentation. Notices of copyright or attribution
17 * which appear at the beginning of any file must remain unchanged.
19 * 2. The names of EUROPAGATE or the project partners may not be used to
20 * endorse or promote products derived from this software without specific
21 * prior written permission.
23 * 3. Users of this software (implementors and gateway operators) agree to
24 * inform the EUROPAGATE consortium of their use of the software. This
25 * information will be used to evaluate the EUROPAGATE project and the
26 * software, and to plan further developments. The consortium may use
27 * the information in later publications.
29 * 4. Users of this software agree to make their best efforts, when
30 * documenting their use of the software, to acknowledge the EUROPAGATE
31 * consortium, and the role played by the software in their work.
33 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
34 * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
35 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
36 * IN NO EVENT SHALL THE EUROPAGATE CONSORTIUM OR ITS MEMBERS BE LIABLE
37 * FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF
38 * ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
39 * OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND
40 * ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
41 * USE OR PERFORMANCE OF THIS SOFTWARE.
48 * Revision 1.13 1995/05/16 09:39:40 adam
51 * Revision 1.12 1995/04/20 15:25:25 quinn
54 * Revision 1.11 1995/04/19 12:55:41 quinn
57 * Revision 1.10 1995/04/17 11:27:24 quinn
60 * Revision 1.9 1995/02/23 08:32:12 adam
63 * Revision 1.7 1995/02/17 13:59:06 quinn
71 #define ZASS_DEBUG GW_LOG_DEBUGN(9)
72 #define ZASS_TYPE "zass"
74 #define ZASS_ID "EUROPAGATE/DTV/ID"
75 #define ZASS_NAME "EUROPAGATE E-mail/Z39.50 gateway"
76 #define ZASS_VERSION "development 0.2"
78 #define ZASS_MAXRECORDSIZE 40000
79 #define ZASS_PREFERREDMESSAGESIZE 40000
81 typedef struct zass *ZASS;
85 ZASS_PRES_SUCCESS, /* all records available */
86 ZASS_PRES_PARTIAL_1, /* subset only 'cause of access control */
87 ZASS_PRES_PARTIAL_2, /* subset 'cause of max msg size constraints*/
88 ZASS_PRES_PARTIAL_3, /* subset 'cause of resource control org */
89 ZASS_PRES_PARTIAL_4, /* subset 'cause of resource control trg */
90 ZASS_PRES_FAILURE /* check errcode */
93 typedef struct zass_searchent
96 int status; /* status - boolean - qualified by setstatus */
97 enum present_status setstatus; /* consult if status. Value according to Z proto */
99 /* These two fields provide info from a diagnostic rec returned with
101 int errcode; /* bib 1 assumed here. -1 if none provided */
102 char errstring[512]; /* Additional info from diagnostic rec, or "" */
105 typedef struct zass_record
112 } which; /* 0 = diagnostic, others according to z3950v3 */
113 char *record; /* marc or other */
115 int errcode; /* Only valid if which == 0 */
118 struct zass_record *next;
121 typedef struct zass_presentent
123 int num; /* # of recs returned */
124 int nextpos; /* next resultset position. 1==first record */
125 enum present_status presentstatus; /* status of set */
126 struct zass_record *records;
130 * open a connection to the target. If complete is NULL, the connection
131 * will be blocking, and complete will be ignored by the following
132 * primitives. If complete is not null, the connection will be non-blocking.
133 * if the connection cannot be established immediately, *complete will
134 * be set to zero, and the user should call openresult when select signals
135 * that I/O is possible. Returns NULL on a fatal error in the connection
138 ZASS zass_open(char *host, int port, int *complete, char *auth);
141 * second half of connection establishment in nonblocking mode.
143 * -1 with *complete == 0 : call again when select allows.
144 * -1 with *complete == 1 : fatal error. Abort connection.
147 int zass_openresult(ZASS a, int *complete);
150 * Return the file handle of the association (for select() & other fun.
152 int zass_fileno(ZASS a);
156 * NULL with *complete == 0 : call searchresult when select allows (nonbl. only)
157 * NULL with *complete == 1 : fatal error. Abort connection.
158 * non-null : operation complete.
160 const struct zass_searchent *zass_search(ZASS a, struct ccl_rpn_node *query,
161 char *resname, char *databases, int *complete);
165 * NULL with *complete == 0 : call again when select allows (nonbl. only)
166 * NULL with *complete == 1 : fatal error. Abort connection.
167 * non-null : operation complete.
169 const struct zass_searchent *zass_searchresult(ZASS a, int *complete);
173 * NULL with *complete == 0 : call presentresult when select ok (nonbl. only)
174 * NULL with *complete == 1 : fatal error. Abort connection.
175 * non-null : operation complete.
177 const struct zass_presentent *zass_present(ZASS a, char *resname, int start,
178 int num, int *complete);
182 * NULL with *complete == 0 : call again when select allows (nonbl. only)
183 * NULL with *complete == 1 : fatal error. Abort connection.
184 * non-null : operation complete.
186 const struct zass_presentent *zass_presentresult(ZASS a, int *complete);