From f8ec9ce4a0624d49be64a0cce115846155b79e42 Mon Sep 17 00:00:00 2001 From: Sebastian Hammer Date: Thu, 10 Oct 1996 12:35:12 +0000 Subject: [PATCH] Added Update extended service. --- asn/prt-exd.c | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++- asn/prt-ext.c | 7 ++- include/prt-exd.h | 109 ++++++++++++++++++++++++++++++++++ include/prt-ext.h | 2 + util/oid.c | 7 ++- 5 files changed, 292 insertions(+), 4 deletions(-) diff --git a/asn/prt-exd.c b/asn/prt-exd.c index b8c94c3..521907c 100644 --- a/asn/prt-exd.c +++ b/asn/prt-exd.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-exd.c,v $ - * Revision 1.3 1995-09-29 17:11:54 quinn + * Revision 1.4 1996-10-10 12:35:12 quinn + * Added Update extended service. + * + * Revision 1.3 1995/09/29 17:11:54 quinn * Smallish * * Revision 1.2 1995/09/27 15:02:41 quinn @@ -197,3 +200,169 @@ int z_ItemOrder(ODR o, Z_ItemOrder **p, int opt) *p = 0; return opt && odr_ok(o); } + +/* ----------------------- ITEM UPDATE -------------------- */ + +int z_IUSuppliedRecordsId (ODR o, Z_IUSuppliedRecordsId **p, int opt) +{ + static Odr_arm arm[] = { + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_IUSuppliedRecordsId_timeStamp, + odr_generalizedtime}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_IUSuppliedRecordsId_versionNumber, + z_InternationalString}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_IUSuppliedRecordsId_previousVersion, + odr_external}, + {-1, -1, -1, -1, 0} + }; + if (!odr_initmember(o, p, sizeof(**p))) + return opt && odr_ok(o); + if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) + return 1; + *p = 0; + return opt && odr_ok(o); +} + +int z_IUCorrelationInfo (ODR o, Z_IUCorrelationInfo **p, int opt) +{ + if (!odr_sequence_begin (o, p, sizeof(**p))) + return opt && odr_ok (o); + return + odr_implicit (o, z_InternationalString, + &(*p)->note, ODR_CONTEXT, 1, 1) && + odr_implicit (o, odr_integer, + &(*p)->id, ODR_CONTEXT, 2, 1) && + odr_sequence_end (o); +} + +int z_IUSuppliedRecords_elem (ODR o, Z_IUSuppliedRecords_elem **p, int opt) +{ + static Odr_arm arm[] = { + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_IUSuppliedRecords_number, + odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_IUSuppliedRecords_string, + z_InternationalString}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_IUSuppliedRecords_opaque, + odr_octetstring}, + {-1, -1, -1, -1, 0} + }; + if (!odr_sequence_begin (o, p, sizeof(**p))) + return opt && odr_ok (o); + return + ((odr_constructed_begin (o, &(*p)->u, ODR_CONTEXT, 1) && + odr_choice (o, arm, &(*p)->u, &(*p)->which) && + odr_constructed_end (o)) || odr_ok(o)) && + odr_explicit (o, z_IUSuppliedRecordsId, + &(*p)->supplementalId, ODR_CONTEXT, 2, 1) && + odr_implicit (o, z_IUCorrelationInfo, + &(*p)->correlationInfo, ODR_CONTEXT, 3, 1) && + odr_implicit (o, odr_external, + &(*p)->record, ODR_CONTEXT, 4, 0) && + odr_sequence_end (o); +} + +int z_IUSuppliedRecords (ODR o, Z_IUSuppliedRecords **p, int opt) +{ + if (odr_initmember (o, p, sizeof(**p))) + return opt && odr_ok(o); + if (odr_sequence_of (o, z_IUSuppliedRecords_elem, &(*p)->elements, + &(*p)->num)) + return 1; + *p = 0; + return opt && odr_ok(o); +} + +int z_IUTaskPackageRecordStructure (ODR o, Z_IUTaskPackageRecordStructure **p, + int opt) +{ + static Odr_arm arm[] = { + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_IUTaskPackageRecordStructure_record, + odr_external}, + {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_IUTaskPackageRecordStructure_diagnostic, + z_DiagRec}, + {-1, -1, -1, -1, 0} + }; + if (!odr_sequence_begin (o, p, sizeof(**p))) + return opt && odr_ok (o); + return + ((odr_constructed_begin (o, &(*p)->u, ODR_CONTEXT, 1) && + odr_choice (o, arm, &(*p)->u, &(*p)->which) && + odr_constructed_end (o)) || odr_ok(o)) && + odr_implicit (o, z_IUCorrelationInfo, + &(*p)->correlationInfo, ODR_CONTEXT, 2, 1) && + odr_implicit (o, odr_integer, + &(*p)->recordStatus, ODR_CONTEXT, 3, 0) && + odr_sequence_end (o); +} + +int z_IUOriginPartToKeep (ODR o, Z_IUOriginPartToKeep **p, int opt) +{ + if (!odr_sequence_begin (o, p, sizeof(**p))) + return opt && odr_ok (o); + return + odr_implicit (o, odr_integer, + &(*p)->action, ODR_CONTEXT, 1, 0) && + odr_implicit (o, z_InternationalString, + &(*p)->databaseName, ODR_CONTEXT, 2, 0) && + odr_implicit (o, odr_oid, + &(*p)->schema, ODR_CONTEXT, 3, 1) && + odr_implicit (o, z_InternationalString, + &(*p)->elementSetName, ODR_CONTEXT, 4, 1) && + odr_sequence_end (o); +} + +int z_IUTargetPart (ODR o, Z_IUTargetPart **p, int opt) +{ + if (!odr_sequence_begin (o, p, sizeof(**p))) + return opt && odr_ok (o); + return + odr_implicit (o, odr_integer, + &(*p)->updateStatus, ODR_CONTEXT, 1, 0) && + odr_implicit_settag (o, ODR_CONTEXT, 2) && + (odr_sequence_of(o, z_DiagRec, &(*p)->globalDiagnostics, + &(*p)->num_globalDiagnostics) || odr_ok(o)) && + odr_implicit_settag (o, ODR_CONTEXT, 3) && + odr_sequence_of(o, z_IUTaskPackageRecordStructure, &(*p)->taskPackageRecords, + &(*p)->num_taskPackageRecords) && + odr_sequence_end (o); +} + +int z_IUUpdateEsRequest (ODR o, Z_IUUpdateEsRequest **p, int opt) +{ + if (!odr_sequence_begin (o, p, sizeof(**p))) + return opt && odr_ok (o); + return + odr_explicit (o, z_IUOriginPartToKeep, + &(*p)->toKeep, ODR_CONTEXT, 1, 0) && + odr_explicit (o, z_IUSuppliedRecords, + &(*p)->notToKeep, ODR_CONTEXT, 2, 0) && + odr_sequence_end (o); +} + +int z_IUUpdateTaskPackage (ODR o, Z_IUUpdateTaskPackage **p, int opt) +{ + if (!odr_sequence_begin (o, p, sizeof(**p))) + return opt && odr_ok (o); + return + odr_explicit (o, z_IUOriginPartToKeep, + &(*p)->originPart, ODR_CONTEXT, 1, 0) && + odr_explicit (o, z_IUTargetPart, + &(*p)->targetPart, ODR_CONTEXT, 2, 0) && + odr_sequence_end (o); +} + +int z_IUUpdate (ODR o, Z_IUUpdate **p, int opt) +{ + static Odr_arm arm[] = { + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_IUUpdate_esRequest, + z_IUUpdateEsRequest}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_IUUpdate_taskPackage, + z_IUUpdateTaskPackage}, + {-1, -1, -1, -1, 0} + }; + if (!odr_initmember(o, p, sizeof(**p))) + return opt && odr_ok(o); + if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) + return 1; + *p = 0; + return opt && odr_ok(o); +} diff --git a/asn/prt-ext.c b/asn/prt-ext.c index 42b1580..0a3bc39 100644 --- a/asn/prt-ext.c +++ b/asn/prt-ext.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-ext.c,v $ - * Revision 1.10 1996-10-09 15:54:55 quinn + * Revision 1.11 1996-10-10 12:35:13 quinn + * Added Update extended service. + * + * Revision 1.10 1996/10/09 15:54:55 quinn * Added SearchInfoReport * * Revision 1.9 1996/06/10 08:53:36 quinn @@ -59,6 +62,7 @@ static Z_ext_typeent type_table[] = {VAL_SUMMARY, Z_External_summary, z_BriefBib}, {VAL_OPAC, Z_External_OPAC, z_OPACRecord}, {VAL_SEARCHRES1, Z_External_searchResult1, z_SearchInfoReport}, + {VAL_DBUPDATE, Z_External_update, z_IUUpdate}, {VAL_NONE, 0, 0} }; @@ -102,6 +106,7 @@ int z_External(ODR o, Z_External **p, int opt) {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_OPAC, z_OPACRecord}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_searchResult1, z_SearchInfoReport}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_update}, {-1, -1, -1, -1, 0} }; diff --git a/include/prt-exd.h b/include/prt-exd.h index 97531b9..0b8bdce 100644 --- a/include/prt-exd.h +++ b/include/prt-exd.h @@ -145,4 +145,113 @@ typedef struct Z_ItemOrder int z_ItemOrder(ODR o, Z_ItemOrder **p, int opt); +/* ----------------------- ITEM UPDATE ------------------------ */ + +typedef struct Z_IUSuppliedRecordsId +{ + int which; +#define Z_IUSuppliedRecordsId_timeStamp 1 +#define Z_IUSuppliedRecordsId_versionNumber 2 +#define Z_IUSuppliedRecordsId_previousVersion 3 + union { + char *timeStamp; + char *versionNumber; + Odr_external *previousVersion; + } u; +} Z_IUSuppliedRecordsId; + +typedef struct Z_IUCorrelationInfo +{ + char *note; /* OPTIONAL */ + int *id; /* OPTIONAL */ +} Z_IUCorrelationInfo; + +typedef struct Z_IUSuppliedRecords_elem +{ + int which; +#define Z_IUSuppliedRecords_number 1 +#define Z_IUSuppliedRecords_string 2 +#define Z_IUSuppliedRecords_opaque 3 + union { + int *number; + char *string; + Odr_oct *opaque; + } u; /* OPTIONAL */ + Z_IUSuppliedRecordsId *supplementalId; /* OPTIONAL */ + Z_IUCorrelationInfo *correlationInfo; /* OPTIONAL */ + Odr_external *record; +} Z_IUSuppliedRecords_elem; + +typedef struct Z_IUSuppliedRecords +{ + int num; + Z_IUSuppliedRecords_elem **elements; +} Z_IUSuppliedRecords; + +typedef struct Z_IUOriginPartToKeep +{ + int *action; +#define Z_IUOriginPartToKeep_recordInsert 1 +#define Z_IUOriginPartToKeep_recordReplace 2 +#define Z_IUOriginPartToKeep_recordDelete 3 +#define Z_IUOriginPartToKeep_elementUpdate 4 + char *databaseName; + Odr_oid *schema; /* OPTIONAL */ + char *elementSetName; /* OPTIONAL */ +} Z_IUOriginPartToKeep; + +typedef struct Z_IUTaskPackageRecordStructure +{ + int which; +#define Z_IUTaskPackageRecordStructure_record 1 +#define Z_IUTaskPackageRecordStructure_diagnostic 2 + union { + Odr_external *record; + Z_DiagRec *diagnostic; + } u; /* OPTIONAL */ + Z_IUCorrelationInfo *correlationInfo; /* OPTIONAL */ + int *recordStatus; +#define Z_IUTaskPackageRecordStructureS_success 1 +#define Z_IUTaskPackageRecordStructureS_queued 2 +#define Z_IUTaskPackageRecordStructureS_inProcess 3 +#define Z_IUTaskPackageRecordStructureS_failure 4 +} Z_IUTaskPackageRecordStructure; + +typedef struct Z_IUTargetPart +{ + int *updateStatus; +#define Z_IUTargetPart_success 1 +#define Z_IUTargetPart_partial 2 +#define Z_IUTargetPart_failure 3 + int num_globalDiagnostics; + Z_DiagRec **globalDiagnostics; /* OPTIONAL */ + int num_taskPackageRecords; + Z_IUTaskPackageRecordStructure **taskPackageRecords; +} Z_IUTargetPart; + +typedef struct Z_IUUpdateEsRequest +{ + Z_IUOriginPartToKeep *toKeep; + Z_IUSuppliedRecords *notToKeep; +} Z_IUUpdateEsRequest; + +typedef struct Z_IUUpdateTaskPackage +{ + Z_IUOriginPartToKeep *originPart; + Z_IUTargetPart *targetPart; +} Z_IUUpdateTaskPackage; + +typedef struct Z_IUUpdate +{ + int which; +#define Z_IUUpdate_esRequest 1 +#define Z_IUUpdate_taskPackage 2 + union { + Z_IUUpdateEsRequest *esRequest; + Z_IUUpdateTaskPackage *taskPackage; + } u; +} Z_IUUpdate; + +int z_IUUpdate(ODR o, Z_IUUpdate **p, int opt); + #endif diff --git a/include/prt-ext.h b/include/prt-ext.h index e6f708c..5fb4729 100644 --- a/include/prt-ext.h +++ b/include/prt-ext.h @@ -70,6 +70,7 @@ struct Z_External #define Z_External_summary 13 #define Z_External_OPAC 14 #define Z_External_searchResult1 15 +#define Z_External_update 16 union { /* Generic types */ @@ -90,6 +91,7 @@ struct Z_External Z_Espec1 *espec1; Z_BriefBib *summary; Z_SearchInfoReport *searchResult1; + Z_IUUpdate *update; } u; }; diff --git a/util/oid.c b/util/oid.c index 950abf4..02addc9 100644 --- a/util/oid.c +++ b/util/oid.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: oid.c,v $ - * Revision 1.16 1996-10-09 15:55:02 quinn + * Revision 1.17 1996-10-10 12:35:23 quinn + * Added Update extended service. + * + * Revision 1.16 1996/10/09 15:55:02 quinn * Added SearchInfoReport * * Revision 1.15 1996/10/07 15:29:43 quinn @@ -141,7 +144,7 @@ static oident oids[] = {PROTO_Z3950, CLASS_EXTSERV, VAL_EXPORTSPEC,{9,6,-1}, "exp. spec." }, {PROTO_Z3950, CLASS_EXTSERV, VAL_EXPORTINV, {9,7,-1}, "exp. inv." }, - {PROTO_Z3950, CLASS_USERINFO,VAL_SEARCHRES1 {10,1,-1}, "searchResult-1"}, + {PROTO_Z3950, CLASS_USERINFO,VAL_SEARCHRES1,{10,1,-1}, "searchResult-1"}, {PROTO_Z3950, CLASS_ELEMSPEC,VAL_ESPEC1, {11,1,-1}, "Espec-1" }, {PROTO_Z3950, CLASS_VARSET, VAL_VAR1, {12,1,-1}, "Variant-1" }, -- 1.7.10.4