Partitioned server.
authorSebastian Hammer <quinn@indexdata.com>
Thu, 16 Mar 1995 13:28:59 +0000 (13:28 +0000)
committerSebastian Hammer <quinn@indexdata.com>
Thu, 16 Mar 1995 13:28:59 +0000 (13:28 +0000)
server/Makefile
server/seshigh.c
server/statserv.c

index 9794f71..54f578d 100644 (file)
@@ -1,7 +1,7 @@
 # Copyright (C) 1994, Index Data I/S 
 # All rights reserved.
 # Sebastian Hammer, Adam Dickmeiss
 # 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\
 
 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
 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
 CPP=cc -E
-PROG=statserv
-PROGO=statserv.o session.o
+PROG=ztest
+PROGO=ztest.o session.o
 
 all: $(LIBDIR) $(LIB) $(PROG)
 
 
 all: $(LIBDIR) $(LIB) $(PROG)
 
index 2a7a4c6..a55478c 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: seshigh.c,v $
  * 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
  * 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.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))
     {
     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);
        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))
     {
 
     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);
        return -1;
     }
     odr_getbuf(assoc->encode, &assoc->encoded_len);
@@ -291,72 +294,6 @@ static int process_searchRequest(IOCHAN client, Z_SearchRequest *req)
     return 0;
 }
 
     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; i<no_requested; i++)
-    {
-        if (z_nprl.records[i]->which == 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;
 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;
 
     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))
     {
 
     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);
        return -1;
     }
     odr_getbuf(assoc->encode, &assoc->encoded_len);
index a827e24..d84065f 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: statserv.c,v $
  * 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
  *
  * Little changes to better support nonblocking I/O
  * Added backend.h
  *
@@ -161,7 +164,7 @@ void add_listener(char *where)
     iochan_setdata(lst, l);
 }
 
     iochan_setdata(lst, l);
 }
 
-int main(int argc, char **argv)
+int statserv_main(int argc, char **argv)
 {
     int ret, listeners = 0;
     char *arg;
 {
     int ret, listeners = 0;
     char *arg;