Added Espec-1.
authorSebastian Hammer <quinn@indexdata.com>
Thu, 12 Oct 1995 10:34:28 +0000 (10:34 +0000)
committerSebastian Hammer <quinn@indexdata.com>
Thu, 12 Oct 1995 10:34:28 +0000 (10:34 +0000)
CHANGELOG
asn/Makefile
asn/prt-esp.c [new file with mode: 0644]
asn/prt-ext.c
include/oid.h
include/proto.h
include/prt-esp.h [new file with mode: 0644]
include/prt-ext.h
include/prt-grs.h
util/oid.c

index f1c0d5a..442c53e 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,8 @@ Possible compatibility problems with earlier versions marked with '*'.
 
 --- XXXXX XXXX/XX/XX
 
+Added Espec-1 format.
+
 Added VisibleString field body type to GRS-1. It is illegal acc. to my copy
 of the protocol and it cannot be selected when encoding (maps into 'string'
 when decoding). Needed to talk to some servers.
index ddbd223..eb72585 100644 (file)
@@ -1,7 +1,7 @@
 # Copyright (C) 1994, Index Data I/S 
 # All rights reserved.
 # Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.20 1995-08-29 11:17:14 quinn Exp $
+# $Id: Makefile,v 1.21 1995-10-12 10:34:36 quinn Exp $
 
 SHELL=/bin/sh
 INCLUDE=-I../include -I.
@@ -12,7 +12,7 @@ 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 prt-exd.o prt-dia.o
+       prt-grs.o prt-exd.o prt-dia.o prt-esp.o
 CPP=$(CC) -E
 RANLIB=ranlib
 
