2 * Copyright (c) 2004, 2007 Lev Walkin <vlm@lionet.info>. All rights reserved.
3 * Redistribution and modifications are permitted subject to BSD license.
6 * Read the NativeInteger.h for the explanation wrt. differences between
7 * INTEGER and NativeInteger.
8 * Basically, both are decoders and encoders of ASN.1 INTEGER type, but this
9 * implementation deals with the standard (machine-specific) representation
10 * of them instead of using the platform-independent buffer.
12 #include <asn_internal.h>
13 #include <NativeEnumerated.h>
16 * NativeEnumerated basic type description.
18 static const ber_tlv_tag_t asn_DEF_NativeEnumerated_tags[] = {
19 (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
21 asn_TYPE_operation_t asn_OP_NativeEnumerated = {
23 #if !defined(ASN_DISABLE_PRINT_SUPPORT)
27 #endif /* !defined(ASN_DISABLE_PRINT_SUPPORT) */
28 NativeInteger_compare,
29 #if !defined(ASN_DISABLE_BER_SUPPORT)
30 NativeInteger_decode_ber,
31 NativeInteger_encode_der,
35 #endif /* !defined(ASN_DISABLE_BER_SUPPORT) */
36 #if !defined(ASN_DISABLE_XER_SUPPORT)
37 NativeInteger_decode_xer,
38 NativeEnumerated_encode_xer,
42 #endif /* !defined(ASN_DISABLE_XER_SUPPORT) */
43 #if !defined(ASN_DISABLE_JER_SUPPORT)
44 NativeEnumerated_encode_jer,
47 #endif /* !defined(ASN_DISABLE_JER_SUPPORT) */
48 #if !defined(ASN_DISABLE_OER_SUPPORT)
49 NativeEnumerated_decode_oer,
50 NativeEnumerated_encode_oer,
54 #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
55 #if !defined(ASN_DISABLE_UPER_SUPPORT)
56 NativeEnumerated_decode_uper,
57 NativeEnumerated_encode_uper,
61 #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) */
62 #if !defined(ASN_DISABLE_APER_SUPPORT)
63 NativeEnumerated_decode_aper,
64 NativeEnumerated_encode_aper,
68 #endif /* !defined(ASN_DISABLE_APER_SUPPORT) */
69 #if !defined(ASN_DISABLE_RFILL_SUPPORT)
70 NativeEnumerated_random_fill,
73 #endif /* !defined(ASN_DISABLE_RFILL_SUPPORT) */
74 0 /* Use generic outmost tag fetcher */
76 asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = {
77 "ENUMERATED", /* The ASN.1 type is still ENUMERATED */
79 &asn_OP_NativeEnumerated,
80 asn_DEF_NativeEnumerated_tags,
81 sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]),
82 asn_DEF_NativeEnumerated_tags, /* Same as above */
83 sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]),
85 #if !defined(ASN_DISABLE_OER_SUPPORT)
87 #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
88 #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
90 #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
91 asn_generic_no_constraint
93 0, 0, /* No members */
97 #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
99 NativeEnumerated__compar_value2enum(const void *ap, const void *bp) {
100 const asn_INTEGER_enum_map_t *a = ap;
101 const asn_INTEGER_enum_map_t *b = bp;
102 if(a->nat_value == b->nat_value)
104 if(a->nat_value < b->nat_value)
108 #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */