Implemented odr_strdup. Added Reference ID to backend server API.
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 31 Mar 1999 11:18:24 +0000 (11:18 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 31 Mar 1999 11:18:24 +0000 (11:18 +0000)
CHANGELOG
client/Makefile.in
client/client.c
include/backend.h
include/odr.h
odr/odr_mem.c
retrieval/d1_grs.c
server/seshigh.c
util/nmem.c
ztest/read-grs.c

index 39ce4af..c929736 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,14 @@
 Possible compatibility problems with earlier versions marked with '*'.
 
-Fixed bug in Explain for Category TargetInfo.
+Fixed memory leak in ccl_find_str and ccl_qual_rm. Thanks to Hans van
+den Dool <H.M.vdnDool@kub.nl>.
+
+Added reference ID parameter to most functions in server API - refer
+to backend.h. Thanks to Hans van den Dool <H.M.vdnDool@kub.nl>.
+
+Changed name of ccl library to libccl.a (was ccl.a).
+
+Fixed bug in decoder for Explain (Category TargetInfo).
 
 Added support for GNU readline in client. Thanks to Jacob Poulsen
 <ja7@dbc.dk>. GNU configure attempts to detect if readline is available.
index 0729a66..9dc4fc9 100644 (file)
@@ -1,7 +1,7 @@
 # Copyright (C) 1995-1998, Index Data I/S 
 # All rights reserved.
 # Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile.in,v 1.4 1998-10-28 15:10:04 adam Exp $
+# $Id: Makefile.in,v 1.5 1999-03-31 11:18:24 adam Exp $
 
 SHELL=/bin/sh
 
@@ -17,8 +17,8 @@ LIBDIR=../lib
 
 INCLUDE=-I../z39.50 -I../include -I. -I../../xtimosi/src
 DEFS=$(INCLUDE) $(CDEFS) -DCCL2RPN=1
-YAZLIBS=$(LIBDIR)/libasn.a $(LIBDIR)/libutil.a \
-  $(LIBDIR)/libcomstack.a ../lib/ccl.a $(LIBMOSI) $(LIBDIR)/libodr.a 
+YAZLIBS=$(LIBDIR)/libasn.a $(LIBDIR)/libcomstack.a \
+  ../lib/libccl.a $(LIBMOSI) $(LIBDIR)/libodr.a $(LIBDIR)/libutil.a 
 PROG=client
 PROGO=client.o
 
index 2dd242a..33fcfdd 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: client.c,v $
- * Revision 1.79  1999-03-23 14:14:25  adam
+ * Revision 1.80  1999-03-31 11:18:24  adam
+ * Implemented odr_strdup. Added Reference ID to backend server API.
+ *
+ * Revision 1.79  1999/03/23 14:14:25  adam
  * Yet another fix.
  *
  * Revision 1.78  1999/03/18 12:57:18  adam
@@ -1458,7 +1461,8 @@ int send_sortrequest(char *arg, int newset)
 {
     Z_APDU *apdu = zget_APDU(out, Z_APDU_sortRequest);
     Z_SortRequest *req = apdu->u.sortRequest;
-    Z_SortKeySpecList *sksl = (Z_SortKeySpecList *)odr_malloc (out, sizeof(*sksl));
+    Z_SortKeySpecList *sksl = (Z_SortKeySpecList *)
+        odr_malloc (out, sizeof(*sksl));
     char setstring[32];
     char sort_string[32], sort_flags[32];
     int off;
@@ -1476,9 +1480,7 @@ int send_sortrequest(char *arg, int newset)
     req->num_inputResultSetNames = 1;
     req->inputResultSetNames = (Z_InternationalString **)
        odr_malloc (out, sizeof(*req->inputResultSetNames));
-    req->inputResultSetNames[0] = (char *)
-       odr_malloc (out, strlen(setstring)+1);
-    strcpy (req->inputResultSetNames[0], setstring);
+    req->inputResultSetNames[0] = odr_strdup (out, setstring);
 #else
     req->inputResultSetNames =
        (Z_StringList *)odr_malloc (out, sizeof(*req->inputResultSetNames));
@@ -1486,15 +1488,13 @@ int send_sortrequest(char *arg, int newset)
     req->inputResultSetNames->strings =
        (char **)odr_malloc (out, sizeof(*req->inputResultSetNames->strings));
     req->inputResultSetNames->strings[0] =
-       (char *)odr_malloc (out, strlen(setstring)+1);
-    strcpy (req->inputResultSetNames->strings[0], setstring);
+       odr_strdup (out, setstring);
 #endif
 
     if (newset && setnumber >= 0)
        sprintf (setstring, "%d", ++setnumber);
 
-    req->sortedResultSetName = (char *)odr_malloc (out, strlen(setstring)+1);
-    strcpy (req->sortedResultSetName, setstring);
+    req->sortedResultSetName = odr_strdup (out, setstring);
 
     req->sortSequence = sksl;
     sksl->num_specs = 0;
@@ -1541,8 +1541,7 @@ int send_sortrequest(char *arg, int newset)
        else
        {
            sk->which = Z_SortKey_sortField;
-           sk->u.sortField = (char *)odr_malloc (out, strlen(sort_string)+1);
-           strcpy (sk->u.sortField, sort_string);
+           sk->u.sortField = odr_strdup (out, sort_string);
        }
        sks->sortRelation = (int *)odr_malloc (out, sizeof(*sks->sortRelation));
        *sks->sortRelation = Z_SortRelation_ascending;
index 2cd4745..b531fe3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995-1998, Index Data.
+ * Copyright (c) 1995-1999, Index Data.
  *
  * Permission to use, copy, modify, distribute, and sell this software and
  * its documentation, in whole or in part, for any purpose, is hereby granted,
  * OF THIS SOFTWARE.
  *
  * $Log: backend.h,v $
- * Revision 1.23  1998-10-13 16:12:23  adam
+ * Revision 1.24  1999-03-31 11:18:24  adam
+ * Implemented odr_strdup. Added Reference ID to backend server API.
+ *
+ * Revision 1.23  1998/10/13 16:12:23  adam
  * Added support for Surrogate Diagnostics for Scan Term entries.
  *
  * Revision 1.22  1998/09/02 12:41:51  adam
@@ -72,6 +75,7 @@ typedef struct
     int replace_set;           /* replace set, if it already exists */
     int num_bases;             /* number of databases in list */
     char **basenames;          /* databases to search */
+    Z_ReferenceId *referenceId;/* reference ID */
     Z_Query *query;            /* query structure */
     ODR stream;                /* encoding stream */
     ODR decode;                /* decoding stream */
@@ -91,6 +95,7 @@ typedef struct {
     int replace_set;           /* replace set, if it already exists */
     int num_bases;             /* number of databases in list */
     char **basenames;          /* databases to search */
+    Z_ReferenceId *referenceId;/* reference ID */
     Z_Query *query;            /* query structure */
     ODR stream;                /* encode stream */
     ODR decode;                /* decode stream */
@@ -109,6 +114,7 @@ typedef struct {
     int start;
     int number;                /* record number */
     oid_value format;          /* One of the CLASS_RECSYN members */
+    Z_ReferenceId *referenceId;/* reference ID */
     Z_RecordComposition *comp; /* Formatting instructions */
     ODR stream;                /* encoding stream - memory source if required */
     bend_request request;
@@ -127,6 +133,7 @@ typedef struct
 {
     char *setname;             /* set name */
     int number;                /* record number */
+    Z_ReferenceId *referenceId;/* reference ID */
     oid_value format;          /* One of the CLASS_RECSYN members */
     Z_RecordComposition *comp; /* Formatting instructions */
     ODR stream;                /* encoding stream - memory source if req */
@@ -153,6 +160,7 @@ typedef struct
     int num_bases;      /* number of elements in databaselist */
     char **basenames;   /* databases to search */
     oid_value attributeset;
+    Z_ReferenceId *referenceId; /* reference ID */
     Z_AttributesPlusTerm *term;
     int term_position;  /* desired index of term in result list */
     int num_entries;    /* number of entries requested */
@@ -167,7 +175,7 @@ struct scan_entry {
 };
 
 typedef enum {
-    BEND_SCAN_SUCCESS,   /* ok */
+    BEND_SCAN_SUCCESS,  /* ok */
     BEND_SCAN_PARTIAL   /* not all entries could be found */
 } bend_scan_status;
 
@@ -190,6 +198,7 @@ typedef struct bend_delete_rr {
     int function;
     int num_setnames;
     char **setnames;
+    Z_ReferenceId *referenceId;
     int delete_status;
     ODR stream;
 } bend_delete_rr;
@@ -205,6 +214,7 @@ typedef struct bend_sort_rr
     char *output_setname;
     Z_SortKeySpecList *sort_sequence;
     ODR stream;
+    Z_ReferenceId *referenceId;/* reference ID */
 
     int sort_status;
     int errcode;
@@ -216,7 +226,9 @@ typedef struct bend_esrequest_rr
 {
     int ItemNo;
     Z_ExtendedServicesRequest *esr;
+    
     ODR stream;                /* encoding stream */
+    Z_ReferenceId *referenceId;/* reference ID */
     bend_request request;
     bend_association association;
     int errcode;               /* 0==success */
@@ -228,6 +240,7 @@ typedef struct bend_initrequest
     char *configname;
     Z_IdAuthentication *auth;
     ODR stream;                /* encoding stream */
+    Z_ReferenceId *referenceId;/* reference ID */
     
     int (*bend_sort) (void *handle, bend_sort_rr *rr);
     int (*bend_search) (void *handle, bend_search_rr *rr);
index 2e15659..45861f3 100644 (file)
  * OF THIS SOFTWARE.
  *
  * $Log: odr.h,v $
- * Revision 1.27  1999-01-08 11:23:17  adam
+ * Revision 1.28  1999-03-31 11:18:25  adam
+ * Implemented odr_strdup. Added Reference ID to backend server API.
+ *
+ * Revision 1.27  1999/01/08 11:23:17  adam
  * Added const modifier to some of the BER/ODR encoding routines.
  *
  * Revision 1.26  1998/03/20 17:29:20  adam
@@ -339,6 +342,7 @@ YAZ_EXPORT void odr_destroy(ODR o);
 YAZ_EXPORT void odr_setbuf(ODR o, char *buf, int len, int can_grow);
 YAZ_EXPORT char *odr_getbuf(ODR o, int *len, int *size);
 YAZ_EXPORT void *odr_malloc(ODR o, int size);
+YAZ_EXPORT char *odr_strdup(ODR o, const char *str);
 YAZ_EXPORT NMEM odr_extract_mem(ODR o);
 YAZ_EXPORT Odr_null *odr_nullval(void);
 #define odr_release_mem(m) nmem_destroy(m)
index 20768a5..1572152 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: odr_mem.c,v $
- * Revision 1.14  1998-07-20 12:38:15  adam
+ * Revision 1.15  1999-03-31 11:18:25  adam
+ * Implemented odr_strdup. Added Reference ID to backend server API.
+ *
+ * Revision 1.14  1998/07/20 12:38:15  adam
  * More LOG_DEBUG-diagnostics.
  *
  * Revision 1.13  1998/02/11 11:53:34  adam
@@ -74,6 +77,11 @@ void *odr_malloc(ODR o, int size)
     return nmem_malloc(o ? o->mem : 0, size);
 }
 
+char *odr_strdup(ODR o, const char *str)
+{
+    return nmem_strdup(o->mem, str);
+}
+
 int odr_total(ODR o)
 {
     return o->mem ? nmem_total(o->mem) : 0;
index 599bb61..14503b4 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: d1_grs.c,v $
- * Revision 1.14  1998-03-16 12:21:15  adam
+ * Revision 1.15  1999-03-31 11:18:25  adam
+ * Implemented odr_strdup. Added Reference ID to backend server API.
+ *
+ * Revision 1.14  1998/03/16 12:21:15  adam
  * Fixed problem with tag names that weren't set to the right value
  * when wildcards were used.
  *
@@ -117,9 +120,8 @@ static Z_Variant *make_variant(data1_node *n, int num, ODR o)
        {
            case DATA1K_string:
                t->which = Z_Triple_internationalString;
-               t->value.internationalString = (char *)odr_malloc(o,
-                   strlen(p->u.variant.value)+1);
-               strcpy(t->value.internationalString, p->u.variant.value);
+               t->value.internationalString =
+                    odr_strdup(o, p->u.variant.value);
                break;
            default:
                logf(LOG_WARN, "Unable to handle value for variant %s",
@@ -277,8 +279,7 @@ static Z_TaggedElement *nodetotaggedelement(data1_handle dh, data1_node *n,
        else
            tagstr = "?";                /* no tag at all! */
        res->tagValue->which = Z_StringOrNumeric_string;
-       res->tagValue->u.string = (char *)odr_malloc(o, strlen(tagstr)+1);
-       strcpy(res->tagValue->u.string, tagstr);
+       res->tagValue->u.string = odr_strdup(o, tagstr);
     }
     res->tagOccurrence = 0;
     res->appliedVariant = 0;
index 8a65140..d1d05b8 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: seshigh.c,v $
- * Revision 1.86  1999-02-02 13:57:38  adam
+ * Revision 1.87  1999-03-31 11:18:25  adam
+ * Implemented odr_strdup. Added Reference ID to backend server API.
+ *
+ * Revision 1.86  1999/02/02 13:57:38  adam
  * Uses preprocessor define WIN32 instead of WINDOWS to build code
  * for Microsoft WIN32.
  *
@@ -782,6 +785,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb)
     binitreq.stream = assoc->encode;
     binitreq.configname = "default-config";
     binitreq.auth = req->idAuthentication;
+    binitreq.referenceId = req->referenceId;
     binitreq.bend_sort = NULL;
     binitreq.bend_search = NULL;
     binitreq.bend_present = NULL;
@@ -1015,7 +1019,8 @@ static Z_DiagRecs *diagrecs(association *assoc, int error, char *addinfo)
 
 static Z_Records *pack_records(association *a, char *setname, int start,
                                int *num, Z_RecordComposition *comp,
-                               int *next, int *pres, oid_value format)
+                               int *next, int *pres, oid_value format,
+                               Z_ReferenceId *referenceId)
 {
     int oid[OID_SIZE];
     int recno, total_length = 0, toget = *num, dumped_records = 0;
@@ -1058,6 +1063,7 @@ static Z_Records *pack_records(association *a, char *setname, int start,
        freq.format = format;
        freq.stream = a->encode;
        freq.surrogate_flag = 0;
+       freq.referenceId = referenceId;
        if (!(fres = bend_fetch(a->backend, &freq, 0)))
        {
            *pres = Z_PRES_FAILURE;
@@ -1121,21 +1127,22 @@ static Z_Records *pack_records(association *a, char *setname, int start,
            }
        }
 
-       if (!(thisrec = (Z_NamePlusRecord *)odr_malloc(a->encode, sizeof(*thisrec))))
+       if (!(thisrec = (Z_NamePlusRecord *)
+             odr_malloc(a->encode, sizeof(*thisrec))))
            return 0;
        if (!(thisrec->databaseName = (char *)odr_malloc(a->encode,
            strlen(fres->basename) + 1)))
            return 0;
        strcpy(thisrec->databaseName, fres->basename);
        thisrec->which = Z_NamePlusRecord_databaseRecord;
-       if (!(thisrec->u.databaseRecord = thisext = (Z_External *)odr_malloc(a->encode,
-           sizeof(Z_DatabaseRecord))))
+       if (!(thisrec->u.databaseRecord = thisext = (Z_External *)
+             odr_malloc(a->encode, sizeof(Z_DatabaseRecord))))
            return 0;
        recform.proto = a->proto;
        recform.oclass = CLASS_RECSYN;
        recform.value = fres->format;
-       thisext->direct_reference = odr_oiddup(a->encode,
-                                              oid_ent_to_oid(&recform, oid));
+       thisext->direct_reference =
+           odr_oiddup(a->encode, oid_ent_to_oid(&recform, oid));
        thisext->indirect_reference = 0;
        thisext->descriptor = 0;
        if (fres->len < 0) /* Structured data */
@@ -1185,8 +1192,8 @@ static Z_Records *pack_records(association *a, char *setname, int start,
            if (!(thisext->u.octet_aligned = (Odr_oct *)odr_malloc(a->encode,
                sizeof(Odr_oct))))
                return 0;
-           if (!(thisext->u.octet_aligned->buf = (unsigned char *)odr_malloc(a->encode,
-               fres->len)))
+           if (!(thisext->u.octet_aligned->buf = (unsigned char *)
+                 odr_malloc(a->encode, fres->len)))
                return 0;
            memcpy(thisext->u.octet_aligned->buf, fres->record, fres->len);
            thisext->u.octet_aligned->len = thisext->u.octet_aligned->size =
@@ -1208,11 +1215,11 @@ static Z_APDU *process_searchRequest(association *assoc, request *reqb,
        (bend_search_rr *)nmem_malloc (reqb->request_mem, sizeof(*bsrr));
     
     logf(LOG_LOG, "Got SearchRequest.");
-    save_referenceId (reqb, req->referenceId);
-    /* store ref id in request */
     bsrr->fd = fd;
     bsrr->request = reqb;
     bsrr->association = assoc;
+    bsrr->referenceId = req->referenceId;
+    save_referenceId (reqb, bsrr->referenceId);
 
     logf (LOG_LOG, "ResultSet '%s'", req->resultSetName);
     if (req->databaseNames)
@@ -1253,9 +1260,10 @@ static Z_APDU *process_searchRequest(association *assoc, request *reqb,
        bsrq.num_bases = req->num_databaseNames;
        bsrq.basenames = req->databaseNames;
        bsrq.query = req->query;
+        bsrq.referenceId = req->referenceId;
        bsrq.stream = assoc->encode;
        bsrq.decode = assoc->decode;
-       if (!(bsrt = bend_search(assoc->backend, &bsrq, fd)))
+       if (!(bsrt = bend_search (assoc->backend, &bsrq, fd)))
            return 0;
        bsrr->hits = bsrt->hits;
        bsrr->errcode = bsrt->errcode;
@@ -1278,7 +1286,8 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb,
 {
     Z_SearchRequest *req = reqb->request->u.searchRequest;
     Z_APDU *apdu = (Z_APDU *)odr_malloc (assoc->encode, sizeof(*apdu));
-    Z_SearchResponse *resp = (Z_SearchResponse *)odr_malloc (assoc->encode, sizeof(*resp));
+    Z_SearchResponse *resp = (Z_SearchResponse *)
+       odr_malloc (assoc->encode, sizeof(*resp));
     int *nulint = (int *)odr_malloc (assoc->encode, sizeof(*nulint));
     bool_t *sr = (bool_t *)odr_malloc (assoc->encode, sizeof(*sr));
     int *next = (int *)odr_malloc (assoc->encode, sizeof(*next));
@@ -1351,7 +1360,7 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb,
            else
                form = prefformat->value;
            resp->records = pack_records(assoc, req->resultSetName, 1,
-               toget, compp, next, presst, form);
+               toget, compp, next, presst, form, req->referenceId);
            if (!resp->records)
                return 0;
            resp->numberOfRecordsReturned = toget;
@@ -1410,19 +1419,22 @@ static Z_APDU *process_presentRequest(association *assoc, request *reqb,
        form = prefformat->value;
     if (assoc->bend_present)
     {
-       bend_present_rr *bprr = (bend_present_rr *)nmem_malloc (reqb->request_mem, sizeof(*bprr));
+       bend_present_rr *bprr = (bend_present_rr *)
+           nmem_malloc (reqb->request_mem, sizeof(*bprr));
        bprr->setname = req->resultSetId;
        bprr->start = *req->resultSetStartPoint;
        bprr->number = *req->numberOfRecordsRequested;
        bprr->format = form;
        bprr->comp = req->recordComposition;
+       bprr->referenceId = req->referenceId;
        bprr->stream = assoc->encode;
        bprr->request = reqb;
        bprr->association = assoc;
        bprr->errcode = 0;
        bprr->errstring = NULL;
-       ((int (*)(void *, bend_present_rr *))(*assoc->bend_present))(assoc->backend, bprr);
-
+       ((int (*)(void *, bend_present_rr *))(*assoc->bend_present))(
+           assoc->backend, bprr);
+       
        if (!bprr->request)
            return 0;
     }
@@ -1442,7 +1454,8 @@ static Z_APDU *process_presentRequest(association *assoc, request *reqb,
     
     resp->records =
        pack_records(assoc, req->resultSetId, *req->resultSetStartPoint,
-                    num, req->recordComposition, next, presst, form);
+                    num, req->recordComposition, next, presst, form,
+                     req->referenceId);
     if (!resp->records)
        return 0;
     resp->numberOfRecordsReturned = num;
@@ -1460,11 +1473,14 @@ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd)
 {
     Z_ScanRequest *req = reqb->request->u.scanRequest;
     Z_APDU *apdu = (Z_APDU *)odr_malloc (assoc->encode, sizeof(*apdu));
-    Z_ScanResponse *res = (Z_ScanResponse *)odr_malloc (assoc->encode, sizeof(*res));
-    int *scanStatus = (int *)odr_malloc (assoc->encode, sizeof(*scanStatus));
-    int *numberOfEntriesReturned =
-         (int *)odr_malloc (assoc->encode, sizeof(*numberOfEntriesReturned));
-    Z_ListEntries *ents = (Z_ListEntries *)odr_malloc (assoc->encode, sizeof(*ents));
+    Z_ScanResponse *res = (Z_ScanResponse *)
+       odr_malloc (assoc->encode, sizeof(*res));
+    int *scanStatus = (int *)
+       odr_malloc (assoc->encode, sizeof(*scanStatus));
+    int *numberOfEntriesReturned = (int *)
+       odr_malloc (assoc->encode, sizeof(*numberOfEntriesReturned));
+    Z_ListEntries *ents = (Z_ListEntries *)
+       odr_malloc (assoc->encode, sizeof(*ents));
     Z_DiagRecs *diagrecs_p = NULL;
     oident *attent;
     bend_scanrequest srq;
@@ -1508,6 +1524,7 @@ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd)
        srq.basenames = req->databaseNames;
        srq.num_entries = *req->numberOfTermsRequested;
        srq.term = req->termListAndStartPoint;
+       srq.referenceId = req->referenceId;
        srq.stream = assoc->encode;
        if (!(attset = oid_getentbyoid(req->attributeSet)) ||
            attset->oclass != CLASS_RECSYN)
@@ -1590,8 +1607,10 @@ static Z_APDU *process_sortRequest(association *assoc, request *reqb,
     int *fd)
 {
     Z_SortRequest *req = reqb->request->u.sortRequest;
-    Z_SortResponse *res = (Z_SortResponse *)odr_malloc (assoc->encode, sizeof(*res));
-    bend_sort_rr *bsrr = (bend_sort_rr *)odr_malloc (assoc->encode, sizeof(*bsrr));
+    Z_SortResponse *res = (Z_SortResponse *)
+       odr_malloc (assoc->encode, sizeof(*res));
+    bend_sort_rr *bsrr = (bend_sort_rr *)
+       odr_malloc (assoc->encode, sizeof(*bsrr));
 
     Z_APDU *apdu = (Z_APDU *)odr_malloc (assoc->encode, sizeof(*apdu));
 
@@ -1604,6 +1623,7 @@ static Z_APDU *process_sortRequest(association *assoc, request *reqb,
     bsrr->num_input_setnames = req->inputResultSetNames->num_strings;
     bsrr->input_setnames = req->inputResultSetNames->strings;
 #endif
+    bsrr->referenceId = req->referenceId;
     bsrr->output_setname = req->sortedResultSetName;
     bsrr->sort_sequence = req->sortSequence;
     bsrr->stream = assoc->encode;
@@ -1611,11 +1631,13 @@ static Z_APDU *process_sortRequest(association *assoc, request *reqb,
     bsrr->sort_status = Z_SortStatus_failure;
     bsrr->errcode = 0;
     bsrr->errstring = 0;
-
-    ((int (*)(void *, bend_sort_rr *))(*assoc->bend_sort))(assoc->backend, bsrr);
-
-    res->referenceId = req->referenceId;
-    res->sortStatus = (int *)odr_malloc (assoc->encode, sizeof(*res->sortStatus));
+    
+    ((int (*)(void *, bend_sort_rr *))(*assoc->bend_sort))(assoc->backend,
+                                                          bsrr);
+    
+    res->referenceId = bsrr->referenceId;
+    res->sortStatus = (int *)
+       odr_malloc (assoc->encode, sizeof(*res->sortStatus));
     *res->sortStatus = bsrr->sort_status;
     res->resultSetStatus = 0;
     if (bsrr->errcode)
@@ -1658,6 +1680,7 @@ static Z_APDU *process_deleteRequest(association *assoc, request *reqb,
     bdrr->setnames = req->resultSetList;
     bdrr->stream = assoc->encode;
     bdrr->function = *req->deleteFunction;
+    bdrr->referenceId = req->referenceId;
 
     ((int (*)(void *, bend_delete_rr *))
      (*assoc->bend_delete))(assoc->backend, bdrr);
@@ -1701,8 +1724,8 @@ static void process_close(association *assoc, request *reqb)
        req->diagnosticInformation : "NULL");
     if (assoc->version < 3) /* to make do_force respond with close */
        assoc->version = 3;
-    do_close_req(assoc, Z_Close_finished, "Association terminated by client",
-                reqb);
+    do_close_req(assoc, Z_Close_finished,
+                "Association terminated by client", reqb);
 }
 
 void save_referenceId (request *reqb, Z_ReferenceId *refid)
@@ -1766,7 +1789,6 @@ void *bend_request_getdata(bend_request r)
     return r->clientData;
 }
 
-/* Chas: Added in from DALI */
 static Z_APDU *process_ESRequest(association *assoc, request *reqb, int *fd)
 {
     bend_esrequest_rr esrequest;
@@ -1784,9 +1806,10 @@ static Z_APDU *process_ESRequest(association *assoc, request *reqb, int *fd)
     esrequest.errstring = NULL;
     esrequest.request = reqb;
     esrequest.association = assoc;
+    esrequest.referenceId = req->referenceId;
     
-    ((int (*)(void *, bend_esrequest_rr *))(*assoc->bend_esrequest))(assoc->backend,
-                                                                  &esrequest);
+    ((int (*)(void *, bend_esrequest_rr *))(*assoc->bend_esrequest))
+       (assoc->backend, &esrequest);
     
     /* If the response is being delayed, return NULL */
     if (esrequest.request == NULL)
@@ -1812,5 +1835,3 @@ static Z_APDU *process_ESRequest(association *assoc, request *reqb, int *fd)
 
     return apdu;
 }
-
-/* Chas: End of addition from DALI */
index 518226b..d72cf70 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: nmem.c,v $
- * Revision 1.15  1999-02-11 09:10:26  adam
+ * Revision 1.16  1999-03-31 11:18:25  adam
+ * Implemented odr_strdup. Added Reference ID to backend server API.
+ *
+ * Revision 1.15  1999/02/11 09:10:26  adam
  * Function nmem_init only mandatory on Windows.
  *
  * Revision 1.14  1999/02/02 13:57:40  adam
@@ -181,7 +184,10 @@ void *nmem_malloc(NMEM n, int size)
                      n, size);
 #endif
     if (!n)
+    {
+        abort ();
        return xmalloc(size);
+    }
 #ifdef WIN32
     assert (nmem_init_flag);
 #endif
index 2b9c103..cd4a5ae 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: read-grs.c,v $
- * Revision 1.2  1998-02-11 11:53:36  adam
+ * Revision 1.3  1999-03-31 11:18:25  adam
+ * Implemented odr_strdup. Added Reference ID to backend server API.
+ *
+ * Revision 1.2  1998/02/11 11:53:36  adam
  * Changed code so that it compiles as C++.
  *
  * Revision 1.1  1997/09/01 08:55:53  adam
@@ -71,15 +74,16 @@ Z_GenericRecord *read_grs1(FILE *f, ODR o)
        if (!r)
        {
            r = (Z_GenericRecord *)odr_malloc(o, sizeof(*r));
-           r->elements = (Z_TaggedElement **)odr_malloc(o, sizeof(Z_TaggedElement*) *
-               GRS_MAX_FIELDS);
+           r->elements = (Z_TaggedElement **)
+                odr_malloc(o, sizeof(Z_TaggedElement*) * GRS_MAX_FIELDS);
            r->num_elements = 0;
        }
-       r->elements[r->num_elements] = t = (Z_TaggedElement *)odr_malloc(o,
-           sizeof(Z_TaggedElement));
+       r->elements[r->num_elements] = t = (Z_TaggedElement *)
+            odr_malloc(o, sizeof(Z_TaggedElement));
        t->tagType = (int *)odr_malloc(o, sizeof(int));
        *t->tagType = type;
-       t->tagValue = (Z_StringOrNumeric *)odr_malloc(o, sizeof(Z_StringOrNumeric));
+       t->tagValue = (Z_StringOrNumeric *)
+            odr_malloc(o, sizeof(Z_StringOrNumeric));
        if ((ivalue = atoi(value)))
        {
            t->tagValue->which = Z_StringOrNumeric_numeric;
@@ -105,8 +109,7 @@ Z_GenericRecord *read_grs1(FILE *f, ODR o)
        {
            c->which = Z_ElementData_string;
            buf[strlen(buf)-1] = '\0';
-           c->u.string = (char *)odr_malloc(o, strlen(buf)+1);
-           strcpy(c->u.string, buf);
+           c->u.string = odr_strdup(o, buf);
        }
        r->num_elements++;
     }