Replacing E2AP v1.0 asn files with E2AP v2.0 files [Jira Id - ODUHIGH-409]
[o-du/l2.git] / src / codec_utils / E2AP / RANfunctionOID.c
1 /*
2  * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
3  * From ASN.1 module "E2AP-IEs"
4  *      found in "2022_E2AP.asn1"
5  *      `asn1c -D ./E2AP/ -fcompound-names -fno-include-deps -findirect-choice -gen-PER -no-gen-example`
6  */
7
8 #include "RANfunctionOID.h"
9
10 static const int permitted_alphabet_table_1[256] = {
11  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        /*                  */
12  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        /*                  */
13  1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9,        /* .      '() +,-./ */
14 10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22,        /* 0123456789:  = ? */
15  0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,        /*  ABCDEFGHIJKLMNO */
16 38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0,        /* PQRSTUVWXYZ      */
17  0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,        /*  abcdefghijklmno */
18 64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0,        /* pqrstuvwxyz      */
19 };
20 static const int permitted_alphabet_code2value_1[74] = {
21 32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
22 55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
23 75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
24 97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
25 113,114,115,116,117,118,119,120,121,122,};
26
27
28 static int check_permitted_alphabet_1(const void *sptr) {
29         const int *table = permitted_alphabet_table_1;
30         /* The underlying type is PrintableString */
31         const PrintableString_t *st = (const PrintableString_t *)sptr;
32         const uint8_t *ch = st->buf;
33         const uint8_t *end = ch + st->size;
34         
35         for(; ch < end; ch++) {
36                 uint8_t cv = *ch;
37                 if(!table[cv]) return -1;
38         }
39         return 0;
40 }
41
42 int
43 RANfunctionOID_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
44                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
45         const PrintableString_t *st = (const PrintableString_t *)sptr;
46         size_t size;
47         
48         if(!sptr) {
49                 ASN__CTFAIL(app_key, td, sptr,
50                         "%s: value not given (%s:%d)",
51                         td->name, __FILE__, __LINE__);
52                 return -1;
53         }
54         
55         size = st->size;
56         
57         if((size >= 1 && size <= 1000)
58                  && !check_permitted_alphabet_1(st)) {
59                 /* Constraint check succeeded */
60                 return 0;
61         } else {
62                 ASN__CTFAIL(app_key, td, sptr,
63                         "%s: constraint failed (%s:%d)",
64                         td->name, __FILE__, __LINE__);
65                 return -1;
66         }
67 }
68
69 static int asn_PER_MAP_RANfunctionOID_1_v2c(unsigned int value) {
70         if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0]))
71                 return -1;
72         return permitted_alphabet_table_1[value] - 1;
73 }
74 static int asn_PER_MAP_RANfunctionOID_1_c2v(unsigned int code) {
75         if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0]))
76                 return -1;
77         return permitted_alphabet_code2value_1[code];
78 }
79 /*
80  * This type is implemented using PrintableString,
81  * so here we adjust the DEF accordingly.
82  */
83 static asn_oer_constraints_t asn_OER_type_RANfunctionOID_constr_1 CC_NOTUSED = {
84         { 0, 0 },
85         -1      /* (SIZE(0..MAX)) */};
86 asn_per_constraints_t asn_PER_type_RANfunctionOID_constr_1 CC_NOTUSED = {
87         { APC_CONSTRAINED,       7,  7,  32,  122 }     /* (32..122) */,
88         { APC_CONSTRAINED | APC_EXTENSIBLE,  10,  10,  1,  1000 }       /* (SIZE(1..1000,...)) */,
89         asn_PER_MAP_RANfunctionOID_1_v2c,       /* Value to PER code map */
90         asn_PER_MAP_RANfunctionOID_1_c2v        /* PER code to value map */
91 };
92 static const ber_tlv_tag_t asn_DEF_RANfunctionOID_tags_1[] = {
93         (ASN_TAG_CLASS_UNIVERSAL | (19 << 2))
94 };
95 asn_TYPE_descriptor_t asn_DEF_RANfunctionOID = {
96         "RANfunctionOID",
97         "RANfunctionOID",
98         &asn_OP_PrintableString,
99         asn_DEF_RANfunctionOID_tags_1,
100         sizeof(asn_DEF_RANfunctionOID_tags_1)
101                 /sizeof(asn_DEF_RANfunctionOID_tags_1[0]), /* 1 */
102         asn_DEF_RANfunctionOID_tags_1,  /* Same as above */
103         sizeof(asn_DEF_RANfunctionOID_tags_1)
104                 /sizeof(asn_DEF_RANfunctionOID_tags_1[0]), /* 1 */
105         { &asn_OER_type_RANfunctionOID_constr_1, &asn_PER_type_RANfunctionOID_constr_1, RANfunctionOID_constraint },
106         0, 0,   /* No members */
107         0       /* No specifics */
108 };
109