aboutsummaryrefslogtreecommitdiffstats
path: root/libasn1parser/asn1p_expr2uclass.h
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 /libasn1parser/asn1p_expr2uclass.h
parentb65b30055c8a7ca96db646dcbfadbe7b8b350a0d (diff)
removed orthohonality
Diffstat (limited to 'libasn1parser/asn1p_expr2uclass.h')
-rw-r--r--libasn1parser/asn1p_expr2uclass.h73
1 files changed, 44 insertions, 29 deletions
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 */