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.
# 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
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
* 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
{
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;
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));
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;
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;
/*
- * 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
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 */
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 */
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;
{
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 */
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 */
};
typedef enum {
- BEND_SCAN_SUCCESS, /* ok */
+ BEND_SCAN_SUCCESS, /* ok */
BEND_SCAN_PARTIAL /* not all entries could be found */
} bend_scan_status;
int function;
int num_setnames;
char **setnames;
+ Z_ReferenceId *referenceId;
int delete_status;
ODR stream;
} bend_delete_rr;
char *output_setname;
Z_SortKeySpecList *sort_sequence;
ODR stream;
+ Z_ReferenceId *referenceId;/* reference ID */
int sort_status;
int errcode;
{
int ItemNo;
Z_ExtendedServicesRequest *esr;
+
ODR stream; /* encoding stream */
+ Z_ReferenceId *referenceId;/* reference ID */
bend_request request;
bend_association association;
int errcode; /* 0==success */
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);
* 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
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)
* 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
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;
* 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.
*
{
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",
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;
* 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.
*
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;
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;
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;
}
}
- 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 */
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 =
(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)
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;
{
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));
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;
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;
}
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;
{
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;
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)
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));
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;
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)
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);
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)
return r->clientData;
}
-/* Chas: Added in from DALI */
static Z_APDU *process_ESRequest(association *assoc, request *reqb, int *fd)
{
bend_esrequest_rr esrequest;
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)
return apdu;
}
-
-/* Chas: End of addition from DALI */
* 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
n, size);
#endif
if (!n)
+ {
+ abort ();
return xmalloc(size);
+ }
#ifdef WIN32
assert (nmem_init_flag);
#endif
* 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
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;
{
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++;
}