diff --git a/asn/prt-esp.c b/asn/prt-esp.c
new file mode 100644 (file)
index 0000000..bc11d72
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 1995, Index Data.
+ * See the file LICENSE for details.
+ * Sebastian Hammer, Adam Dickmeiss
+ *
+ * $Log: prt-esp.c,v $
+ * Revision 1.1  1995-10-12 10:34:37  quinn
+ * Added Espec-1.
+ *
+ *
+ */
+
+#include <proto.h>
+
+int z_OccurValues(ODR o, Z_OccurValues **p, int opt)
+{
+    if (!odr_sequence_begin(o, p, sizeof(**p)))
+       return opt && odr_ok(o);
+    return
+       odr_implicit(o, odr_integer, &(*p)->start, ODR_CONTEXT, 1, 0) &&
+       odr_implicit(o, odr_integer, &(*p)->howMany, ODR_CONTEXT, 2, 1) &&
+       odr_sequence_end(o);
+}
+
+int z_Occurrences(ODR o, Z_Occurrences **p, int opt)
+{
+    static Odr_arm arm[] =
+    {
+       {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Occurrences_all, odr_null},
+       {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Occurrences_last, odr_null},
+       {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Occurrences_values, z_OccurValues},
+       {-1, -1, -1, -1, 0}
+    };
+
+    if (o->direction == ODR_DECODE)
+       *p = odr_malloc(o, sizeof(**p));
+    else if (!*p)
+       return opt;
+    if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
+       return 1;
+    *p = 0;
+    return opt && odr_ok(o);
+}
+
+int z_SpecificTag(ODR o, Z_SpecificTag **p, int opt)
+{
+    if (!odr_sequence_begin(o, p, sizeof(**p)))
+       return opt && odr_ok(o);
+    return
+        odr_implicit(o, odr_integer, &(*p)->tagType, ODR_CONTEXT, 1, 1) &&
+       odr_explicit(o, z_StringOrNumeric, &(*p)->tagValue, ODR_CONTEXT,
+           2, 0) &&
+       odr_explicit(o, z_Occurrences, &(*p)->occurrences, ODR_CONTEXT, 3, 1) &&
+       odr_sequence_end(o);
+}
+
+int z_ETagUnit(ODR o, Z_ETagUnit **p, int opt)
+{
+    static Odr_arm arm[] =
+    {
+       {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ETagUnit_specificTag, z_SpecificTag},
+       {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_ETagUnit_wildThing, z_Occurrences},
+       {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_ETagUnit_wildPath, odr_null},
+       {-1, -1, -1 -1, 0}
+    };
+
+    if (o->direction == ODR_DECODE)
+       *p = odr_malloc(o, sizeof(**p));
+    else if (!*p)
+       return opt;
+    if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
+       return 1;
+    *p = 0;
+    return opt && odr_ok(o);
+}
+
+int z_ETagPath(ODR o, Z_ETagPath **p, int opt)
+{
+    if (o->direction == ODR_DECODE)
+       *p = odr_malloc(o, sizeof(**p));
+    else if (!*p)
+       return opt;
+    if (odr_sequence_of(o, z_ETagUnit, &(*p)->tags, &(*p)->num_tags))
+       return 1;
+    *p = 0;
+    return opt && odr_ok(o);
+}
+
+int z_SimpleElement(ODR o, Z_SimpleElement **p, int opt)
+{
+    if (!odr_sequence_begin(o, p, sizeof(**p)))
+       return opt && odr_ok(o);
+    return
+       odr_implicit(o, z_ETagPath, &(*p)->path, ODR_CONTEXT, 1, 0) &&
+       odr_implicit(o, z_Variant, &(*p)->variantRequest, ODR_CONTEXT,
+           2, 1) &&
+       odr_sequence_end(o);
+}
+
+int z_CompoPrimitives(ODR o, Z_CompoPrimitives **p, int opt)
+{
+    if (o->direction == ODR_DECODE)
+       *p = odr_malloc(o, sizeof(**p));
+    else if (!*p)
+       return opt;
+    if (odr_sequence_of(o, z_InternationalString, &(*p)->primitives,
+       &(*p)->num_primitives))
+       return 1;
+    *p = 0;
+    return opt && odr_ok(o);
+}
+
+int z_CompoSpecs(ODR o, Z_CompoSpecs **p, int opt)
+{
+    if (o->direction == ODR_DECODE)
+       *p = odr_malloc(o, sizeof(**p));
+    else if (!*p)
+       return opt;
+    if (odr_sequence_of(o, z_SimpleElement, &(*p)->specs, &(*p)->num_specs))
+       return 1;
+    *p = 0;
+    return opt && odr_ok(o);
+}
+
+int z_CompositeElement(ODR o, Z_CompositeElement **p, int opt)
+{
+    static Odr_arm arm[] =
+    {
+       {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_CompoElement_primitives,
+           z_CompoPrimitives},
+       {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_CompoElement_specs,
+           z_CompoSpecs},
+       {-1, -1, -1, -1, 0}
+    };
+
+    if (!odr_sequence_begin(o, p, sizeof(**p)))
+       return opt && odr_ok(o);
+    return
+        odr_constructed_begin(o, &(*p)->elementList, ODR_CONTEXT, 1) &&
+       odr_choice(o, arm, &(*p)->elementList, &(*p)->which) &&
+       odr_constructed_end(o) &&
+       odr_implicit(o, z_ETagPath, &(*p)->deliveryTag, ODR_CONTEXT, 2, 0) &&
+       odr_implicit(o, z_Variant, &(*p)->variantRequest, ODR_CONTEXT, 3, 1) &&
+       odr_sequence_end(o);
+}
+
+int z_ElementRequest(ODR o, Z_ElementRequest **p, int opt)
+{
+    static Odr_arm arm[] =
+    {
+       {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ERequest_simpleElement,
+           z_SimpleElement},
+       {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ERequest_compositeElement,
+           z_CompositeElement},
+       {-1, -1, -1 -1, 0}
+    };
+
+    if (o->direction == ODR_DECODE)
+       *p = odr_malloc(o, sizeof(**p));
+    else if (!*p)
+       return opt;
+    if (odr_choice(o, arm, &(*p)->u, &(*p)->which))
+       return 1;
+    *p = 0;
+    return opt && odr_ok(o);
+}
+
+int z_Espec1(ODR o, Z_Espec1 **p, int opt)
+{
+    if (!odr_sequence_begin(o, p, sizeof(**p)))
+       return opt && odr_ok(o);
+    return
+        odr_implicit_settag(o, ODR_CONTEXT, 1) &&
+       (odr_sequence_of(o, z_InternationalString, &(*p)->elementSetNames,
+           &(*p)->num_elementSetNames) || odr_ok(o)) &&
+       odr_implicit(o, odr_oid, &(*p)->defaultVariantSetId, ODR_CONTEXT,
+           2, 1) &&
+       odr_implicit(o, z_Variant, &(*p)->defaultVariantRequest, ODR_CONTEXT,
+           3, 1) &&
+       odr_implicit(o, odr_integer, &(*p)->defaultTagType, ODR_CONTEXT,
+           4, 1) &&
+       odr_implicit_settag(o, ODR_CONTEXT, 5) &&
+       (odr_sequence_of(o, z_ElementRequest, &(*p)->elements,
+           &(*p)->num_elements) || odr_ok(o)) &&
+       odr_sequence_end(o);
+}
index 688ef28..f9feee8 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: prt-ext.c,v $
- * Revision 1.6  1995-09-29 17:11:55  quinn
+ * Revision 1.7  1995-10-12 10:34:38  quinn
+ * Added Espec-1.
+ *
+ * Revision 1.6  1995/09/29  17:11:55  quinn
  * Smallish
  *
  * Revision 1.5  1995/09/27  15:02:42  quinn
