Initial commit
[yaz4j-moved-to-github.git] / dependencies / yaz-2.1.28 / doc / yaz-ztest.8
1 .\"     Title: yaz\-ztest
2 .\"    Author: 
3 .\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/>
4 .\"      Date: 09/04/2006
5 .\"    Manual: 
6 .\"    Source: YAZ 2.1.28
7 .\"
8 .TH "YAZ\-ZTEST" "8" "09/04/2006" "YAZ 2.1.28" ""
9 .\" disable hyphenation
10 .nh
11 .\" disable justification (adjust text to left margin only)
12 .ad l
13 .SH "NAME"
14 yaz\-ztest \- Z39.50 Test Server
15 .SH "SYNOPSIS"
16 .HP 12
17 \fBapplication\fR [\fB\-install\fR] [\fB\-installa\fR] [\fB\-remove\fR] [\fB\-a\ \fR\fB\fIfile\fR\fR] [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-l\ \fR\fB\fIfile\fR\fR] [\fB\-u\ \fR\fB\fIuid\fR\fR] [\fB\-c\ \fR\fB\fIconfig\fR\fR] [\fB\-f\ \fR\fB\fIvconfig\fR\fR] [\fB\-C\ \fR\fB\fIfname\fR\fR] [\fB\-t\ \fR\fB\fIminutes\fR\fR] [\fB\-k\ \fR\fB\fIkilobytes\fR\fR] [\fB\-d\ \fR\fB\fIdaemon\fR\fR] [\fB\-w\ \fR\fB\fIdir\fR\fR] [\fB\-p\ \fR\fB\fIpidfile\fR\fR] [\fB\-ziDST1\fR] [listener\-spec...]
18 .SH "DESCRIPTION"
19 .PP
20
21 \fByaz\-ztest\fR
22 is a Z39.50 test server that uses the YAZ generic frontend server API. The server acts as a real Z39.50 server but does not use a database. It returns a random hit count and returns a subset of a few built\-in records.
23 .PP
24 The
25 \fIlistener\-spec\fR
26 consists of a transport mode followed by a colon, followed by a listener address. The transport mode is either
27 tcp,
28 unix, or
29 ssl.
30 .PP
31 For TCP and SSL, an address has the form:
32 .sp
33 .RS 3n
34 .nf
35     hostname | IP\-number [ : portnumber ]
36    
37 .fi
38 .RE
39 .sp
40 .PP
41 For UNIX local socket the address is the filename of the local socket.
42 .SH "OPTIONS"
43 .TP 3n
44 \-a \fIfile\fR
45 Specify a file for dumping PDUs (for diagnostic purposes). The special name
46 \-
47 (dash) sends output to
48 stderr.
49 .TP 3n
50 \-S
51 Don't fork or make threads on connection requests. This is good for debugging, but not recommended for real operation: Although the server is asynchronous and non\-blocking, it can be nice to keep a software malfunction (okay then, a crash) from affecting all current users.
52 .TP 3n
53 \-1
54 Like
55 \-S
56 but after one session the server exits. This mode is for debugging
57 \fIonly\fR.
58 .TP 3n
59 \-T
60 Operate the server in threaded mode. The server creates a thread for each connection rather than a fork a process. Only available on UNIX systems that offers POSIX threads.
61 .TP 3n
62 \-s
63 Use the SR protocol (obsolete).
64 .TP 3n
65 \-z
66 Use the Z39.50 protocol (default). This option and
67 \-s
68 complement each other. You can use both multiple times on the same command line, between listener\-specifications (see below). This way, you can set up the server to listen for connections in both protocols concurrently, on different local ports.
69 .TP 3n
70 \-l \fIfile\fR
71 The logfile.
72 .TP 3n
73 \-c \fIconfig\fR
74 A user option that serves as a specifier for some sort of configuration, usually a filename. The argument to this option is transferred to member
75 configname
76 of the
77 statserv_options_block.
78 .TP 3n
79 \-f \fIvconfig\fR
80 This specifies an XML file that describes one or more YAZ frontend virtual servers.
81 .TP 3n
82 \-C \fIfname\fR
83 Sets SSL certificate file name for server (PEM).
84 .TP 3n
85 \-v \fIlevel\fR
86 The log level. Use a comma\-separated list of members of the set {fatal,debug,warn,log,malloc,all,none}.
87 .TP 3n
88 \-u \fIuid\fR
89 Set user ID. Sets the real UID of the server process to that of the given user. It's useful if you aren't comfortable with having the server run as root, but you need to start it as such to bind a privileged port.
90 .TP 3n
91 \-w \fIdir\fR
92 The server changes to this directory during before listening on incoming connections. This option is useful when the server is operating from the
93 inetd
94 daemon (see
95 \-i).
96 .TP 3n
97 \-p \fIpidfile\fR
98 Specifies that the server should write its Process ID to file given by
99 \fIpidfile\fR. A typical location would be
100 \fI/var/run/yaz\-ztest.pid\fR.
101 .TP 3n
102 \-i
103 Use this to make the the server run from the
104 inetd
105 server (UNIX only).
106 .TP 3n
107 \-D
108 Use this to make the server put itself in the background and run as a daemon. If neither
109 \-i
110 nor
111 \-D
112 is given, the server starts in the foreground.
113 .TP 3n
114 \-install
115 Use this to install the server as an NT service (Windows NT/2000/XP only). Control the server by going to the Services in the Control Panel.
116 .TP 3n
117 \-installa
118 Use this to install and activate the server as an NT service (Windows NT/2000/XP only). Control the server by going to the Services in the Control Panel.
119 .TP 3n
120 \-remove
121 Use this to remove the server from the NT services (Windows NT/2000/XP only).
122 .TP 3n
123 \-t \fIminutes\fR
124 Idle session timeout, in minutes.
125 .TP 3n
126 \-k \fIsize\fR
127 Maximum record size/message size, in kilobytes.
128 .TP 3n
129 \-d \fIdaemon\fR
130 Set name of daemon to be used in hosts access file. See
131 \fBhosts_access\fR(5)
132 and
133 \fBtcpd\fR(8).
134 .TP 3n
135 \-m \fItime\-format\fR
136 Sets the format of time\-stamps in the log\-file. Specify a string in the input format to
137 strftime().
138 .SH "VIRTUAL HOSTS"
139 .PP
140 The Virtual hosts mechanism allows a YAZ frontend server to support multiple backends. A backend is selected on the basis of the TCP/IP binding (port+listening adddress) and/or the virtual host.
141 .PP
142 A backend can be configured to execute in a particular working directory. Or the YAZ frontend may perform CQL to RPN conversion, thus allowing traditional Z39.50 backends to be offered as a SRW/SRU service. SRW/SRU Explain information for a particular backend may also be specified.
143 .PP
144 For the HTTP protocol, the virtual host is specified in the Host header. For the Z39.50 protocol, the virtual host is specified as in the Initialize Request in the OtherInfo, OID 1.2.840.10003.10.1000.81.1.
145 .sp
146 .it 1 an-trap
147 .nr an-no-space-flag 1
148 .nr an-break-flag 1
149 .br
150 \fBNote\fR
151 .PP
152 Not all Z39.50 clients allows the VHOST information to be set. For those the selection of the backend must rely on the TCP/IP information alone (port and address).
153 .PP
154 The YAZ frontend server uses XML to describe the backend configurations. Command\-line option
155 \-f
156 specifies filename of the XML configuration.
157 .PP
158 The configuration uses the root element
159 yazgfs. This element includes a list of
160 listen
161 elements, followed by one or more
162 server
163 elements.
164 .PP
165 The
166 listen
167 describes listener (transport end point), such as TCP/IP, Unix file socket or SSL server. Content for a listener:
168 .TP 3n
169 CDATA (required)
170 The CDATA for the
171 listen
172 element holds the listener string, such as
173 tcp:@:210,
174 tcp:server1:2100, etc.
175 .TP 3n
176 attribute id (optional)
177 identifier for this listener. This may be referred to from server sections.
178 .sp
179 .it 1 an-trap
180 .nr an-no-space-flag 1
181 .nr an-break-flag 1
182 .br
183 \fBNote\fR
184 .PP
185 We expect more information to be added for the listen section in a future version, such as CERT file for SSL servers.
186 .PP
187 The
188 server
189 describes a server and the parameters for this server type. Content for a server:
190 .TP 3n
191 attribute id (optional)
192 Identifier for this server. Currently not used for anything, but it might be for logging purposes.
193 .TP 3n
194 attribute listenref (optional)
195 Specifies listener for this server. If this attribute is not given, the server is accessible from all listener. In order for the server to be used for real, howeever, the virtual host must match (if specified in the configuration).
196 .TP 3n
197 element config (optional)
198 Specifies the server configuration. This is equivalent to the config specified using command line option
199 \-c.
200 .TP 3n
201 element directory (optional)
202 Specifies a working directory for this backend server. If specifid, the YAZ fronend changes current working directory to this directory whenever a backend of this type is started (backend handler bend_start), stopped (backend handler hand_stop) and initialized (bend_init).
203 .TP 3n
204 element host (optional)
205 Specifies the virtual host for this server. If this is specified a client
206 \fImust\fR
207 specify this host string in order to use this backend.
208 .TP 3n
209 element cql2rpn (optional)
210 Specifies a filename that includes CQL to RPN conversion for this backend server. See
211 the section called \(lqSEE ALSO\(rq
212 If given, the backend server will only "see" a Type\-1/RPN query.
213 .TP 3n
214 element stylesheet (optional)
215 Specifies the stylesheet reference to be part of SRU HTTP responses when the client does not specify one. If neither this is given, nor the client specifies one, no stylesheet reference is part of the SRU HTTP response.
216 .TP 3n
217 element docpath (optional)
218 Specifies a path for local file access using HTTP. All URLs with a leading prefix (/ exluded) that matches the value of docpath are used for file access. For example, if the server is to offer access in directory
219 xsl, the docpath would be
220 xsl
221 and all URLs of the form
222 http://host/exl
223 will result in a local file access.
224 .TP 3n
225 element explain (optional)
226 Specifies SRW/SRU ZeeRex content for this server. Copied verbatim to the client. As things are now, some of the Explain content seeem redundant because host information, etc. is also stored elsewhere.
227 .PP
228 The XML below configures a server that accepts connections from two ports, TCP/IP port 9900 and a local UNIX file socket. We name the TCP/IP server
229 public
230 and the other server
231 internal.
232 .sp
233 .RS 3n
234 .nf
235   
236  <yazgfs>
237   <listen id="public">tcp:@:9900</listen>
238   <listen id="internal">unix:/var/tmp/socket</listen>
239   <server id="server1">
240     <host>server1.mydomain</host>
241     <directory>/var/www/s1</directory>
242     <config>config.cfg</config>
243   </server>
244   <server id="server2">
245     <host>server2.mydomain</host>
246     <directory>/var/www/s2</directory>
247     <config>config.cfg</config>
248     <cql2rpn>../etc/pqf.properties</cql2rpn>
249     <explain xmlns="http://explain.z3950.org/dtd/2.0/">
250       <serverInfo>
251         <host>server2.mydomain</host>
252         <port>9900</port>
253         <database>a</database>
254       </serverInfo>
255     </explain>
256   </server>
257   <server id="server3" listenref="internal">
258     <directory>/var/www/s3</directory>
259     <config>config.cfg</config>
260   </server>
261  </yazgfs>
262
263  
264 .fi
265 .RE
266 .PP
267 There are three configured backend servers. The first two servers,
268 "server1"
269 and
270 "server2", can be reached by both listener addresses \- since no
271 listenref
272 attribute is specified. In order to distinguish between the two a virtual host has been specified for each of server in the
273 host
274 elements.
275 .PP
276 For
277 "server2"
278 elements for CQL to RPN conversion is supported and explain information has been added (a short one here to keep the example small).
279 .PP
280 The third server,
281 "server3"
282 can only be reached via listener
283 "internal".
284 .SH "FILES"
285 .PP
286
287 \fIyaz\-<version>/ztest/yaz\-ztest.c\fR
288 .PP
289
290 \fIyaz\-<version>/include/yaz/backend.h\fR
291 .SH "SEE ALSO"
292 .PP
293
294 \fByaz\fR(7)
295 .PP
296 Section "Generic server" in the YAZ manual.