blob: 009c0da4ece34425b9b57cd156c308a126d79074 [file] [log] [blame]
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -08001/**
2 * This class file was automatically generated by jASN1 v1.8.2 (http://www.openmuc.org)
3 */
4
5package org.onosproject.xran.asn1lib.pdu;
6
7import com.fasterxml.jackson.annotation.JsonIgnore;
8import com.fasterxml.jackson.annotation.JsonValue;
9import org.onosproject.xran.asn1lib.api.CRNTI;
10import org.onosproject.xran.asn1lib.api.ECGI;
11import org.onosproject.xran.asn1lib.ber.BerByteArrayOutputStream;
12import org.onosproject.xran.asn1lib.ber.BerLength;
13import org.onosproject.xran.asn1lib.ber.BerTag;
14import org.onosproject.xran.asn1lib.ber.types.BerEnum;
15
16import java.io.IOException;
17import java.io.InputStream;
18import java.io.Serializable;
19import java.util.ArrayList;
20import java.util.Iterator;
21import java.util.List;
22
23public class RRMConfigStatus implements Serializable {
24
25 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
26 private static final long serialVersionUID = 1L;
27 @JsonIgnore
28 public byte[] code = null;
29 private ECGI ecgi = null;
30 private Crnti crnti = null;
31 private Status status = null;
32
33 public RRMConfigStatus() {
34 }
35
36 public RRMConfigStatus(byte[] code) {
37 this.code = code;
38 }
39
40 public ECGI getEcgi() {
41 return ecgi;
42 }
43
44 public void setEcgi(ECGI ecgi) {
45 this.ecgi = ecgi;
46 }
47
48 public Crnti getCrnti() {
49 return crnti;
50 }
51
52 public void setCrnti(Crnti crnti) {
53 this.crnti = crnti;
54 }
55
56 public Status getStatus() {
57 return status;
58 }
59
60 public void setStatus(Status status) {
61 this.status = status;
62 }
63
64 public int encode(BerByteArrayOutputStream os) throws IOException {
65 return encode(os, true);
66 }
67
68 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
69
70 if (code != null) {
71 for (int i = code.length - 1; i >= 0; i--) {
72 os.write(code[i]);
73 }
74 if (withTag) {
75 return tag.encode(os) + code.length;
76 }
77 return code.length;
78 }
79
80 int codeLength = 0;
81 codeLength += status.encode(os, false);
82 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
83 os.write(0xA2);
84 codeLength += 1;
85
86 if (crnti != null) {
87 codeLength += crnti.encode(os, false);
88 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
89 os.write(0xA1);
90 codeLength += 1;
91 }
92
93 codeLength += ecgi.encode(os, false);
94 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
95 os.write(0xA0);
96 codeLength += 1;
97
98 codeLength += BerLength.encodeLength(os, codeLength);
99
100 if (withTag) {
101 codeLength += tag.encode(os);
102 }
103
104 return codeLength;
105
106 }
107
108 public int decode(InputStream is) throws IOException {
109 return decode(is, true);
110 }
111
112 public int decode(InputStream is, boolean withTag) throws IOException {
113 int codeLength = 0;
114 int subCodeLength = 0;
115 BerTag berTag = new BerTag();
116
117 if (withTag) {
118 codeLength += tag.decodeAndCheck(is);
119 }
120
121 BerLength length = new BerLength();
122 codeLength += length.decode(is);
123
124 int totalLength = length.val;
125 codeLength += totalLength;
126
127 subCodeLength += berTag.decode(is);
128 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
129 ecgi = new ECGI();
130 subCodeLength += ecgi.decode(is, false);
131 subCodeLength += berTag.decode(is);
132 } else {
133 throw new IOException("Tag does not match the mandatory sequence element tag.");
134 }
135
136 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
137 crnti = new Crnti();
138 subCodeLength += crnti.decode(is, false);
139 subCodeLength += berTag.decode(is);
140 }
141
142 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
143 status = new Status();
144 subCodeLength += status.decode(is, false);
145 if (subCodeLength == totalLength) {
146 return codeLength;
147 }
148 }
149 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
150
151
152 }
153
154 public void encodeAndSave(int encodingSizeGuess) throws IOException {
155 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
156 encode(os, false);
157 code = os.getArray();
158 }
159
160 public String toString() {
161 StringBuilder sb = new StringBuilder();
162 appendAsString(sb, 0);
163 return sb.toString();
164 }
165
166 public void appendAsString(StringBuilder sb, int indentLevel) {
167
168 sb.append("{");
169 sb.append("\n");
170 for (int i = 0; i < indentLevel + 1; i++) {
171 sb.append("\t");
172 }
173 if (ecgi != null) {
174 sb.append("ecgi: ");
175 ecgi.appendAsString(sb, indentLevel + 1);
176 } else {
177 sb.append("ecgi: <empty-required-field>");
178 }
179
180 if (crnti != null) {
181 sb.append(",\n");
182 for (int i = 0; i < indentLevel + 1; i++) {
183 sb.append("\t");
184 }
185 sb.append("crnti: ");
186 crnti.appendAsString(sb, indentLevel + 1);
187 }
188
189 sb.append(",\n");
190 for (int i = 0; i < indentLevel + 1; i++) {
191 sb.append("\t");
192 }
193 if (status != null) {
194 sb.append("status: ");
195 status.appendAsString(sb, indentLevel + 1);
196 } else {
197 sb.append("status: <empty-required-field>");
198 }
199
200 sb.append("\n");
201 for (int i = 0; i < indentLevel; i++) {
202 sb.append("\t");
203 }
204 sb.append("}");
205 }
206
207 public static class Crnti implements Serializable {
208
209 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
210 private static final long serialVersionUID = 1L;
211 @JsonIgnore
212 public byte[] code = null;
213 private List<CRNTI> seqOf = null;
214
215 public Crnti() {
216 seqOf = new ArrayList<CRNTI>();
217 }
218
219 public Crnti(byte[] code) {
220 this.code = code;
221 }
222
223 @JsonValue
224 public List<CRNTI> getCRNTI() {
225 if (seqOf == null) {
226 seqOf = new ArrayList<CRNTI>();
227 }
228 return seqOf;
229 }
230
231 public int encode(BerByteArrayOutputStream os) throws IOException {
232 return encode(os, true);
233 }
234
235 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
236
237 if (code != null) {
238 for (int i = code.length - 1; i >= 0; i--) {
239 os.write(code[i]);
240 }
241 if (withTag) {
242 return tag.encode(os) + code.length;
243 }
244 return code.length;
245 }
246
247 int codeLength = 0;
248 for (int i = (seqOf.size() - 1); i >= 0; i--) {
249 codeLength += seqOf.get(i).encode(os, true);
250 }
251
252 codeLength += BerLength.encodeLength(os, codeLength);
253
254 if (withTag) {
255 codeLength += tag.encode(os);
256 }
257
258 return codeLength;
259 }
260
261 public int decode(InputStream is) throws IOException {
262 return decode(is, true);
263 }
264
265 public int decode(InputStream is, boolean withTag) throws IOException {
266 int codeLength = 0;
267 int subCodeLength = 0;
268 if (withTag) {
269 codeLength += tag.decodeAndCheck(is);
270 }
271
272 BerLength length = new BerLength();
273 codeLength += length.decode(is);
274 int totalLength = length.val;
275
276 while (subCodeLength < totalLength) {
277 CRNTI element = new CRNTI();
278 subCodeLength += element.decode(is, true);
279 seqOf.add(element);
280 }
281 if (subCodeLength != totalLength) {
282 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
283
284 }
285 codeLength += subCodeLength;
286
287 return codeLength;
288 }
289
290 public void encodeAndSave(int encodingSizeGuess) throws IOException {
291 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
292 encode(os, false);
293 code = os.getArray();
294 }
295
296 public String toString() {
297 StringBuilder sb = new StringBuilder();
298 appendAsString(sb, 0);
299 return sb.toString();
300 }
301
302 public void appendAsString(StringBuilder sb, int indentLevel) {
303
304 sb.append("{\n");
305 for (int i = 0; i < indentLevel + 1; i++) {
306 sb.append("\t");
307 }
308 if (seqOf == null) {
309 sb.append("null");
310 } else {
311 Iterator<CRNTI> it = seqOf.iterator();
312 if (it.hasNext()) {
313 sb.append(it.next());
314 while (it.hasNext()) {
315 sb.append(",\n");
316 for (int i = 0; i < indentLevel + 1; i++) {
317 sb.append("\t");
318 }
319 sb.append(it.next());
320 }
321 }
322 }
323
324 sb.append("\n");
325 for (int i = 0; i < indentLevel; i++) {
326 sb.append("\t");
327 }
328 sb.append("}");
329 }
330
331 }
332
333 public static class Status implements Serializable {
334
335 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
336 private static final long serialVersionUID = 1L;
337 @JsonIgnore
338 public byte[] code = null;
339 private List<BerEnum> seqOf = null;
340
341 public Status() {
342 seqOf = new ArrayList<BerEnum>();
343 }
344
345 public Status(byte[] code) {
346 this.code = code;
347 }
348
349 @JsonValue
350 public List<BerEnum> getBerEnum() {
351 if (seqOf == null) {
352 seqOf = new ArrayList<BerEnum>();
353 }
354 return seqOf;
355 }
356
357 public int encode(BerByteArrayOutputStream os) throws IOException {
358 return encode(os, true);
359 }
360
361 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
362
363 if (code != null) {
364 for (int i = code.length - 1; i >= 0; i--) {
365 os.write(code[i]);
366 }
367 if (withTag) {
368 return tag.encode(os) + code.length;
369 }
370 return code.length;
371 }
372
373 int codeLength = 0;
374 for (int i = (seqOf.size() - 1); i >= 0; i--) {
375 codeLength += seqOf.get(i).encode(os, true);
376 }
377
378 codeLength += BerLength.encodeLength(os, codeLength);
379
380 if (withTag) {
381 codeLength += tag.encode(os);
382 }
383
384 return codeLength;
385 }
386
387 public int decode(InputStream is) throws IOException {
388 return decode(is, true);
389 }
390
391 public int decode(InputStream is, boolean withTag) throws IOException {
392 int codeLength = 0;
393 int subCodeLength = 0;
394 if (withTag) {
395 codeLength += tag.decodeAndCheck(is);
396 }
397
398 BerLength length = new BerLength();
399 codeLength += length.decode(is);
400 int totalLength = length.val;
401
402 while (subCodeLength < totalLength) {
403 BerEnum element = new BerEnum();
404 subCodeLength += element.decode(is, true);
405 seqOf.add(element);
406 }
407 if (subCodeLength != totalLength) {
408 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
409
410 }
411 codeLength += subCodeLength;
412
413 return codeLength;
414 }
415
416 public void encodeAndSave(int encodingSizeGuess) throws IOException {
417 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
418 encode(os, false);
419 code = os.getArray();
420 }
421
422 public String toString() {
423 StringBuilder sb = new StringBuilder();
424 appendAsString(sb, 0);
425 return sb.toString();
426 }
427
428 public void appendAsString(StringBuilder sb, int indentLevel) {
429
430 sb.append("{\n");
431 for (int i = 0; i < indentLevel + 1; i++) {
432 sb.append("\t");
433 }
434 if (seqOf == null) {
435 sb.append("null");
436 } else {
437 Iterator<BerEnum> it = seqOf.iterator();
438 if (it.hasNext()) {
439 sb.append(it.next());
440 while (it.hasNext()) {
441 sb.append(",\n");
442 for (int i = 0; i < indentLevel + 1; i++) {
443 sb.append("\t");
444 }
445 sb.append(it.next());
446 }
447 }
448 }
449
450 sb.append("\n");
451 for (int i = 0; i < indentLevel; i++) {
452 sb.append("\t");
453 }
454 sb.append("}");
455 }
456
457 }
458
459}
460