From 63aea810bb0d282daf5468eca9f5aa6a5611fc2e Mon Sep 17 00:00:00 2001 From: Sebastian Hammer Date: Fri, 26 Jul 1996 13:37:06 +0000 Subject: [PATCH] Various smaller things. Gathered header-files. --- client/default.bib | 3 +-- include/odr.h | 7 ++++++- include/prt.h | 1 + odr/Makefile | 4 ++-- odr/odr.c | 9 +++++++-- odr/odr_cons.c | 22 +++++++++++++++++++--- tab/gils-b.est | 3 ++- tab/gils-g.est | 7 +++++++ tab/gils.abs | 8 ++++++++ 9 files changed, 53 insertions(+), 11 deletions(-) diff --git a/client/default.bib b/client/default.bib index 198f81b..2316a29 100644 --- a/client/default.bib +++ b/client/default.bib @@ -1,5 +1,5 @@ # Subset of bib-1 attributes map to CCL qualifiers -# $Id: default.bib,v 1.3 1996-07-06 19:58:30 quinn Exp $ +# $Id: default.bib,v 1.4 1996-07-26 13:37:06 quinn Exp $ # term t=l,r s=pw clean t=l @@ -16,7 +16,6 @@ la u=54 s=pw ab u=62 s=pw note u=63 s=pw af u=1006 s=pw - north u=2040 r=o south u=2041 r=o east u=2038 r=o diff --git a/include/odr.h b/include/odr.h index e1b0c0c..1546d68 100644 --- a/include/odr.h +++ b/include/odr.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: odr.h,v $ - * Revision 1.17 1995-11-08 17:41:27 quinn + * Revision 1.18 1996-07-26 13:38:14 quinn + * Various smaller things. Gathered header-files. + * + * Revision 1.17 1995/11/08 17:41:27 quinn * Smallish. * * Revision 1.16 1995/11/01 13:54:36 quinn @@ -245,6 +248,7 @@ typedef struct odr int t_tag; int choice_bias; /* force choice */ + int lenlen; /* force length-of-lenght (odr_setlen()) */ FILE *print; /* output file for direction print */ int indent; /* current indent level for printing */ @@ -282,6 +286,7 @@ typedef struct odr_arm #define ODATA 8 #define OSTACK 9 #define OCONLEN 10 +#define OLENOV 11 extern char *odr_errlist[]; diff --git a/include/prt.h b/include/prt.h index fd7dc73..9d2dcd2 100644 --- a/include/prt.h +++ b/include/prt.h @@ -52,5 +52,6 @@ char *odr_errmsg(int n); Odr_oid *odr_getoidbystr(ODR o, char *str); int odr_initmember(ODR o, void *p, int size); int odr_peektag(ODR o, int *class, int *tag, int *cons); +void odr_setlenlen(ODR o, int len); #endif diff --git a/odr/Makefile b/odr/Makefile index 4f129d3..30b8dfc 100644 --- a/odr/Makefile +++ b/odr/Makefile @@ -1,13 +1,13 @@ # Copyright (C) 1994, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.23 1996-05-22 08:35:50 adam Exp $ +# $Id: Makefile,v 1.24 1996-07-26 13:38:18 quinn Exp $ SHELL=/bin/sh INCLUDE=-I../include -I. LIBDIR=../lib LIBINCLUDE=-L$(LIBDIR) -DEFS=$(INCLUDE) +DEFS=$(INCLUDE) -DODR_DEBUG LIB=$(LIBDIR)/libodr.a LIBS=-lodr PO = odr_bool.o ber_bool.o ber_len.o ber_tag.o odr_util.o odr_null.o \ diff --git a/odr/odr.c b/odr/odr.c index af2665d..301f151 100644 --- a/odr/odr.c +++ b/odr/odr.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr.c,v $ - * Revision 1.20 1995-11-08 17:41:32 quinn + * Revision 1.21 1996-07-26 13:38:19 quinn + * Various smaller things. Gathered header-files. + * + * Revision 1.20 1995/11/08 17:41:32 quinn * Smallish. * * Revision 1.19 1995/11/01 13:54:41 quinn @@ -88,7 +91,8 @@ char *odr_errlist[] = "Protocol error", "Malformed data", "Stack overflow", - "Length of constructed type different from sum of members" + "Length of constructed type different from sum of members", + "Overflow writing definite length of constructed type" }; char *odr_errmsg(int n) @@ -142,6 +146,7 @@ void odr_reset(ODR o) o->stackp = -1; nmem_reset(o->mem); o->choice_bias = -1; + o->lenlen = 1; } void odr_destroy(ODR o) diff --git a/odr/odr_cons.c b/odr/odr_cons.c index 1ae66c1..917e154 100644 --- a/odr/odr_cons.c +++ b/odr/odr_cons.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_cons.c,v $ - * Revision 1.15 1995-09-29 17:12:23 quinn + * Revision 1.16 1996-07-26 13:38:20 quinn + * Various smaller things. Gathered header-files. + * + * Revision 1.15 1995/09/29 17:12:23 quinn * Smallish * * Revision 1.14 1995/09/27 15:02:58 quinn @@ -57,13 +60,20 @@ #include #include +void odr_setlenlen(ODR o, int len) +{ + o->lenlen = len; +} + int odr_constructed_begin(ODR o, void *p, int class, int tag) { int res; int cons = 1; + int lenlen = o->lenlen; if (o->error) return 0; + o->lenlen = 1; /* reset lenlen */ if (o->t_class < 0) { o->t_class = class; @@ -86,8 +96,11 @@ int odr_constructed_begin(ODR o, void *p, int class, int tag) #endif if (o->direction == ODR_ENCODE) { - o->stack[o->stackp].lenlen = 1; - if (odr_putc(o, 0) < 0) /* dummy */ + unsigned char dummy[sizeof(int)+1]; + + o->stack[o->stackp].lenlen = lenlen; + + if (odr_write(o, dummy, lenlen) < 0) /* dummy */ return 0; } else if (o->direction == ODR_DECODE) @@ -167,7 +180,10 @@ int odr_constructed_end(ODR o) odr_seek(o, ODR_S_SET, o->stack[o->stackp].len_offset); if ((res = ber_enclen(o, pos - o->stack[o->stackp].base_offset, o->stack[o->stackp].lenlen, 1)) < 0) + { + o->error = OLENOV; return 0; + } odr_seek(o, ODR_S_END, 0); if (res == 0) /* indefinite encoding */ { diff --git a/tab/gils-b.est b/tab/gils-b.est index aff86b0..d00e5c0 100644 --- a/tab/gils-b.est +++ b/tab/gils-b.est @@ -1,4 +1,4 @@ -# $Id: gils-b.est,v 1.6 1996-07-06 19:58:36 quinn Exp $ +# $Id: gils-b.est,v 1.7 1996-07-26 13:38:23 quinn Exp $ simpleelement (1,1) simpleelement (1,10) simpleelement (1,12) @@ -7,3 +7,4 @@ simpleelement (1,14) simpleelement (1,16) simpleelement (4,1) simpleelement (4,52) +simpleelement (4,70)/(4,17) diff --git a/tab/gils-g.est b/tab/gils-g.est index ba35172..01624c0 100644 --- a/tab/gils-g.est +++ b/tab/gils-g.est @@ -7,3 +7,10 @@ simpleelement (1,16) simpleelement (4,1) simpleelement (4,52) simpleelement (4,98) + +# +# These are not formally required by GILS +# +simpleelement (4,59) +simpleelement (4,70) +simpleelement (4,97) diff --git a/tab/gils.abs b/tab/gils.abs index cab3f82..e1d1119 100644 --- a/tab/gils.abs +++ b/tab/gils.abs @@ -94,3 +94,11 @@ elm (4,98)/(4,17) crossReferenceLinkage ! elm (4,98)/(4,18) crossReferenceType ! elm (4,23) originalControlIdentifier ! elm (4,59) supplementalInformation ! + +elm (2,9) bodyOfDisplay Any + +# +# Local tags - testing only +# + +elm sampleText bodyOfText ! -- 1.7.10.4