@@ -51,6 +54,7 @@ int z_External(ODR o, Z_External **p, int opt)
            z_TaskPackage},
        {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_itemOrder, z_ItemOrder},
        {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_diag1, z_DiagnosticFormat},
+       {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_espec1, z_Espec1},
        {-1, -1, -1, -1, 0}
     };
     /*
@@ -73,6 +77,7 @@ int z_External(ODR o, Z_External **p, int opt)
        {VAL_EXTENDED, Z_External_extendedService},
        {VAL_ITEMORDER, Z_External_itemOrder},
        {VAL_DIAG1, Z_External_diag1},
+       {VAL_ESPEC1, Z_External_espec1},
        {VAL_NONE, 0}
     };
 
index ffee3c5..b681a9d 100644 (file)
  * OF THIS SOFTWARE.
  *
  * $Log: oid.h,v $
- * Revision 1.8  1995-10-10 16:27:08  quinn
+ * Revision 1.9  1995-10-12 10:34:45  quinn
+ * Added Espec-1.
+ *
+ * Revision 1.8  1995/10/10  16:27:08  quinn
  * *** empty log message ***
  *
  * Revision 1.7  1995/09/29  17:12:05  quinn
@@ -136,7 +139,8 @@ typedef struct oident
        VAL_NONE,
        VAL_SETM,
        VAL_SETG,
-       VAL_VAR1
+       VAL_VAR1,
+       VAL_ESPEC1
     } value;
     int oidsuffix[20];
     char *desc;
index 1bf3a65..1d3d89f 100644 (file)
  * OF THIS SOFTWARE.
  *
  * $Log: proto.h,v $
- * Revision 1.26  1995-09-29 17:12:08  quinn
+ * Revision 1.27  1995-10-12 10:34:46  quinn
+ * Added Espec-1.
+ *
+ * Revision 1.26  1995/09/29  17:12:08  quinn
  * Smallish
  *
  * Revision 1.25  1995/09/27  15:02:49  quinn
@@ -1168,6 +1171,7 @@ Z_APDU *zget_APDU(ODR o, enum Z_APDU_which which);
 #include <prt-grs.h>
 #include <prt-exd.h>
 #include <prt-dia.h>
+#include <prt-esp.h>
 
 #include <prt-ext.h>
 
diff --git a/include/prt-esp.h b/include/prt-esp.h
new file mode 100644 (file)
index 0000000..ce0f3b8
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 1995, 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,
+ * provided that:
+ *
+ * 1. This copyright and permission notice appear in all copies of the
+ * software and its documentation. Notices of copyright or attribution
+ * which appear at the beginning of any file must remain unchanged.
+ *
+ * 2. The names of Index Data or the individual authors may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
+ * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ */
+
+#ifndef PRT_ESP_H
+#define PRT_ESP_H
+
+#include <yconfig.h>
+
+typedef struct Z_OccurValues
+{
+    int *start;
+    int *howMany;                     /* OPTIONAL */
+} Z_OccurValues;
+
+typedef struct Z_Occurrences
+{
+    enum
+    {
+       Z_Occurrences_all,
+       Z_Occurrences_last,
+       Z_Occurrences_values
+    } which;
+    union
+    {
+       Odr_null *all;
+       Odr_null *last;
+       Z_OccurValues *values;
+    } u;
+} Z_Occurrences;
+
+typedef struct Z_SpecificTag
+{
+    int *tagType;                           /* OPTIONAL */
+    Z_StringOrNumeric *tagValue;
+    Z_Occurrences *occurrences;             /* OPTIONAL */
+} Z_SpecificTag;
+
+typedef struct Z_ETagUnit
+{
+    enum
+    {
+       Z_ETagUnit_specificTag,
+       Z_ETagUnit_wildThing,
+       Z_ETagUnit_wildPath
+    } which;
+    union
+    {
+       Z_SpecificTag *specificTag;
+       Z_Occurrences *wildThing;
+       Odr_null *wildPath;
+    } u;
+} Z_ETagUnit;
+
+typedef struct Z_ETagPath
+{
+    int num_tags;
+    Z_ETagUnit **tags;
+} Z_ETagPath;
+
+typedef struct Z_SimpleElement
+{
+    Z_ETagPath *path;
+    Z_Variant *variantRequest;           /* OPTIONAL */
+} Z_SimpleElement;
+
+typedef struct Z_CompoPrimitives
+{
+    int num_primitives;
+    char **primitives;
+} Z_CompoPrimitives;
+
+typedef struct Z_CompoSpecs
+{
+    int num_specs;
+    Z_SimpleElement **specs;
+} Z_CompoSpecs;
+
+typedef struct Z_CompositeElement
+{
+    enum
+    {
+       Z_CompoElement_primitives,
+       Z_CompoElement_specs
+    } which;
+    union
+    {
+       Z_CompoPrimitives *primitives;
+       Z_CompoSpecs *specs;
+    } elementList;
+    Z_ETagPath *deliveryTag;
+    Z_Variant *variantRequest;
+} Z_CompositeElement;
+
+typedef struct Z_ElementRequest
+{
+    enum
+    {
+       Z_ERequest_simpleElement,
+       Z_ERequest_compositeElement
+    } which;
+    union
+    {
+       Z_SimpleElement *simpleElement;
+       Z_CompositeElement *compositeElement;
+    } u;
+} Z_ElementRequest;
+
+typedef struct Z_Espec1
+{
+    int num_elementSetNames;
+    char **elementSetNames;               /* OPTIONAL */
+    Odr_oid *defaultVariantSetId;         /* OPTIONAL */
+    Z_Variant *defaultVariantRequest;     /* OPTIONAL */
+    int *defaultTagType;                  /* OPTIONAL */
+    int num_elements;
+    Z_ElementRequest *elements;           /* OPTIONAL */
+} Z_Espec1;
+
+int z_Espec1(ODR o, Z_Espec1 **p, int opt);
+
+#endif
index d55ff5c..3ef41bc 100644 (file)
@@ -55,7 +55,8 @@ struct Z_External
        Z_External_grs1,
        Z_External_extendedService,
        Z_External_itemOrder,
