version 4.0.6
[ric-plt/e2.git] / RIC-E2-TERMINATION / 3rdparty / oranE2SM / RANparameter-Name.c
1 /*
2  *
3  * Copyright 2020 AT&T Intellectual Property
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18
19 /*
20  * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
21  * From ASN.1 module "E2SM-gNB-NRT-IEs"
22  *      found in "../asnTextFiles/e2sm-gNB-NRT-v401.asn"
23  *      `asn1c -fcompound-names -fincludes-quoted -fno-include-deps -findirect-choice -gen-PER -no-gen-OER -D.`
24  */
25
26 #include "RANparameter-Name.h"
27
28 static const int permitted_alphabet_table_1[256] = {
29  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        /*                  */
30  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,        /*                  */
31  1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9,        /* .      '() +,-./ */
32 10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22,        /* 0123456789:  = ? */
33  0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,        /*  ABCDEFGHIJKLMNO */
34 38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0,        /* PQRSTUVWXYZ      */
35  0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,        /*  abcdefghijklmno */
36 64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0,        /* pqrstuvwxyz      */
37 };
38 static const int permitted_alphabet_code2value_1[74] = {
39 32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
40 55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
41 75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
42 97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
43 113,114,115,116,117,118,119,120,121,122,};
44
45
46 static int check_permitted_alphabet_1(const void *sptr) {
47         const int *table = permitted_alphabet_table_1;
48         /* The underlying type is PrintableString */
49         const PrintableString_t *st = (const PrintableString_t *)sptr;
50         const uint8_t *ch = st->buf;
51         const uint8_t *end = ch + st->size;
52         
53         for(; ch < end; ch++) {
54                 uint8_t cv = *ch;
55                 if(!table[cv]) return -1;
56         }
57         return 0;
58 }
59
60 int
61 RANparameter_Name_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
62                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
63         const PrintableString_t *st = (const PrintableString_t *)sptr;
64         size_t size;
65         
66         if(!sptr) {
67                 ASN__CTFAIL(app_key, td, sptr,
68                         "%s: value not given (%s:%d)",
69                         td->name, __FILE__, __LINE__);
70                 return -1;
71         }
72         
73         size = st->size;
74         
75         if((size >= 1 && size <= 150)
76                  && !check_permitted_alphabet_1(st)) {
77                 /* Constraint check succeeded */
78                 return 0;
79         } else {
80                 ASN__CTFAIL(app_key, td, sptr,
81                         "%s: constraint failed (%s:%d)",
82                         td->name, __FILE__, __LINE__);
83                 return -1;
84         }
85 }
86
87 static int asn_PER_MAP_RANparameter_Name_1_v2c(unsigned int value) {
88         if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0]))
89                 return -1;
90         return permitted_alphabet_table_1[value] - 1;
91 }
92 static int asn_PER_MAP_RANparameter_Name_1_c2v(unsigned int code) {
93         if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0]))
94                 return -1;
95         return permitted_alphabet_code2value_1[code];
96 }
97 /*
98  * This type is implemented using PrintableString,
99  * so here we adjust the DEF accordingly.
100  */
101 asn_per_constraints_t asn_PER_type_RANparameter_Name_constr_1 CC_NOTUSED = {
102         { APC_CONSTRAINED,       7,  7,  32,  122 }     /* (32..122) */,
103         { APC_CONSTRAINED | APC_EXTENSIBLE,  8,  8,  1,  150 }  /* (SIZE(1..150,...)) */,
104         asn_PER_MAP_RANparameter_Name_1_v2c,    /* Value to PER code map */
105         asn_PER_MAP_RANparameter_Name_1_c2v     /* PER code to value map */
106 };
107 static const ber_tlv_tag_t asn_DEF_RANparameter_Name_tags_1[] = {
108         (ASN_TAG_CLASS_UNIVERSAL | (19 << 2))
109 };
110 asn_TYPE_descriptor_t asn_DEF_RANparameter_Name = {
111         "RANparameter-Name",
112         "RANparameter-Name",
113         &asn_OP_PrintableString,
114         asn_DEF_RANparameter_Name_tags_1,
115         sizeof(asn_DEF_RANparameter_Name_tags_1)
116                 /sizeof(asn_DEF_RANparameter_Name_tags_1[0]), /* 1 */
117         asn_DEF_RANparameter_Name_tags_1,       /* Same as above */
118         sizeof(asn_DEF_RANparameter_Name_tags_1)
119                 /sizeof(asn_DEF_RANparameter_Name_tags_1[0]), /* 1 */
120         { 0, &asn_PER_type_RANparameter_Name_constr_1, RANparameter_Name_constraint },
121         0, 0,   /* No members */
122         0       /* No specifics */
123 };
124