X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=server%2Fseshigh.c;h=4b2313ef0926a363fc06bf12db17798bbe99f97a;hp=e3149181f16fe23d2e42c772bda8249ed6c61c0f;hb=512bca4cb3acca0a9dd9386fb3fdd289804a4291;hpb=08d286ddede794e73ba8b3c85497de3e0c80312b diff --git a/server/seshigh.c b/server/seshigh.c index e314918..4b2313e 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -4,7 +4,19 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: seshigh.c,v $ - * Revision 1.3 1995-03-16 17:42:39 quinn + * Revision 1.7 1995-03-21 15:53:31 quinn + * Little changes. + * + * Revision 1.6 1995/03/21 12:30:09 quinn + * Beginning to add support for record packing. + * + * Revision 1.5 1995/03/17 10:44:13 quinn + * Added catch of null-string in makediagrec + * + * Revision 1.4 1995/03/17 10:18:08 quinn + * Added memory management. + * + * Revision 1.3 1995/03/16 17:42:39 quinn * Little changes * * Revision 1.2 1995/03/16 13:29:01 quinn @@ -91,6 +103,8 @@ void destroy_association(association *h) odr_destroy(h->decode); odr_destroy(h->encode); free(h->encode_buffer); + if (h->input_buffer) + free(h->input_buffer); free(h); } @@ -176,6 +190,7 @@ static int process_apdu(IOCHAN chan) fprintf(stderr, "Bad APDU\n"); return -1; } + odr_reset(assoc->decode); return res; } @@ -220,7 +235,7 @@ 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.3 $"; + resp.implementationVersion = "$Revision: 1.7 $"; resp.userInformationField = 0; if (!z_APDU(assoc->encode, &apdup, 0)) { @@ -228,6 +243,7 @@ static int process_initRequest(IOCHAN client, Z_InitRequest *req) return -1; } odr_getbuf(assoc->encode, &assoc->encoded_len); + odr_reset(assoc->encode); iochan_setflags(client, EVENT_OUTPUT | EVENT_EXCEPT); return 0; } @@ -239,16 +255,39 @@ static Z_Records *diagrec(int error, char *addinfo) static Z_DiagRec dr; static int err; - fprintf(stderr, "Diagnostic: %d -- %s\n", error, addinfo); + fprintf(stderr, "Diagnostic: %d -- %s\n", error, addinfo ? addinfo : + "NULL"); err = error; rec.which = Z_Records_NSD; rec.u.nonSurrogateDiagnostic = &dr; dr.diagnosticSetId = bib1; dr.condition = &err; - dr.addinfo = addinfo; + dr.addinfo = addinfo ? addinfo : ""; return &rec; } +static Z_NamePlusRecord *surrogatediagrec(char *dbname, int error, + char *addinfo) +{ + static Z_NamePlusRecord rec; + static Z_DiagRec dr; + static Odr_oid bib1[] = { 1, 2, 3, 4, 5, -1 }; + static int err; + + fprintf(stderr, "SurrogateDiagnotic: %d -- %s\n", error, addinfo); + rec.databaseName = dbname; + rec.which = Z_NamePlusRecord_surrogateDiagnostic; + rec.u.surrogateDiagnostic = &dr; + dr.diagnosticSetId = bib1; + dr.condition = &err; + dr.addinfo = addinfo ? addinfo : ""; + return &rec; +} + +static Z_Records *pack_records(association *a, int num, Z_ElementSetNames *esn) +{ +} + static int process_searchRequest(IOCHAN client, Z_SearchRequest *req) { Z_APDU apdu, *apdup; @@ -293,6 +332,7 @@ static int process_searchRequest(IOCHAN client, Z_SearchRequest *req) return -1; } odr_getbuf(assoc->encode, &assoc->encoded_len); + odr_reset(assoc->encode); iochan_setflags(client, EVENT_OUTPUT | EVENT_EXCEPT); return 0; } @@ -322,6 +362,7 @@ static int process_presentRequest(IOCHAN client, Z_PresentRequest *req) return -1; } odr_getbuf(assoc->encode, &assoc->encoded_len); + odr_reset(assoc->encode); iochan_setflags(client, EVENT_OUTPUT | EVENT_EXCEPT); return 0; }