-       Z_External_diag1
+       Z_External_diag1,
+       Z_External_espec1
     } which;
     union
     {
@@ -74,6 +75,7 @@ struct Z_External
        Z_TaskPackage *extendedService;
        Z_ItemOrder *itemOrder;
        Z_DiagnosticFormat *diag1;
+       Z_Espec1 *espec1;
     } u;
 };
 
index c97c7df..e6ad783 100644 (file)
@@ -175,5 +175,6 @@ struct Z_GenericRecord
 };
 
 int z_GenericRecord(ODR o, Z_GenericRecord **p, int opt);
+int z_Variant(ODR o, Z_Variant **p, int opt);
 
 #endif
index 3df84ba..b373809 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: oid.c,v $
- * Revision 1.7  1995-10-10 16:27:12  quinn
+ * Revision 1.8  1995-10-12 10:34:56  quinn
+ * Added Espec-1.
+ *
+ * Revision 1.7  1995/10/10  16:27:12  quinn
  * *** empty log message ***
  *
  * Revision 1.6  1995/09/29  17:12:35  quinn
@@ -108,6 +111,7 @@ static oident oids[] =
     {PROTO_Z3950,   CLASS_EXTSERV, VAL_DBUPDATE,  {9,5,-1},    "DB. Update"  },
     {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_ELEMSPEC,VAL_ESPEC1,    {11,1,-1},   "Espec-1"     },
     {PROTO_Z3950,   CLASS_VARSET,  VAL_VAR1,      {12,1,-1},   "Variant-1"   },
 
     {PROTO_Z3950,   CLASS_TAGSET,  VAL_SETM,      {14,1,-1},   "TagsetM"     },
@@ -162,6 +166,7 @@ static oident oids[] =
     {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."   },
+    {PROTO_SR,      CLASS_ELEMSPEC,VAL_ESPEC1,    {11,1,-1},   "Espec-1"     },
     {PROTO_SR,      CLASS_VARSET,  VAL_VAR1,      {12,1,-1},   "Variant-1"   },
 
     {PROTO_SR,      CLASS_TAGSET,  VAL_SETM,      {14,1,-1},   "TagsetM"     },