From: Sebastian Hammer Date: Thu, 16 Mar 1995 13:28:59 +0000 (+0000) Subject: Partitioned server. X-Git-Tag: YAZ.1.8~1122 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=25b7a1f19e0a16578e5918dd7ce70320d915dd23 Partitioned server. --- diff --git a/server/Makefile b/server/Makefile index 9794f71..54f578d 100644 --- a/server/Makefile +++ b/server/Makefile @@ -1,7 +1,7 @@ # Copyright (C) 1994, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.10 1995-03-15 15:36:12 quinn Exp $ +# $Id: Makefile,v 1.11 1995-03-16 13:28:59 quinn Exp $ SHELL=/bin/sh INCLUDE=-I../include -I. -I../asn -I../odr -I../yazlib -I../../egate/include\ @@ -12,10 +12,10 @@ LIBINCLUDE=-L$(LIBDIR) DEFS=$(INCLUDE) LIB=$(LIBDIR)/libserver.a LIBS=$(LIBDIR)/libserver.a $(LIBDIR)/libasn.a $(LIBDIR)/libodr.a $(LIBDIR)/libcomstack.a ../../alex/lib/util.a ../../egate/lib/util.a -PO = eventl.o +PO = eventl.o seshigh.o statserv.o CPP=cc -E -PROG=statserv -PROGO=statserv.o session.o +PROG=ztest +PROGO=ztest.o session.o all: $(LIBDIR) $(LIB) $(PROG) diff --git a/server/seshigh.c b/server/seshigh.c index 2a7a4c6..a55478c 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: seshigh.c,v $ - * Revision 1.1 1995-03-15 16:02:10 quinn + * Revision 1.2 1995-03-16 13:29:01 quinn + * Partitioned server. + * + * Revision 1.1 1995/03/15 16:02:10 quinn * Modded session.c seshigh.c * * Revision 1.10 1995/03/15 15:18:51 quinn @@ -214,11 +217,11 @@ static int process_initRequest(IOCHAN client, Z_InitRequest *req) resp.result = &result; resp.implementationId = "YAZ"; resp.implementationName = "YAZ/Simple asynchronous test server"; - resp.implementationVersion = "$Revision: 1.1 $"; + resp.implementationVersion = "$Revision: 1.2 $"; resp.userInformationField = 0; if (!z_APDU(assoc->encode, &apdup, 0)) { - odr_perror(assoc->encode, "Encode init"); + odr_perror(assoc->encode, "Encode initres"); return -1; } odr_getbuf(assoc->encode, &assoc->encoded_len); @@ -283,7 +286,7 @@ static int process_searchRequest(IOCHAN client, Z_SearchRequest *req) if (!z_APDU(assoc->encode, &apdup, 0)) { - odr_perror(assoc->encode, "Encode init"); + odr_perror(assoc->encode, "Encode searchres"); return -1; } odr_getbuf(assoc->encode, &assoc->encoded_len); @@ -291,72 +294,6 @@ static int process_searchRequest(IOCHAN client, Z_SearchRequest *req) return 0; } -static Z_Records *dummy_database_records (int start, int no_requested, - int *no_returned, - int preferredMessageSize) -{ - static Z_Records rec; - static int no_records = 0; - static Z_NamePlusRecordList z_nprl; - int i, size; - static Z_NamePlusRecord **records; - - rec.which = Z_Records_DBOSD; - rec.u.databaseOrSurDiagnostics = &z_nprl; - if (!no_records) - { - FILE *inf; - char *buf; - Odr_external *oep; - - inf = fopen ("dummy-records", "r"); - if (!inf) - return NULL; - records = malloc (sizeof(*records) * 50); - assert (records); - for (i=0; i<50; i++) - { - buf = iso2709_read (inf); - if (!buf) - break; - records[i] = malloc (sizeof(**records)); - assert (records[i]); - records[i]->databaseName = NULL; - records[i]->which = Z_NamePlusRecord_databaseRecord; - oep = records[i]->u.databaseRecord = - malloc (sizeof(*oep)); - assert (oep); - oep->direct_reference = NULL; - oep->indirect_reference = NULL; - oep->descriptor = NULL; - oep->which = ODR_EXTERNAL_octet; - oep->u.octet_aligned = malloc (sizeof(*oep->u.octet_aligned)); - assert (oep->u.octet_aligned); - oep->u.octet_aligned->size = oep->u.octet_aligned->len - = strlen(buf); - oep->u.octet_aligned->buf = buf; - } - no_records = i; - fclose (inf); - } - if (no_records < start + no_requested) - return NULL; - - z_nprl.records = records + start -1; - for (size = 0, i = 0; iwhich == Z_NamePlusRecord_databaseRecord) - size += z_nprl.records[i]->u.databaseRecord->u.octet_aligned->size; - printf ("size=%d\n", size); - if (size > preferredMessageSize) - break; - } - if (i == 0) - return NULL; - z_nprl.num_records = *no_returned = i; - return &rec; -} - static int process_presentRequest(IOCHAN client, Z_PresentRequest *req) { Z_APDU apdu, *apdup; @@ -374,18 +311,11 @@ static int process_presentRequest(IOCHAN client, Z_PresentRequest *req) resp.nextResultSetPosition = &nrr; resp.presentStatus = &nrr; -#if 0 - resp.records = diagrec(1, "Waiting for records from Adam. :)"); -#else - if (!(resp.records = dummy_database_records (*req->resultSetStartPoint, - *req->numberOfRecordsRequested, &nrr, assoc->preferredMessageSize))) - resp.records = diagrec (1, "No records from Adam. Sorry"); - printf ("nrr=%d\n", nrr); -#endif + resp.records = diagrec(1, "No records yet."); if (!z_APDU(assoc->encode, &apdup, 0)) { - odr_perror(assoc->encode, "Encode init"); + odr_perror(assoc->encode, "Encode presentres"); return -1; } odr_getbuf(assoc->encode, &assoc->encoded_len); diff --git a/server/statserv.c b/server/statserv.c index a827e24..d84065f 100644 --- a/server/statserv.c +++ b/server/statserv.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: statserv.c,v $ - * Revision 1.6 1995-03-15 15:18:52 quinn + * Revision 1.7 1995-03-16 13:29:04 quinn + * Partitioned server. + * + * Revision 1.6 1995/03/15 15:18:52 quinn * Little changes to better support nonblocking I/O * Added backend.h * @@ -161,7 +164,7 @@ void add_listener(char *where) iochan_setdata(lst, l); } -int main(int argc, char **argv) +int statserv_main(int argc, char **argv) { int ret, listeners = 0; char *arg;