/*
- * Copyright (c) 1995-2000, Index Data
+ * Copyright (c) 1995-2001, Index Data
* See the file LICENSE for details.
*
* $Log: seshigh.c,v $
- * Revision 1.111 2000-11-23 10:58:32 adam
+ * Revision 1.114 2001-02-21 13:46:53 adam
+ * C++ fixes.
+ *
+ * Revision 1.113 2001/01/30 21:34:17 adam
+ * Added step-size for Scan backend interface.
+ *
+ * Revision 1.112 2001/01/29 09:38:22 adam
+ * Fixed bug that made the frontend server crash when no attribute set
+ * was specified for scan.
+ *
+ * Revision 1.111 2000/11/23 10:58:32 adam
* SSL comstack support. Separate POSIX thread support library.
*
* Revision 1.110 2000/10/02 13:05:32 adam
char options[100];
xfree (assoc->init);
- assoc->init = xmalloc (sizeof(*assoc->init));
+ assoc->init = (bend_initrequest *) xmalloc (sizeof(*assoc->init));
yaz_log(LOG_LOG, "Got initRequest");
if (req->implementationId)
* These functions should be merged.
*/
-static void set_addinfo (Z_DefaultDiagFormat *dr, char *addinfo)
+static void set_addinfo (Z_DefaultDiagFormat *dr, char *addinfo, ODR odr)
{
#if ASN_COMPILED
dr->which = Z_DefaultDiagFormat_v2Addinfo;
- dr->u.v2Addinfo = addinfo ? addinfo : "";
+ dr->u.v2Addinfo = odr_strdup (odr, addinfo ? addinfo : "");
#else
dr->which = Z_DiagForm_v2AddInfo;
- dr->addinfo = addinfo ? addinfo : "";
+ dr->addinfo = odr_strdup (odr, addinfo ? addinfo : "");
#endif
}
dr->diagnosticSetId =
odr_oiddup (assoc->encode, oid_ent_to_oid(&bib1, oid));
dr->condition = err;
- set_addinfo (dr, addinfo);
+ set_addinfo (dr, addinfo, assoc->encode);
return rec;
}
dr->diagnosticSetId = odr_oiddup (assoc->encode,
oid_ent_to_oid(&bib1, oid));
dr->condition = err;
- set_addinfo (dr, addinfo);
+ set_addinfo (dr, addinfo, assoc->encode);
return rec;
}
#ifdef ASN_COMPILED
rec->which = Z_DefaultDiagFormat_v2Addinfo;
- rec->u.v2Addinfo = addinfo ? addinfo : "";
+ rec->u.v2Addinfo = odr_strdup (assoc->encode, addinfo ? addinfo : "");
#else
rec->which = Z_DiagForm_v2AddInfo;
- rec->addinfo = addinfo ? addinfo : "";
+ rec->addinfo = odr_strdup (assoc->encode, addinfo ? addinfo : "");
#endif
return recs;
}
return apdu;
}
-#if 0
-static int bend_default_scan (void *handle, bend_scan_rr *rr)
-{
- bend_scanrequest srq;
- bend_scanresult *srs;
-
- srq.num_bases = rr->num_bases;
- srq.basenames = rr->basenames;
- srq.attributeset = rr->attributeset;
- srq.referenceId = rr->referenceId;
- srq.term = rr->term;
- srq.term_position = rr->term_position;
- srq.num_entries = rr->num_entries;
- srq.stream = rr->stream;
- srq.print = rr->print;
-
- srs = bend_scan(handle, &srq, 0);
-
- rr->term_position = srs->term_position;
- rr->num_entries = srs->num_entries;
- rr->entries = srs->entries;
- rr->status = srs->status;
- rr->errcode = srs->errcode;
- rr->errstring = srs->errstring;
- return 0;
-}
-#endif
-
/*
* Scan was implemented rather in a hurry, and with support for only the basic
* elements of the service in the backend API. Suggestions are welcome.
apdu->which = Z_APDU_scanResponse;
apdu->u.scanResponse = res;
res->referenceId = req->referenceId;
- res->stepSize = 0;
+ res->stepSize = (int*) odr_malloc (assoc->encode, sizeof(*res->stepSize));
+ *res->stepSize = 0;
+ if (req->stepSize)
+ *res->stepSize = *req->stepSize;
res->scanStatus = scanStatus;
res->numberOfEntriesReturned = numberOfEntriesReturned;
res->positionOfTerm = 0;
bsrr->referenceId = req->referenceId;
bsrr->stream = assoc->encode;
bsrr->print = assoc->print;
+ bsrr->step_size = res->stepSize;
if (!(attset = oid_getentbyoid(req->attributeSet)) ||
attset->oclass != CLASS_RECSYN)
bsrr->attributeset = VAL_NONE;
else
bsrr->attributeset = attset->value;
- log_scan_term (req->termListAndStartPoint, attset->value);
+ log_scan_term (req->termListAndStartPoint, bsrr->attributeset);
bsrr->term_position = req->preferredPositionInResponse ?
*req->preferredPositionInResponse : 1;
((int (*)(void *, bend_scan_rr *))
if (bdrr->num_setnames > 0)
{
int i;
- bdrr->statuses = odr_malloc(assoc->encode, sizeof(*bdrr->statuses) *
- bdrr->num_setnames);
+ bdrr->statuses = (int*)
+ odr_malloc(assoc->encode, sizeof(*bdrr->statuses) *
+ bdrr->num_setnames);
for (i = 0; i < bdrr->num_setnames; i++)
bdrr->statuses[i] = 0;
}
if (bdrr->num_setnames > 0)
{
int i;
- res->deleteListStatuses = odr_malloc(assoc->encode,
- sizeof(*res->deleteListStatuses));
+ res->deleteListStatuses = (Z_ListStatuses *)
+ odr_malloc(assoc->encode, sizeof(*res->deleteListStatuses));
res->deleteListStatuses->num = bdrr->num_setnames;
res->deleteListStatuses->elements =
- odr_malloc (assoc->encode,
+ (Z_ListStatus **)
+ odr_malloc (assoc->encode,
sizeof(*res->deleteListStatuses->elements) *
bdrr->num_setnames);
for (i = 0; i<bdrr->num_setnames; i++)
{
res->deleteListStatuses->elements[i] =
+ (Z_ListStatus *)
odr_malloc (assoc->encode,
sizeof(**res->deleteListStatuses->elements));
res->deleteListStatuses->elements[i]->status = bdrr->statuses+i;