SIM-115: update simulator to use latest E2SM KPM version 3
[sim/e2-interface.git] / e2sim / asn1c / NativeEnumerated.c
1 /*-
2  * Copyright (c) 2004, 2007 Lev Walkin <vlm@lionet.info>. All rights reserved.
3  * Redistribution and modifications are permitted subject to BSD license.
4  */
5 /*
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.
11  */
12 #include <asn_internal.h>
13 #include <NativeEnumerated.h>
14
15 /*
16  * NativeEnumerated basic type description.
17  */
18 static const ber_tlv_tag_t asn_DEF_NativeEnumerated_tags[] = {
19     (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
20 };
21 asn_TYPE_operation_t asn_OP_NativeEnumerated = {
22     NativeInteger_free,
23 #if !defined(ASN_DISABLE_PRINT_SUPPORT)
24     NativeInteger_print,
25 #else
26     0,
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,
32 #else
33     0,
34     0,
35 #endif  /* !defined(ASN_DISABLE_BER_SUPPORT) */
36 #if !defined(ASN_DISABLE_XER_SUPPORT)
37     NativeInteger_decode_xer,
38     NativeEnumerated_encode_xer,
39 #else
40     0,
41     0,
42 #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */
43 #if !defined(ASN_DISABLE_JER_SUPPORT)
44     NativeEnumerated_encode_jer,
45 #else
46     0,
47 #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */
48 #if !defined(ASN_DISABLE_OER_SUPPORT)
49     NativeEnumerated_decode_oer,
50     NativeEnumerated_encode_oer,
51 #else
52     0,
53     0,
54 #endif  /* !defined(ASN_DISABLE_OER_SUPPORT) */
55 #if !defined(ASN_DISABLE_UPER_SUPPORT)
56     NativeEnumerated_decode_uper,
57     NativeEnumerated_encode_uper,
58 #else
59     0,
60     0,
61 #endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) */
62 #if !defined(ASN_DISABLE_APER_SUPPORT)
63     NativeEnumerated_decode_aper,
64     NativeEnumerated_encode_aper,
65 #else
66     0,
67     0,
68 #endif  /* !defined(ASN_DISABLE_APER_SUPPORT) */
69 #if !defined(ASN_DISABLE_RFILL_SUPPORT)
70     NativeEnumerated_random_fill,
71 #else
72     0,
73 #endif  /* !defined(ASN_DISABLE_RFILL_SUPPORT) */
74     0  /* Use generic outmost tag fetcher */
75 };
76 asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = {
77     "ENUMERATED",  /* The ASN.1 type is still ENUMERATED */
78     "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]),
84     {
85 #if !defined(ASN_DISABLE_OER_SUPPORT)
86         0,
87 #endif  /* !defined(ASN_DISABLE_OER_SUPPORT) */
88 #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
89         0,
90 #endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
91         asn_generic_no_constraint
92     },
93     0, 0,  /* No members */
94     0  /* No specifics */
95 };
96
97 #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
98 int
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)
103         return 0;
104     if(a->nat_value < b->nat_value)
105         return -1;
106     return 1;
107 }
108 #endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */