blob: c2164c3120b03cbc25314726629efcf7a11931f3 [file] [log] [blame]
slowr13fa5b02017-08-08 16:32:31 -07001/**
2 * This class file was automatically generated by jASN1 v1.8.0 (http://www.openmuc.org)
3 */
4
5package org.onosproject.xran.codecs.pdu;
6
slowr60d4d102017-08-16 18:33:58 -07007import com.fasterxml.jackson.annotation.JsonIgnore;
8import com.fasterxml.jackson.annotation.JsonValue;
slowr13fa5b02017-08-08 16:32:31 -07009import org.onosproject.xran.codecs.api.CRNTI;
10import org.onosproject.xran.codecs.api.ECGI;
11import org.onosproject.xran.codecs.api.XICICPA;
slowr60d4d102017-08-16 18:33:58 -070012import org.onosproject.xran.codecs.ber.BerByteArrayOutputStream;
13import org.onosproject.xran.codecs.ber.BerLength;
14import org.onosproject.xran.codecs.ber.BerTag;
15import org.onosproject.xran.codecs.ber.types.BerBitString;
16import org.onosproject.xran.codecs.ber.types.BerInteger;
17import org.onosproject.xran.codecs.ber.types.string.BerUTF8String;
slowr67d05e42017-08-11 20:37:22 -070018
slowr13fa5b02017-08-08 16:32:31 -070019import java.io.IOException;
20import java.io.InputStream;
21import java.io.Serializable;
slowr67d05e42017-08-11 20:37:22 -070022import java.io.UnsupportedEncodingException;
slowr13fa5b02017-08-08 16:32:31 -070023import java.util.ArrayList;
24import java.util.Iterator;
25import java.util.List;
26
27public class RRMConfig implements Serializable {
28
slowr67d05e42017-08-11 20:37:22 -070029 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
30 private static final long serialVersionUID = 1L;
slowr60d4d102017-08-16 18:33:58 -070031 @JsonIgnore
slowr67d05e42017-08-11 20:37:22 -070032 public byte[] code = null;
33 private ECGI ecgi = null;
34 private Crnti crnti = null;
35 private Pa pa = null;
36 private StartPrbDl startPrbDl = null;
37 private EndPrbDl endPrbDl = null;
38 private SubframeBitmaskDl subframeBitmaskDl = null;
39 private P0UePusch p0UePusch = null;
40 private StartPrbUl startPrbUl = null;
41 private EndPrbUl endPrbUl = null;
42 private SubframeBitmaskUl subframeBitmaskUl = null;
slowr13fa5b02017-08-08 16:32:31 -070043
slowr67d05e42017-08-11 20:37:22 -070044 public RRMConfig() {
45 }
slowr13fa5b02017-08-08 16:32:31 -070046
slowr67d05e42017-08-11 20:37:22 -070047 public RRMConfig(byte[] code) {
48 this.code = code;
49 }
slowr13fa5b02017-08-08 16:32:31 -070050
slowr67d05e42017-08-11 20:37:22 -070051 public ECGI getEcgi() {
52 return ecgi;
53 }
slowr13fa5b02017-08-08 16:32:31 -070054
slowr67d05e42017-08-11 20:37:22 -070055 public void setEcgi(ECGI ecgi) {
56 this.ecgi = ecgi;
57 }
slowr13fa5b02017-08-08 16:32:31 -070058
slowr67d05e42017-08-11 20:37:22 -070059 public Crnti getCrnti() {
60 return crnti;
61 }
slowr13fa5b02017-08-08 16:32:31 -070062
slowr67d05e42017-08-11 20:37:22 -070063 public void setCrnti(Crnti crnti) {
64 this.crnti = crnti;
65 }
slowr13fa5b02017-08-08 16:32:31 -070066
slowr67d05e42017-08-11 20:37:22 -070067 public Pa getPa() {
68 return pa;
69 }
slowr13fa5b02017-08-08 16:32:31 -070070
slowr67d05e42017-08-11 20:37:22 -070071 public void setPa(Pa pa) {
72 this.pa = pa;
73 }
slowr13fa5b02017-08-08 16:32:31 -070074
slowr67d05e42017-08-11 20:37:22 -070075 public StartPrbDl getStartPrbDl() {
76 return startPrbDl;
77 }
slowr13fa5b02017-08-08 16:32:31 -070078
slowr67d05e42017-08-11 20:37:22 -070079 public void setStartPrbDl(StartPrbDl startPrbDl) {
80 this.startPrbDl = startPrbDl;
81 }
slowr13fa5b02017-08-08 16:32:31 -070082
slowr67d05e42017-08-11 20:37:22 -070083 public EndPrbDl getEndPrbDl() {
84 return endPrbDl;
85 }
slowr13fa5b02017-08-08 16:32:31 -070086
slowr67d05e42017-08-11 20:37:22 -070087 public void setEndPrbDl(EndPrbDl endPrbDl) {
88 this.endPrbDl = endPrbDl;
89 }
slowr13fa5b02017-08-08 16:32:31 -070090
slowr67d05e42017-08-11 20:37:22 -070091 public SubframeBitmaskDl getSubframeBitmaskDl() {
92 return subframeBitmaskDl;
93 }
slowr13fa5b02017-08-08 16:32:31 -070094
slowr67d05e42017-08-11 20:37:22 -070095 public void setSubframeBitmaskDl(SubframeBitmaskDl subframeBitmaskDl) {
96 this.subframeBitmaskDl = subframeBitmaskDl;
97 }
slowr13fa5b02017-08-08 16:32:31 -070098
slowr67d05e42017-08-11 20:37:22 -070099 public P0UePusch getP0UePusch() {
100 return p0UePusch;
101 }
slowr13fa5b02017-08-08 16:32:31 -0700102
slowr67d05e42017-08-11 20:37:22 -0700103 public void setP0UePusch(P0UePusch p0UePusch) {
104 this.p0UePusch = p0UePusch;
105 }
slowr13fa5b02017-08-08 16:32:31 -0700106
slowr67d05e42017-08-11 20:37:22 -0700107 public StartPrbUl getStartPrbUl() {
108 return startPrbUl;
109 }
slowr13fa5b02017-08-08 16:32:31 -0700110
slowr67d05e42017-08-11 20:37:22 -0700111 public void setStartPrbUl(StartPrbUl startPrbUl) {
112 this.startPrbUl = startPrbUl;
113 }
slowr13fa5b02017-08-08 16:32:31 -0700114
slowr67d05e42017-08-11 20:37:22 -0700115 public EndPrbUl getEndPrbUl() {
116 return endPrbUl;
117 }
slowr13fa5b02017-08-08 16:32:31 -0700118
slowr67d05e42017-08-11 20:37:22 -0700119 public void setEndPrbUl(EndPrbUl endPrbUl) {
120 this.endPrbUl = endPrbUl;
121 }
slowr13fa5b02017-08-08 16:32:31 -0700122
slowr67d05e42017-08-11 20:37:22 -0700123 public SubframeBitmaskUl getSubframeBitmaskUl() {
124 return subframeBitmaskUl;
125 }
slowr13fa5b02017-08-08 16:32:31 -0700126
slowr67d05e42017-08-11 20:37:22 -0700127 public void setSubframeBitmaskUl(SubframeBitmaskUl subframeBitmaskUl) {
128 this.subframeBitmaskUl = subframeBitmaskUl;
129 }
slowr13fa5b02017-08-08 16:32:31 -0700130
slowr67d05e42017-08-11 20:37:22 -0700131 public int encode(BerByteArrayOutputStream os) throws IOException {
132 return encode(os, true);
133 }
134
135 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
136
137 if (code != null) {
138 for (int i = code.length - 1; i >= 0; i--) {
139 os.write(code[i]);
140 }
141 if (withTag) {
142 return tag.encode(os) + code.length;
143 }
144 return code.length;
145 }
146
147 int codeLength = 0;
148 if (subframeBitmaskUl != null) {
149 codeLength += subframeBitmaskUl.encode(os, false);
150 // write tag: CONTEXT_CLASS, CONSTRUCTED, 9
151 os.write(0xA9);
152 codeLength += 1;
153 }
154
155 if (endPrbUl != null) {
156 codeLength += endPrbUl.encode(os, false);
157 // write tag: CONTEXT_CLASS, CONSTRUCTED, 8
158 os.write(0xA8);
159 codeLength += 1;
160 }
161
162 if (startPrbUl != null) {
163 codeLength += startPrbUl.encode(os, false);
164 // write tag: CONTEXT_CLASS, CONSTRUCTED, 7
165 os.write(0xA7);
166 codeLength += 1;
167 }
168
169 if (p0UePusch != null) {
170 codeLength += p0UePusch.encode(os, false);
171 // write tag: CONTEXT_CLASS, CONSTRUCTED, 6
172 os.write(0xA6);
173 codeLength += 1;
174 }
175
176 if (subframeBitmaskDl != null) {
177 codeLength += subframeBitmaskDl.encode(os, false);
178 // write tag: CONTEXT_CLASS, CONSTRUCTED, 5
179 os.write(0xA5);
180 codeLength += 1;
181 }
182
183 if (endPrbDl != null) {
184 codeLength += endPrbDl.encode(os, false);
185 // write tag: CONTEXT_CLASS, CONSTRUCTED, 4
186 os.write(0xA4);
187 codeLength += 1;
188 }
189
190 if (startPrbDl != null) {
191 codeLength += startPrbDl.encode(os, false);
192 // write tag: CONTEXT_CLASS, CONSTRUCTED, 3
193 os.write(0xA3);
194 codeLength += 1;
195 }
196
197 if (pa != null) {
198 codeLength += pa.encode(os, false);
199 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
200 os.write(0xA2);
201 codeLength += 1;
202 }
203
204 if (crnti != null) {
205 codeLength += crnti.encode(os, false);
206 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
207 os.write(0xA1);
208 codeLength += 1;
209 }
210
211 codeLength += ecgi.encode(os, false);
212 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
213 os.write(0xA0);
214 codeLength += 1;
215
216 codeLength += BerLength.encodeLength(os, codeLength);
217
218 if (withTag) {
219 codeLength += tag.encode(os);
220 }
221
222 return codeLength;
223
224 }
225
226 public int decode(InputStream is) throws IOException {
227 return decode(is, true);
228 }
229
230 public int decode(InputStream is, boolean withTag) throws IOException {
231 int codeLength = 0;
232 int subCodeLength = 0;
233 BerTag berTag = new BerTag();
234
235 if (withTag) {
236 codeLength += tag.decodeAndCheck(is);
237 }
238
239 BerLength length = new BerLength();
240 codeLength += length.decode(is);
241
242 int totalLength = length.val;
243 codeLength += totalLength;
244
245 subCodeLength += berTag.decode(is);
246 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
247 ecgi = new ECGI();
248 subCodeLength += ecgi.decode(is, false);
249 if (subCodeLength == totalLength) {
250 return codeLength;
251 }
252 subCodeLength += berTag.decode(is);
253 } else {
254 throw new IOException("Tag does not match the mandatory sequence element tag.");
255 }
256
257 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
258 crnti = new Crnti();
259 subCodeLength += crnti.decode(is, false);
260 if (subCodeLength == totalLength) {
261 return codeLength;
262 }
263 subCodeLength += berTag.decode(is);
264 }
265
266 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
267 pa = new Pa();
268 subCodeLength += pa.decode(is, false);
269 if (subCodeLength == totalLength) {
270 return codeLength;
271 }
272 subCodeLength += berTag.decode(is);
273 }
274
275 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
276 startPrbDl = new StartPrbDl();
277 subCodeLength += startPrbDl.decode(is, false);
278 if (subCodeLength == totalLength) {
279 return codeLength;
280 }
281 subCodeLength += berTag.decode(is);
282 }
283
284 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
285 endPrbDl = new EndPrbDl();
286 subCodeLength += endPrbDl.decode(is, false);
287 if (subCodeLength == totalLength) {
288 return codeLength;
289 }
290 subCodeLength += berTag.decode(is);
291 }
292
293 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) {
294 subframeBitmaskDl = new SubframeBitmaskDl();
295 subCodeLength += subframeBitmaskDl.decode(is, false);
296 if (subCodeLength == totalLength) {
297 return codeLength;
298 }
299 subCodeLength += berTag.decode(is);
300 }
301
302 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) {
303 p0UePusch = new P0UePusch();
304 subCodeLength += p0UePusch.decode(is, false);
305 if (subCodeLength == totalLength) {
306 return codeLength;
307 }
308 subCodeLength += berTag.decode(is);
309 }
310
311 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 7)) {
312 startPrbUl = new StartPrbUl();
313 subCodeLength += startPrbUl.decode(is, false);
314 if (subCodeLength == totalLength) {
315 return codeLength;
316 }
317 subCodeLength += berTag.decode(is);
318 }
319
320 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 8)) {
321 endPrbUl = new EndPrbUl();
322 subCodeLength += endPrbUl.decode(is, false);
323 if (subCodeLength == totalLength) {
324 return codeLength;
325 }
326 subCodeLength += berTag.decode(is);
327 }
328
329 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 9)) {
330 subframeBitmaskUl = new SubframeBitmaskUl();
331 subCodeLength += subframeBitmaskUl.decode(is, false);
332 if (subCodeLength == totalLength) {
333 return codeLength;
334 }
335 }
336 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
337
338
339 }
340
341 public void encodeAndSave(int encodingSizeGuess) throws IOException {
342 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
343 encode(os, false);
344 code = os.getArray();
345 }
346
347 public String toString() {
348 StringBuilder sb = new StringBuilder();
349 appendAsString(sb, 0);
350 return sb.toString();
351 }
352
353 public void appendAsString(StringBuilder sb, int indentLevel) {
354
355 sb.append("{");
356 sb.append("\n");
357 for (int i = 0; i < indentLevel + 1; i++) {
358 sb.append("\t");
359 }
360 if (ecgi != null) {
slowr60d4d102017-08-16 18:33:58 -0700361 sb.append("ecgi: ");
slowr67d05e42017-08-11 20:37:22 -0700362 ecgi.appendAsString(sb, indentLevel + 1);
363 }
364
365 if (crnti != null) {
366 sb.append(",\n");
367 for (int i = 0; i < indentLevel + 1; i++) {
368 sb.append("\t");
369 }
slowr60d4d102017-08-16 18:33:58 -0700370 sb.append("crnti: ");
slowr67d05e42017-08-11 20:37:22 -0700371 crnti.appendAsString(sb, indentLevel + 1);
372 }
373
374 if (pa != null) {
375 sb.append(",\n");
376 for (int i = 0; i < indentLevel + 1; i++) {
377 sb.append("\t");
378 }
slowr60d4d102017-08-16 18:33:58 -0700379 sb.append("pa: ");
slowr67d05e42017-08-11 20:37:22 -0700380 pa.appendAsString(sb, indentLevel + 1);
381 }
382
383 if (startPrbDl != null) {
384 sb.append(",\n");
385 for (int i = 0; i < indentLevel + 1; i++) {
386 sb.append("\t");
387 }
slowr60d4d102017-08-16 18:33:58 -0700388 sb.append("startPrbDl: ");
slowr67d05e42017-08-11 20:37:22 -0700389 startPrbDl.appendAsString(sb, indentLevel + 1);
390 }
391
392 if (endPrbDl != null) {
393 sb.append(",\n");
394 for (int i = 0; i < indentLevel + 1; i++) {
395 sb.append("\t");
396 }
slowr60d4d102017-08-16 18:33:58 -0700397 sb.append("endPrbDl: ");
slowr67d05e42017-08-11 20:37:22 -0700398 endPrbDl.appendAsString(sb, indentLevel + 1);
399 }
400
401 if (subframeBitmaskDl != null) {
402 sb.append(",\n");
403 for (int i = 0; i < indentLevel + 1; i++) {
404 sb.append("\t");
405 }
slowr60d4d102017-08-16 18:33:58 -0700406 sb.append("subframeBitmaskDl: ");
slowr67d05e42017-08-11 20:37:22 -0700407 subframeBitmaskDl.appendAsString(sb, indentLevel + 1);
408 }
409
410 if (p0UePusch != null) {
411 sb.append(",\n");
412 for (int i = 0; i < indentLevel + 1; i++) {
413 sb.append("\t");
414 }
slowr60d4d102017-08-16 18:33:58 -0700415 sb.append("p0UePusch: ");
slowr67d05e42017-08-11 20:37:22 -0700416 p0UePusch.appendAsString(sb, indentLevel + 1);
417 }
418
419 if (startPrbUl != null) {
420 sb.append(",\n");
421 for (int i = 0; i < indentLevel + 1; i++) {
422 sb.append("\t");
423 }
slowr60d4d102017-08-16 18:33:58 -0700424 sb.append("startPrbUl: ");
slowr67d05e42017-08-11 20:37:22 -0700425 startPrbUl.appendAsString(sb, indentLevel + 1);
426 }
427
428 if (endPrbUl != null) {
429 sb.append(",\n");
430 for (int i = 0; i < indentLevel + 1; i++) {
431 sb.append("\t");
432 }
slowr60d4d102017-08-16 18:33:58 -0700433 sb.append("endPrbUl: ");
slowr67d05e42017-08-11 20:37:22 -0700434 endPrbUl.appendAsString(sb, indentLevel + 1);
435 }
436
437 if (subframeBitmaskUl != null) {
438 sb.append(",\n");
439 for (int i = 0; i < indentLevel + 1; i++) {
440 sb.append("\t");
441 }
slowr60d4d102017-08-16 18:33:58 -0700442 sb.append("subframeBitmaskUl: ");
slowr67d05e42017-08-11 20:37:22 -0700443 subframeBitmaskUl.appendAsString(sb, indentLevel + 1);
444 }
445
446 sb.append("\n");
447 for (int i = 0; i < indentLevel; i++) {
448 sb.append("\t");
449 }
450 sb.append("}");
451 }
452
453 public static class Crnti implements Serializable {
454
455 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
456 private static final long serialVersionUID = 1L;
slowr60d4d102017-08-16 18:33:58 -0700457 @JsonIgnore public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -0700458 private List<CRNTI> seqOf = null;
459
460 public Crnti() {
461 seqOf = new ArrayList<CRNTI>();
462 }
463
464 public Crnti(byte[] code) {
465 this.code = code;
466 }
467
slowr60d4d102017-08-16 18:33:58 -0700468 @JsonValue
slowr67d05e42017-08-11 20:37:22 -0700469 public List<CRNTI> getCRNTI() {
470 if (seqOf == null) {
471 seqOf = new ArrayList<CRNTI>();
472 }
473 return seqOf;
474 }
475
476 public void addCRNTI(CRNTI crnti) {
477 seqOf.add(crnti);
478 }
479
480 public int encode(BerByteArrayOutputStream os) throws IOException {
481 return encode(os, true);
482 }
483
484 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
485
486 if (code != null) {
487 for (int i = code.length - 1; i >= 0; i--) {
488 os.write(code[i]);
489 }
490 if (withTag) {
491 return tag.encode(os) + code.length;
492 }
493 return code.length;
494 }
495
496 int codeLength = 0;
497 for (int i = (seqOf.size() - 1); i >= 0; i--) {
498 codeLength += seqOf.get(i).encode(os, true);
499 }
500
501 codeLength += BerLength.encodeLength(os, codeLength);
502
503 if (withTag) {
504 codeLength += tag.encode(os);
505 }
506
507 return codeLength;
508 }
509
510 public int decode(InputStream is) throws IOException {
511 return decode(is, true);
512 }
513
514 public int decode(InputStream is, boolean withTag) throws IOException {
515 int codeLength = 0;
516 int subCodeLength = 0;
517 if (withTag) {
518 codeLength += tag.decodeAndCheck(is);
519 }
520
521 BerLength length = new BerLength();
522 codeLength += length.decode(is);
523 int totalLength = length.val;
524
525 while (subCodeLength < totalLength) {
526 CRNTI element = new CRNTI();
527 subCodeLength += element.decode(is, true);
528 seqOf.add(element);
529 }
530 if (subCodeLength != totalLength) {
531 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
532
533 }
534 codeLength += subCodeLength;
535
536 return codeLength;
537 }
538
539 public void encodeAndSave(int encodingSizeGuess) throws IOException {
540 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
541 encode(os, false);
542 code = os.getArray();
543 }
544
545 public String toString() {
546 StringBuilder sb = new StringBuilder();
547 appendAsString(sb, 0);
548 return sb.toString();
549 }
550
551 public void appendAsString(StringBuilder sb, int indentLevel) {
552
553 sb.append("[\n");
554 for (int i = 0; i < indentLevel + 1; i++) {
555 sb.append("\t");
556 }
557 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -0700558// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -0700559 } else {
560 Iterator<CRNTI> it = seqOf.iterator();
561 if (it.hasNext()) {
562 sb.append(it.next());
563 while (it.hasNext()) {
564 sb.append(",\n");
565 for (int i = 0; i < indentLevel + 1; i++) {
566 sb.append("\t");
567 }
568 sb.append(it.next());
569 }
570 }
571 }
slowr13fa5b02017-08-08 16:32:31 -0700572
slowr67d05e42017-08-11 20:37:22 -0700573 sb.append("\n");
574 for (int i = 0; i < indentLevel; i++) {
575 sb.append("\t");
576 }
577 sb.append("]");
578 }
slowr13fa5b02017-08-08 16:32:31 -0700579
slowr67d05e42017-08-11 20:37:22 -0700580 }
slowr13fa5b02017-08-08 16:32:31 -0700581
slowr67d05e42017-08-11 20:37:22 -0700582 public static class Pa implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -0700583
slowr67d05e42017-08-11 20:37:22 -0700584 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
585 private static final long serialVersionUID = 1L;
slowr60d4d102017-08-16 18:33:58 -0700586 @JsonIgnore public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -0700587 private List<XICICPA> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -0700588
slowr67d05e42017-08-11 20:37:22 -0700589 public Pa() {
590 seqOf = new ArrayList<XICICPA>();
591 }
slowr13fa5b02017-08-08 16:32:31 -0700592
slowr67d05e42017-08-11 20:37:22 -0700593 public Pa(byte[] code) {
594 this.code = code;
595 }
slowr13fa5b02017-08-08 16:32:31 -0700596
slowr60d4d102017-08-16 18:33:58 -0700597 @JsonValue
slowr67d05e42017-08-11 20:37:22 -0700598 public List<XICICPA> getXICICPA() {
599 if (seqOf == null) {
600 seqOf = new ArrayList<XICICPA>();
601 }
602 return seqOf;
603 }
slowr13fa5b02017-08-08 16:32:31 -0700604
slowr67d05e42017-08-11 20:37:22 -0700605 public int encode(BerByteArrayOutputStream os) throws IOException {
606 return encode(os, true);
607 }
slowr13fa5b02017-08-08 16:32:31 -0700608
slowr67d05e42017-08-11 20:37:22 -0700609 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -0700610
slowr67d05e42017-08-11 20:37:22 -0700611 if (code != null) {
612 for (int i = code.length - 1; i >= 0; i--) {
613 os.write(code[i]);
614 }
615 if (withTag) {
616 return tag.encode(os) + code.length;
617 }
618 return code.length;
619 }
slowr13fa5b02017-08-08 16:32:31 -0700620
slowr67d05e42017-08-11 20:37:22 -0700621 int codeLength = 0;
622 for (int i = (seqOf.size() - 1); i >= 0; i--) {
623 codeLength += seqOf.get(i).encode(os, true);
624 }
slowr13fa5b02017-08-08 16:32:31 -0700625
slowr67d05e42017-08-11 20:37:22 -0700626 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -0700627
slowr67d05e42017-08-11 20:37:22 -0700628 if (withTag) {
629 codeLength += tag.encode(os);
630 }
slowr13fa5b02017-08-08 16:32:31 -0700631
slowr67d05e42017-08-11 20:37:22 -0700632 return codeLength;
633 }
slowr13fa5b02017-08-08 16:32:31 -0700634
slowr67d05e42017-08-11 20:37:22 -0700635 public int decode(InputStream is) throws IOException {
636 return decode(is, true);
637 }
slowr13fa5b02017-08-08 16:32:31 -0700638
slowr67d05e42017-08-11 20:37:22 -0700639 public int decode(InputStream is, boolean withTag) throws IOException {
640 int codeLength = 0;
641 int subCodeLength = 0;
642 if (withTag) {
643 codeLength += tag.decodeAndCheck(is);
644 }
slowr13fa5b02017-08-08 16:32:31 -0700645
slowr67d05e42017-08-11 20:37:22 -0700646 BerLength length = new BerLength();
647 codeLength += length.decode(is);
648 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -0700649
slowr67d05e42017-08-11 20:37:22 -0700650 while (subCodeLength < totalLength) {
651 XICICPA element = new XICICPA();
652 subCodeLength += element.decode(is, true);
653 seqOf.add(element);
654 }
655 if (subCodeLength != totalLength) {
656 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -0700657
slowr67d05e42017-08-11 20:37:22 -0700658 }
659 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -0700660
slowr67d05e42017-08-11 20:37:22 -0700661 return codeLength;
662 }
slowr13fa5b02017-08-08 16:32:31 -0700663
slowr67d05e42017-08-11 20:37:22 -0700664 public void encodeAndSave(int encodingSizeGuess) throws IOException {
665 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
666 encode(os, false);
667 code = os.getArray();
668 }
slowr13fa5b02017-08-08 16:32:31 -0700669
slowr67d05e42017-08-11 20:37:22 -0700670 public String toString() {
671 StringBuilder sb = new StringBuilder();
672 appendAsString(sb, 0);
673 return sb.toString();
674 }
slowr13fa5b02017-08-08 16:32:31 -0700675
slowr67d05e42017-08-11 20:37:22 -0700676 public void appendAsString(StringBuilder sb, int indentLevel) {
slowr13fa5b02017-08-08 16:32:31 -0700677
slowr67d05e42017-08-11 20:37:22 -0700678 sb.append("[\n");
679 for (int i = 0; i < indentLevel + 1; i++) {
680 sb.append("\t");
681 }
682 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -0700683// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -0700684 } else {
685 Iterator<XICICPA> it = seqOf.iterator();
686 if (it.hasNext()) {
687 sb.append(it.next());
688 while (it.hasNext()) {
689 sb.append(",\n");
690 for (int i = 0; i < indentLevel + 1; i++) {
691 sb.append("\t");
692 }
693 sb.append(it.next());
694 }
695 }
696 }
slowr13fa5b02017-08-08 16:32:31 -0700697
slowr67d05e42017-08-11 20:37:22 -0700698 sb.append("\n");
699 for (int i = 0; i < indentLevel; i++) {
700 sb.append("\t");
701 }
702 sb.append("]");
703 }
slowr13fa5b02017-08-08 16:32:31 -0700704
slowr67d05e42017-08-11 20:37:22 -0700705 }
slowr13fa5b02017-08-08 16:32:31 -0700706
slowr67d05e42017-08-11 20:37:22 -0700707 public static class StartPrbDl implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -0700708
slowr67d05e42017-08-11 20:37:22 -0700709 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
710 private static final long serialVersionUID = 1L;
slowr60d4d102017-08-16 18:33:58 -0700711 @JsonIgnore public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -0700712 private List<BerInteger> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -0700713
slowr67d05e42017-08-11 20:37:22 -0700714 public StartPrbDl() {
715 seqOf = new ArrayList<BerInteger>();
716 }
slowr13fa5b02017-08-08 16:32:31 -0700717
slowr67d05e42017-08-11 20:37:22 -0700718 public StartPrbDl(byte[] code) {
719 this.code = code;
720 }
slowr13fa5b02017-08-08 16:32:31 -0700721
slowr67d05e42017-08-11 20:37:22 -0700722 public List<BerInteger> getSeqOf() {
723 return seqOf;
724 }
slowr13fa5b02017-08-08 16:32:31 -0700725
slowr67d05e42017-08-11 20:37:22 -0700726 public void setSeqOf(List<BerInteger> seqOf) {
727 this.seqOf = seqOf;
728 }
slowr13fa5b02017-08-08 16:32:31 -0700729
slowr60d4d102017-08-16 18:33:58 -0700730 @JsonValue public List<BerInteger> getBerInteger() {
slowr67d05e42017-08-11 20:37:22 -0700731 if (seqOf == null) {
732 seqOf = new ArrayList<BerInteger>();
733 }
734 return seqOf;
735 }
slowr13fa5b02017-08-08 16:32:31 -0700736
slowr67d05e42017-08-11 20:37:22 -0700737 public int encode(BerByteArrayOutputStream os) throws IOException {
738 return encode(os, true);
739 }
slowr13fa5b02017-08-08 16:32:31 -0700740
slowr67d05e42017-08-11 20:37:22 -0700741 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -0700742
slowr67d05e42017-08-11 20:37:22 -0700743 if (code != null) {
744 for (int i = code.length - 1; i >= 0; i--) {
745 os.write(code[i]);
746 }
747 if (withTag) {
748 return tag.encode(os) + code.length;
749 }
750 return code.length;
751 }
slowr13fa5b02017-08-08 16:32:31 -0700752
slowr67d05e42017-08-11 20:37:22 -0700753 int codeLength = 0;
754 for (int i = (seqOf.size() - 1); i >= 0; i--) {
755 codeLength += seqOf.get(i).encode(os, true);
756 }
slowr13fa5b02017-08-08 16:32:31 -0700757
slowr67d05e42017-08-11 20:37:22 -0700758 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -0700759
slowr67d05e42017-08-11 20:37:22 -0700760 if (withTag) {
761 codeLength += tag.encode(os);
762 }
slowr13fa5b02017-08-08 16:32:31 -0700763
slowr67d05e42017-08-11 20:37:22 -0700764 return codeLength;
765 }
slowr13fa5b02017-08-08 16:32:31 -0700766
slowr67d05e42017-08-11 20:37:22 -0700767 public int decode(InputStream is) throws IOException {
768 return decode(is, true);
769 }
slowr13fa5b02017-08-08 16:32:31 -0700770
slowr67d05e42017-08-11 20:37:22 -0700771 public int decode(InputStream is, boolean withTag) throws IOException {
772 int codeLength = 0;
773 int subCodeLength = 0;
774 if (withTag) {
775 codeLength += tag.decodeAndCheck(is);
776 }
slowr13fa5b02017-08-08 16:32:31 -0700777
slowr67d05e42017-08-11 20:37:22 -0700778 BerLength length = new BerLength();
779 codeLength += length.decode(is);
780 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -0700781
slowr67d05e42017-08-11 20:37:22 -0700782 while (subCodeLength < totalLength) {
783 BerInteger element = new BerInteger();
784 subCodeLength += element.decode(is, true);
785 seqOf.add(element);
786 }
787 if (subCodeLength != totalLength) {
788 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -0700789
slowr67d05e42017-08-11 20:37:22 -0700790 }
791 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -0700792
slowr67d05e42017-08-11 20:37:22 -0700793 return codeLength;
794 }
slowr13fa5b02017-08-08 16:32:31 -0700795
slowr67d05e42017-08-11 20:37:22 -0700796 public void encodeAndSave(int encodingSizeGuess) throws IOException {
797 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
798 encode(os, false);
799 code = os.getArray();
800 }
slowr13fa5b02017-08-08 16:32:31 -0700801
slowr67d05e42017-08-11 20:37:22 -0700802 public String toString() {
803 StringBuilder sb = new StringBuilder();
804 appendAsString(sb, 0);
805 return sb.toString();
806 }
slowr13fa5b02017-08-08 16:32:31 -0700807
slowr67d05e42017-08-11 20:37:22 -0700808 public void appendAsString(StringBuilder sb, int indentLevel) {
809
810 sb.append("[\n");
811 for (int i = 0; i < indentLevel + 1; i++) {
812 sb.append("\t");
813 }
814 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -0700815// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -0700816 } else {
817 Iterator<BerInteger> it = seqOf.iterator();
818 if (it.hasNext()) {
819 sb.append(it.next());
820 while (it.hasNext()) {
821 sb.append(",\n");
822 for (int i = 0; i < indentLevel + 1; i++) {
823 sb.append("\t");
824 }
825 sb.append(it.next());
826 }
827 }
828 }
slowr13fa5b02017-08-08 16:32:31 -0700829
slowr67d05e42017-08-11 20:37:22 -0700830 sb.append("\n");
831 for (int i = 0; i < indentLevel; i++) {
832 sb.append("\t");
833 }
834 sb.append("]");
835 }
slowr13fa5b02017-08-08 16:32:31 -0700836
slowr67d05e42017-08-11 20:37:22 -0700837 public void addBerInteger(BerInteger berInteger) {
838 seqOf.add(berInteger);
839 }
840 }
slowr13fa5b02017-08-08 16:32:31 -0700841
slowr67d05e42017-08-11 20:37:22 -0700842 public static class EndPrbDl implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -0700843
slowr67d05e42017-08-11 20:37:22 -0700844 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
845 private static final long serialVersionUID = 1L;
slowr60d4d102017-08-16 18:33:58 -0700846 @JsonIgnore public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -0700847 private List<BerInteger> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -0700848
slowr67d05e42017-08-11 20:37:22 -0700849 public EndPrbDl() {
850 seqOf = new ArrayList<BerInteger>();
851 }
slowr13fa5b02017-08-08 16:32:31 -0700852
slowr67d05e42017-08-11 20:37:22 -0700853 public EndPrbDl(byte[] code) {
854 this.code = code;
855 }
slowr13fa5b02017-08-08 16:32:31 -0700856
slowr60d4d102017-08-16 18:33:58 -0700857 @JsonValue public List<BerInteger> getBerInteger() {
slowr67d05e42017-08-11 20:37:22 -0700858 if (seqOf == null) {
859 seqOf = new ArrayList<BerInteger>();
860 }
861 return seqOf;
862 }
slowr13fa5b02017-08-08 16:32:31 -0700863
slowr67d05e42017-08-11 20:37:22 -0700864 public int encode(BerByteArrayOutputStream os) throws IOException {
865 return encode(os, true);
866 }
slowr13fa5b02017-08-08 16:32:31 -0700867
slowr67d05e42017-08-11 20:37:22 -0700868 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -0700869
slowr67d05e42017-08-11 20:37:22 -0700870 if (code != null) {
871 for (int i = code.length - 1; i >= 0; i--) {
872 os.write(code[i]);
873 }
874 if (withTag) {
875 return tag.encode(os) + code.length;
876 }
877 return code.length;
878 }
slowr13fa5b02017-08-08 16:32:31 -0700879
slowr67d05e42017-08-11 20:37:22 -0700880 int codeLength = 0;
881 for (int i = (seqOf.size() - 1); i >= 0; i--) {
882 codeLength += seqOf.get(i).encode(os, true);
883 }
slowr13fa5b02017-08-08 16:32:31 -0700884
slowr67d05e42017-08-11 20:37:22 -0700885 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -0700886
slowr67d05e42017-08-11 20:37:22 -0700887 if (withTag) {
888 codeLength += tag.encode(os);
889 }
slowr13fa5b02017-08-08 16:32:31 -0700890
slowr67d05e42017-08-11 20:37:22 -0700891 return codeLength;
892 }
slowr13fa5b02017-08-08 16:32:31 -0700893
slowr67d05e42017-08-11 20:37:22 -0700894 public int decode(InputStream is) throws IOException {
895 return decode(is, true);
896 }
slowr13fa5b02017-08-08 16:32:31 -0700897
slowr67d05e42017-08-11 20:37:22 -0700898 public int decode(InputStream is, boolean withTag) throws IOException {
899 int codeLength = 0;
900 int subCodeLength = 0;
901 if (withTag) {
902 codeLength += tag.decodeAndCheck(is);
903 }
slowr13fa5b02017-08-08 16:32:31 -0700904
slowr67d05e42017-08-11 20:37:22 -0700905 BerLength length = new BerLength();
906 codeLength += length.decode(is);
907 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -0700908
slowr67d05e42017-08-11 20:37:22 -0700909 while (subCodeLength < totalLength) {
910 BerInteger element = new BerInteger();
911 subCodeLength += element.decode(is, true);
912 seqOf.add(element);
913 }
914 if (subCodeLength != totalLength) {
915 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -0700916
slowr67d05e42017-08-11 20:37:22 -0700917 }
918 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -0700919
slowr67d05e42017-08-11 20:37:22 -0700920 return codeLength;
921 }
slowr13fa5b02017-08-08 16:32:31 -0700922
slowr67d05e42017-08-11 20:37:22 -0700923 public void encodeAndSave(int encodingSizeGuess) throws IOException {
924 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
925 encode(os, false);
926 code = os.getArray();
927 }
slowr13fa5b02017-08-08 16:32:31 -0700928
slowr67d05e42017-08-11 20:37:22 -0700929 public String toString() {
930 StringBuilder sb = new StringBuilder();
931 appendAsString(sb, 0);
932 return sb.toString();
933 }
slowr13fa5b02017-08-08 16:32:31 -0700934
slowr67d05e42017-08-11 20:37:22 -0700935 public void appendAsString(StringBuilder sb, int indentLevel) {
slowr13fa5b02017-08-08 16:32:31 -0700936
slowr67d05e42017-08-11 20:37:22 -0700937 sb.append("[\n");
938 for (int i = 0; i < indentLevel + 1; i++) {
939 sb.append("\t");
940 }
941 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -0700942// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -0700943 } else {
944 Iterator<BerInteger> it = seqOf.iterator();
945 if (it.hasNext()) {
946 sb.append(it.next());
947 while (it.hasNext()) {
948 sb.append(",\n");
949 for (int i = 0; i < indentLevel + 1; i++) {
950 sb.append("\t");
951 }
952 sb.append(it.next());
953 }
954 }
955 }
slowr13fa5b02017-08-08 16:32:31 -0700956
slowr67d05e42017-08-11 20:37:22 -0700957 sb.append("\n");
958 for (int i = 0; i < indentLevel; i++) {
959 sb.append("\t");
960 }
961 sb.append("]");
962 }
slowr13fa5b02017-08-08 16:32:31 -0700963
slowr67d05e42017-08-11 20:37:22 -0700964 public void addBerInteger(BerInteger berInteger) {
965 seqOf.add(berInteger);
966 }
slowr13fa5b02017-08-08 16:32:31 -0700967
slowr67d05e42017-08-11 20:37:22 -0700968 public List<BerInteger> getSeqOf() {
969 return seqOf;
970 }
slowr13fa5b02017-08-08 16:32:31 -0700971
slowr67d05e42017-08-11 20:37:22 -0700972 public void setSeqOf(List<BerInteger> seqOf) {
973 this.seqOf = seqOf;
974 }
975 }
slowr13fa5b02017-08-08 16:32:31 -0700976
slowr67d05e42017-08-11 20:37:22 -0700977 public static class SubframeBitmaskDl implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -0700978
slowr67d05e42017-08-11 20:37:22 -0700979 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
980 private static final long serialVersionUID = 1L;
slowr60d4d102017-08-16 18:33:58 -0700981 @JsonIgnore public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -0700982 private List<BerBitString> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -0700983
slowr67d05e42017-08-11 20:37:22 -0700984 public SubframeBitmaskDl() {
985 seqOf = new ArrayList<BerBitString>();
986 }
slowr13fa5b02017-08-08 16:32:31 -0700987
slowr67d05e42017-08-11 20:37:22 -0700988 public SubframeBitmaskDl(byte[] code) {
989 this.code = code;
990 }
slowr13fa5b02017-08-08 16:32:31 -0700991
slowr60d4d102017-08-16 18:33:58 -0700992 @JsonValue
slowr67d05e42017-08-11 20:37:22 -0700993 public List<BerBitString> getBerBitString() {
994 if (seqOf == null) {
995 seqOf = new ArrayList<BerBitString>();
996 }
997 return seqOf;
998 }
slowr13fa5b02017-08-08 16:32:31 -0700999
slowr67d05e42017-08-11 20:37:22 -07001000 public void addBerBitString(BerBitString berBitString) {
1001 seqOf.add(berBitString);
1002 }
slowr13fa5b02017-08-08 16:32:31 -07001003
slowr67d05e42017-08-11 20:37:22 -07001004 public int encode(BerByteArrayOutputStream os) throws IOException {
1005 return encode(os, true);
1006 }
slowr13fa5b02017-08-08 16:32:31 -07001007
slowr67d05e42017-08-11 20:37:22 -07001008 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -07001009
slowr67d05e42017-08-11 20:37:22 -07001010 if (code != null) {
1011 for (int i = code.length - 1; i >= 0; i--) {
1012 os.write(code[i]);
1013 }
1014 if (withTag) {
1015 return tag.encode(os) + code.length;
1016 }
1017 return code.length;
1018 }
slowr13fa5b02017-08-08 16:32:31 -07001019
slowr67d05e42017-08-11 20:37:22 -07001020 int codeLength = 0;
1021 for (int i = (seqOf.size() - 1); i >= 0; i--) {
1022 codeLength += seqOf.get(i).encode(os, true);
1023 }
slowr13fa5b02017-08-08 16:32:31 -07001024
slowr67d05e42017-08-11 20:37:22 -07001025 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -07001026
slowr67d05e42017-08-11 20:37:22 -07001027 if (withTag) {
1028 codeLength += tag.encode(os);
1029 }
slowr13fa5b02017-08-08 16:32:31 -07001030
slowr67d05e42017-08-11 20:37:22 -07001031 return codeLength;
1032 }
slowr13fa5b02017-08-08 16:32:31 -07001033
slowr67d05e42017-08-11 20:37:22 -07001034 public int decode(InputStream is) throws IOException {
1035 return decode(is, true);
1036 }
slowr13fa5b02017-08-08 16:32:31 -07001037
slowr67d05e42017-08-11 20:37:22 -07001038 public int decode(InputStream is, boolean withTag) throws IOException {
1039 int codeLength = 0;
1040 int subCodeLength = 0;
1041 if (withTag) {
1042 codeLength += tag.decodeAndCheck(is);
1043 }
slowr13fa5b02017-08-08 16:32:31 -07001044
slowr67d05e42017-08-11 20:37:22 -07001045 BerLength length = new BerLength();
1046 codeLength += length.decode(is);
1047 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -07001048
slowr67d05e42017-08-11 20:37:22 -07001049 while (subCodeLength < totalLength) {
1050 BerBitString element = new BerBitString();
1051 subCodeLength += element.decode(is, true);
1052 seqOf.add(element);
1053 }
1054 if (subCodeLength != totalLength) {
1055 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -07001056
slowr67d05e42017-08-11 20:37:22 -07001057 }
1058 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -07001059
slowr67d05e42017-08-11 20:37:22 -07001060 return codeLength;
1061 }
slowr13fa5b02017-08-08 16:32:31 -07001062
slowr67d05e42017-08-11 20:37:22 -07001063 public void encodeAndSave(int encodingSizeGuess) throws IOException {
1064 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
1065 encode(os, false);
1066 code = os.getArray();
1067 }
slowr13fa5b02017-08-08 16:32:31 -07001068
slowr67d05e42017-08-11 20:37:22 -07001069 public String toString() {
1070 StringBuilder sb = new StringBuilder();
1071 appendAsString(sb, 0);
1072 return sb.toString();
1073 }
1074
1075 public void appendAsString(StringBuilder sb, int indentLevel) {
1076
1077 sb.append("[\n");
1078 for (int i = 0; i < indentLevel + 1; i++) {
1079 sb.append("\t");
1080 }
1081 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -07001082// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -07001083 } else {
1084 Iterator<BerBitString> it = seqOf.iterator();
1085 if (it.hasNext()) {
slowr60d4d102017-08-16 18:33:58 -07001086 sb.append("" + it.next() + "");
slowr67d05e42017-08-11 20:37:22 -07001087 while (it.hasNext()) {
1088 sb.append(",\n");
1089 for (int i = 0; i < indentLevel + 1; i++) {
1090 sb.append("\t");
1091 }
slowr60d4d102017-08-16 18:33:58 -07001092 sb.append("" + it.next() + "");
slowr67d05e42017-08-11 20:37:22 -07001093 }
1094 }
1095 }
slowr13fa5b02017-08-08 16:32:31 -07001096
slowr67d05e42017-08-11 20:37:22 -07001097 sb.append("\n");
1098 for (int i = 0; i < indentLevel; i++) {
1099 sb.append("\t");
1100 }
1101 sb.append("]");
1102 }
slowr13fa5b02017-08-08 16:32:31 -07001103
slowr67d05e42017-08-11 20:37:22 -07001104 }
slowr13fa5b02017-08-08 16:32:31 -07001105
slowr67d05e42017-08-11 20:37:22 -07001106 public static class P0UePusch implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -07001107
slowr67d05e42017-08-11 20:37:22 -07001108 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
1109 private static final long serialVersionUID = 1L;
slowr60d4d102017-08-16 18:33:58 -07001110 @JsonIgnore public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -07001111 private List<BerInteger> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -07001112
slowr67d05e42017-08-11 20:37:22 -07001113 public P0UePusch() {
1114 seqOf = new ArrayList<BerInteger>();
1115 }
slowr13fa5b02017-08-08 16:32:31 -07001116
slowr67d05e42017-08-11 20:37:22 -07001117 public P0UePusch(byte[] code) {
1118 this.code = code;
1119 }
slowr13fa5b02017-08-08 16:32:31 -07001120
slowr60d4d102017-08-16 18:33:58 -07001121 @JsonValue public List<BerInteger> getBerInteger() {
slowr67d05e42017-08-11 20:37:22 -07001122 if (seqOf == null) {
1123 seqOf = new ArrayList<BerInteger>();
1124 }
1125 return seqOf;
1126 }
slowr13fa5b02017-08-08 16:32:31 -07001127
slowr67d05e42017-08-11 20:37:22 -07001128 public int encode(BerByteArrayOutputStream os) throws IOException {
1129 return encode(os, true);
1130 }
slowr13fa5b02017-08-08 16:32:31 -07001131
slowr67d05e42017-08-11 20:37:22 -07001132 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -07001133
slowr67d05e42017-08-11 20:37:22 -07001134 if (code != null) {
1135 for (int i = code.length - 1; i >= 0; i--) {
1136 os.write(code[i]);
1137 }
1138 if (withTag) {
1139 return tag.encode(os) + code.length;
1140 }
1141 return code.length;
1142 }
slowr13fa5b02017-08-08 16:32:31 -07001143
slowr67d05e42017-08-11 20:37:22 -07001144 int codeLength = 0;
1145 for (int i = (seqOf.size() - 1); i >= 0; i--) {
1146 codeLength += seqOf.get(i).encode(os, true);
1147 }
slowr13fa5b02017-08-08 16:32:31 -07001148
slowr67d05e42017-08-11 20:37:22 -07001149 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -07001150
slowr67d05e42017-08-11 20:37:22 -07001151 if (withTag) {
1152 codeLength += tag.encode(os);
1153 }
slowr13fa5b02017-08-08 16:32:31 -07001154
slowr67d05e42017-08-11 20:37:22 -07001155 return codeLength;
1156 }
slowr13fa5b02017-08-08 16:32:31 -07001157
slowr67d05e42017-08-11 20:37:22 -07001158 public int decode(InputStream is) throws IOException {
1159 return decode(is, true);
1160 }
slowr13fa5b02017-08-08 16:32:31 -07001161
slowr67d05e42017-08-11 20:37:22 -07001162 public int decode(InputStream is, boolean withTag) throws IOException {
1163 int codeLength = 0;
1164 int subCodeLength = 0;
1165 if (withTag) {
1166 codeLength += tag.decodeAndCheck(is);
1167 }
slowr13fa5b02017-08-08 16:32:31 -07001168
slowr67d05e42017-08-11 20:37:22 -07001169 BerLength length = new BerLength();
1170 codeLength += length.decode(is);
1171 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -07001172
slowr67d05e42017-08-11 20:37:22 -07001173 while (subCodeLength < totalLength) {
1174 BerInteger element = new BerInteger();
1175 subCodeLength += element.decode(is, true);
1176 seqOf.add(element);
1177 }
1178 if (subCodeLength != totalLength) {
1179 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -07001180
slowr67d05e42017-08-11 20:37:22 -07001181 }
1182 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -07001183
slowr67d05e42017-08-11 20:37:22 -07001184 return codeLength;
1185 }
slowr13fa5b02017-08-08 16:32:31 -07001186
slowr67d05e42017-08-11 20:37:22 -07001187 public void encodeAndSave(int encodingSizeGuess) throws IOException {
1188 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
1189 encode(os, false);
1190 code = os.getArray();
1191 }
slowr13fa5b02017-08-08 16:32:31 -07001192
slowr67d05e42017-08-11 20:37:22 -07001193 public String toString() {
1194 StringBuilder sb = new StringBuilder();
1195 appendAsString(sb, 0);
1196 return sb.toString();
1197 }
slowr13fa5b02017-08-08 16:32:31 -07001198
slowr67d05e42017-08-11 20:37:22 -07001199 public void appendAsString(StringBuilder sb, int indentLevel) {
slowr13fa5b02017-08-08 16:32:31 -07001200
slowr67d05e42017-08-11 20:37:22 -07001201 sb.append("[\n");
1202 for (int i = 0; i < indentLevel + 1; i++) {
1203 sb.append("\t");
1204 }
1205 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -07001206// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -07001207 } else {
1208 Iterator<BerInteger> it = seqOf.iterator();
1209 if (it.hasNext()) {
1210 sb.append(it.next());
1211 while (it.hasNext()) {
1212 sb.append(",\n");
1213 for (int i = 0; i < indentLevel + 1; i++) {
1214 sb.append("\t");
1215 }
1216 sb.append(it.next());
1217 }
1218 }
1219 }
slowr13fa5b02017-08-08 16:32:31 -07001220
slowr67d05e42017-08-11 20:37:22 -07001221 sb.append("\n");
1222 for (int i = 0; i < indentLevel; i++) {
1223 sb.append("\t");
1224 }
1225 sb.append("]");
1226 }
slowr13fa5b02017-08-08 16:32:31 -07001227
slowr67d05e42017-08-11 20:37:22 -07001228 }
slowr13fa5b02017-08-08 16:32:31 -07001229
slowr67d05e42017-08-11 20:37:22 -07001230 public static class StartPrbUl implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -07001231
slowr67d05e42017-08-11 20:37:22 -07001232 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
1233 private static final long serialVersionUID = 1L;
slowr60d4d102017-08-16 18:33:58 -07001234 @JsonIgnore public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -07001235 private List<BerInteger> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -07001236
slowr67d05e42017-08-11 20:37:22 -07001237 public StartPrbUl() {
1238 seqOf = new ArrayList<BerInteger>();
1239 }
slowr13fa5b02017-08-08 16:32:31 -07001240
slowr67d05e42017-08-11 20:37:22 -07001241 public StartPrbUl(byte[] code) {
1242 this.code = code;
1243 }
slowr13fa5b02017-08-08 16:32:31 -07001244
slowr60d4d102017-08-16 18:33:58 -07001245 @JsonValue public List<BerInteger> getBerInteger() {
slowr67d05e42017-08-11 20:37:22 -07001246 if (seqOf == null) {
1247 seqOf = new ArrayList<BerInteger>();
1248 }
1249 return seqOf;
1250 }
slowr13fa5b02017-08-08 16:32:31 -07001251
slowr67d05e42017-08-11 20:37:22 -07001252 public int encode(BerByteArrayOutputStream os) throws IOException {
1253 return encode(os, true);
1254 }
slowr13fa5b02017-08-08 16:32:31 -07001255
slowr67d05e42017-08-11 20:37:22 -07001256 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -07001257
slowr67d05e42017-08-11 20:37:22 -07001258 if (code != null) {
1259 for (int i = code.length - 1; i >= 0; i--) {
1260 os.write(code[i]);
1261 }
1262 if (withTag) {
1263 return tag.encode(os) + code.length;
1264 }
1265 return code.length;
1266 }
slowr13fa5b02017-08-08 16:32:31 -07001267
slowr67d05e42017-08-11 20:37:22 -07001268 int codeLength = 0;
1269 for (int i = (seqOf.size() - 1); i >= 0; i--) {
1270 codeLength += seqOf.get(i).encode(os, true);
1271 }
slowr13fa5b02017-08-08 16:32:31 -07001272
slowr67d05e42017-08-11 20:37:22 -07001273 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -07001274
slowr67d05e42017-08-11 20:37:22 -07001275 if (withTag) {
1276 codeLength += tag.encode(os);
1277 }
slowr13fa5b02017-08-08 16:32:31 -07001278
slowr67d05e42017-08-11 20:37:22 -07001279 return codeLength;
1280 }
slowr13fa5b02017-08-08 16:32:31 -07001281
slowr67d05e42017-08-11 20:37:22 -07001282 public int decode(InputStream is) throws IOException {
1283 return decode(is, true);
1284 }
slowr13fa5b02017-08-08 16:32:31 -07001285
slowr67d05e42017-08-11 20:37:22 -07001286 public int decode(InputStream is, boolean withTag) throws IOException {
1287 int codeLength = 0;
1288 int subCodeLength = 0;
1289 if (withTag) {
1290 codeLength += tag.decodeAndCheck(is);
1291 }
slowr13fa5b02017-08-08 16:32:31 -07001292
slowr67d05e42017-08-11 20:37:22 -07001293 BerLength length = new BerLength();
1294 codeLength += length.decode(is);
1295 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -07001296
slowr67d05e42017-08-11 20:37:22 -07001297 while (subCodeLength < totalLength) {
1298 BerInteger element = new BerInteger();
1299 subCodeLength += element.decode(is, true);
1300 seqOf.add(element);
1301 }
1302 if (subCodeLength != totalLength) {
1303 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -07001304
slowr67d05e42017-08-11 20:37:22 -07001305 }
1306 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -07001307
slowr67d05e42017-08-11 20:37:22 -07001308 return codeLength;
1309 }
slowr13fa5b02017-08-08 16:32:31 -07001310
slowr67d05e42017-08-11 20:37:22 -07001311 public void encodeAndSave(int encodingSizeGuess) throws IOException {
1312 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
1313 encode(os, false);
1314 code = os.getArray();
1315 }
slowr13fa5b02017-08-08 16:32:31 -07001316
slowr67d05e42017-08-11 20:37:22 -07001317 public String toString() {
1318 StringBuilder sb = new StringBuilder();
1319 appendAsString(sb, 0);
1320 return sb.toString();
1321 }
slowr13fa5b02017-08-08 16:32:31 -07001322
slowr67d05e42017-08-11 20:37:22 -07001323 public void appendAsString(StringBuilder sb, int indentLevel) {
slowr13fa5b02017-08-08 16:32:31 -07001324
slowr67d05e42017-08-11 20:37:22 -07001325 sb.append("[\n");
1326 for (int i = 0; i < indentLevel + 1; i++) {
1327 sb.append("\t");
1328 }
1329 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -07001330// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -07001331 } else {
1332 Iterator<BerInteger> it = seqOf.iterator();
1333 if (it.hasNext()) {
1334 sb.append(it.next());
1335 while (it.hasNext()) {
1336 sb.append(",\n");
1337 for (int i = 0; i < indentLevel + 1; i++) {
1338 sb.append("\t");
1339 }
1340 sb.append(it.next());
1341 }
1342 }
1343 }
slowr13fa5b02017-08-08 16:32:31 -07001344
slowr67d05e42017-08-11 20:37:22 -07001345 sb.append("\n");
1346 for (int i = 0; i < indentLevel; i++) {
1347 sb.append("\t");
1348 }
1349 sb.append("]");
1350 }
slowr13fa5b02017-08-08 16:32:31 -07001351
slowr67d05e42017-08-11 20:37:22 -07001352 public void addBerInteger(BerInteger berInteger) {
1353 seqOf.add(berInteger);
1354 }
slowr8ddc2b12017-08-14 14:13:38 -07001355
1356 public List<BerInteger> getSeqOf() {
1357 return seqOf;
1358 }
1359
1360 public void setSeqOf(List<BerInteger> seqOf) {
1361 this.seqOf = seqOf;
1362 }
slowr67d05e42017-08-11 20:37:22 -07001363 }
slowr13fa5b02017-08-08 16:32:31 -07001364
slowr67d05e42017-08-11 20:37:22 -07001365 public static class EndPrbUl implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -07001366
slowr67d05e42017-08-11 20:37:22 -07001367 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
1368 private static final long serialVersionUID = 1L;
slowr60d4d102017-08-16 18:33:58 -07001369 @JsonIgnore public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -07001370 private List<BerInteger> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -07001371
slowr67d05e42017-08-11 20:37:22 -07001372 public EndPrbUl() {
1373 seqOf = new ArrayList<BerInteger>();
1374 }
slowr13fa5b02017-08-08 16:32:31 -07001375
slowr67d05e42017-08-11 20:37:22 -07001376 public EndPrbUl(byte[] code) {
1377 this.code = code;
1378 }
slowr13fa5b02017-08-08 16:32:31 -07001379
slowr60d4d102017-08-16 18:33:58 -07001380 @JsonValue
slowr67d05e42017-08-11 20:37:22 -07001381 public List<BerInteger> getBerInteger() {
1382 if (seqOf == null) {
1383 seqOf = new ArrayList<BerInteger>();
1384 }
1385 return seqOf;
1386 }
slowr13fa5b02017-08-08 16:32:31 -07001387
slowr67d05e42017-08-11 20:37:22 -07001388 public int encode(BerByteArrayOutputStream os) throws IOException {
1389 return encode(os, true);
1390 }
slowr13fa5b02017-08-08 16:32:31 -07001391
slowr67d05e42017-08-11 20:37:22 -07001392 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -07001393
slowr67d05e42017-08-11 20:37:22 -07001394 if (code != null) {
1395 for (int i = code.length - 1; i >= 0; i--) {
1396 os.write(code[i]);
1397 }
1398 if (withTag) {
1399 return tag.encode(os) + code.length;
1400 }
1401 return code.length;
1402 }
slowr13fa5b02017-08-08 16:32:31 -07001403
slowr67d05e42017-08-11 20:37:22 -07001404 int codeLength = 0;
1405 for (int i = (seqOf.size() - 1); i >= 0; i--) {
1406 codeLength += seqOf.get(i).encode(os, true);
1407 }
slowr13fa5b02017-08-08 16:32:31 -07001408
slowr67d05e42017-08-11 20:37:22 -07001409 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -07001410
slowr67d05e42017-08-11 20:37:22 -07001411 if (withTag) {
1412 codeLength += tag.encode(os);
1413 }
slowr13fa5b02017-08-08 16:32:31 -07001414
slowr67d05e42017-08-11 20:37:22 -07001415 return codeLength;
1416 }
slowr13fa5b02017-08-08 16:32:31 -07001417
slowr67d05e42017-08-11 20:37:22 -07001418 public int decode(InputStream is) throws IOException {
1419 return decode(is, true);
1420 }
slowr13fa5b02017-08-08 16:32:31 -07001421
slowr67d05e42017-08-11 20:37:22 -07001422 public int decode(InputStream is, boolean withTag) throws IOException {
1423 int codeLength = 0;
1424 int subCodeLength = 0;
1425 if (withTag) {
1426 codeLength += tag.decodeAndCheck(is);
1427 }
slowr13fa5b02017-08-08 16:32:31 -07001428
slowr67d05e42017-08-11 20:37:22 -07001429 BerLength length = new BerLength();
1430 codeLength += length.decode(is);
1431 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -07001432
slowr67d05e42017-08-11 20:37:22 -07001433 while (subCodeLength < totalLength) {
1434 BerInteger element = new BerInteger();
1435 subCodeLength += element.decode(is, true);
1436 seqOf.add(element);
1437 }
1438 if (subCodeLength != totalLength) {
1439 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -07001440
slowr67d05e42017-08-11 20:37:22 -07001441 }
1442 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -07001443
slowr67d05e42017-08-11 20:37:22 -07001444 return codeLength;
1445 }
slowr13fa5b02017-08-08 16:32:31 -07001446
slowr67d05e42017-08-11 20:37:22 -07001447 public void encodeAndSave(int encodingSizeGuess) throws IOException {
1448 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
1449 encode(os, false);
1450 code = os.getArray();
1451 }
slowr13fa5b02017-08-08 16:32:31 -07001452
slowr67d05e42017-08-11 20:37:22 -07001453 public String toString() {
1454 StringBuilder sb = new StringBuilder();
1455 appendAsString(sb, 0);
1456 return sb.toString();
1457 }
slowr13fa5b02017-08-08 16:32:31 -07001458
slowr67d05e42017-08-11 20:37:22 -07001459 public void appendAsString(StringBuilder sb, int indentLevel) {
slowr13fa5b02017-08-08 16:32:31 -07001460
slowr67d05e42017-08-11 20:37:22 -07001461 sb.append("[\n");
1462 for (int i = 0; i < indentLevel + 1; i++) {
1463 sb.append("\t");
1464 }
1465 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -07001466// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -07001467 } else {
1468 Iterator<BerInteger> it = seqOf.iterator();
1469 if (it.hasNext()) {
1470 sb.append(it.next());
1471 while (it.hasNext()) {
1472 sb.append(",\n");
1473 for (int i = 0; i < indentLevel + 1; i++) {
1474 sb.append("\t");
1475 }
1476 sb.append(it.next());
1477 }
1478 }
1479 }
slowr13fa5b02017-08-08 16:32:31 -07001480
slowr67d05e42017-08-11 20:37:22 -07001481 sb.append("\n");
1482 for (int i = 0; i < indentLevel; i++) {
1483 sb.append("\t");
1484 }
1485 sb.append("]");
1486 }
slowr13fa5b02017-08-08 16:32:31 -07001487
slowr67d05e42017-08-11 20:37:22 -07001488 public void addBerInteger(BerInteger berInteger) {
1489 seqOf.add(berInteger);
1490 }
slowr8ddc2b12017-08-14 14:13:38 -07001491
1492 public List<BerInteger> getSeqOf() {
1493 return seqOf;
1494 }
1495
1496 public void setSeqOf(List<BerInteger> seqOf) {
1497 this.seqOf = seqOf;
1498 }
slowr67d05e42017-08-11 20:37:22 -07001499 }
slowr13fa5b02017-08-08 16:32:31 -07001500
slowr67d05e42017-08-11 20:37:22 -07001501 public static class SubframeBitmaskUl implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -07001502
slowr67d05e42017-08-11 20:37:22 -07001503 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
1504 private static final long serialVersionUID = 1L;
slowr60d4d102017-08-16 18:33:58 -07001505 @JsonIgnore public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -07001506 private List<BerBitString> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -07001507
slowr67d05e42017-08-11 20:37:22 -07001508 public SubframeBitmaskUl() {
1509 seqOf = new ArrayList<BerBitString>();
1510 }
slowr13fa5b02017-08-08 16:32:31 -07001511
slowr67d05e42017-08-11 20:37:22 -07001512 public SubframeBitmaskUl(byte[] code) {
1513 this.code = code;
1514 }
slowr13fa5b02017-08-08 16:32:31 -07001515
slowr60d4d102017-08-16 18:33:58 -07001516 @JsonValue
slowr67d05e42017-08-11 20:37:22 -07001517 public List<BerBitString> getBerBitString() {
1518 if (seqOf == null) {
1519 seqOf = new ArrayList<BerBitString>();
1520 }
1521 return seqOf;
1522 }
slowr13fa5b02017-08-08 16:32:31 -07001523
slowr67d05e42017-08-11 20:37:22 -07001524 public int encode(BerByteArrayOutputStream os) throws IOException {
1525 return encode(os, true);
1526 }
slowr13fa5b02017-08-08 16:32:31 -07001527
slowr67d05e42017-08-11 20:37:22 -07001528 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -07001529
slowr67d05e42017-08-11 20:37:22 -07001530 if (code != null) {
1531 for (int i = code.length - 1; i >= 0; i--) {
1532 os.write(code[i]);
1533 }
1534 if (withTag) {
1535 return tag.encode(os) + code.length;
1536 }
1537 return code.length;
1538 }
slowr13fa5b02017-08-08 16:32:31 -07001539
slowr67d05e42017-08-11 20:37:22 -07001540 int codeLength = 0;
1541 for (int i = (seqOf.size() - 1); i >= 0; i--) {
1542 codeLength += seqOf.get(i).encode(os, true);
1543 }
slowr13fa5b02017-08-08 16:32:31 -07001544
slowr67d05e42017-08-11 20:37:22 -07001545 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -07001546
slowr67d05e42017-08-11 20:37:22 -07001547 if (withTag) {
1548 codeLength += tag.encode(os);
1549 }
slowr13fa5b02017-08-08 16:32:31 -07001550
slowr67d05e42017-08-11 20:37:22 -07001551 return codeLength;
1552 }
slowr13fa5b02017-08-08 16:32:31 -07001553
slowr67d05e42017-08-11 20:37:22 -07001554 public int decode(InputStream is) throws IOException {
1555 return decode(is, true);
1556 }
slowr13fa5b02017-08-08 16:32:31 -07001557
slowr67d05e42017-08-11 20:37:22 -07001558 public int decode(InputStream is, boolean withTag) throws IOException {
1559 int codeLength = 0;
1560 int subCodeLength = 0;
1561 if (withTag) {
1562 codeLength += tag.decodeAndCheck(is);
1563 }
slowr13fa5b02017-08-08 16:32:31 -07001564
slowr67d05e42017-08-11 20:37:22 -07001565 BerLength length = new BerLength();
1566 codeLength += length.decode(is);
1567 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -07001568
slowr67d05e42017-08-11 20:37:22 -07001569 while (subCodeLength < totalLength) {
1570 BerBitString element = new BerBitString();
1571 subCodeLength += element.decode(is, true);
1572 seqOf.add(element);
1573 }
1574 if (subCodeLength != totalLength) {
1575 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -07001576
slowr67d05e42017-08-11 20:37:22 -07001577 }
1578 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -07001579
slowr67d05e42017-08-11 20:37:22 -07001580 return codeLength;
1581 }
slowr13fa5b02017-08-08 16:32:31 -07001582
slowr67d05e42017-08-11 20:37:22 -07001583 public void encodeAndSave(int encodingSizeGuess) throws IOException {
1584 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
1585 encode(os, false);
1586 code = os.getArray();
1587 }
slowr13fa5b02017-08-08 16:32:31 -07001588
slowr67d05e42017-08-11 20:37:22 -07001589 public String toString() {
1590 StringBuilder sb = new StringBuilder();
1591 appendAsString(sb, 0);
1592 return sb.toString();
1593 }
slowr13fa5b02017-08-08 16:32:31 -07001594
slowr67d05e42017-08-11 20:37:22 -07001595 public void appendAsString(StringBuilder sb, int indentLevel) {
slowr13fa5b02017-08-08 16:32:31 -07001596
slowr67d05e42017-08-11 20:37:22 -07001597 sb.append("[\n");
1598 for (int i = 0; i < indentLevel + 1; i++) {
1599 sb.append("\t");
1600 }
1601 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -07001602// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -07001603 } else {
1604 Iterator<BerBitString> it = seqOf.iterator();
1605 if (it.hasNext()) {
1606 sb.append(it.next());
1607 while (it.hasNext()) {
1608 sb.append(",\n");
1609 for (int i = 0; i < indentLevel + 1; i++) {
1610 sb.append("\t");
1611 }
1612 sb.append(it.next());
1613 }
1614 }
1615 }
slowr13fa5b02017-08-08 16:32:31 -07001616
slowr67d05e42017-08-11 20:37:22 -07001617 sb.append("\n");
1618 for (int i = 0; i < indentLevel; i++) {
1619 sb.append("\t");
1620 }
1621 sb.append("]");
1622 }
slowr13fa5b02017-08-08 16:32:31 -07001623
slowr67d05e42017-08-11 20:37:22 -07001624 }
slowr13fa5b02017-08-08 16:32:31 -07001625
slowr8ddc2b12017-08-14 14:13:38 -07001626 public static XrancPdu constructPacket(RRMConfig config) {
slowr67d05e42017-08-11 20:37:22 -07001627 XrancPduBody body = new XrancPduBody();
slowr8ddc2b12017-08-14 14:13:38 -07001628 body.setRRMConfig(config);
slowr13fa5b02017-08-08 16:32:31 -07001629
slowr67d05e42017-08-11 20:37:22 -07001630 BerUTF8String ver = null;
1631 try {
slowr8ddc2b12017-08-14 14:13:38 -07001632 ver = new BerUTF8String("3");
slowr67d05e42017-08-11 20:37:22 -07001633 } catch (UnsupportedEncodingException e) {
1634 e.printStackTrace();
1635 }
slowr13fa5b02017-08-08 16:32:31 -07001636
slowr8ddc2b12017-08-14 14:13:38 -07001637 XrancApiID apiID = new XrancApiID(29);
slowr67d05e42017-08-11 20:37:22 -07001638 XrancPduHdr hdr = new XrancPduHdr();
1639 hdr.setVer(ver);
1640 hdr.setApiId(apiID);
slowr13fa5b02017-08-08 16:32:31 -07001641
slowr67d05e42017-08-11 20:37:22 -07001642 XrancPdu pdu = new XrancPdu();
1643 pdu.setHdr(hdr);
1644 pdu.setBody(body);
1645 return pdu;
1646 }
slowr13fa5b02017-08-08 16:32:31 -07001647
1648}
1649