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.14 2001/02/26 14:32:36 adam
49 * Updated for YAZ 1.7. HTML output tidy up. Added LOC target.
51 * Revision 1.13 1995/05/16 09:39:40 adam
54 * Revision 1.12 1995/04/20 15:25:25 quinn
57 * Revision 1.11 1995/04/19 12:55:41 quinn
60 * Revision 1.10 1995/04/17 11:27:24 quinn
63 * Revision 1.9 1995/02/23 08:32:12 adam
66 * Revision 1.7 1995/02/17 13:59:06 quinn
74 #define ZASS_DEBUG GW_LOG_DEBUGN(9)
75 #define ZASS_TYPE "zass"
77 #define ZASS_ID "EUROPAGATE/DTV/ID"
78 #define ZASS_NAME "EUROPAGATE E-mail/Z39.50 gateway"
79 #define ZASS_VERSION "development 0.2"
81 #define ZASS_MAXRECORDSIZE 40000
82 #define ZASS_PREFERREDMESSAGESIZE 40000
84 typedef struct zass *ZASS;
88 ZASS_PRES_SUCCESS, /* all records available */
89 ZASS_PRES_PARTIAL_1, /* subset only 'cause of access control */
90 ZASS_PRES_PARTIAL_2, /* subset 'cause of max msg size constraints*/
91 ZASS_PRES_PARTIAL_3, /* subset 'cause of resource control org */
92 ZASS_PRES_PARTIAL_4, /* subset 'cause of resource control trg */
93 ZASS_PRES_FAILURE /* check errcode */
96 typedef struct zass_searchent
99 int status; /* status - boolean - qualified by setstatus */
100 enum present_status setstatus; /* consult if status. Value according to Z proto */
102 /* These two fields provide info from a diagnostic rec returned with
104 int errcode; /* bib 1 assumed here. -1 if none provided */
105 char errstring[512]; /* Additional info from diagnostic rec, or "" */
108 typedef struct zass_record
116 } which; /* 0 = diagnostic, others according to z3950v3 */
117 char *record; /* marc or other */
119 int errcode; /* Only valid if which == 0 */
122 struct zass_record *next;
125 typedef struct zass_presentent
127 int num; /* # of recs returned */
128 int nextpos; /* next resultset position. 1==first record */
129 enum present_status presentstatus; /* status of set */
130 struct zass_record *records;
134 * open a connection to the target. If complete is NULL, the connection
135 * will be blocking, and complete will be ignored by the following
136 * primitives. If complete is not null, the connection will be non-blocking.
137 * if the connection cannot be established immediately, *complete will
138 * be set to zero, and the user should call openresult when select signals
139 * that I/O is possible. Returns NULL on a fatal error in the connection
142 ZASS zass_open(char *host, int port, int *complete, char *auth);
145 * second half of connection establishment in nonblocking mode.
147 * -1 with *complete == 0 : call again when select allows.
148 * -1 with *complete == 1 : fatal error. Abort connection.
151 int zass_openresult(ZASS a, int *complete);
154 * Return the file handle of the association (for select() & other fun.
156 int zass_fileno(ZASS a);
160 * NULL with *complete == 0 : call searchresult when select allows (nonbl. only)
161 * NULL with *complete == 1 : fatal error. Abort connection.
162 * non-null : operation complete.
164 const struct zass_searchent *zass_search(ZASS a, struct ccl_rpn_node *query,
165 char *resname, char *databases, int *complete);
169 * NULL with *complete == 0 : call again when select allows (nonbl. only)
170 * NULL with *complete == 1 : fatal error. Abort connection.
171 * non-null : operation complete.
173 const struct zass_searchent *zass_searchresult(ZASS a, int *complete);
177 * NULL with *complete == 0 : call presentresult when select ok (nonbl. only)
178 * NULL with *complete == 1 : fatal error. Abort connection.
179 * non-null : operation complete.
181 const struct zass_presentent *zass_present(ZASS a, char *resname, int start,
182 int num, int *complete);
186 * NULL with *complete == 0 : call again when select allows (nonbl. only)
187 * NULL with *complete == 1 : fatal error. Abort connection.
188 * non-null : operation complete.
190 const struct zass_presentent *zass_presentresult(ZASS a, int *complete);