From: Adam Dickmeiss Date: Thu, 26 May 2005 21:47:16 +0000 (+0000) Subject: Add OID test. Changed prototype for ber_oidc. X-Git-Tag: YAZ.2.1.8~16 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=029ba3910b555dc57c38fd8d5a27091e59338890;p=yaz-moved-to-github.git Add OID test. Changed prototype for ber_oidc. --- diff --git a/include/yaz/odr.h b/include/yaz/odr.h index 9b70faf..43f352c 100644 --- a/include/yaz/odr.h +++ b/include/yaz/odr.h @@ -23,7 +23,7 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * - * $Id: odr.h,v 1.19 2005-01-27 09:04:07 adam Exp $ + * $Id: odr.h,v 1.20 2005-05-26 21:47:16 adam Exp $ */ /** @@ -259,7 +259,7 @@ YAZ_EXPORT int odr_bitstring(ODR o, Odr_bitmask **p, int opt, const char *name); YAZ_EXPORT int ber_bitstring(ODR o, Odr_bitmask *p, int cons); YAZ_EXPORT int odr_generalstring(ODR o, char **p, int opt, const char *name); -YAZ_EXPORT int ber_oidc(ODR o, Odr_oid *p); +YAZ_EXPORT int ber_oidc(ODR o, Odr_oid *p, int max_oid_size); YAZ_EXPORT int odr_oid(ODR o, Odr_oid **p, int opt, const char *name); YAZ_EXPORT int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp, const char *name); diff --git a/test/tstodr.asn b/test/tstodr.asn index e61dd73..a526abb 100644 --- a/test/tstodr.asn +++ b/test/tstodr.asn @@ -1,5 +1,5 @@ -- Small ASN.1 spec for tstodr test --- $Id: tstodr.asn,v 1.1 2003-10-27 12:21:38 adam Exp $ +-- $Id: tstodr.asn,v 1.2 2005-05-26 21:47:16 adam Exp $ tstodrcodec {tstodrcodec} DEFINITIONS ::= BEGIN @@ -11,6 +11,7 @@ MySequence ::= SEQUENCE { fifth [5] IMPLICIT INTEGER { enum1(0), enum2(1) - } + }, + myoid [6] IMPLICIT OBJECT IDENTIFIER } END diff --git a/test/tstodr.c b/test/tstodr.c index a0180a6..5b26a16 100644 --- a/test/tstodr.c +++ b/test/tstodr.c @@ -2,14 +2,17 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: tstodr.c,v 1.4 2005-02-01 17:23:36 adam Exp $ + * $Id: tstodr.c,v 1.5 2005-05-26 21:47:16 adam Exp $ * */ #include #include #include +#include #include "tstodrcodec.h" +#define MYOID "1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19" + void tst_MySequence1(ODR encode, ODR decode) { char *ber_buf; @@ -25,6 +28,8 @@ void tst_MySequence1(ODR encode, ODR decode) s->third = odr_intdup(encode, 1); s->fourth = odr_nullval(); s->fifth = odr_intdup(encode, YC_MySequence_enum1); + + s->myoid = odr_getoidbystr(decode, MYOID); if (!yc_MySequence(encode, &s, 0, 0)) exit(1); @@ -47,6 +52,17 @@ void tst_MySequence1(ODR encode, ODR decode) exit(7); if (!t->fifth || *t->fifth != YC_MySequence_enum1) exit(8); + if (!t->myoid) + exit(9); + else + { + int *myoid = odr_getoidbystr(decode, MYOID); + struct oident *oident; + + if (oid_oidcmp(myoid, t->myoid)) + exit(10); + oident = oid_getentbyoid(t->myoid); + } } void tst_MySequence2(ODR encode, ODR decode) @@ -61,6 +77,7 @@ void tst_MySequence2(ODR encode, ODR decode) s->third = odr_intdup(encode, 1); s->fourth = odr_nullval(); s->fifth = odr_intdup(encode, YC_MySequence_enum1); + s->myoid = odr_getoidbystr(encode, MYOID); if (yc_MySequence(encode, &s, 0, 0)) /* should fail */ exit(9);