Enhanced SIM for E2AP v1 for TS UC
[sim/e2-interface.git] / e2sim / e2apv1sim / src / ASN1 / generated / X2AP-CommonDataTypes.hpp
1 /*****************************************************************************
2 # Copyright 2019 AT&T Intellectual Property                                  *
3 #                                                                            *
4 # Licensed under the Apache License, Version 2.0 (the "License");            *
5 # you may not use this file except in compliance with the License.           *
6 # You may obtain a copy of the License at                                    *
7 #                                                                            *
8 #      http://www.apache.org/licenses/LICENSE-2.0                            *
9 #                                                                            *
10 # Unless required by applicable law or agreed to in writing, software        *
11 # distributed under the License is distributed on an "AS IS" BASIS,          *
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *
13 # See the License for the specific language governing permissions and        *
14 # limitations under the License.                                             *
15 #                                                                            *
16 ******************************************************************************/
17
18 #pragma once
19
20 #include "asn/asn.hpp"
21 static_assert(ASN_API_VERSION_MAJOR == 5, "re-generate the ASN parser's code using 'make regen-asn' (do not use -j option)");
22
23
24 /*
25 Criticality             ::= ENUMERATED { reject, ignore, notify }
26 */
27
28 struct Criticality : asn::enumerated<3, 0, false>
29 {
30         static constexpr const char* name() {return "Criticality";}
31         using parent_t = asn::enumerated<3, 0, false>;
32         typedef enum {
33                 reject
34                 ,ignore
35                 ,notify
36         } index_t;
37
38 };
39
40 /*
41 Presence                ::= ENUMERATED { optional, conditional, mandatory }
42 */
43
44 struct Presence : asn::enumerated<3, 0, false>
45 {
46         static constexpr const char* name() {return "Presence";}
47         using parent_t = asn::enumerated<3, 0, false>;
48         typedef enum {
49                 optional
50                 ,conditional
51                 ,mandatory
52         } index_t;
53
54 };
55
56 /*
57 maxPrivateIEs                                                                   INTEGER ::= 65535
58 */
59
60 constexpr int64_t maxPrivateIEs = 65535;
61 /*
62 PrivateIE-ID    ::= CHOICE {
63         local                           INTEGER (0.. maxPrivateIEs),
64         global                          OBJECT IDENTIFIER
65 }
66 */
67
68 struct PrivateIE_ID : asn::choice<2, 0, false>
69 {
70         static constexpr const char* name() {return "PrivateIE-ID";}
71         using parent_t = asn::choice<2, 0, false>;
72         index_type get_index() const {return index;}
73         ~PrivateIE_ID() {clear();}
74         struct local_t : asn::integer<>
75         {
76                 using constraint_t = asn::constraints<false,asn::span<0,  maxPrivateIEs >>;
77                 static constexpr const char* name() {return "local_t";}
78                 using parent_t = asn::integer<>;
79
80         };
81
82         struct global_t : asn::oid
83         {
84                 static constexpr const char* name() {return "global_t";}
85                 using parent_t = asn::oid;
86
87         };
88         void clear()
89         {
90                 switch(get_index())
91                 {
92                 case 1: var.destroy<local_t>(); break;
93                 case 2: var.destroy<global_t>(); break;
94                 }
95                 index = 0;
96                 base::clear();
97         }
98         template<typename V> bool decode(size_t idx, V& v)
99         {
100                 clear();
101                 switch(idx)
102                 {
103                 case 1: set_index(1); return v(var.build<local_t>());
104                 case 2: set_index(2); return v(var.build<global_t>());
105                 }
106                 return false;
107
108         }
109         template<typename V> bool encode(V& v) const
110         {
111                 switch(get_index())
112                 {
113                 case 1: return v(var.as<local_t>());
114                 case 2: return v(var.as<global_t>());
115                 }
116                 return false;
117         }
118         template<typename V> static inline void enumerate(V& v)
119         {
120                 v.template operator()<local_t>(1);
121                 v.template operator()<global_t>(2);
122
123         }
124         local_t& select_local() { if(get_index() != 1) { clear(); set_index(1); return var.build<local_t>();} return var.as<local_t>();}
125         local_t const* get_local() const { if(get_index() == 1) { return &var.as<local_t>();} return nullptr; }
126         global_t& select_global() { if(get_index() != 2) { clear(); set_index(2); return var.build<global_t>();} return var.as<global_t>();}
127         global_t const* get_global() const { if(get_index() == 2) { return &var.as<global_t>();} return nullptr; }
128         private:
129         void set_index(index_type i) {index = i; base::set();}
130         union union_type
131         {
132                 char dummy1[sizeof(local_t)];
133                 char dummy2[sizeof(global_t)];
134
135         };
136         asn::variant<sizeof(union_type)>        var;
137         index_type      index {0};
138 };
139 /*
140 ProcedureCode           ::= INTEGER (0..255)
141 */
142
143 struct ProcedureCode : asn::integer<>
144 {
145         using constraint_t = asn::constraints<false,asn::span<0, 255>>;
146         static constexpr const char* name() {return "ProcedureCode";}
147         using parent_t = asn::integer<>;
148
149 };
150
151 /*
152 maxProtocolIEs                                                                  INTEGER ::= 65535
153 */
154
155 constexpr int64_t maxProtocolIEs = 65535;
156 /*
157 ProtocolIE-ID           ::= INTEGER (0..maxProtocolIEs)
158 */
159
160 struct ProtocolIE_ID : asn::integer<>
161 {
162         using constraint_t = asn::constraints<false,asn::span<0,  maxProtocolIEs >>;
163         static constexpr const char* name() {return "ProtocolIE-ID";}
164         using parent_t = asn::integer<>;
165
166 };
167
168 /*
169 TriggeringMessage       ::= ENUMERATED { initiating-message, successful-outcome, unsuccessful-outcome}
170 */
171
172 struct TriggeringMessage : asn::enumerated<3, 0, false>
173 {
174         static constexpr const char* name() {return "TriggeringMessage";}
175         using parent_t = asn::enumerated<3, 0, false>;
176         typedef enum {
177                 initiating_message
178                 ,successful_outcome
179                 ,unsuccessful_outcome
180         } index_t;
181
182 };
183
184 /*
185 maxProtocolExtensions                                                   INTEGER ::= 65535
186 */
187
188 constexpr int64_t maxProtocolExtensions = 65535;