From: Sebastian Hammer Date: Fri, 3 Feb 1995 17:04:31 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: YAZ.1.8~1171 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=32226b4f15d634d5e48b1306aeeb26a370c8f5c5 *** empty log message *** --- diff --git a/odr/ber_bit.c b/odr/ber_bit.c index ce8e21a..31b528f 100644 --- a/odr/ber_bit.c +++ b/odr/ber_bit.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ber_bit.c,v $ - * Revision 1.1 1995-02-02 20:38:49 quinn + * Revision 1.2 1995-02-03 17:04:31 quinn + * *** empty log message *** + * + * Revision 1.1 1995/02/02 20:38:49 quinn * Updates. * * @@ -12,7 +15,7 @@ #include -int ber_bitstring(ODR o, ODR_BITMASK *p, int cons) +int ber_bitstring(ODR o, Odr_bitmask *p, int cons) { int res, len; unsigned char *base; diff --git a/odr/ber_oct.c b/odr/ber_oct.c index 9b5a2fd..1114aa6 100644 --- a/odr/ber_oct.c +++ b/odr/ber_oct.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ber_oct.c,v $ - * Revision 1.2 1995-02-02 20:38:50 quinn + * Revision 1.3 1995-02-03 17:04:34 quinn + * *** empty log message *** + * + * Revision 1.2 1995/02/02 20:38:50 quinn * Updates. * * Revision 1.1 1995/02/02 16:21:52 quinn @@ -14,7 +17,7 @@ #include -int ber_octetstring(ODR o, ODR_OCT *p, int cons) +int ber_octetstring(ODR o, Odr_oct *p, int cons) { int res, len; unsigned char *base, *c; diff --git a/odr/odr_bit.c b/odr/odr_bit.c index 80434b7..8d080a2 100644 --- a/odr/odr_bit.c +++ b/odr/odr_bit.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_bit.c,v $ - * Revision 1.1 1995-02-02 20:38:50 quinn + * Revision 1.2 1995-02-03 17:04:37 quinn + * *** empty log message *** + * + * Revision 1.1 1995/02/02 20:38:50 quinn * Updates. * * @@ -17,7 +20,7 @@ * Top level bitstring string en/decoder. * Returns 1 on success, 0 on error. */ -int odr_bitstring(ODR o, ODR_BITMASK **p, int opt) +int odr_bitstring(ODR o, Odr_bitmask **p, int opt) { int res, cons = 0; @@ -40,7 +43,7 @@ int odr_bitstring(ODR o, ODR_BITMASK **p, int opt) } if (o->direction == ODR_DECODE && !*p) { - *p = nalloc(o, sizeof(ODR_BITMASK)); + *p = nalloc(o, sizeof(Odr_bitmask)); memset((*p)->bits, 0, ODR_BITMASK_SIZE); (*p)->top = -1; } diff --git a/odr/odr_oct.c b/odr/odr_oct.c index 4daccb3..791654a 100644 --- a/odr/odr_oct.c +++ b/odr/odr_oct.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_oct.c,v $ - * Revision 1.2 1995-02-02 20:38:51 quinn + * Revision 1.3 1995-02-03 17:04:38 quinn + * *** empty log message *** + * + * Revision 1.2 1995/02/02 20:38:51 quinn * Updates. * * Revision 1.1 1995/02/02 16:21:54 quinn @@ -18,7 +21,7 @@ * Top level octet string en/decoder. * Returns 1 on success, 0 on error. */ -int odr_octetstring(ODR o, ODR_OCT **p, int opt) +int odr_octetstring(ODR o, Odr_oct **p, int opt) { int res, cons = 0; @@ -41,7 +44,7 @@ int odr_octetstring(ODR o, ODR_OCT **p, int opt) } if (o->direction == ODR_DECODE && !*p) { - *p = nalloc(o, sizeof(ODR_OCT)); + *p = nalloc(o, sizeof(Odr_oct)); (*p)->size= 0; (*p)->len = 0; (*p)->buf = 0; @@ -52,15 +55,15 @@ int odr_octetstring(ODR o, ODR_OCT **p, int opt) /* * Friendlier interface to octetstring. */ -int odr_visiblestring(ODR o, char **p, int opt) +int odr_cstring(ODR o, char **p, int opt) { int cons = 0, res; - ODR_OCT *t; + Odr_oct *t; if (o->t_class < 0) { o->t_class = ODR_UNIVERSAL; - o->t_tag = ODR_VISIBLESTRING; + o->t_tag = ODR_OCTETSTRING; } if ((res = ber_tag(o, *p, o->t_class, o->t_tag, &cons)) < 0) return 0; @@ -74,7 +77,7 @@ int odr_visiblestring(ODR o, char **p, int opt) fprintf(o->print, "'%s'\n", *p); return 1; } - t = nalloc(o, sizeof(ODR_OCT)); /* wrapper for octstring */ + t = nalloc(o, sizeof(Odr_oct)); /* wrapper for octstring */ if (o->direction == ODR_ENCODE) { t->buf = (unsigned char *) *p; diff --git a/odr/test.c b/odr/test.c index 94e0aa9..894ef1b 100644 --- a/odr/test.c +++ b/odr/test.c @@ -1,13 +1,14 @@ #include #include +#include -typedef ODR_BITMASK Z_ReferenceId; +typedef Odr_bitmask Z_ReferenceId; typedef struct Z_InitRequest { Z_ReferenceId *referenceId; /* OPTIONAL */ - ODR_BITMASK *options; - ODR_BITMASK *protocolVersion; + Odr_bitmask *options; + Odr_bitmask *protocolVersion; int *preferredMessageSize; int *maximumRecordSize; char *idAuthentication; /* OPTIONAL */ @@ -18,7 +19,7 @@ typedef struct Z_InitRequest int z_ReferenceId(ODR o, Z_ReferenceId **p, int opt) { - return odr_implicit(o, odr_octetstring, (ODR_OCT**) p, ODR_CONTEXT, 2, opt); + return odr_implicit(o, odr_octetstring, (Odr_oct**) p, ODR_CONTEXT, 2, opt); } int z_InitRequest(ODR o, Z_InitRequest **p, int opt) @@ -54,10 +55,13 @@ int main() unsigned char buf[4048]; struct odr o; Z_InitRequest ireq, *ireqp, *ireq2p; - ODR_BITMASK options, protocolVersion; + Odr_bitmask options, protocolVersion; char *iId = "YAZ", *iName = "Yet Another Z39.50 Implementation", *iVersion = "0.1"; int maximumRS = 4096, preferredMS = 2048; + static Odr_oid oid[] = {1, 2, 3, 4, -1}, *oidp1, *oidp2; + + oidp1 = oid; ODR_MASK_ZERO(&protocolVersion); ODR_MASK_SET(&protocolVersion, 0); @@ -85,10 +89,10 @@ int main() o.direction = ODR_ENCODE; o.t_class = -1; - z_InitRequest(&o, &ireqp, 0); + odr_oid(&o, &oidp1, 0); o.direction = ODR_DECODE; o.bp = o.buf; - z_InitRequest(&o, &ireq2p, 0); + odr_oid(&o, &oidp2, 0); }