From d4081206ab9bd0ed0c97c032d264ad1e1d4a051e Mon Sep 17 00:00:00 2001 From: Sebastian Hammer Date: Mon, 29 May 1995 08:11:30 +0000 Subject: [PATCH] Moved oid from odr/asn to util. --- include/backend.h | 1 + include/comstack.h | 10 ++++++---- include/odr.h | 6 ++++-- include/oid.h | 17 ++++++++++++----- include/proto.h | 6 +++++- include/prt.h | 4 ---- odr/odr_oid.c | 8 ++++++-- odr/odr_util.c | 43 +++---------------------------------------- 8 files changed, 37 insertions(+), 58 deletions(-) diff --git a/include/backend.h b/include/backend.h index 8296e63..78d670a 100644 --- a/include/backend.h +++ b/include/backend.h @@ -29,6 +29,7 @@ #define BACKEND_H #include +#include typedef struct bend_initrequest { diff --git a/include/comstack.h b/include/comstack.h index 304b6cf..42c8b03 100644 --- a/include/comstack.h +++ b/include/comstack.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: comstack.h,v $ - * Revision 1.4 1995-05-16 08:50:29 quinn + * Revision 1.5 1995-05-29 08:11:31 quinn + * Moved oid from odr/asn to util. + * + * Revision 1.4 1995/05/16 08:50:29 quinn * License, documentation, and memory fixes * * Revision 1.3 1995/04/20 15:12:44 quinn @@ -78,6 +81,7 @@ #ifndef COMSTACK_H #define COMSTACK_H +#include #include #define COMSTACK_DEFAULT_TIMEOUT -1 @@ -109,9 +113,7 @@ struct comstack #define CS_DISCON 2 #define CS_LISTEN 3 #define CS_DATA 4 - int protocol; /* what application protocol are we talking? */ -#define CS_Z3950 0 -#define CS_SR 1 + enum oid_proto protocol; /* what application protocol are we talking? */ int (*f_look)(COMSTACK handle); int (*f_put)(COMSTACK handle, char *buf, int size); int (*f_get)(COMSTACK handle, char **buf, int *bufsize); diff --git a/include/odr.h b/include/odr.h index 8aeb5ab..065323b 100644 --- a/include/odr.h +++ b/include/odr.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: odr.h,v $ - * Revision 1.6 1995-05-22 14:47:00 quinn + * Revision 1.7 1995-05-29 08:11:32 quinn + * Moved oid from odr/asn to util. + * + * Revision 1.6 1995/05/22 14:47:00 quinn * ODR_NULLVAL --> void * * Revision 1.5 1995/05/22 11:31:24 quinn @@ -161,7 +164,6 @@ typedef struct odr_bitmask int top; } Odr_bitmask; -#define ODR_OID_SIZE 100 typedef int Odr_oid; /* terminate by -1 */ typedef struct odr_constack diff --git a/include/oid.h b/include/oid.h index 33aac90..af5a0c9 100644 --- a/include/oid.h +++ b/include/oid.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: oid.h,v $ - * Revision 1.2 1995-05-16 08:50:35 quinn + * Revision 1.3 1995-05-29 08:11:33 quinn + * Moved oid from odr/asn to util. + * + * Revision 1.2 1995/05/16 08:50:35 quinn * License, documentation, and memory fixes * * Revision 1.1 1995/03/30 09:39:41 quinn @@ -39,7 +42,7 @@ #ifndef OID_H #define OID_H -#include +#define OID_SIZE 100 typedef struct oident { @@ -114,7 +117,7 @@ typedef struct oident VAL_EXPORTSPEC, VAL_EXPORTINV } value; - Odr_oid oidsuffix[20]; + int oidsuffix[20]; char *desc; } oident; @@ -122,7 +125,11 @@ typedef enum oid_proto oid_proto; typedef enum oid_class oid_class; typedef enum oid_value oid_value; -Odr_oid *oid_getoidbyent(struct oident *ent); -struct oident *oid_getentbyoid(Odr_oid *o); +int *oid_getoidbyent(struct oident *ent); +struct oident *oid_getentbyoid(int *o); +void oid_oidcpy(int *t, int *s); +void oid_oidcat(int *t, int *s); +int oid_oidcmp(int *o1, int *o2); +int oid_oidlen(int *o); #endif diff --git a/include/proto.h b/include/proto.h index f536d83..23e06d6 100644 --- a/include/proto.h +++ b/include/proto.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: proto.h,v $ - * Revision 1.9 1995-05-22 11:31:25 quinn + * Revision 1.10 1995-05-29 08:11:34 quinn + * Moved oid from odr/asn to util. + * + * Revision 1.9 1995/05/22 11:31:25 quinn * Added PDUs * * Revision 1.8 1995/05/17 08:41:35 quinn @@ -88,6 +91,7 @@ #define PROTO_H #include +#include #include /* ----------------- GLOBAL AUXILIARY DEFS ----------------*/ diff --git a/include/prt.h b/include/prt.h index 8300f7a..8fb09e9 100644 --- a/include/prt.h +++ b/include/prt.h @@ -37,10 +37,6 @@ int completeBER(unsigned char *buf, int len); void odr_begin(ODR o); void odr_end(ODR o); void odr_release_mem(struct odr_memblock *p); -void odr_oidcpy(Odr_oid *t, Odr_oid *s); -void odr_oidcat(Odr_oid *t, Odr_oid *s); -int odr_oidcmp(Odr_oid *o1, Odr_oid *o2); -int odr_oidlen(Odr_oid *o); Odr_oid *odr_oiddup(ODR odr, Odr_oid *o); int odr_grow_block(odr_ecblock *b, int min_bytes); int odr_write(ODR o, unsigned char *buf, int bytes); diff --git a/odr/odr_oid.c b/odr/odr_oid.c index 1108a4b..f6d005d 100644 --- a/odr/odr_oid.c +++ b/odr/odr_oid.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_oid.c,v $ - * Revision 1.9 1995-05-16 08:50:57 quinn + * Revision 1.10 1995-05-29 08:11:44 quinn + * Moved oid from odr/asn to util. + * + * Revision 1.9 1995/05/16 08:50:57 quinn * License, documentation, and memory fixes * * Revision 1.8 1995/03/17 10:17:55 quinn @@ -35,6 +38,7 @@ */ #include +#include /* * Top level oid en/decoder. @@ -71,6 +75,6 @@ int odr_oid(ODR o, Odr_oid **p, int opt) return 1; } if (o->direction == ODR_DECODE) - *p = odr_malloc(o, ODR_OID_SIZE * sizeof(**p)); + *p = odr_malloc(o, OID_SIZE * sizeof(**p)); return ber_oidc(o, *p); } diff --git a/odr/odr_util.c b/odr/odr_util.c index 0ea1c08..d399f9e 100644 --- a/odr/odr_util.c +++ b/odr/odr_util.c @@ -1,5 +1,6 @@ #include #include +#include char *odr_indent(ODR o) { @@ -29,52 +30,14 @@ int odp_more_chunks(ODR o, unsigned char *base, int len) return o->bp - base < len; } -/* OID utilities */ - -void odr_oidcpy(Odr_oid *t, Odr_oid *s) -{ - while ((*(t++) = *(s++)) > -1); -} - -void odr_oidcat(Odr_oid *t, Odr_oid *s) -{ - while (*t > -1) - t++; - while ((*(t++) = *(s++)) > -1); -} - -int odr_oidcmp(Odr_oid *o1, Odr_oid *o2) -{ - while (*o1 == *o2 && *o1 > -1) - { - o1++; - o2++; - } - if (*o1 == *o2) - return 0; - else if (*o1 > *o2) - return 1; - else - return -1; -} - -int odr_oidlen(Odr_oid *o) -{ - int len = 0; - - while (*(o++) >= 0) - len++; - return len; -} - Odr_oid *odr_oiddup(ODR odr, Odr_oid *o) { Odr_oid *r; if (!o) return 0; - if (!(r = odr_malloc(odr, (odr_oidlen(o) + 1) * sizeof(Odr_oid)))) + if (!(r = odr_malloc(odr, (oid_oidlen(o) + 1) * sizeof(int)))) return 0; - odr_oidcpy(r, o); + oid_oidcpy(r, o); return r; } -- 1.7.10.4