schema via ASN.1 compiler directives.
--- 1.9.3 2003/MM/DD
Support for SRW 1.0. This is an optional feature and requires
-libxml and libxslt to operate. Enable it by specifying --with-xslt for
-configure.
+libxml and libxslt to operate. Enable it by specifying --with-xslt
+for configure.
Z39.50 Query Type-104 added - to facilitate CQL within Z39.50.
* Copyright (c) 1995-2003, Index Data
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.181 2003-02-14 18:49:23 adam Exp $
+ * $Id: client.c,v 1.182 2003-02-17 21:23:31 adam Exp $
*/
#include <stdio.h>
compo.u.complex->generic = (Z_Specification *)
odr_malloc(out, sizeof(*compo.u.complex->generic));
- compo.u.complex->generic->which = Z_Specification_oid;
- compo.u.complex->generic->u.oid = (Odr_oid *)
+ compo.u.complex->generic->which = Z_Schema_oid;
+ compo.u.complex->generic->schema.oid = (Odr_oid *)
odr_oiddup(out, oid_ent_to_oid(&prefschema, oid));
- if (!compo.u.complex->generic->u.oid)
+ if (!compo.u.complex->generic->schema.oid)
{
/* OID wasn't a schema! Try record syntax instead. */
prefschema.oclass = CLASS_RECSYN;
- compo.u.complex->generic->u.oid = (Odr_oid *)
+ compo.u.complex->generic->schema.oid = (Odr_oid *)
odr_oiddup(out, oid_ent_to_oid(&prefschema, oid));
}
if (!elementSetNames)
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: eventl.c,v 1.35 2003-02-12 15:06:43 adam Exp $
+ * $Id: eventl.c,v 1.36 2003-02-17 21:23:31 adam Exp $
*/
#include <stdio.h>
IOCHAN p, nextp;
fd_set in, out, except;
int res, max;
- static struct timeval nullto = {0, 0}, to;
- struct timeval *timeout;
+ static struct timeval to;
+ time_t now = time(0);
if (statserv_must_terminate())
{
FD_ZERO(&in);
FD_ZERO(&out);
FD_ZERO(&except);
- timeout = &to; /* hang on select */
- to.tv_sec = 5*60;
- to.tv_usec = 0;
+ to.tv_sec = 3600;
+ to.tv_usec = 1;
max = 0;
for (p = *iochans; p; p = p->next)
{
+ time_t w, ftime;
yaz_log(LOG_LOG, "fd=%d flags=%d force_event=%d",
p->fd, p->flags, p->force_event);
if (p->force_event)
- timeout = &nullto; /* polling select */
+ to.tv_sec = 0; /* polling select */
if (p->flags & EVENT_INPUT)
FD_SET(p->fd, &in);
if (p->flags & EVENT_OUTPUT)
FD_SET(p->fd, &except);
if (p->fd > max)
max = p->fd;
+ if (p->max_idle && p->last_event)
+ {
+ ftime = p->last_event + p->max_idle;
+ if (ftime < now)
+ w = p->max_idle;
+ else
+ w = ftime - now;
+ if (w < to.tv_sec)
+ to.tv_sec = w;
+ }
}
- yaz_log(LOG_LOG, "select start");
- res = YAZ_EV_SELECT(max + 1, &in, &out, &except, timeout);
+ yaz_log(LOG_LOG, "select start %d", to.tv_sec);
+ res = YAZ_EV_SELECT(max + 1, &in, &out, &except, &to);
yaz_log(LOG_LOG, "select end");
if (res < 0)
{
*iochans);
}
}
+ now = time(0);
for (p = *iochans; p; p = p->next)
{
int force_event = p->force_event;
- time_t now = time(0);
p->force_event = 0;
if (!p->destroyed && (FD_ISSET(p->fd, &in) ||
p->last_event = now;
(*p->fun)(p, EVENT_EXCEPT);
}
- if (!p->destroyed && ((p->max_idle && now - p->last_event >
+ if (!p->destroyed && ((p->max_idle && now - p->last_event >=
p->max_idle) || force_event == EVENT_TIMEOUT))
{
p->last_event = now;
* Copyright (c) 1995-2003, Index Data
* See the file LICENSE for details.
*
- * $Id: seshigh.c,v 1.136 2003-02-17 14:35:42 adam Exp $
+ * $Id: seshigh.c,v 1.137 2003-02-17 21:23:31 adam Exp $
*/
/*
xfree(h);
xmalloc_trav("session closed");
if (control_block && control_block->one_shot)
+ {
exit (0);
+ }
}
static void do_close_req(association *a, int reason, char *message,
*cls->closeReason = reason;
cls->diagnosticInformation = message;
process_z_response(a, req, &apdu);
- iochan_settimeout(a->client_chan, 60);
+ iochan_settimeout(a->client_chan, 20);
}
else
{
{ /* restore mask for cs_get operation ... */
iochan_clearflag(h, EVENT_OUTPUT|EVENT_INPUT);
iochan_setflag(h, assoc->cs_get_mask);
- yaz_log(LOG_LOG, "queue empty mask=%d", assoc->cs_get_mask);
if (assoc->state == ASSOC_DEAD)
iochan_setevent(assoc->client_chan, EVENT_TIMEOUT);
}
else
{
assoc->cs_put_mask = EVENT_OUTPUT;
- yaz_log(LOG_LOG, "queue not empty");
}
break;
default:
rr.comp->u.complex->generic = (Z_Specification *)
odr_malloc(assoc->decode, sizeof(Z_Specification));
- rr.comp->u.complex->generic->which = Z_Specification_uri;
- rr.comp->u.complex->generic->u.uri = srw_req->recordSchema;
+ rr.comp->u.complex->generic->which = Z_Schema_uri;
+ rr.comp->u.complex->generic->schema.uri = srw_req->recordSchema;
rr.comp->u.complex->generic->elementSpec = 0;
rr.stream = assoc->encode;
}
else
{
+ int t;
+ const char *alive = z_HTTP_header_lookup(hreq->headers, "Keep-Alive");
+
+ if (alive && isdigit(*alive))
+ t = atoi(alive);
+ else
+ t = 30;
+ if (t < 0 || t > 3600)
+ t = 3600;
+ iochan_settimeout(assoc->client_chan,t);
z_HTTP_header_add(o, &hres->headers, "Connection", "Keep-Alive");
}
process_gdu_response(assoc, req, p);
switch (req->apdu_request->which)
{
case Z_APDU_initRequest:
+ iochan_settimeout(assoc->client_chan,
+ statserv_getcontrol()->idle_timeout * 60);
res = process_initRequest(assoc, req); break;
case Z_APDU_searchRequest:
res = process_searchRequest(assoc, req, &fd); break;
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: session.h,v 1.28 2003-02-12 15:06:43 adam Exp $
+ * $Id: session.h,v 1.29 2003-02-17 21:23:31 adam Exp $
*/
#ifndef SESSION_H
unsigned cs_accept_mask;
struct bend_initrequest *init;
-#if 0
- int (*bend_sort) ();
- int (*bend_search) ();
- int (*bend_present) ();
- int (*bend_esrequest) ();
- int (*bend_delete) ();
- int (*bend_scan) ();
- int (*bend_segment) ();
-#endif
} association;
association *create_association(IOCHAN channel, COMSTACK link);
* NT threaded server code by
* Chas Woodfield, Fretwell Downing Informatics.
*
- * $Id: statserv.c,v 1.92 2003-02-14 18:49:24 adam Exp $
+ * $Id: statserv.c,v 1.93 2003-02-17 21:23:31 adam Exp $
*/
#include <stdio.h>
"", /* diagnostic output to stderr */
"tcp:@:9999", /* default listener port */
PROTO_Z3950, /* default application protocol */
- 60, /* idle timeout (minutes) */
+ 15, /* idle timeout (minutes) */
1024*1024, /* maximum PDU size (approx.) to allow */
"default-config", /* configuration name to pass to backend */
"", /* set user id */
yaz_log(LOG_DEBUG, "Setting timeout %d", control_block.idle_timeout);
iochan_setdata(new_chan, newas);
- iochan_settimeout(new_chan, control_block.idle_timeout * 60);
+ iochan_settimeout(new_chan, 60);
/* Now what we need todo is create a new thread with this iochan as
the parameter */
newas->cs_get_mask = cs_get_mask;
iochan_setdata(new_chan, newas);
- iochan_settimeout(new_chan, control_block.idle_timeout * 60);
+ iochan_settimeout(new_chan, 60);
a = cs_addrstr(new_line);
yaz_log(LOG_LOG, "Starting session %d from %s",
no_sessions, a ? a : "[Unknown]");
# YC Sample Config File for Z39.50
-# $Id: z.tcl,v 1.9 2002-12-05 12:07:00 adam Exp $
+# $Id: z.tcl,v 1.10 2003-02-17 21:23:31 adam Exp $
# ----------------------------------------------------------
# Prefix Specifications
#
set unionmap($m,OtherInformation) {num_elements list}
set unionmap($m,Specification,elementSpec) {}
set map($m,Specification_0) ElementSpec
+set unionmap($m,Specification,schema) {which schema Schema}
# ----
set m DiagnosticFormatDiag1
/*
- * $Id: zoomsh.c,v 1.14 2003-02-17 14:35:42 adam Exp $
+ * $Id: zoomsh.c,v 1.15 2003-02-17 21:23:31 adam Exp $
*
* ZOOM-C Shell
*/
#include <yaz/xmalloc.h>
+#include <yaz/log.h>
#include <yaz/zoom.h>
#define MAX_CON 100
}
}
+static void cmd_debug (ZOOM_connection *c, ZOOM_resultset *r,
+ ZOOM_options options,
+ const char **args)
+{
+ yaz_log_init_level(LOG_ALL);
+}
+
static void cmd_search (ZOOM_connection *c, ZOOM_resultset *r,
ZOOM_options options,
const char **args)
cmd_help(c, r, options, buf);
else if (is_command ("ext", cmd_str, cmd_len))
cmd_ext(c, r, options, buf);
+ else if (is_command ("debug", cmd_str, cmd_len))
+ cmd_debug(c, r, options, buf);
else
printf ("unknown command %.*s\n", cmd_len, cmd_str);
return 2;
ZOOM_connection z39_con[MAX_CON];
ZOOM_resultset z39_res[MAX_CON];
-#if 0
- yaz_log_init_level(65535);
-#endif
+ nmem_init();
for (i = 0; i<MAX_CON; i++)
{
z39_con[i] = 0;
ZOOM_connection_destroy(z39_con[i]);
ZOOM_resultset_destroy(z39_res[i]);
}
+ nmem_exit();
exit (0);
}
* Copyright (c) 2002-2003, Index Data.
* See the file LICENSE for details.
*
- * $Id: srwtst.c,v 1.1 2003-02-14 18:49:24 adam Exp $
+ * $Id: srwtst.c,v 1.2 2003-02-17 21:23:31 adam Exp $
*/
#include <yaz/srw.h>
ODR decode, encode;
int debug = 0;
+ nmem_init();
if (argc == 2 && !strcmp(argv[1], "debug"))
debug = 1;
no = fread(buf, 1, sizeof(buf), stdin);
fprintf(stderr, "No output!\n");
exit(1);
}
+ odr_destroy(decode);
+ odr_destroy(encode);
+ nmem_exit();
exit(0);
}
#else
* Copyright (c) 2002-2003, Index Data.
* See the file LICENSE for details.
*
- * $Id: zgdu.c,v 1.3 2003-02-17 14:35:42 adam Exp $
+ * $Id: zgdu.c,v 1.4 2003-02-17 21:23:32 adam Exp $
*/
#include <yaz/proto.h>
-#define HTTP_DEBUG 1
+#define HTTP_DEBUG 0
static int decode_headers_content(ODR o, int off, Z_HTTP_Header **headers,
char **content_buf, int *content_len)
* Copyright (c) 2000-2003, Index Data
* See the file LICENSE for details.
*
- * $Id: zoom-c.c,v 1.20 2003-02-17 14:35:42 adam Exp $
+ * $Id: zoom-c.c,v 1.21 2003-02-17 21:23:32 adam Exp $
*
* ZOOM layer for C, connections, result sets, queries.
*/
c->lang = 0;
xfree (c->host_port);
- xfree (c->path);
if (portnum)
{
char hostn[128];
ZOOM_options_destroy (c->options);
ZOOM_connection_remove_tasks (c);
xfree (c->host_port);
+ xfree (c->path);
xfree (c->proxy);
xfree (c->charset);
xfree (c->lang);
c = r->connection;
if (!c)
return;
+
+ if (c->host_port && c->proto == PROTO_SRW)
+ {
+ if (!c->cs)
+ {
+ yaz_log(LOG_DEBUG, "NO COMSTACK");
+ ZOOM_connection_add_task(c, ZOOM_TASK_CONNECT);
+ }
+ else
+ {
+ yaz_log(LOG_DEBUG, "PREPARE FOR RECONNECT");
+ c->reconnect_ok = 1;
+ }
+ }
task = ZOOM_connection_add_task (c, ZOOM_TASK_RETRIEVE);
task->u.retrieve.resultset = r;
task->u.retrieve.start = start;
static zoom_ret send_APDU (ZOOM_connection c, Z_APDU *a)
{
ZOOM_Event event;
- yaz_log(LOG_LOG, "sending Z39.50 APDU");
assert (a);
if (encode_APDU(c, a, c->odr_out))
return zoom_complete;
return zoom_complete;
assert (c->tasks);
if (c->tasks->which == ZOOM_TASK_SEARCH)
+ {
resultset = c->tasks->u.search.resultset;
+ resultset->setname = xstrdup ("default");
+ ZOOM_options_set (resultset->options, "setname", resultset->setname);
+ }
else if(c->tasks->which == ZOOM_TASK_RETRIEVE)
{
resultset = c->tasks->u.retrieve.resultset;
sr->u.request->maximumRecords = odr_intdup (c->odr_out, resultset->count);
sr->u.request->recordSchema = resultset->schema;
- resultset->setname = xstrdup ("default");
- ZOOM_options_set (resultset->options, "setname", resultset->setname);
return send_srw(c, sr);
}
compo->u.complex->generic = (Z_Specification *)
odr_malloc(c->odr_out, sizeof(*compo->u.complex->generic));
- compo->u.complex->generic->which = Z_Specification_oid;
- compo->u.complex->generic->u.oid = (Odr_oid *)
+ compo->u.complex->generic->which = Z_Schema_oid;
+ compo->u.complex->generic->schema.oid = (Odr_oid *)
yaz_str_to_z3950oid (c->odr_out, CLASS_SCHEMA, resultset->schema);
- if (!compo->u.complex->generic->u.oid)
+ if (!compo->u.complex->generic->schema.oid)
{
/* OID wasn't a schema! Try record syntax instead. */
- compo->u.complex->generic->u.oid = (Odr_oid *)
+ compo->u.complex->generic->schema.oid = (Odr_oid *)
yaz_str_to_z3950oid (c->odr_out, CLASS_RECSYN, resultset->schema);
}
if (elementSetName && *elementSetName)
yaz_log (LOG_DEBUG, "reconnect write");
c->tasks->running = 0;
ZOOM_connection_insert_task (c, ZOOM_TASK_CONNECT);
- return zoom_complete;
+ return zoom_pending;
}
if (c->state == STATE_CONNECTING)
set_ZOOM_error(c, ZOOM_ERROR_CONNECT, 0);