yazproxy — The YAZ toolkit's transparent Z39.50/SRU proxy
yazproxy
[-a filename
] [-c config
] [-D] [-i seconds
] [-l filename
] [-m num
] [-n num
] [-o level
] [-t target
] [-p pidfile
] [-T seconds
] [-u userid
] [-v level
] [-V] [-X] {host
:port
}
yazproxy is a proxy that accepts connections
from Z39.50/SRU clients and contacts a Z39.50 backend.
The listening port must be specified on the command-line.
inetd operation is not supported.
The host
:port
argument specifies host address to listen to, and the port to
listen on. Use the host @
to listen for connections coming from any address.
yazproxy can be configured using command-line options or a configuration file. Configuration file options override values specified on the command-line.
yazproxy rereads its configuration file and reopens log files when it receives the hangup signal, SIGHUP.
filename
Specifies the name of a file to which to write a log of the
APDUs (protocol packets) that pass through the proxy. The
special filename -
may be used to indicate
standard output.
config
Specifies config filename. Configuration is in XML and is only supported if the YAZ proxy is compiled with libxml2.
Puts YAZ proxy in the background after startup. This is similar to using shell's & operator but often better since it allows the start / stop script to capture startup errors.
seconds
Specifies in seconds the idle time for communication between client and proxy. If a connection is inactive for this long it will be closed. Default: 600 seconds (10 minutes).
filename
Specifies the name of a file to which to write a log of the YAZ proxy activity. This uses the logging facility as provided by the YAZ toolkit. If this options is omitted, the output directed to stderr.
num
Specifies the maximum number of client connections to be offered [default 150].
num
Sets maximum number of open files to num
.
This is only available on systems that offers the
setrlimit(2)
call.
level
Sets level for optimization. Use zero to disable; non-zero to enable. Handling for this is not fully implemented; we will probably use a bit mask to enable/disable specific features. By default optimization is enabled (value 1).
pidfile
When specified, yazproxy will create pidfile
with the process ID of the proxy. The pidfile will be generated
before the process changes identity (see option -u
).
target
Specifies the default backend target to use when a client
connects that does not explicitly specify a target in its
initRequest
.
seconds
Specifies in seconds the idle time for communication between proxy and backend target. If a connection is inactive for this long it will be closed. Default: 600 seconds (10 minutes).
userid
When specified, yazproxy will change identity to the user ID
specified, just after the proxy has started listening to a
possibly privileged port and after the PID file has been created
if specified by option -u
.
level
Sets the logging level. level
is
a comma-separated list of members of the set
{fatal
,debug
,warn
,log
,malloc
,all
,none
}.
Displays yazproxy version and exits with status code 0. Should not be used in conjunction with other options.
Enables debugging mode for the proxy. When specified, the proxy will not fork itself, thus any violations becomes fatal. Useful if you run yazproxy inside gdb. Don't run this in production.
The following command starts the proxy, listening on port 9000, with its default backend target set to Index Data's test server:
$ yazproxy -t indexdata.dk:210 @:9000
You can connect to the proxy via yaz-client as follows:
$ ./yaz-client localhost:9000/gils Connecting...OK. Sent initrequest. Connection accepted by v3 target. ID : 81 Name : Zebra Information Server/GFS/YAZ (YAZ Proxy) Version: Zebra 1.3.15/1.23/2.0.19 Options: search present delSet scan sort extendedServices namedResultSets Elapsed: 0.152108 Z> f computer Sent searchRequest. Received SearchResponse. Search was a success. Number of hits: 3, setno 1 SearchResult-1: computer(3) records returned: 0 Elapsed: 0.172533
The YAZ command-line client, yaz-client, allows you to set the proxy address by specifying option -p. In that case, the actual backend target is specified as part of the Initialize Request.
Suppose the proxy running on localhost, port 9000.
To connect to British Library's server at
blpcz.bl.uk:21021
use:
yaz-client -p localhost:9000 blpcz.bl.uk:21021/BLPC-ALL