More documentation. LICENSE and CCL.
[egate.git] / doc / egate.sgml
1 <!doctype linuxdoc system>
2
3 <!--
4   $Id: egate.sgml,v 1.3 1995/07/05 10:06:42 adam Exp $
5 -->
6
7 <article>
8 <title>Email/Z39.50 gateway guide
9 <author>Europagate, 1995
10 <date>$Revision: 1.3 $
11 <abstract>
12 This document describes a Email server that provides access to the
13 Z39.50 protocol.
14 </abstract>
15
16 <toc>
17
18 <sect>Introduction
19
20 <p>
21 This document describes how to compile, install and setup the
22 Email server (ES) software. It does not address the internal design of
23 the software.
24
25 <sect>Before you begin
26
27 <p>
28 An ANSI C compiler is required in order to compile the ES software.
29
30 The ES can use either CNIDR's zdist package or the YAZ package from
31 Index Data to interface the Z39.50 protocol. So you need to obtain
32 either of these first.
33
34 The Zdist package can be found in:
35
36 <url url="ftp://ftp.cnidr.org/pub/NIDR.tools/zdist/zdist102b1-1.tar.Z" >
37
38 The zdist doesn't support result-set references. Also, it has a few
39 bugs &mdash; see the file zdist.es.patch for details.
40
41 YAZ can be found in:
42
43 <url url="ftp://ftp.algonet.se/pub/index/yaz/">.
44
45 The ES also use GNU's regex package to parse regular expressions. 
46 The ES has been tested with regex-0.12. Some systems, such as Linux,
47 comes with the regex package preinstalled.
48
49 <sect>Compilation
50
51 <p>
52 Unpack <tt>egate.tar.gz</tt> and edit the top level <tt/Makefile/. Specify
53 where the GNU regex package is located and specify whether you use
54 YAZ or zdist. One some systems, you may have to set the <tt/NETLIB/ as
55 well.
56
57 You may wish to set <tt/CC/ and <tt/CFLAGS/ in your shell, since these
58 will affect the compilation &mdash; these are not set in the <tt/Makefile/.
59
60 Now, type <tt/make/. 
61
62 <sect>Installation
63
64 <p>
65 If the compilation was successful, you should install the software.
66 Edit the <tt/Makefile/ and set the LIBDIR to the installation
67 directory. Since, the ES is executed by the mail system, and not by a
68 user, this directory shouldn't be globally executable.
69
70 When satisfied, type <tt/make install/.
71
72 Three executables are installed in LIBDIR:
73 <descrip>
74 <tag/eti/ The email transport interface. This program receives
75 incoming mail, identifies the user, and delivers the mail request
76 to the monitor or kernel (depending on configuration).
77 <tag/monitor/ The monitor
78  is optional component. The main objective
79 of the monitor is to limit the number of simultanous running kernel
80 processes.
81 <tag/kernel/ The kernel process is the core of the ES. It parses
82 the user's requests and interfaces the Z39.50 protocols.
83 </descrip>
84
85 The <tt/sendmail/ or a similar program delivers the mail to the
86 <tt/eti/ program. The <tt/sendmail/ program usually runs as user
87 <tt/mail/ or some other special user name. We strongly suggest that
88 you create a special user and group for the ES software. In this case
89 you should use <tt/chmod/ to and set the 'set user ID on execution'
90 bits on the executable files and give that user read/write/execute
91 permissions in LIBDIR.
92
93 The mail system needs to know about the ES. Pick some name that serves
94 as the ES user and edit <tt/aliases/ used by your mail system (usually 
95 <tt>usr/lib/aliases</tt>). Now add the following line:
96
97 <tt>es:"|/usr/local/lib/es/eti </tt><em>options</em><tt>"</tt>
98
99 In this example the mail user name was <tt/es/ and the LIBDIR was
100 <tt>/usr/local/lib/es</tt>.
101
102 The ES system can operate with or without the monitor. When using
103 the monitor the number of simultanous running kernels can be
104 controlled. If the <tt>eti</tt> program is started with 
105 two dashes (<tt>--</tt>) it will operate without the monitor and
106 the options specified after the two dashes are transferred to the
107 kernel.
108
109 <sect1>With the monitor
110
111 <p>
112 The monitor must be running at all times in this mode. You should
113 start the monitor in one of your boot scripts (rc). For example this
114 might be put in a boot script:
115
116 <tscreen><verb>
117 (cd /usr/local/lib/es; ./monitor -d -l mon.log -- -d -l kernel.log &)
118 </verb></tscreen>
119
120 Here the monitor is started with the options <tt>-d -l mon.log</tt>
121 and the options after the two dashes are transferred to the 
122 kernel. In this mode, the eti should contact the monitor (and not
123 the kernel), so the following might be put in the aliases file:
124
125 <tscreen><verb>
126 es:"|/usr/local/lib/es/eti -c /usr/local/lib/es"
127 </verb></tscreen>
128
129 The eti sets current directory to the path specified by option <tt>-c</tt>.
130
131 <sect1>Without the monitor
132
133 <p>
134 In this mode you should never start the monitor. 
135 The eti will contact the kernel directly. The following line could
136 be put in your aliases file:
137
138 <tscreen><verb>
139 es:"|/usr/local/lib/es/eti -c /usr/local/lib/es -- -d -l kernel.log"
140 </verb></tscreen>
141
142 <sect1>eti
143
144 <p>
145 The eti program accepts the following options:
146 <descrip>
147 <tag><tt>-l </tt>log</tag> The log file. If absent stderr is used.
148 <tag><tt>-d</tt></tag> Turns on debugging.
149 <tag><tt>-c </tt>dir</tag> Sets current directory to dir.
150 <tag><tt>-H</tt></tag> Help message.
151 <tag><tt>--</tt></tag> Indicates that the eti program should contact the
152 kernel (and not the monitor. All options after this one are transferred
153 to the kernel
154 </descrip>
155
156 <sect1>monitor
157
158 <p>
159 The monitor program accepts the following command line options:
160 <descrip>
161 <tag><tt>-l </tt>log</tag> The log file. If absent stderr is used.
162 <tag><tt>-d</tt></tag> Turns on debugging.
163 <tag><tt>-H</tt></tag> Help message.
164 <tag><tt>--</tt></tag> Precedes options that are transferred to the kernel
165 </descrip>
166
167 The monitor normally reads the resource <tt>default.res</tt> in
168 current directory. You can change this behaviour by specifying an
169 alternate file on the command line.
170
171 <sect1>kernel
172
173 <p>
174 List of options observed by the kernel:
175 <descrip>
176 <tag><tt>-d</tt></tag> Turns on debugging.
177 <tag><tt>-t </tt>target</tag> Opens connection to target (for testing only).
178 <tag><tt>-g </tt>lang</tag> Set language name.
179 <tag><tt>-o </tt>res</tag> Overriding resource file name. These
180 resources override both <tt>default.res</tt> and all user resources.
181 <tag><tt>-h </tt>host</tag> Override host name (for testing only).
182 <tag><tt>-p </tt>port</tag> Override port no (for testing only).
183 <tag><tt>-l </tt>log</tag> Specify log file.
184 <tag><tt>-H</tt></tag> Help message.
185 </descrip>
186
187 The kernel normally reads the resource <tt>default.res</tt> in
188 current directory. You can change this behaviour by specifying an
189 alternate file on the command line.
190
191 <sect>Managing the system
192
193 <sect1>Summary of files
194 <p>
195
196 To maintain the ES you need to know the files it uses. These are:
197 <descrip>
198 <tag>*.res</tag> Resource files with several settings that control
199  how the system operates, such as definition of targets, messages, etc.
200 <tag>*.bib</tag> Bib-1 attribute mapping files. These files describe
201  the mapping between CCL and the RPN query.
202 <tag>user.db</tag> Database of users. Only the eti process accesses
203  this file.
204 <tag>user.*.r</tag> Resource file for a user &mdash; accessed by the kernel
205  &mdash; only created when the user uses the <tt>def</tt> command.
206 <tag>user.*.p</tag> Persistency file for a user &mdash; accessed by
207  the kernel
208  process. 
209 </descrip>
210
211 The ES system is mostly managed by resource files. The following
212 are example resource files that comes with the ES:
213 <descrip>
214 <tag><tt>default.res</tt></tag> General resource with reasonable defaults. 
215  This file is read by the monitor and the kernel.
216 <tag><tt>loc.res</tt></tag> Resource file for Library of Congress test
217  server.
218 <tag><tt>drewdb.res</tt></tag> Resource file for Data Research's test
219  server.
220 <tag><tt>lang.uk.res</tt></tag> Resource file for english conversation.
221 <tag><tt>lang.dk.res</tt></tag> Resource file for danish conversation.
222 </descrip>
223
224 <sect1>Resources
225
226 <p>
227 Most general resources should be set in the file <tt>default.res</tt>. 
228 Some of the resources may be changed (overridden) by the user, while 
229 others may be overridden by individual target defintions. 
230 The complete scenario is depicted below:
231 <tscreen><verb>
232        +-------------+
233        | default.res |
234        +-------------+
235               |          +--------------+
236               |<---------| "target.res" | 
237               |          +--------------+
238               |
239               |          +--------------+
240               |<---------| user.x.res   |
241               |          +--------------+
242               |
243               |          +--------------+
244               |<---------| "lang.res"   |
245               |          +--------------+
246               |
247               |          +--------------+
248               |<---------| "override"   |
249               |          +--------------+
250             result
251 </verb></tscreen>
252
253 The following describes the general resources:
254 <descrip>
255 <tag>gw.reply.mta</tag> Name of MTA program &mdash; default
256  <tt>/usr/lib/sendmail</tt>.
257 <tag>gw.reply.tmp.prefix</tag> Prefix of temporary files used by the ES.
258 <tag>gw.reply.tmp.dir</tag> Name of directory with temporary files.
259 <tag>gw.marc.log</tag> If this resource is specified, retrieved MARC
260  records will be appended to this file.
261 <tag>gw.timeout</tag> Idle time before the kernel exits. When the
262  kernel exits, the Z39.50 persistency layer will reconnect when
263  necessary.
264 <tag>gw.resultset</tag> If this setting is 1, the Z39.50 client will
265  use named result sets. If 0, the Z39.50 system will always use 
266  <tt/Default/ as result-set name.
267 <tag>gw.persist</tag> If this setting 1, the persistency is enabled;
268  disabled otherwise.
269 <tag>gw.max.process</tag> This settings is the maximum number of
270  simultaneous kernel processes &mdash; only used by the monitor.
271 <tag>gw.ignore.which</tag> Some targets doesn't indicate whether
272  a record is a diagnostic messaage or a database record. If this
273  setting is 1, the ES will always try to interpret the record as a
274  database record in ISO2709 format. If 0, the ES will use the
275  record type.
276 <tag>gw.default.show</tag> Default number of records to retrieve and display
277  when using the show command. This setting may be changed by the user
278  with the <tt>def defaultshow</tt> command.
279 <tag>gw.max.show</tag> This setting specifies the maximum number of
280  records the user may retrieve in one show command &mdash; default 100.
281 <tag>gw.autoshow</tag> Number of records to retrieve in a find
282  command &mdash; default 0. This setting may be changed by the user by
283  the <tt>def autoshow</tt> command.
284 <tag>gw.display.format</tag> Default display format. This setting may
285  be changed by the user by the <tt>def f</tt> command.
286 <tag>gw.language</tag> Current language. This setting may be
287 changed by the user with the <tt>def lang</tt> command. When the 
288  langauge is set to something, say x, then the resource gw.lang.x 
289  should hold a name of a resource file read by the kernel.
290 <tag>gw.lang.<em/x/</tag> Specifies name of resource file for 
291  language <em/x/.
292 <tag>gw.target.<em/name/ </tag> Name of resource file of target
293  <em/name/.
294 <tag>gw.portno</tag> Z39.50 target port number &mdash; default 210.
295 <tag>gw.hostname</tag> Z39.50 target host name.
296 <tag>gw.bibset</tag> Name of file with Bib-1 attribute mapping.
297 <tag>gw.databases</tag> Available databases on target.
298 <tag>gw.description</tag> Description of a target. This message
299  is returned to the user when the connection is established with the
300  target.
301 <tag>gw.account</tag> Z39.50 Authentication string &mdash; default
302  empty (i.e. none).
303 </descrip>
304
305 <sect1>Messages
306
307 <p>
308 There are several resource settings that deal with language 
309 dependencies. These fall into the following categories that
310 depend on the resource name prefixes:
311 <descrip>
312 <tag>gw.msg</tag> Miscellaneous messages.
313 <tag>gw.err</tag> Error messages.
314 <tag>gw.bib1.diag.<em/no/</tag> Diagnostic error message indicated by
315  <em/no/.
316 <tag>gw.help</tag> Help/description of various commands.
317 <tag>ccl.command</tag> CCL command names.
318 <tag>ccl.token</tag> CCL tokens names.
319 </descrip>
320
321 Refer to the sample files, <tt>default.res</tt>, <tt>lang.uk.res</tt>
322 and <tt>lang.dk.res</tt> for all available settings.
323
324 <sect1>Target definitions
325
326 <p>
327 To add a target definition called <em/mytarget/ you need to make a resource 
328 entry in <tt>default.res</tt> called <tt>gw.target.</tt><em>mytarget</em>.
329 The value of this resource is the name of a resource file &mdash; for 
330 example <em>mytarget</em><tt>.res</tt>. The resource file should at least
331 define the resources: <tt/gw.hostname/, <tt/gw.databases/ and 
332 <tt/gw.description/. You might also consider specifying
333 <tt/gw.account/, <tt/gw.bibset/, <tt/gw.resultset/ and <tt/gw.portno/
334 in the target resource file. The user only needs to use the command
335 <tt>target </tt><em>mytarget</em> to use the target. Also, since we
336 already specified database names, the user doesn't need to use the
337 <tt/base/ command.
338
339 <sect1>CCL to RPN mapping
340
341 <p>
342 The mapping between CCL-queries and RPN are stored in files &mdash;
343 normally with the suffix <tt>.bib</tt>. We will refer these
344 files as bibset-files. You might consult the file <tt/default.bib/
345 to see an example of such file.
346
347 The mapping is necessary because targets usually only support a little
348 subset of the Bib-1 attribute set and because the CCL qualifiers
349 (field names) are not standardized. A bibset-file is specified
350 by the <tt/gw.bibset/ resource.
351
352 Column zero of a bib-file line either hold a hash character (<tt/#/)
353 indicating a comment in which case the rest of the line is
354 ignored; or a CCL qualifier.
355
356 The name of the CCL qualifier is up to you. However, the special
357 qualifier name <tt/term/ applies to the case where no qualifier
358 is specified in CCL. The CCL qualifier is
359 followed by one or more mapping specifications. A mapping
360 specification takes the form:
361
362 <em/type/<tt/=/<em/value/<tt/,/<em/value/...
363
364 The type is simply one of the six Bib-1 attribute query types:
365 <descrip>
366 <tag/u/ Use attribute. Value is an integer.
367 <tag/t/ Truncation attribute. Value is an integer; or the
368  value is a combination of:
369   <descrip>
370   <tag/l/ This character indicates that the CCL parser should allow
371   left truncation (2) if indicated by a <tt/?/ on the left side
372   of a term.
373   <tag/r/ This character indicates that the CCL parser should allow
374   right truncation (1) if indicated by a <tt/?/ on the right side
375   of a term.
376   <tag/b/ This character indicates that the CCL parser should allow
377   both left and right (3) truncation indicated by a <tt/?/ on both
378   left and right side of a term.
379   <tag/n/ This character indicates that the CCL parser should announce
380   no truncation (100) if no truncation was indicated.
381   </descrip>
382 <tag/p/ Position attribute. Valus is an integer.
383 <tag/s/ Structure attribute. Value is an integer; or the
384  value is <tt/pw/ in which case the CCL parser announces word (2) or
385  phrase (1) depending on the number of adjacent terms.
386 <tag/r/ Relation attribute. Value is an integer; or the value is
387  <tt/o/ in which case, the CCL parser will select <em/less than/, 
388  <em/less than or equal/, ... <em/greater than/ &mdash; depending on
389  the relation specified in CCL.
390 <tag/p/ Position attribute. Value is an integer.
391 </descrip>
392
393 Consider these bibset-lines:
394 <tscreen><verb>
395 term t=l,r,b s=pw
396 au= u=1 t=l,r,b s=pw
397 date u=30 r=o
398 </verb></tscreen>
399 The first line describes the mapping in when no qualifiers are
400 present, as in:
401 <tscreen><verb>
402 find foo bar?
403 </verb></tscreen>
404 In this case the right truncation is enabled and the structure is
405 <em/phrase/.
406
407 The second line is used in this search:
408 <tscreen><verb>
409 find au=andersen
410 </verb></tscreen>
411 where the use attribute is <em/author/ and the structure is <em/word/.
412
413 The third line is used in:
414 <tscreen><verb>
415 find date>1990
416 </verb></tscreen>
417 where the use attribute is <em/date/ and the relation is <em/greater than/.
418
419 <sect>LICENSE
420
421 <p>
422  Copyright &copy; 1995, the EUROPAGATE consortium (see below).
423
424  The EUROPAGATE consortium members are:
425
426 <itemize>
427 <item>University College Dublin
428 <item>Danmarks Teknologiske Videnscenter
429 <item>An Chomhairle Leabharlanna
430 <item>Consejo Superior de Investigaciones Cientificas
431 </itemize>
432
433  Permission to use, copy, modify, distribute, and sell this software and
434  its documentation, in whole or in part, for any purpose, is hereby granted,
435  provided that:
436
437  1. This copyright and permission notice appear in all copies of the
438  software and its documentation. Notices of copyright or attribution
439  which appear at the beginning of any file must remain unchanged.
440
441  2. The names of EUROPAGATE or the project partners may not be used to
442  endorse or promote products derived from this software without specific
443  prior written permission.
444
445  3. Users of this software (implementors and gateway operators) agree to
446  inform the EUROPAGATE consortium of their use of the software. This
447  information will be used to evaluate the EUROPAGATE project and the
448  software, and to plan further developments. The consortium may use
449  the information in later publications.
450  
451  4. Users of this software agree to make their best efforts, when
452  documenting their use of the software, to acknowledge the EUROPAGATE
453  consortium, and the role played by the software in their work.
454
455  THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
456  EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
457  WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
458  IN NO EVENT SHALL THE EUROPAGATE CONSORTIUM OR ITS MEMBERS BE LIABLE
459  FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF
460  ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
461  OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND
462  ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
463  USE OR PERFORMANCE OF THIS SOFTWARE.
464
465 </article>