blob: 20b0980e26a1cfead2f638eac90df690b1f8f902 [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.*;
10import org.onosproject.xran.asn1lib.ber.BerByteArrayOutputStream;
11import org.onosproject.xran.asn1lib.ber.BerLength;
12import org.onosproject.xran.asn1lib.ber.BerTag;
13import org.onosproject.xran.asn1lib.ber.types.string.BerUTF8String;
14
15import java.io.IOException;
16import java.io.InputStream;
17import java.io.Serializable;
18import java.io.UnsupportedEncodingException;
19import java.util.ArrayList;
20import java.util.Iterator;
21import java.util.List;
22
23public class RRCMeasConfig 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 MeasObjects measObjects = null;
32 private ReportConfigs reportConfigs = null;
33 private MeasIds measIds = null;
34
35 public RRCMeasConfig() {
36 }
37
38 public RRCMeasConfig(byte[] code) {
39 this.code = code;
40 }
41
42 public static XrancPdu constructPacket(
43 ECGI ecgi, CRNTI crnti, MeasObjects measObjects, ReportConfigs reportConfigs,
44 MeasIds measIds, int rxSignalInterval
45 ) {
46 RRCMeasConfig rrcMeasConfig = new RRCMeasConfig();
47
48 Crnti crntilist = new Crnti();
49 crntilist.getCRNTI().add(crnti);
50
51 rrcMeasConfig.setEcgi(ecgi);
52 rrcMeasConfig.setCrnti(crntilist);
53 rrcMeasConfig.setMeasIds(measIds);
54 rrcMeasConfig.setMeasObjects(measObjects);
55 rrcMeasConfig.setReportConfigs(reportConfigs);
56
57 BerUTF8String ver = null;
58 try {
59 ver = new BerUTF8String("5");
60 } catch (UnsupportedEncodingException e) {
61 e.printStackTrace();
62 }
63
64 XrancApiID apiID = new XrancApiID(34);
65 XrancPduBody body = new XrancPduBody();
66 body.setRRCMeasConfig(rrcMeasConfig);
67
68 XrancPduHdr hdr = new XrancPduHdr();
69 hdr.setVer(ver);
70 hdr.setApiId(apiID);
71
72 XrancPdu pdu = new XrancPdu();
73 pdu.setBody(body);
74 pdu.setHdr(hdr);
75
76 return pdu;
77 }
78
79 public ECGI getEcgi() {
80 return ecgi;
81 }
82
83 public void setEcgi(ECGI ecgi) {
84 this.ecgi = ecgi;
85 }
86
87 public Crnti getCrnti() {
88 return crnti;
89 }
90
91 public void setCrnti(Crnti crnti) {
92 this.crnti = crnti;
93 }
94
95 public MeasObjects getMeasObjects() {
96 return measObjects;
97 }
98
99 public void setMeasObjects(MeasObjects measObjects) {
100 this.measObjects = measObjects;
101 }
102
103 public ReportConfigs getReportConfigs() {
104 return reportConfigs;
105 }
106
107 public void setReportConfigs(ReportConfigs reportConfigs) {
108 this.reportConfigs = reportConfigs;
109 }
110
111 public MeasIds getMeasIds() {
112 return measIds;
113 }
114
115 public void setMeasIds(MeasIds measIds) {
116 this.measIds = measIds;
117 }
118
119 public int encode(BerByteArrayOutputStream os) throws IOException {
120 return encode(os, true);
121 }
122
123 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
124
125 if (code != null) {
126 for (int i = code.length - 1; i >= 0; i--) {
127 os.write(code[i]);
128 }
129 if (withTag) {
130 return tag.encode(os) + code.length;
131 }
132 return code.length;
133 }
134
135 int codeLength = 0;
136 codeLength += measIds.encode(os, false);
137 // write tag: CONTEXT_CLASS, CONSTRUCTED, 4
138 os.write(0xA4);
139 codeLength += 1;
140
141 codeLength += reportConfigs.encode(os, false);
142 // write tag: CONTEXT_CLASS, CONSTRUCTED, 3
143 os.write(0xA3);
144 codeLength += 1;
145
146 codeLength += measObjects.encode(os, false);
147 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
148 os.write(0xA2);
149 codeLength += 1;
150
151 if (crnti != null) {
152 codeLength += crnti.encode(os, false);
153 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
154 os.write(0xA1);
155 codeLength += 1;
156 }
157
158 codeLength += ecgi.encode(os, false);
159 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
160 os.write(0xA0);
161 codeLength += 1;
162
163 codeLength += BerLength.encodeLength(os, codeLength);
164
165 if (withTag) {
166 codeLength += tag.encode(os);
167 }
168
169 return codeLength;
170
171 }
172
173 public int decode(InputStream is) throws IOException {
174 return decode(is, true);
175 }
176
177 public int decode(InputStream is, boolean withTag) throws IOException {
178 int codeLength = 0;
179 int subCodeLength = 0;
180 BerTag berTag = new BerTag();
181
182 if (withTag) {
183 codeLength += tag.decodeAndCheck(is);
184 }
185
186 BerLength length = new BerLength();
187 codeLength += length.decode(is);
188
189 int totalLength = length.val;
190 codeLength += totalLength;
191
192 subCodeLength += berTag.decode(is);
193 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
194 ecgi = new ECGI();
195 subCodeLength += ecgi.decode(is, false);
196 subCodeLength += berTag.decode(is);
197 } else {
198 throw new IOException("Tag does not match the mandatory sequence element tag.");
199 }
200
201 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
202 crnti = new Crnti();
203 subCodeLength += crnti.decode(is, false);
204 subCodeLength += berTag.decode(is);
205 }
206
207 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
208 measObjects = new MeasObjects();
209 subCodeLength += measObjects.decode(is, false);
210 subCodeLength += berTag.decode(is);
211 } else {
212 throw new IOException("Tag does not match the mandatory sequence element tag.");
213 }
214
215 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
216 reportConfigs = new ReportConfigs();
217 subCodeLength += reportConfigs.decode(is, false);
218 subCodeLength += berTag.decode(is);
219 } else {
220 throw new IOException("Tag does not match the mandatory sequence element tag.");
221 }
222
223 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
224 measIds = new MeasIds();
225 subCodeLength += measIds.decode(is, false);
226 if (subCodeLength == totalLength) {
227 return codeLength;
228 }
229 }
230 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
231
232
233 }
234
235 public void encodeAndSave(int encodingSizeGuess) throws IOException {
236 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
237 encode(os, false);
238 code = os.getArray();
239 }
240
241 public String toString() {
242 StringBuilder sb = new StringBuilder();
243 appendAsString(sb, 0);
244 return sb.toString();
245 }
246
247 public void appendAsString(StringBuilder sb, int indentLevel) {
248
249 sb.append("{");
250 sb.append("\n");
251 for (int i = 0; i < indentLevel + 1; i++) {
252 sb.append("\t");
253 }
254 if (ecgi != null) {
255 sb.append("ecgi: ");
256 ecgi.appendAsString(sb, indentLevel + 1);
257 } else {
258 sb.append("ecgi: <empty-required-field>");
259 }
260
261 if (crnti != null) {
262 sb.append(",\n");
263 for (int i = 0; i < indentLevel + 1; i++) {
264 sb.append("\t");
265 }
266 sb.append("crnti: ");
267 crnti.appendAsString(sb, indentLevel + 1);
268 }
269
270 sb.append(",\n");
271 for (int i = 0; i < indentLevel + 1; i++) {
272 sb.append("\t");
273 }
274 if (measObjects != null) {
275 sb.append("measObjects: ");
276 measObjects.appendAsString(sb, indentLevel + 1);
277 } else {
278 sb.append("measObjects: <empty-required-field>");
279 }
280
281 sb.append(",\n");
282 for (int i = 0; i < indentLevel + 1; i++) {
283 sb.append("\t");
284 }
285 if (reportConfigs != null) {
286 sb.append("reportConfigs: ");
287 reportConfigs.appendAsString(sb, indentLevel + 1);
288 } else {
289 sb.append("reportConfigs: <empty-required-field>");
290 }
291
292 sb.append(",\n");
293 for (int i = 0; i < indentLevel + 1; i++) {
294 sb.append("\t");
295 }
296 if (measIds != null) {
297 sb.append("measIds: ");
298 measIds.appendAsString(sb, indentLevel + 1);
299 } else {
300 sb.append("measIds: <empty-required-field>");
301 }
302
303 sb.append("\n");
304 for (int i = 0; i < indentLevel; i++) {
305 sb.append("\t");
306 }
307 sb.append("}");
308 }
309
310 public static class Crnti implements Serializable {
311
312 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
313 private static final long serialVersionUID = 1L;
314 @JsonIgnore
315 public byte[] code = null;
316 private List<CRNTI> seqOf = null;
317
318 public Crnti() {
319 seqOf = new ArrayList<CRNTI>();
320 }
321
322 public Crnti(byte[] code) {
323 this.code = code;
324 }
325
326 @JsonValue
327 public List<CRNTI> getCRNTI() {
328 if (seqOf == null) {
329 seqOf = new ArrayList<CRNTI>();
330 }
331 return seqOf;
332 }
333
334 public int encode(BerByteArrayOutputStream os) throws IOException {
335 return encode(os, true);
336 }
337
338 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
339
340 if (code != null) {
341 for (int i = code.length - 1; i >= 0; i--) {
342 os.write(code[i]);
343 }
344 if (withTag) {
345 return tag.encode(os) + code.length;
346 }
347 return code.length;
348 }
349
350 int codeLength = 0;
351 for (int i = (seqOf.size() - 1); i >= 0; i--) {
352 codeLength += seqOf.get(i).encode(os, true);
353 }
354
355 codeLength += BerLength.encodeLength(os, codeLength);
356
357 if (withTag) {
358 codeLength += tag.encode(os);
359 }
360
361 return codeLength;
362 }
363
364 public int decode(InputStream is) throws IOException {
365 return decode(is, true);
366 }
367
368 public int decode(InputStream is, boolean withTag) throws IOException {
369 int codeLength = 0;
370 int subCodeLength = 0;
371 if (withTag) {
372 codeLength += tag.decodeAndCheck(is);
373 }
374
375 BerLength length = new BerLength();
376 codeLength += length.decode(is);
377 int totalLength = length.val;
378
379 while (subCodeLength < totalLength) {
380 CRNTI element = new CRNTI();
381 subCodeLength += element.decode(is, true);
382 seqOf.add(element);
383 }
384 if (subCodeLength != totalLength) {
385 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
386
387 }
388 codeLength += subCodeLength;
389
390 return codeLength;
391 }
392
393 public void encodeAndSave(int encodingSizeGuess) throws IOException {
394 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
395 encode(os, false);
396 code = os.getArray();
397 }
398
399 public String toString() {
400 StringBuilder sb = new StringBuilder();
401 appendAsString(sb, 0);
402 return sb.toString();
403 }
404
405 public void appendAsString(StringBuilder sb, int indentLevel) {
406
407 sb.append("{\n");
408 for (int i = 0; i < indentLevel + 1; i++) {
409 sb.append("\t");
410 }
411 if (seqOf == null) {
412 sb.append("null");
413 } else {
414 Iterator<CRNTI> it = seqOf.iterator();
415 if (it.hasNext()) {
416 sb.append(it.next());
417 while (it.hasNext()) {
418 sb.append(",\n");
419 for (int i = 0; i < indentLevel + 1; i++) {
420 sb.append("\t");
421 }
422 sb.append(it.next());
423 }
424 }
425 }
426
427 sb.append("\n");
428 for (int i = 0; i < indentLevel; i++) {
429 sb.append("\t");
430 }
431 sb.append("}");
432 }
433
434 }
435
436 public static class MeasObjects implements Serializable {
437
438 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
439 private static final long serialVersionUID = 1L;
440 @JsonIgnore
441 public byte[] code = null;
442 private List<MeasObject> seqOf = null;
443
444 public MeasObjects() {
445 seqOf = new ArrayList<MeasObject>();
446 }
447
448 public MeasObjects(byte[] code) {
449 this.code = code;
450 }
451
452 @JsonValue
453 public List<MeasObject> getMeasObject() {
454 if (seqOf == null) {
455 seqOf = new ArrayList<MeasObject>();
456 }
457 return seqOf;
458 }
459
460 public int encode(BerByteArrayOutputStream os) throws IOException {
461 return encode(os, true);
462 }
463
464 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
465
466 if (code != null) {
467 for (int i = code.length - 1; i >= 0; i--) {
468 os.write(code[i]);
469 }
470 if (withTag) {
471 return tag.encode(os) + code.length;
472 }
473 return code.length;
474 }
475
476 int codeLength = 0;
477 for (int i = (seqOf.size() - 1); i >= 0; i--) {
478 codeLength += seqOf.get(i).encode(os, true);
479 }
480
481 codeLength += BerLength.encodeLength(os, codeLength);
482
483 if (withTag) {
484 codeLength += tag.encode(os);
485 }
486
487 return codeLength;
488 }
489
490 public int decode(InputStream is) throws IOException {
491 return decode(is, true);
492 }
493
494 public int decode(InputStream is, boolean withTag) throws IOException {
495 int codeLength = 0;
496 int subCodeLength = 0;
497 if (withTag) {
498 codeLength += tag.decodeAndCheck(is);
499 }
500
501 BerLength length = new BerLength();
502 codeLength += length.decode(is);
503 int totalLength = length.val;
504
505 while (subCodeLength < totalLength) {
506 MeasObject element = new MeasObject();
507 subCodeLength += element.decode(is, true);
508 seqOf.add(element);
509 }
510 if (subCodeLength != totalLength) {
511 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
512
513 }
514 codeLength += subCodeLength;
515
516 return codeLength;
517 }
518
519 public void encodeAndSave(int encodingSizeGuess) throws IOException {
520 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
521 encode(os, false);
522 code = os.getArray();
523 }
524
525 public String toString() {
526 StringBuilder sb = new StringBuilder();
527 appendAsString(sb, 0);
528 return sb.toString();
529 }
530
531 public void appendAsString(StringBuilder sb, int indentLevel) {
532
533 sb.append("{\n");
534 for (int i = 0; i < indentLevel + 1; i++) {
535 sb.append("\t");
536 }
537 if (seqOf == null) {
538 sb.append("null");
539 } else {
540 Iterator<MeasObject> it = seqOf.iterator();
541 if (it.hasNext()) {
542 it.next().appendAsString(sb, indentLevel + 1);
543 while (it.hasNext()) {
544 sb.append(",\n");
545 for (int i = 0; i < indentLevel + 1; i++) {
546 sb.append("\t");
547 }
548 it.next().appendAsString(sb, indentLevel + 1);
549 }
550 }
551 }
552
553 sb.append("\n");
554 for (int i = 0; i < indentLevel; i++) {
555 sb.append("\t");
556 }
557 sb.append("}");
558 }
559
560 }
561
562 public static class ReportConfigs implements Serializable {
563
564 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
565 private static final long serialVersionUID = 1L;
566 @JsonIgnore
567 public byte[] code = null;
568 private List<ReportConfig> seqOf = null;
569
570 public ReportConfigs() {
571 seqOf = new ArrayList<ReportConfig>();
572 }
573
574 public ReportConfigs(byte[] code) {
575 this.code = code;
576 }
577
578 @JsonValue
579 public List<ReportConfig> getReportConfig() {
580 if (seqOf == null) {
581 seqOf = new ArrayList<ReportConfig>();
582 }
583 return seqOf;
584 }
585
586 public int encode(BerByteArrayOutputStream os) throws IOException {
587 return encode(os, true);
588 }
589
590 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
591
592 if (code != null) {
593 for (int i = code.length - 1; i >= 0; i--) {
594 os.write(code[i]);
595 }
596 if (withTag) {
597 return tag.encode(os) + code.length;
598 }
599 return code.length;
600 }
601
602 int codeLength = 0;
603 for (int i = (seqOf.size() - 1); i >= 0; i--) {
604 codeLength += seqOf.get(i).encode(os, true);
605 }
606
607 codeLength += BerLength.encodeLength(os, codeLength);
608
609 if (withTag) {
610 codeLength += tag.encode(os);
611 }
612
613 return codeLength;
614 }
615
616 public int decode(InputStream is) throws IOException {
617 return decode(is, true);
618 }
619
620 public int decode(InputStream is, boolean withTag) throws IOException {
621 int codeLength = 0;
622 int subCodeLength = 0;
623 if (withTag) {
624 codeLength += tag.decodeAndCheck(is);
625 }
626
627 BerLength length = new BerLength();
628 codeLength += length.decode(is);
629 int totalLength = length.val;
630
631 while (subCodeLength < totalLength) {
632 ReportConfig element = new ReportConfig();
633 subCodeLength += element.decode(is, true);
634 seqOf.add(element);
635 }
636 if (subCodeLength != totalLength) {
637 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
638
639 }
640 codeLength += subCodeLength;
641
642 return codeLength;
643 }
644
645 public void encodeAndSave(int encodingSizeGuess) throws IOException {
646 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
647 encode(os, false);
648 code = os.getArray();
649 }
650
651 public String toString() {
652 StringBuilder sb = new StringBuilder();
653 appendAsString(sb, 0);
654 return sb.toString();
655 }
656
657 public void appendAsString(StringBuilder sb, int indentLevel) {
658
659 sb.append("{\n");
660 for (int i = 0; i < indentLevel + 1; i++) {
661 sb.append("\t");
662 }
663 if (seqOf == null) {
664 sb.append("null");
665 } else {
666 Iterator<ReportConfig> it = seqOf.iterator();
667 if (it.hasNext()) {
668 it.next().appendAsString(sb, indentLevel + 1);
669 while (it.hasNext()) {
670 sb.append(",\n");
671 for (int i = 0; i < indentLevel + 1; i++) {
672 sb.append("\t");
673 }
674 it.next().appendAsString(sb, indentLevel + 1);
675 }
676 }
677 }
678
679 sb.append("\n");
680 for (int i = 0; i < indentLevel; i++) {
681 sb.append("\t");
682 }
683 sb.append("}");
684 }
685
686 }
687
688 public static class MeasIds implements Serializable {
689
690 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
691 private static final long serialVersionUID = 1L;
692 @JsonIgnore
693 public byte[] code = null;
694 private List<MeasID> seqOf = null;
695
696 public MeasIds() {
697 seqOf = new ArrayList<MeasID>();
698 }
699
700 public MeasIds(byte[] code) {
701 this.code = code;
702 }
703
704 @JsonValue
705 public List<MeasID> getMeasID() {
706 if (seqOf == null) {
707 seqOf = new ArrayList<MeasID>();
708 }
709 return seqOf;
710 }
711
712 public int encode(BerByteArrayOutputStream os) throws IOException {
713 return encode(os, true);
714 }
715
716 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
717
718 if (code != null) {
719 for (int i = code.length - 1; i >= 0; i--) {
720 os.write(code[i]);
721 }
722 if (withTag) {
723 return tag.encode(os) + code.length;
724 }
725 return code.length;
726 }
727
728 int codeLength = 0;
729 for (int i = (seqOf.size() - 1); i >= 0; i--) {
730 codeLength += seqOf.get(i).encode(os, true);
731 }
732
733 codeLength += BerLength.encodeLength(os, codeLength);
734
735 if (withTag) {
736 codeLength += tag.encode(os);
737 }
738
739 return codeLength;
740 }
741
742 public int decode(InputStream is) throws IOException {
743 return decode(is, true);
744 }
745
746 public int decode(InputStream is, boolean withTag) throws IOException {
747 int codeLength = 0;
748 int subCodeLength = 0;
749 if (withTag) {
750 codeLength += tag.decodeAndCheck(is);
751 }
752
753 BerLength length = new BerLength();
754 codeLength += length.decode(is);
755 int totalLength = length.val;
756
757 while (subCodeLength < totalLength) {
758 MeasID element = new MeasID();
759 subCodeLength += element.decode(is, true);
760 seqOf.add(element);
761 }
762 if (subCodeLength != totalLength) {
763 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
764
765 }
766 codeLength += subCodeLength;
767
768 return codeLength;
769 }
770
771 public void encodeAndSave(int encodingSizeGuess) throws IOException {
772 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
773 encode(os, false);
774 code = os.getArray();
775 }
776
777 public String toString() {
778 StringBuilder sb = new StringBuilder();
779 appendAsString(sb, 0);
780 return sb.toString();
781 }
782
783 public void appendAsString(StringBuilder sb, int indentLevel) {
784
785 sb.append("{\n");
786 for (int i = 0; i < indentLevel + 1; i++) {
787 sb.append("\t");
788 }
789 if (seqOf == null) {
790 sb.append("null");
791 } else {
792 Iterator<MeasID> it = seqOf.iterator();
793 if (it.hasNext()) {
794 it.next().appendAsString(sb, indentLevel + 1);
795 while (it.hasNext()) {
796 sb.append(",\n");
797 for (int i = 0; i < indentLevel + 1; i++) {
798 sb.append("\t");
799 }
800 it.next().appendAsString(sb, indentLevel + 1);
801 }
802 }
803 }
804
805 sb.append("\n");
806 for (int i = 0; i < indentLevel; i++) {
807 sb.append("\t");
808 }
809 sb.append("}");
810 }
811
812 }
813
814}
815