6b1cceafba53b4f0253d1bea06e13b3ea12f3d27
[ric-plt/e2.git] / RIC-E2-TERMINATION / 3rdparty / oranE2 / ENB-ID-Choice.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 "E2AP-IEs"
22  *      found in "e2ap-v01.01.00.asn"
23  *      `asn1c -pdu=auto -fincludes-quoted -fcompound-names -findirect-choice -fno-include-deps -gen-PER -no-gen-OER -no-gen-example`
24  */
25
26 #include "ENB-ID-Choice.h"
27
28 static int
29 memb_enb_ID_macro_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
30                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
31         const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
32         size_t size;
33         
34         if(!sptr) {
35                 ASN__CTFAIL(app_key, td, sptr,
36                         "%s: value not given (%s:%d)",
37                         td->name, __FILE__, __LINE__);
38                 return -1;
39         }
40         
41         if(st->size > 0) {
42                 /* Size in bits */
43                 size = 8 * st->size - (st->bits_unused & 0x07);
44         } else {
45                 size = 0;
46         }
47         
48         if((size == 20)) {
49                 /* Constraint check succeeded */
50                 return 0;
51         } else {
52                 ASN__CTFAIL(app_key, td, sptr,
53                         "%s: constraint failed (%s:%d)",
54                         td->name, __FILE__, __LINE__);
55                 return -1;
56         }
57 }
58
59 static int
60 memb_enb_ID_shortmacro_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
61                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
62         const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
63         size_t size;
64         
65         if(!sptr) {
66                 ASN__CTFAIL(app_key, td, sptr,
67                         "%s: value not given (%s:%d)",
68                         td->name, __FILE__, __LINE__);
69                 return -1;
70         }
71         
72         if(st->size > 0) {
73                 /* Size in bits */
74                 size = 8 * st->size - (st->bits_unused & 0x07);
75         } else {
76                 size = 0;
77         }
78         
79         if((size == 18)) {
80                 /* Constraint check succeeded */
81                 return 0;
82         } else {
83                 ASN__CTFAIL(app_key, td, sptr,
84                         "%s: constraint failed (%s:%d)",
85                         td->name, __FILE__, __LINE__);
86                 return -1;
87         }
88 }
89
90 static int
91 memb_enb_ID_longmacro_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
92                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
93         const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
94         size_t size;
95         
96         if(!sptr) {
97                 ASN__CTFAIL(app_key, td, sptr,
98                         "%s: value not given (%s:%d)",
99                         td->name, __FILE__, __LINE__);
100                 return -1;
101         }
102         
103         if(st->size > 0) {
104                 /* Size in bits */
105                 size = 8 * st->size - (st->bits_unused & 0x07);
106         } else {
107                 size = 0;
108         }
109         
110         if((size == 21)) {
111                 /* Constraint check succeeded */
112                 return 0;
113         } else {
114                 ASN__CTFAIL(app_key, td, sptr,
115                         "%s: constraint failed (%s:%d)",
116                         td->name, __FILE__, __LINE__);
117                 return -1;
118         }
119 }
120
121 static asn_per_constraints_t asn_PER_memb_enb_ID_macro_constr_2 CC_NOTUSED = {
122         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
123         { APC_CONSTRAINED,       0,  0,  20,  20 }      /* (SIZE(20..20)) */,
124         0, 0    /* No PER value map */
125 };
126 static asn_per_constraints_t asn_PER_memb_enb_ID_shortmacro_constr_3 CC_NOTUSED = {
127         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
128         { APC_CONSTRAINED,       0,  0,  18,  18 }      /* (SIZE(18..18)) */,
129         0, 0    /* No PER value map */
130 };
131 static asn_per_constraints_t asn_PER_memb_enb_ID_longmacro_constr_4 CC_NOTUSED = {
132         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
133         { APC_CONSTRAINED,       0,  0,  21,  21 }      /* (SIZE(21..21)) */,
134         0, 0    /* No PER value map */
135 };
136 asn_per_constraints_t asn_PER_type_ENB_ID_Choice_constr_1 CC_NOTUSED = {
137         { APC_CONSTRAINED | APC_EXTENSIBLE,  2,  2,  0,  2 }    /* (0..2,...) */,
138         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
139         0, 0    /* No PER value map */
140 };
141 asn_TYPE_member_t asn_MBR_ENB_ID_Choice_1[] = {
142         { ATF_NOFLAGS, 0, offsetof(struct ENB_ID_Choice, choice.enb_ID_macro),
143                 (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
144                 -1,     /* IMPLICIT tag at current level */
145                 &asn_DEF_BIT_STRING,
146                 0,
147                 { 0, &asn_PER_memb_enb_ID_macro_constr_2,  memb_enb_ID_macro_constraint_1 },
148                 0, 0, /* No default value */
149                 "enb-ID-macro"
150                 },
151         { ATF_NOFLAGS, 0, offsetof(struct ENB_ID_Choice, choice.enb_ID_shortmacro),
152                 (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
153                 -1,     /* IMPLICIT tag at current level */
154                 &asn_DEF_BIT_STRING,
155                 0,
156                 { 0, &asn_PER_memb_enb_ID_shortmacro_constr_3,  memb_enb_ID_shortmacro_constraint_1 },
157                 0, 0, /* No default value */
158                 "enb-ID-shortmacro"
159                 },
160         { ATF_NOFLAGS, 0, offsetof(struct ENB_ID_Choice, choice.enb_ID_longmacro),
161                 (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
162                 -1,     /* IMPLICIT tag at current level */
163                 &asn_DEF_BIT_STRING,
164                 0,
165                 { 0, &asn_PER_memb_enb_ID_longmacro_constr_4,  memb_enb_ID_longmacro_constraint_1 },
166                 0, 0, /* No default value */
167                 "enb-ID-longmacro"
168                 },
169 };
170 static const asn_TYPE_tag2member_t asn_MAP_ENB_ID_Choice_tag2el_1[] = {
171     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* enb-ID-macro */
172     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* enb-ID-shortmacro */
173     { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* enb-ID-longmacro */
174 };
175 asn_CHOICE_specifics_t asn_SPC_ENB_ID_Choice_specs_1 = {
176         sizeof(struct ENB_ID_Choice),
177         offsetof(struct ENB_ID_Choice, _asn_ctx),
178         offsetof(struct ENB_ID_Choice, present),
179         sizeof(((struct ENB_ID_Choice *)0)->present),
180         asn_MAP_ENB_ID_Choice_tag2el_1,
181         3,      /* Count of tags in the map */
182         0, 0,
183         3       /* Extensions start */
184 };
185 asn_TYPE_descriptor_t asn_DEF_ENB_ID_Choice = {
186         "ENB-ID-Choice",
187         "ENB-ID-Choice",
188         &asn_OP_CHOICE,
189         0,      /* No effective tags (pointer) */
190         0,      /* No effective tags (count) */
191         0,      /* No tags (pointer) */
192         0,      /* No tags (count) */
193         { 0, &asn_PER_type_ENB_ID_Choice_constr_1, CHOICE_constraint },
194         asn_MBR_ENB_ID_Choice_1,
195         3,      /* Elements count */
196         &asn_SPC_ENB_ID_Choice_specs_1  /* Additional specs */
197 };
198