Added Explain encoders/decoders to the service-level API. Untested.
Added GRS-1 encoders/decoders to the service-level API. Lightly tested.
-Test-client will ask for and ODR pretty-print GRS1. Ztest will return
-dummy records.
+Test-client will ask for and print GRS1. Ztest will return dummy records
+on request.
+
+Added Extended Services: Item Order encoders and decoders to the Service-
+level API. Untested. Would anyone be willing to fax or mail the pertinent
+bits of the ILL protocol to us?
Moved pretty-printing of structure-wrappers ({..}) from odr_seq.c to
odr_cons.c, which causes a more correct output.
was always set to 0 when no records were requested in the searchRequest.
* Added better external-handling. This shouldn't harm old code that *encodes*
-externals. It will break code that looks for a 'single-ASN1-type'
+externals. It can break code that looks for a 'single-ASN1-type'
representation, since those types that are known are now decoded
immediately. Look at the SUTRS sample code in seshigh.c and client.c.
Documentation updated.
+Better, but backwards-compatible handling of records in bend_fetchresponse.
+Length -1 marks structured record, type is deduced from format field.
+
--- 1.0b2 1995/06/27
Fairly quick maintenance release to add SUTRS support.
# Copyright (C) 1994, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.18 1995-08-17 12:44:59 quinn Exp $
+# $Id: Makefile,v 1.19 1995-08-21 09:10:13 quinn Exp $
SHELL=/bin/sh
INCLUDE=-I../include -I.
DEFS=$(INCLUDE)
LIB=$(LIBDIR)/libasn.a
LIBS=-lodr -lasn
-PO = proto.o diagbib1.o zget.o prt-rsc.o prt-acc.o prt-exp.o prt-ext.o prt-grs.o
+PO = proto.o diagbib1.o zget.o prt-rsc.o prt-acc.o prt-exp.o prt-ext.o \
+ prt-grs.o prt-exd.o
CPP=$(CC) -E
RANLIB=ranlib
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: proto.c,v $
- * Revision 1.36 1995-08-15 11:59:39 quinn
+ * Revision 1.37 1995-08-21 09:10:15 quinn
+ * Smallish fixes to suppport new formats.
+ *
+ * Revision 1.36 1995/08/15 11:59:39 quinn
* Updated External
*
* Revision 1.35 1995/08/10 08:53:59 quinn
/* ------------------------ APDU ------------------------- */
+int z_Permissions(ODR o, Z_Permissions **p, int opt)
+{
+ if (!odr_sequence_begin(o, p, sizeof(**p)))
+ return opt && odr_ok(o);
+ return
+ odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT,
+ 1, 0) &&
+ odr_implicit_settag(o, ODR_CONTEXT, 2) &&
+ odr_sequence_of(o, odr_integer, &(*p)->allowableFunctions,
+ &(*p)->num_allowableFunctions) &&
+ odr_sequence_end(o);
+}
+
+int z_ExtendedServicesRequest(ODR o, Z_ExtendedServicesRequest **p, int opt)
+{
+ if (!odr_sequence_begin(o, p, sizeof(**p)))
+ return opt && odr_ok(o);
+ return
+ z_ReferenceId(o, &(*p)->referenceId, 1) &&
+ odr_implicit(o, odr_integer, &(*p)->function, ODR_CONTEXT, 3, 0) &&
+ odr_implicit(o, odr_oid, &(*p)->packageType, ODR_CONTEXT, 4, 0) &&
+ odr_implicit(o, z_InternationalString, &(*p)->packageName, ODR_CONTEXT, 5, 1) &&
+ odr_implicit(o, z_InternationalString, &(*p)->userId, ODR_CONTEXT, 6, 1) &&
+ odr_implicit(o, z_IntUnit, &(*p)->retentionTime, ODR_CONTEXT, 7, 1) &&
+ odr_implicit(o, z_Permissions, &(*p)->permissions, ODR_CONTEXT, 8, 1) &&
+ odr_implicit(o, z_InternationalString, &(*p)->description, ODR_CONTEXT, 9, 1) &&
+ odr_implicit(o, z_External, &(*p)->taskSpecificParameters, ODR_CONTEXT, 10, 1) &&
+ odr_implicit(o, odr_integer, &(*p)->waitAction, ODR_CONTEXT, 11, 0) &&
+ z_ElementSetName(o, &(*p)->elements, 1) &&
+ z_OtherInformation(o, &(*p)->otherInfo, 1) &&
+ odr_sequence_end(o);
+}
+
+int z_ExtendedServicesResponse(ODR o, Z_ExtendedServicesResponse **p, int opt)
+{
+ if (!odr_sequence_begin(o, p, sizeof(**p)))
+ return opt && odr_ok(o);
+ return
+ z_ReferenceId(o, &(*p)->referenceId, 1) &&
+ odr_implicit(o, odr_integer, &(*p)->operationStatus, ODR_CONTEXT, 3, 0) &&
+ odr_implicit_settag(o, ODR_CONTEXT, 4) &&
+ (odr_sequence_of(o, z_DiagRec, &(*p)->diagnostics,
+ &(*p)->num_diagnostics) || odr_ok(o)) &&
+ odr_implicit(o, z_External, &(*p)->taskPackage, ODR_CONTEXT, 5, 1) &&
+ z_OtherInformation(o, &(*p)->otherInfo, 1) &&
+ odr_sequence_end(o);
+}
+
+/* ------------------------ APDU ------------------------- */
+
int z_APDU(ODR o, Z_APDU **p, int opt)
{
static Odr_arm arm[] =
{ODR_IMPLICIT, ODR_CONTEXT, 35, Z_APDU_scanRequest, z_ScanRequest},
{ODR_IMPLICIT, ODR_CONTEXT, 36, Z_APDU_scanResponse, z_ScanResponse},
{ODR_IMPLICIT, ODR_CONTEXT, 45, Z_APDU_segmentRequest, z_Segment},
+ {ODR_IMPLICIT, ODR_CONTEXT, 46, Z_APDU_extendedServicesRequest,
+ z_ExtendedServicesRequest},
+ {ODR_IMPLICIT, ODR_CONTEXT, 47, Z_APDU_extendedServicesResponse,
+ z_ExtendedServicesResponse},
{ODR_IMPLICIT, ODR_CONTEXT, 48, Z_APDU_close, z_Close},
{-1, -1, -1, -1, 0}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: prt-ext.c,v $
- * Revision 1.2 1995-08-17 12:45:00 quinn
+ * Revision 1.3 1995-08-21 09:10:18 quinn
+ * Smallish fixes to suppport new formats.
+ *
+ * Revision 1.2 1995/08/17 12:45:00 quinn
* Fixed minor problems with GRS-1. Added support in c&s.
*
* Revision 1.1 1995/08/15 13:37:41 quinn
{ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_promptObject1,
z_PromptObject1},
{ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_grs1, z_GenericRecord},
+ {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_extendedService,
+ z_TaskPackage},
+ {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_itemOrder, z_ItemOrder},
{-1, -1, -1, -1, 0}
};
/*
* OF THIS SOFTWARE.
*
* $Log: proto.h,v $
- * Revision 1.22 1995-08-17 12:45:14 quinn
+ * Revision 1.23 1995-08-21 09:10:36 quinn
+ * Smallish fixes to suppport new formats.
+ *
+ * Revision 1.22 1995/08/17 12:45:14 quinn
* Fixed minor problems with GRS-1. Added support in c&s.
*
* Revision 1.21 1995/08/15 12:00:11 quinn
Z_OtherInformation *otherInfo; /* OPTIONAL */
} Z_Segment;
+/* ----------------------- Extended Services ---------------- */
+
+typedef struct Z_Permissions
+{
+ char *userId;
+ int num_allowableFunctions;
+ int **allowableFunctions;
+#define Z_Permissions_delete 1
+#define Z_Permissions_modifyContents 2
+#define Z_Permissions_modifyPermissions 3
+#define Z_Permissions_present 4
+#define Z_Permissions_invoke 5
+} Z_Permissions;
+
+typedef struct Z_ExtendedServicesRequest
+{
+ Z_ReferenceId *referenceId; /* OPTIONAL */
+ int *function;
+#define Z_ExtendedServicesRequest_create 1
+#define Z_ExtendedServicesRequest_delete 2
+#define Z_ExtendedServicesRequest_modify 3
+ Odr_oid *packageType;
+ char *packageName; /* OPTIONAL */
+ char *userId; /* OPTIONAL */
+ Z_IntUnit *retentionTime; /* OPTIONAL */
+ Z_Permissions *permissions; /* OPTIONAL */
+ char *description; /* OPTIONAL */
+ Z_External *taskSpecificParameters; /* OPTIONAL */
+ int *waitAction;
+#define Z_ExtendedServicesRequest_wait 1
+#define Z_ExtendedServicesRequest_waitIfPossible 2
+#define Z_ExtendedServicesRequest_dontWait 3
+#define Z_ExtendedServicesRequest_dontReturnPackage 4
+ char *elements; /* OPTIONAL */
+ Z_OtherInformation *otherInfo; /* OPTIONAL */
+} Z_ExtendedServicesRequest;
+
+typedef struct Z_ExtendedServicesResponse
+{
+ Z_ReferenceId *referenceId; /* OPTIONAL */
+ int *operationStatus;
+#define Z_ExtendedServicesResponse_done 1
+#define Z_ExtendedServicesResponse_accepted 2
+#define Z_ExtendedServicesResponse_failure 3
+ int num_diagnostics;
+ Z_DiagRec **diagnostics; /* OPTIONAL */
+ Z_External *taskPackage; /* OPTIONAL */
+ Z_OtherInformation *otherInfo; /* OPTIONAL */
+} Z_ExtendedServicesResponse;
/* ------------------------ APDU ---------------------------- */
Z_APDU_scanRequest,
Z_APDU_scanResponse,
Z_APDU_segmentRequest,
+ Z_APDU_extendedServicesRequest,
+ Z_APDU_extendedServicesResponse,
Z_APDU_close
} which;
union
Z_ScanRequest *scanRequest;
Z_ScanResponse *scanResponse;
Z_Segment *segmentRequest;
+ Z_ExtendedServicesRequest *extendedServicesRequest;
+ Z_ExtendedServicesResponse *extendedServicesResponse;
Z_Close *close;
} u;
} Z_APDU;
int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt);
int z_Term(ODR o, Z_Term **p, int opt);
int z_Specification(ODR o, Z_Specification **p, int opt);
+int z_Permissions(ODR o, Z_Permissions **p, int opt);
+int z_DiagRec(ODR o, Z_DiagRec **p, int opt);
Z_APDU *zget_APDU(ODR o, enum Z_APDU_which which);
#include <prt-rsc.h>
#include <prt-acc.h>
#include <prt-exp.h>
#include <prt-grs.h>
+#include <prt-exd.h>
#include <prt-ext.h>
Z_External_resourceReport1,
Z_External_resourceReport2,
Z_External_promptObject1,
- Z_External_grs1
+ Z_External_grs1,
+ Z_External_extendedService,
+ Z_External_itemOrder
} which;
union
{
Z_ResourceReport2 *resourceReport2;
Z_PromptObject1 *promptObject1;
Z_GenericRecord *grs1;
+ Z_TaskPackage *extendedService;
+ Z_ItemOrder *itemOrder;
} u;
};
int odr_seek(ODR o, int whence, int offset);
int odr_dumpBER(FILE *f, char *buf, int len);
void odr_choice_bias(ODR o, int what);
+int odr_total(ODR o);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: odr_mem.c,v $
- * Revision 1.5 1995-05-16 08:50:55 quinn
+ * Revision 1.6 1995-08-21 09:10:41 quinn
+ * Smallish fixes to suppport new formats.
+ *
+ * Revision 1.5 1995/05/16 08:50:55 quinn
* License, documentation, and memory fixes
*
* Revision 1.4 1995/05/15 11:56:09 quinn
char *buf;
int size;
int top;
+ int total;
struct odr_memblock *next;
} odr_memblock;
abort();
}
r->top = 0;
+ r->total = 0;
return r;
}
abort();
else
{
+ if (o->mem)
+ p->total = o->mem->total;
p->next = o->mem;
o->mem = p;
}
r = p->buf + p->top;
/* align size */
p->top += (size + (sizeof(long) - 1)) & ~(sizeof(long) - 1);
+ p->total += size;
return r;
}
+int odr_total(ODR o)
+{
+ return o->mem ? o->mem->total : 0;
+}
+
/* ---------- memory management for data encoding ----------*/
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: seshigh.c,v $
- * Revision 1.44 1995-08-17 12:45:25 quinn
+ * Revision 1.45 1995-08-21 09:11:00 quinn
+ * Smallish fixes to suppport new formats.
+ *
+ * Revision 1.44 1995/08/17 12:45:25 quinn
* Fixed minor problems with GRS-1. Added support in c&s.
*
* Revision 1.43 1995/08/15 12:00:31 quinn
bend_fetchresult *fres;
Z_NamePlusRecord *thisrec;
Z_DatabaseRecord *thisext;
-
+ int this_length;
+
+ /*
+ * we get the number of bytes allocated on the stream before any
+ * allocation done by the backend - this should give us a reasonable
+ * idea of the total size of the data so far.
+ */
+ total_length = odr_total(a->encode);
if (reclist.num_records == MAX_RECORDS - 1)
{
*pres = Z_PRES_PARTIAL_2;
*pres = Z_PRES_FAILURE;
return diagrec(a->proto, fres->errcode, fres->errstring);
}
+ if (fres->len >= 0)
+ this_length = fres->len;
+ else
+ this_length = odr_total(a->encode) - total_length;
logf(LOG_DEBUG, " fetched record, len=%d, total=%d",
- fres->len, total_length);
- if (fres->len + total_length > a->preferredMessageSize)
+ this_length, total_length);
+ if (this_length + total_length > a->preferredMessageSize)
{
/* record is small enough, really */
- if (fres->len <= a->preferredMessageSize)
+ if (this_length <= a->preferredMessageSize)
{
logf(LOG_DEBUG, " Dropped last normal-sized record");
*pres = Z_PRES_PARTIAL_2;
break;
}
/* record can only be fetched by itself */
- if (fres->len < a->maximumRecordSize)
+ if (this_length < a->maximumRecordSize)
{
logf(LOG_DEBUG, " Record > prefmsgsz");
if (toget > 1)
reclist.records[reclist.num_records] =
surrogatediagrec(a->proto, fres->basename, 16, 0);
reclist.num_records++;
- total_length += 10; /* totally arbitrary */
continue;
}
}
reclist.records[reclist.num_records] =
surrogatediagrec(a->proto, fres->basename, 17, 0);
reclist.num_records++;
- total_length += 10; /* totally arbitrary */
continue;
}
}
}
reclist.records[reclist.num_records] = thisrec;
reclist.num_records++;
- total_length += fres->len;
*next = fres->last_in_set ? 0 : recno + 1;
}
*num = reclist.num_records;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: oid.c,v $
- * Revision 1.1 1995-05-29 08:17:13 quinn
+ * Revision 1.2 1995-08-21 09:11:16 quinn
+ * Smallish fixes to suppport new formats.
+ *
+ * Revision 1.1 1995/05/29 08:17:13 quinn
* iMoved oid to util to support comstack.
*
* Revision 1.5 1995/05/22 11:30:16 quinn
{PROTO_SR, CLASS_RECSYN, VAL_CANMARC, {5,17,-1}, "Canmarc" },
{PROTO_SR, CLASS_RECSYN, VAL_SBN, {5,18,-1}, "SBN" },
{PROTO_SR, CLASS_RECSYN, VAL_PICAMARC, {5,19,-1}, "Picamarc" },
+ {PROTO_SR, CLASS_RECSYN, VAL_AUSMARC, {5,20,-1}, "Ausmarc" },
+ {PROTO_SR, CLASS_RECSYN, VAL_IBERMARC, {5,21,-1}, "Ibermarc" },
+ {PROTO_SR, CLASS_RECSYN, VAL_EXPLAIN, {5,100,-1}, "Explain" },
+ {PROTO_SR, CLASS_RECSYN, VAL_SUTRS, {5,101,-1}, "SUTRS" },
+ {PROTO_SR, CLASS_RECSYN, VAL_OPAC, {5,102,-1}, "OPAC" },
+ {PROTO_SR, CLASS_RECSYN, VAL_SUMMARY, {5,103,-1}, "Summary" },
+ {PROTO_SR, CLASS_RECSYN, VAL_GRS0, {5,104,-1}, "GRS-0" },
+ {PROTO_SR, CLASS_RECSYN, VAL_GRS1, {5,105,-1}, "GRS-1" },
+ {PROTO_SR, CLASS_RECSYN, VAL_EXTENDED, {5,106,-1}, "Extended" },
+ {PROTO_SR, CLASS_RESFORM, VAL_RESOURCE1, {7,1,-1}, "Resource-1" },
+ {PROTO_SR, CLASS_RESFORM, VAL_RESOURCE2, {7,2,-1}, "Resource-2" },
+ {PROTO_SR, CLASS_ACCFORM, VAL_PROMPT1, {8,1,-1}, "Prompt-1" },
+ {PROTO_SR, CLASS_ACCFORM, VAL_DES1, {8,2,-1}, "Des-1" },
+ {PROTO_SR, CLASS_ACCFORM, VAL_KRB1, {8,3,-1}, "Krb-1" },
+ {PROTO_SR, CLASS_EXTSERV, VAL_PRESSET, {9,1,-1}, "Pers. set" },
+ {PROTO_SR, CLASS_EXTSERV, VAL_PQUERY, {9,2,-1}, "Pers. query" },
+ {PROTO_SR, CLASS_EXTSERV, VAL_PCQUERY, {9,3,-1}, "Per'd query" },
+ {PROTO_SR, CLASS_EXTSERV, VAL_ITEMORDER, {9,4,-1}, "Item order" },
+ {PROTO_SR, CLASS_EXTSERV, VAL_DBUPDATE, {9,5,-1}, "DB. Update" },
+ {PROTO_SR, CLASS_EXTSERV, VAL_EXPORTSPEC,{9,6,-1}, "exp. spec." },
+ {PROTO_SR, CLASS_EXTSERV, VAL_EXPORTINV, {9,7,-1}, "exp. inv." },
{0, 0, 0, {-1}, 0 }
};