aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2004-09-23 22:21:07 +0000
committerLev Walkin <vlm@lionet.info>2004-09-23 22:21:07 +0000
commit61f89c4c5792fa780ff465a04f628a6af69a5828 (patch)
tree9493b42b6d12fde8c21407ab8585f0a06a04106c
parentb65b30055c8a7ca96db646dcbfadbe7b8b350a0d (diff)
removed orthohonality
-rw-r--r--libasn1parser/Makefile.in2
-rw-r--r--libasn1parser/asn1p_expr2uclass.h73
-rw-r--r--libasn1parser/asn1p_expr_str.h2
-rwxr-xr-xlibasn1parser/expr-h.pl2
4 files changed, 47 insertions, 32 deletions
diff --git a/libasn1parser/Makefile.in b/libasn1parser/Makefile.in
index ef80e29b..1f29cf7d 100644
--- a/libasn1parser/Makefile.in
+++ b/libasn1parser/Makefile.in
@@ -448,8 +448,8 @@ maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-rm -f asn1p_y.c
- -rm -f asn1p_y.h
-rm -f asn1p_l.c
+ -rm -f asn1p_y.h
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
diff --git a/libasn1parser/asn1p_expr2uclass.h b/libasn1parser/asn1p_expr2uclass.h
index 8812a0be..8bb4f637 100644
--- a/libasn1parser/asn1p_expr2uclass.h
+++ b/libasn1parser/asn1p_expr2uclass.h
@@ -37,37 +37,52 @@ static int expr_type2uclass_value[ASN_EXPR_TYPE_MAX]
[ ASN_STRING_BMPString ] = 30,
};
-static char *expr_uclass2str[32] __attribute__ ((unused)) = {
+static enum asn1p_expr_type expr_utag2type[32] __attribute__ ((unused)) = {
[ 0 ] = 0, /* If zero length, end-of-content */
- [ 1 ] = "BOOLEAN",
- [ 2 ] = "INTEGER",
- [ 3 ] = "BIT STRING",
- [ 4 ] = "OCTET STRING",
- [ 5 ] = "NULL",
- [ 6 ] = "OBJECT IDENTIFIER",
- [ 7 ] = "ObjectDescriptor",
- [ 8 ] = "EXTERNAL",
- [ 9 ] = "REAL",
- [ 10 ] = "ENUMERATED",
- [ 11 ] = "EMBEDDED-PDV",
- [ 12 ] = "UTF8String",
- [ 13 ] = "RELATIVE-OID",
+ [ 1 ] = ASN_BASIC_BOOLEAN,
+ [ 2 ] = ASN_BASIC_INTEGER,
+ [ 3 ] = ASN_BASIC_BIT_STRING,
+ [ 4 ] = ASN_BASIC_OCTET_STRING,
+ [ 5 ] = ASN_BASIC_NULL,
+ [ 6 ] = ASN_BASIC_OBJECT_IDENTIFIER,
+ [ 7 ] = ASN_STRING_ObjectDescriptor,
+ [ 8 ] = ASN_BASIC_EXTERNAL,
+ [ 9 ] = ASN_BASIC_REAL,
+ [ 10 ] = ASN_BASIC_ENUMERATED,
+ [ 11 ] = ASN_BASIC_EMBEDDED_PDV,
+ [ 12 ] = ASN_STRING_UTF8String,
+ [ 13 ] = ASN_BASIC_RELATIVE_OID,
[ 14 ] = 0,
- [ 16 ] = "SEQUENCE", /* Or "SEQUENCE OF" */
- [ 17 ] = "SET", /* Or "SET OF" */
- [ 18 ] = "NumericString", /* " "|"0".."9" */
- [ 19 ] = "PrintableString",
- [ 20 ] = "TeletexString",
- [ 21 ] = "VideotexString",
- [ 22 ] = "IA5String",
- [ 23 ] = "UTCTime",
- [ 24 ] = "GeneralizedTime",
- [ 25 ] = "GraphicString",
- [ 26 ] = "VisibleString",
- [ 27 ] = "GeneralString",
- [ 28 ] = "UniversalString", /* 32-bit UCS-4 */
- [ 29 ] = "CharacterString",
- [ 30 ] = "BMPString", /* 16-bit UCS-2 */
+ [ 15 ] = 0,
+ [ 16 ] = ASN_CONSTR_SEQUENCE, /* Or SEQUENCE OF */
+ [ 17 ] = ASN_CONSTR_SET, /* Or SET OF */
+ [ 18 ] = ASN_STRING_NumericString, /* " "|"0".."9" */
+ [ 19 ] = ASN_STRING_PrintableString,
+ [ 20 ] = ASN_STRING_TeletexString,
+ [ 21 ] = ASN_STRING_VideotexString,
+ [ 22 ] = ASN_STRING_IA5String,
+ [ 23 ] = ASN_BASIC_UTCTime,
+ [ 24 ] = ASN_BASIC_GeneralizedTime,
+ [ 25 ] = ASN_STRING_GraphicString,
+ [ 26 ] = ASN_STRING_VisibleString,
+ [ 27 ] = ASN_STRING_GeneralString,
+ [ 28 ] = ASN_STRING_UniversalString, /* 32-bit UCS-4 */
+ [ 29 ] = ASN_BASIC_CHARACTER_STRING,
+ [ 30 ] = ASN_STRING_BMPString, /* 16-bit UCS-2 */
};
+/*
+ * Convert the [UNIVERSAL value] into the internal type or a string.
+ */
+#define ASN_UNIVERSAL_TAG2TYPE(utag) \
+ ( \
+ (((int)(utag)) < 0 \
+ || ((int)(utag)) >= (int)(sizeof(expr_utag2type) \
+ / sizeof(expr_utag2type[0]))) \
+ ? 0 \
+ : expr_utag2type[(int)(utag)] \
+ )
+#define ASN_UNIVERSAL_TAG2STR(utag) \
+ ASN_EXPR_TYPE2STR(ASN_UNIVERSAL_TAG2TYPE(utag))
+
#endif /* ASN1_PARSER_EXPR2UCLASS_H */
diff --git a/libasn1parser/asn1p_expr_str.h b/libasn1parser/asn1p_expr_str.h
index 40ddeb60..d99f8350 100644
--- a/libasn1parser/asn1p_expr_str.h
+++ b/libasn1parser/asn1p_expr_str.h
@@ -51,7 +51,7 @@ static char *asn1p_expr_type2str[] __attribute__ ((unused)) = {
|| ((size_t)(type)) >= sizeof(asn1p_expr_type2str) \
/ sizeof(asn1p_expr_type2str[0])) \
? (char *)0 \
- : asn1p_expr_type2str[(type)] \
+ : asn1p_expr_type2str[(int)(type)] \
)
#endif /* ASN1_PARSER_EXPR_STR_H */
diff --git a/libasn1parser/expr-h.pl b/libasn1parser/expr-h.pl
index 64f68921..a66425a8 100755
--- a/libasn1parser/expr-h.pl
+++ b/libasn1parser/expr-h.pl
@@ -42,7 +42,7 @@ print<<EOM;
|| ((size_t)(type)) >= sizeof(asn1p_expr_type2str) \\
/ sizeof(asn1p_expr_type2str[0])) \\
? (char *)0 \\
- : asn1p_expr_type2str[(type)] \\
+ : asn1p_expr_type2str[(int)(type)] \\
)
#endif /* ASN1_PARSER_EXPR_STR_H */