blob: 7cd160641739a183ef1e0a0d71322ac894a8f1e6 [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
slowr73b4eae2017-08-17 16:09:09 -070051 public static XrancPdu constructPacket(RRMConfig config) {
52 XrancPduBody body = new XrancPduBody();
53 body.setRRMConfig(config);
54
55 BerUTF8String ver = null;
56 try {
57 ver = new BerUTF8String("3");
58 } catch (UnsupportedEncodingException e) {
59 e.printStackTrace();
60 }
61
62 XrancApiID apiID = new XrancApiID(29);
63 XrancPduHdr hdr = new XrancPduHdr();
64 hdr.setVer(ver);
65 hdr.setApiId(apiID);
66
67 XrancPdu pdu = new XrancPdu();
68 pdu.setHdr(hdr);
69 pdu.setBody(body);
70 return pdu;
71 }
72
slowr67d05e42017-08-11 20:37:22 -070073 public ECGI getEcgi() {
74 return ecgi;
75 }
slowr13fa5b02017-08-08 16:32:31 -070076
slowr67d05e42017-08-11 20:37:22 -070077 public void setEcgi(ECGI ecgi) {
78 this.ecgi = ecgi;
79 }
slowr13fa5b02017-08-08 16:32:31 -070080
slowr67d05e42017-08-11 20:37:22 -070081 public Crnti getCrnti() {
82 return crnti;
83 }
slowr13fa5b02017-08-08 16:32:31 -070084
slowr67d05e42017-08-11 20:37:22 -070085 public void setCrnti(Crnti crnti) {
86 this.crnti = crnti;
87 }
slowr13fa5b02017-08-08 16:32:31 -070088
slowr67d05e42017-08-11 20:37:22 -070089 public Pa getPa() {
90 return pa;
91 }
slowr13fa5b02017-08-08 16:32:31 -070092
slowr67d05e42017-08-11 20:37:22 -070093 public void setPa(Pa pa) {
94 this.pa = pa;
95 }
slowr13fa5b02017-08-08 16:32:31 -070096
slowr67d05e42017-08-11 20:37:22 -070097 public StartPrbDl getStartPrbDl() {
98 return startPrbDl;
99 }
slowr13fa5b02017-08-08 16:32:31 -0700100
slowr67d05e42017-08-11 20:37:22 -0700101 public void setStartPrbDl(StartPrbDl startPrbDl) {
102 this.startPrbDl = startPrbDl;
103 }
slowr13fa5b02017-08-08 16:32:31 -0700104
slowr67d05e42017-08-11 20:37:22 -0700105 public EndPrbDl getEndPrbDl() {
106 return endPrbDl;
107 }
slowr13fa5b02017-08-08 16:32:31 -0700108
slowr67d05e42017-08-11 20:37:22 -0700109 public void setEndPrbDl(EndPrbDl endPrbDl) {
110 this.endPrbDl = endPrbDl;
111 }
slowr13fa5b02017-08-08 16:32:31 -0700112
slowr67d05e42017-08-11 20:37:22 -0700113 public SubframeBitmaskDl getSubframeBitmaskDl() {
114 return subframeBitmaskDl;
115 }
slowr13fa5b02017-08-08 16:32:31 -0700116
slowr67d05e42017-08-11 20:37:22 -0700117 public void setSubframeBitmaskDl(SubframeBitmaskDl subframeBitmaskDl) {
118 this.subframeBitmaskDl = subframeBitmaskDl;
119 }
slowr13fa5b02017-08-08 16:32:31 -0700120
slowr67d05e42017-08-11 20:37:22 -0700121 public P0UePusch getP0UePusch() {
122 return p0UePusch;
123 }
slowr13fa5b02017-08-08 16:32:31 -0700124
slowr67d05e42017-08-11 20:37:22 -0700125 public void setP0UePusch(P0UePusch p0UePusch) {
126 this.p0UePusch = p0UePusch;
127 }
slowr13fa5b02017-08-08 16:32:31 -0700128
slowr67d05e42017-08-11 20:37:22 -0700129 public StartPrbUl getStartPrbUl() {
130 return startPrbUl;
131 }
slowr13fa5b02017-08-08 16:32:31 -0700132
slowr67d05e42017-08-11 20:37:22 -0700133 public void setStartPrbUl(StartPrbUl startPrbUl) {
134 this.startPrbUl = startPrbUl;
135 }
slowr13fa5b02017-08-08 16:32:31 -0700136
slowr67d05e42017-08-11 20:37:22 -0700137 public EndPrbUl getEndPrbUl() {
138 return endPrbUl;
139 }
slowr13fa5b02017-08-08 16:32:31 -0700140
slowr67d05e42017-08-11 20:37:22 -0700141 public void setEndPrbUl(EndPrbUl endPrbUl) {
142 this.endPrbUl = endPrbUl;
143 }
slowr13fa5b02017-08-08 16:32:31 -0700144
slowr67d05e42017-08-11 20:37:22 -0700145 public SubframeBitmaskUl getSubframeBitmaskUl() {
146 return subframeBitmaskUl;
147 }
slowr13fa5b02017-08-08 16:32:31 -0700148
slowr67d05e42017-08-11 20:37:22 -0700149 public void setSubframeBitmaskUl(SubframeBitmaskUl subframeBitmaskUl) {
150 this.subframeBitmaskUl = subframeBitmaskUl;
151 }
slowr13fa5b02017-08-08 16:32:31 -0700152
slowr67d05e42017-08-11 20:37:22 -0700153 public int encode(BerByteArrayOutputStream os) throws IOException {
154 return encode(os, true);
155 }
156
157 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
158
159 if (code != null) {
160 for (int i = code.length - 1; i >= 0; i--) {
161 os.write(code[i]);
162 }
163 if (withTag) {
164 return tag.encode(os) + code.length;
165 }
166 return code.length;
167 }
168
169 int codeLength = 0;
170 if (subframeBitmaskUl != null) {
171 codeLength += subframeBitmaskUl.encode(os, false);
172 // write tag: CONTEXT_CLASS, CONSTRUCTED, 9
173 os.write(0xA9);
174 codeLength += 1;
175 }
176
177 if (endPrbUl != null) {
178 codeLength += endPrbUl.encode(os, false);
179 // write tag: CONTEXT_CLASS, CONSTRUCTED, 8
180 os.write(0xA8);
181 codeLength += 1;
182 }
183
184 if (startPrbUl != null) {
185 codeLength += startPrbUl.encode(os, false);
186 // write tag: CONTEXT_CLASS, CONSTRUCTED, 7
187 os.write(0xA7);
188 codeLength += 1;
189 }
190
191 if (p0UePusch != null) {
192 codeLength += p0UePusch.encode(os, false);
193 // write tag: CONTEXT_CLASS, CONSTRUCTED, 6
194 os.write(0xA6);
195 codeLength += 1;
196 }
197
198 if (subframeBitmaskDl != null) {
199 codeLength += subframeBitmaskDl.encode(os, false);
200 // write tag: CONTEXT_CLASS, CONSTRUCTED, 5
201 os.write(0xA5);
202 codeLength += 1;
203 }
204
205 if (endPrbDl != null) {
206 codeLength += endPrbDl.encode(os, false);
207 // write tag: CONTEXT_CLASS, CONSTRUCTED, 4
208 os.write(0xA4);
209 codeLength += 1;
210 }
211
212 if (startPrbDl != null) {
213 codeLength += startPrbDl.encode(os, false);
214 // write tag: CONTEXT_CLASS, CONSTRUCTED, 3
215 os.write(0xA3);
216 codeLength += 1;
217 }
218
219 if (pa != null) {
220 codeLength += pa.encode(os, false);
221 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
222 os.write(0xA2);
223 codeLength += 1;
224 }
225
226 if (crnti != null) {
227 codeLength += crnti.encode(os, false);
228 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
229 os.write(0xA1);
230 codeLength += 1;
231 }
232
233 codeLength += ecgi.encode(os, false);
234 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
235 os.write(0xA0);
236 codeLength += 1;
237
238 codeLength += BerLength.encodeLength(os, codeLength);
239
240 if (withTag) {
241 codeLength += tag.encode(os);
242 }
243
244 return codeLength;
245
246 }
247
248 public int decode(InputStream is) throws IOException {
249 return decode(is, true);
250 }
251
252 public int decode(InputStream is, boolean withTag) throws IOException {
253 int codeLength = 0;
254 int subCodeLength = 0;
255 BerTag berTag = new BerTag();
256
257 if (withTag) {
258 codeLength += tag.decodeAndCheck(is);
259 }
260
261 BerLength length = new BerLength();
262 codeLength += length.decode(is);
263
264 int totalLength = length.val;
265 codeLength += totalLength;
266
267 subCodeLength += berTag.decode(is);
268 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
269 ecgi = new ECGI();
270 subCodeLength += ecgi.decode(is, false);
271 if (subCodeLength == totalLength) {
272 return codeLength;
273 }
274 subCodeLength += berTag.decode(is);
275 } else {
276 throw new IOException("Tag does not match the mandatory sequence element tag.");
277 }
278
279 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
280 crnti = new Crnti();
281 subCodeLength += crnti.decode(is, false);
282 if (subCodeLength == totalLength) {
283 return codeLength;
284 }
285 subCodeLength += berTag.decode(is);
286 }
287
288 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
289 pa = new Pa();
290 subCodeLength += pa.decode(is, false);
291 if (subCodeLength == totalLength) {
292 return codeLength;
293 }
294 subCodeLength += berTag.decode(is);
295 }
296
297 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
298 startPrbDl = new StartPrbDl();
299 subCodeLength += startPrbDl.decode(is, false);
300 if (subCodeLength == totalLength) {
301 return codeLength;
302 }
303 subCodeLength += berTag.decode(is);
304 }
305
306 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
307 endPrbDl = new EndPrbDl();
308 subCodeLength += endPrbDl.decode(is, false);
309 if (subCodeLength == totalLength) {
310 return codeLength;
311 }
312 subCodeLength += berTag.decode(is);
313 }
314
315 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) {
316 subframeBitmaskDl = new SubframeBitmaskDl();
317 subCodeLength += subframeBitmaskDl.decode(is, false);
318 if (subCodeLength == totalLength) {
319 return codeLength;
320 }
321 subCodeLength += berTag.decode(is);
322 }
323
324 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) {
325 p0UePusch = new P0UePusch();
326 subCodeLength += p0UePusch.decode(is, false);
327 if (subCodeLength == totalLength) {
328 return codeLength;
329 }
330 subCodeLength += berTag.decode(is);
331 }
332
333 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 7)) {
334 startPrbUl = new StartPrbUl();
335 subCodeLength += startPrbUl.decode(is, false);
336 if (subCodeLength == totalLength) {
337 return codeLength;
338 }
339 subCodeLength += berTag.decode(is);
340 }
341
342 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 8)) {
343 endPrbUl = new EndPrbUl();
344 subCodeLength += endPrbUl.decode(is, false);
345 if (subCodeLength == totalLength) {
346 return codeLength;
347 }
348 subCodeLength += berTag.decode(is);
349 }
350
351 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 9)) {
352 subframeBitmaskUl = new SubframeBitmaskUl();
353 subCodeLength += subframeBitmaskUl.decode(is, false);
354 if (subCodeLength == totalLength) {
355 return codeLength;
356 }
357 }
358 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
359
360
361 }
362
363 public void encodeAndSave(int encodingSizeGuess) throws IOException {
364 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
365 encode(os, false);
366 code = os.getArray();
367 }
368
369 public String toString() {
370 StringBuilder sb = new StringBuilder();
371 appendAsString(sb, 0);
372 return sb.toString();
373 }
374
375 public void appendAsString(StringBuilder sb, int indentLevel) {
376
377 sb.append("{");
378 sb.append("\n");
379 for (int i = 0; i < indentLevel + 1; i++) {
380 sb.append("\t");
381 }
382 if (ecgi != null) {
slowr60d4d102017-08-16 18:33:58 -0700383 sb.append("ecgi: ");
slowr67d05e42017-08-11 20:37:22 -0700384 ecgi.appendAsString(sb, indentLevel + 1);
385 }
386
387 if (crnti != null) {
388 sb.append(",\n");
389 for (int i = 0; i < indentLevel + 1; i++) {
390 sb.append("\t");
391 }
slowr60d4d102017-08-16 18:33:58 -0700392 sb.append("crnti: ");
slowr67d05e42017-08-11 20:37:22 -0700393 crnti.appendAsString(sb, indentLevel + 1);
394 }
395
396 if (pa != null) {
397 sb.append(",\n");
398 for (int i = 0; i < indentLevel + 1; i++) {
399 sb.append("\t");
400 }
slowr60d4d102017-08-16 18:33:58 -0700401 sb.append("pa: ");
slowr67d05e42017-08-11 20:37:22 -0700402 pa.appendAsString(sb, indentLevel + 1);
403 }
404
405 if (startPrbDl != null) {
406 sb.append(",\n");
407 for (int i = 0; i < indentLevel + 1; i++) {
408 sb.append("\t");
409 }
slowr60d4d102017-08-16 18:33:58 -0700410 sb.append("startPrbDl: ");
slowr67d05e42017-08-11 20:37:22 -0700411 startPrbDl.appendAsString(sb, indentLevel + 1);
412 }
413
414 if (endPrbDl != null) {
415 sb.append(",\n");
416 for (int i = 0; i < indentLevel + 1; i++) {
417 sb.append("\t");
418 }
slowr60d4d102017-08-16 18:33:58 -0700419 sb.append("endPrbDl: ");
slowr67d05e42017-08-11 20:37:22 -0700420 endPrbDl.appendAsString(sb, indentLevel + 1);
421 }
422
423 if (subframeBitmaskDl != null) {
424 sb.append(",\n");
425 for (int i = 0; i < indentLevel + 1; i++) {
426 sb.append("\t");
427 }
slowr60d4d102017-08-16 18:33:58 -0700428 sb.append("subframeBitmaskDl: ");
slowr67d05e42017-08-11 20:37:22 -0700429 subframeBitmaskDl.appendAsString(sb, indentLevel + 1);
430 }
431
432 if (p0UePusch != null) {
433 sb.append(",\n");
434 for (int i = 0; i < indentLevel + 1; i++) {
435 sb.append("\t");
436 }
slowr60d4d102017-08-16 18:33:58 -0700437 sb.append("p0UePusch: ");
slowr67d05e42017-08-11 20:37:22 -0700438 p0UePusch.appendAsString(sb, indentLevel + 1);
439 }
440
441 if (startPrbUl != null) {
442 sb.append(",\n");
443 for (int i = 0; i < indentLevel + 1; i++) {
444 sb.append("\t");
445 }
slowr60d4d102017-08-16 18:33:58 -0700446 sb.append("startPrbUl: ");
slowr67d05e42017-08-11 20:37:22 -0700447 startPrbUl.appendAsString(sb, indentLevel + 1);
448 }
449
450 if (endPrbUl != null) {
451 sb.append(",\n");
452 for (int i = 0; i < indentLevel + 1; i++) {
453 sb.append("\t");
454 }
slowr60d4d102017-08-16 18:33:58 -0700455 sb.append("endPrbUl: ");
slowr67d05e42017-08-11 20:37:22 -0700456 endPrbUl.appendAsString(sb, indentLevel + 1);
457 }
458
459 if (subframeBitmaskUl != null) {
460 sb.append(",\n");
461 for (int i = 0; i < indentLevel + 1; i++) {
462 sb.append("\t");
463 }
slowr60d4d102017-08-16 18:33:58 -0700464 sb.append("subframeBitmaskUl: ");
slowr67d05e42017-08-11 20:37:22 -0700465 subframeBitmaskUl.appendAsString(sb, indentLevel + 1);
466 }
467
468 sb.append("\n");
469 for (int i = 0; i < indentLevel; i++) {
470 sb.append("\t");
471 }
472 sb.append("}");
473 }
474
475 public static class Crnti implements Serializable {
476
477 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
478 private static final long serialVersionUID = 1L;
slowr73b4eae2017-08-17 16:09:09 -0700479 @JsonIgnore
480 public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -0700481 private List<CRNTI> seqOf = null;
482
483 public Crnti() {
484 seqOf = new ArrayList<CRNTI>();
485 }
486
487 public Crnti(byte[] code) {
488 this.code = code;
489 }
490
slowr60d4d102017-08-16 18:33:58 -0700491 @JsonValue
slowr67d05e42017-08-11 20:37:22 -0700492 public List<CRNTI> getCRNTI() {
493 if (seqOf == null) {
494 seqOf = new ArrayList<CRNTI>();
495 }
496 return seqOf;
497 }
498
499 public void addCRNTI(CRNTI crnti) {
500 seqOf.add(crnti);
501 }
502
503 public int encode(BerByteArrayOutputStream os) throws IOException {
504 return encode(os, true);
505 }
506
507 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
508
509 if (code != null) {
510 for (int i = code.length - 1; i >= 0; i--) {
511 os.write(code[i]);
512 }
513 if (withTag) {
514 return tag.encode(os) + code.length;
515 }
516 return code.length;
517 }
518
519 int codeLength = 0;
520 for (int i = (seqOf.size() - 1); i >= 0; i--) {
521 codeLength += seqOf.get(i).encode(os, true);
522 }
523
524 codeLength += BerLength.encodeLength(os, codeLength);
525
526 if (withTag) {
527 codeLength += tag.encode(os);
528 }
529
530 return codeLength;
531 }
532
533 public int decode(InputStream is) throws IOException {
534 return decode(is, true);
535 }
536
537 public int decode(InputStream is, boolean withTag) throws IOException {
538 int codeLength = 0;
539 int subCodeLength = 0;
540 if (withTag) {
541 codeLength += tag.decodeAndCheck(is);
542 }
543
544 BerLength length = new BerLength();
545 codeLength += length.decode(is);
546 int totalLength = length.val;
547
548 while (subCodeLength < totalLength) {
549 CRNTI element = new CRNTI();
550 subCodeLength += element.decode(is, true);
551 seqOf.add(element);
552 }
553 if (subCodeLength != totalLength) {
554 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
555
556 }
557 codeLength += subCodeLength;
558
559 return codeLength;
560 }
561
562 public void encodeAndSave(int encodingSizeGuess) throws IOException {
563 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
564 encode(os, false);
565 code = os.getArray();
566 }
567
568 public String toString() {
569 StringBuilder sb = new StringBuilder();
570 appendAsString(sb, 0);
571 return sb.toString();
572 }
573
574 public void appendAsString(StringBuilder sb, int indentLevel) {
575
576 sb.append("[\n");
577 for (int i = 0; i < indentLevel + 1; i++) {
578 sb.append("\t");
579 }
580 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -0700581// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -0700582 } else {
583 Iterator<CRNTI> it = seqOf.iterator();
584 if (it.hasNext()) {
585 sb.append(it.next());
586 while (it.hasNext()) {
587 sb.append(",\n");
588 for (int i = 0; i < indentLevel + 1; i++) {
589 sb.append("\t");
590 }
591 sb.append(it.next());
592 }
593 }
594 }
slowr13fa5b02017-08-08 16:32:31 -0700595
slowr67d05e42017-08-11 20:37:22 -0700596 sb.append("\n");
597 for (int i = 0; i < indentLevel; i++) {
598 sb.append("\t");
599 }
600 sb.append("]");
601 }
slowr13fa5b02017-08-08 16:32:31 -0700602
slowr67d05e42017-08-11 20:37:22 -0700603 }
slowr13fa5b02017-08-08 16:32:31 -0700604
slowr67d05e42017-08-11 20:37:22 -0700605 public static class Pa implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -0700606
slowr67d05e42017-08-11 20:37:22 -0700607 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
608 private static final long serialVersionUID = 1L;
slowr73b4eae2017-08-17 16:09:09 -0700609 @JsonIgnore
610 public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -0700611 private List<XICICPA> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -0700612
slowr67d05e42017-08-11 20:37:22 -0700613 public Pa() {
614 seqOf = new ArrayList<XICICPA>();
615 }
slowr13fa5b02017-08-08 16:32:31 -0700616
slowr67d05e42017-08-11 20:37:22 -0700617 public Pa(byte[] code) {
618 this.code = code;
619 }
slowr13fa5b02017-08-08 16:32:31 -0700620
slowr60d4d102017-08-16 18:33:58 -0700621 @JsonValue
slowr67d05e42017-08-11 20:37:22 -0700622 public List<XICICPA> getXICICPA() {
623 if (seqOf == null) {
624 seqOf = new ArrayList<XICICPA>();
625 }
626 return seqOf;
627 }
slowr13fa5b02017-08-08 16:32:31 -0700628
slowr73b4eae2017-08-17 16:09:09 -0700629 public void setXICICPA(List<XICICPA> seqOf) {
630 this.seqOf = seqOf;
631 }
632
slowr67d05e42017-08-11 20:37:22 -0700633 public int encode(BerByteArrayOutputStream os) throws IOException {
634 return encode(os, true);
635 }
slowr13fa5b02017-08-08 16:32:31 -0700636
slowr67d05e42017-08-11 20:37:22 -0700637 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -0700638
slowr67d05e42017-08-11 20:37:22 -0700639 if (code != null) {
640 for (int i = code.length - 1; i >= 0; i--) {
641 os.write(code[i]);
642 }
643 if (withTag) {
644 return tag.encode(os) + code.length;
645 }
646 return code.length;
647 }
slowr13fa5b02017-08-08 16:32:31 -0700648
slowr67d05e42017-08-11 20:37:22 -0700649 int codeLength = 0;
650 for (int i = (seqOf.size() - 1); i >= 0; i--) {
651 codeLength += seqOf.get(i).encode(os, true);
652 }
slowr13fa5b02017-08-08 16:32:31 -0700653
slowr67d05e42017-08-11 20:37:22 -0700654 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -0700655
slowr67d05e42017-08-11 20:37:22 -0700656 if (withTag) {
657 codeLength += tag.encode(os);
658 }
slowr13fa5b02017-08-08 16:32:31 -0700659
slowr67d05e42017-08-11 20:37:22 -0700660 return codeLength;
661 }
slowr13fa5b02017-08-08 16:32:31 -0700662
slowr67d05e42017-08-11 20:37:22 -0700663 public int decode(InputStream is) throws IOException {
664 return decode(is, true);
665 }
slowr13fa5b02017-08-08 16:32:31 -0700666
slowr67d05e42017-08-11 20:37:22 -0700667 public int decode(InputStream is, boolean withTag) throws IOException {
668 int codeLength = 0;
669 int subCodeLength = 0;
670 if (withTag) {
671 codeLength += tag.decodeAndCheck(is);
672 }
slowr13fa5b02017-08-08 16:32:31 -0700673
slowr67d05e42017-08-11 20:37:22 -0700674 BerLength length = new BerLength();
675 codeLength += length.decode(is);
676 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -0700677
slowr67d05e42017-08-11 20:37:22 -0700678 while (subCodeLength < totalLength) {
679 XICICPA element = new XICICPA();
680 subCodeLength += element.decode(is, true);
681 seqOf.add(element);
682 }
683 if (subCodeLength != totalLength) {
684 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -0700685
slowr67d05e42017-08-11 20:37:22 -0700686 }
687 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -0700688
slowr67d05e42017-08-11 20:37:22 -0700689 return codeLength;
690 }
slowr13fa5b02017-08-08 16:32:31 -0700691
slowr67d05e42017-08-11 20:37:22 -0700692 public void encodeAndSave(int encodingSizeGuess) throws IOException {
693 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
694 encode(os, false);
695 code = os.getArray();
696 }
slowr13fa5b02017-08-08 16:32:31 -0700697
slowr67d05e42017-08-11 20:37:22 -0700698 public String toString() {
699 StringBuilder sb = new StringBuilder();
700 appendAsString(sb, 0);
701 return sb.toString();
702 }
slowr13fa5b02017-08-08 16:32:31 -0700703
slowr67d05e42017-08-11 20:37:22 -0700704 public void appendAsString(StringBuilder sb, int indentLevel) {
slowr13fa5b02017-08-08 16:32:31 -0700705
slowr67d05e42017-08-11 20:37:22 -0700706 sb.append("[\n");
707 for (int i = 0; i < indentLevel + 1; i++) {
708 sb.append("\t");
709 }
710 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -0700711// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -0700712 } else {
713 Iterator<XICICPA> it = seqOf.iterator();
714 if (it.hasNext()) {
715 sb.append(it.next());
716 while (it.hasNext()) {
717 sb.append(",\n");
718 for (int i = 0; i < indentLevel + 1; i++) {
719 sb.append("\t");
720 }
721 sb.append(it.next());
722 }
723 }
724 }
slowr13fa5b02017-08-08 16:32:31 -0700725
slowr67d05e42017-08-11 20:37:22 -0700726 sb.append("\n");
727 for (int i = 0; i < indentLevel; i++) {
728 sb.append("\t");
729 }
730 sb.append("]");
731 }
slowr67d05e42017-08-11 20:37:22 -0700732 }
slowr13fa5b02017-08-08 16:32:31 -0700733
slowr67d05e42017-08-11 20:37:22 -0700734 public static class StartPrbDl implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -0700735
slowr67d05e42017-08-11 20:37:22 -0700736 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
737 private static final long serialVersionUID = 1L;
slowr73b4eae2017-08-17 16:09:09 -0700738 @JsonIgnore
739 public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -0700740 private List<BerInteger> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -0700741
slowr67d05e42017-08-11 20:37:22 -0700742 public StartPrbDl() {
743 seqOf = new ArrayList<BerInteger>();
744 }
slowr13fa5b02017-08-08 16:32:31 -0700745
slowr67d05e42017-08-11 20:37:22 -0700746 public StartPrbDl(byte[] code) {
747 this.code = code;
748 }
slowr13fa5b02017-08-08 16:32:31 -0700749
slowr67d05e42017-08-11 20:37:22 -0700750 public List<BerInteger> getSeqOf() {
751 return seqOf;
752 }
slowr13fa5b02017-08-08 16:32:31 -0700753
slowr67d05e42017-08-11 20:37:22 -0700754 public void setSeqOf(List<BerInteger> seqOf) {
755 this.seqOf = seqOf;
756 }
slowr13fa5b02017-08-08 16:32:31 -0700757
slowr73b4eae2017-08-17 16:09:09 -0700758 @JsonValue
759 public List<BerInteger> getBerInteger() {
slowr67d05e42017-08-11 20:37:22 -0700760 if (seqOf == null) {
761 seqOf = new ArrayList<BerInteger>();
762 }
763 return seqOf;
764 }
slowr13fa5b02017-08-08 16:32:31 -0700765
slowr67d05e42017-08-11 20:37:22 -0700766 public int encode(BerByteArrayOutputStream os) throws IOException {
767 return encode(os, true);
768 }
slowr13fa5b02017-08-08 16:32:31 -0700769
slowr67d05e42017-08-11 20:37:22 -0700770 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -0700771
slowr67d05e42017-08-11 20:37:22 -0700772 if (code != null) {
773 for (int i = code.length - 1; i >= 0; i--) {
774 os.write(code[i]);
775 }
776 if (withTag) {
777 return tag.encode(os) + code.length;
778 }
779 return code.length;
780 }
slowr13fa5b02017-08-08 16:32:31 -0700781
slowr67d05e42017-08-11 20:37:22 -0700782 int codeLength = 0;
783 for (int i = (seqOf.size() - 1); i >= 0; i--) {
784 codeLength += seqOf.get(i).encode(os, true);
785 }
slowr13fa5b02017-08-08 16:32:31 -0700786
slowr67d05e42017-08-11 20:37:22 -0700787 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -0700788
slowr67d05e42017-08-11 20:37:22 -0700789 if (withTag) {
790 codeLength += tag.encode(os);
791 }
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 int decode(InputStream is) throws IOException {
797 return decode(is, true);
798 }
slowr13fa5b02017-08-08 16:32:31 -0700799
slowr67d05e42017-08-11 20:37:22 -0700800 public int decode(InputStream is, boolean withTag) throws IOException {
801 int codeLength = 0;
802 int subCodeLength = 0;
803 if (withTag) {
804 codeLength += tag.decodeAndCheck(is);
805 }
slowr13fa5b02017-08-08 16:32:31 -0700806
slowr67d05e42017-08-11 20:37:22 -0700807 BerLength length = new BerLength();
808 codeLength += length.decode(is);
809 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -0700810
slowr67d05e42017-08-11 20:37:22 -0700811 while (subCodeLength < totalLength) {
812 BerInteger element = new BerInteger();
813 subCodeLength += element.decode(is, true);
814 seqOf.add(element);
815 }
816 if (subCodeLength != totalLength) {
817 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -0700818
slowr67d05e42017-08-11 20:37:22 -0700819 }
820 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -0700821
slowr67d05e42017-08-11 20:37:22 -0700822 return codeLength;
823 }
slowr13fa5b02017-08-08 16:32:31 -0700824
slowr67d05e42017-08-11 20:37:22 -0700825 public void encodeAndSave(int encodingSizeGuess) throws IOException {
826 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
827 encode(os, false);
828 code = os.getArray();
829 }
slowr13fa5b02017-08-08 16:32:31 -0700830
slowr67d05e42017-08-11 20:37:22 -0700831 public String toString() {
832 StringBuilder sb = new StringBuilder();
833 appendAsString(sb, 0);
834 return sb.toString();
835 }
slowr13fa5b02017-08-08 16:32:31 -0700836
slowr67d05e42017-08-11 20:37:22 -0700837 public void appendAsString(StringBuilder sb, int indentLevel) {
838
839 sb.append("[\n");
840 for (int i = 0; i < indentLevel + 1; i++) {
841 sb.append("\t");
842 }
843 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -0700844// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -0700845 } else {
846 Iterator<BerInteger> it = seqOf.iterator();
847 if (it.hasNext()) {
848 sb.append(it.next());
849 while (it.hasNext()) {
850 sb.append(",\n");
851 for (int i = 0; i < indentLevel + 1; i++) {
852 sb.append("\t");
853 }
854 sb.append(it.next());
855 }
856 }
857 }
slowr13fa5b02017-08-08 16:32:31 -0700858
slowr67d05e42017-08-11 20:37:22 -0700859 sb.append("\n");
860 for (int i = 0; i < indentLevel; i++) {
861 sb.append("\t");
862 }
863 sb.append("]");
864 }
slowr13fa5b02017-08-08 16:32:31 -0700865
slowr67d05e42017-08-11 20:37:22 -0700866 public void addBerInteger(BerInteger berInteger) {
867 seqOf.add(berInteger);
868 }
869 }
slowr13fa5b02017-08-08 16:32:31 -0700870
slowr67d05e42017-08-11 20:37:22 -0700871 public static class EndPrbDl implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -0700872
slowr67d05e42017-08-11 20:37:22 -0700873 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
874 private static final long serialVersionUID = 1L;
slowr73b4eae2017-08-17 16:09:09 -0700875 @JsonIgnore
876 public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -0700877 private List<BerInteger> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -0700878
slowr67d05e42017-08-11 20:37:22 -0700879 public EndPrbDl() {
880 seqOf = new ArrayList<BerInteger>();
881 }
slowr13fa5b02017-08-08 16:32:31 -0700882
slowr67d05e42017-08-11 20:37:22 -0700883 public EndPrbDl(byte[] code) {
884 this.code = code;
885 }
slowr13fa5b02017-08-08 16:32:31 -0700886
slowr73b4eae2017-08-17 16:09:09 -0700887 @JsonValue
888 public List<BerInteger> getBerInteger() {
slowr67d05e42017-08-11 20:37:22 -0700889 if (seqOf == null) {
890 seqOf = new ArrayList<BerInteger>();
891 }
892 return seqOf;
893 }
slowr13fa5b02017-08-08 16:32:31 -0700894
slowr67d05e42017-08-11 20:37:22 -0700895 public int encode(BerByteArrayOutputStream os) throws IOException {
896 return encode(os, true);
897 }
slowr13fa5b02017-08-08 16:32:31 -0700898
slowr67d05e42017-08-11 20:37:22 -0700899 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -0700900
slowr67d05e42017-08-11 20:37:22 -0700901 if (code != null) {
902 for (int i = code.length - 1; i >= 0; i--) {
903 os.write(code[i]);
904 }
905 if (withTag) {
906 return tag.encode(os) + code.length;
907 }
908 return code.length;
909 }
slowr13fa5b02017-08-08 16:32:31 -0700910
slowr67d05e42017-08-11 20:37:22 -0700911 int codeLength = 0;
912 for (int i = (seqOf.size() - 1); i >= 0; i--) {
913 codeLength += seqOf.get(i).encode(os, true);
914 }
slowr13fa5b02017-08-08 16:32:31 -0700915
slowr67d05e42017-08-11 20:37:22 -0700916 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -0700917
slowr67d05e42017-08-11 20:37:22 -0700918 if (withTag) {
919 codeLength += tag.encode(os);
920 }
slowr13fa5b02017-08-08 16:32:31 -0700921
slowr67d05e42017-08-11 20:37:22 -0700922 return codeLength;
923 }
slowr13fa5b02017-08-08 16:32:31 -0700924
slowr67d05e42017-08-11 20:37:22 -0700925 public int decode(InputStream is) throws IOException {
926 return decode(is, true);
927 }
slowr13fa5b02017-08-08 16:32:31 -0700928
slowr67d05e42017-08-11 20:37:22 -0700929 public int decode(InputStream is, boolean withTag) throws IOException {
930 int codeLength = 0;
931 int subCodeLength = 0;
932 if (withTag) {
933 codeLength += tag.decodeAndCheck(is);
934 }
slowr13fa5b02017-08-08 16:32:31 -0700935
slowr67d05e42017-08-11 20:37:22 -0700936 BerLength length = new BerLength();
937 codeLength += length.decode(is);
938 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -0700939
slowr67d05e42017-08-11 20:37:22 -0700940 while (subCodeLength < totalLength) {
941 BerInteger element = new BerInteger();
942 subCodeLength += element.decode(is, true);
943 seqOf.add(element);
944 }
945 if (subCodeLength != totalLength) {
946 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -0700947
slowr67d05e42017-08-11 20:37:22 -0700948 }
949 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -0700950
slowr67d05e42017-08-11 20:37:22 -0700951 return codeLength;
952 }
slowr13fa5b02017-08-08 16:32:31 -0700953
slowr67d05e42017-08-11 20:37:22 -0700954 public void encodeAndSave(int encodingSizeGuess) throws IOException {
955 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
956 encode(os, false);
957 code = os.getArray();
958 }
slowr13fa5b02017-08-08 16:32:31 -0700959
slowr67d05e42017-08-11 20:37:22 -0700960 public String toString() {
961 StringBuilder sb = new StringBuilder();
962 appendAsString(sb, 0);
963 return sb.toString();
964 }
slowr13fa5b02017-08-08 16:32:31 -0700965
slowr67d05e42017-08-11 20:37:22 -0700966 public void appendAsString(StringBuilder sb, int indentLevel) {
slowr13fa5b02017-08-08 16:32:31 -0700967
slowr67d05e42017-08-11 20:37:22 -0700968 sb.append("[\n");
969 for (int i = 0; i < indentLevel + 1; i++) {
970 sb.append("\t");
971 }
972 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -0700973// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -0700974 } else {
975 Iterator<BerInteger> it = seqOf.iterator();
976 if (it.hasNext()) {
977 sb.append(it.next());
978 while (it.hasNext()) {
979 sb.append(",\n");
980 for (int i = 0; i < indentLevel + 1; i++) {
981 sb.append("\t");
982 }
983 sb.append(it.next());
984 }
985 }
986 }
slowr13fa5b02017-08-08 16:32:31 -0700987
slowr67d05e42017-08-11 20:37:22 -0700988 sb.append("\n");
989 for (int i = 0; i < indentLevel; i++) {
990 sb.append("\t");
991 }
992 sb.append("]");
993 }
slowr13fa5b02017-08-08 16:32:31 -0700994
slowr67d05e42017-08-11 20:37:22 -0700995 public void addBerInteger(BerInteger berInteger) {
996 seqOf.add(berInteger);
997 }
slowr13fa5b02017-08-08 16:32:31 -0700998
slowr67d05e42017-08-11 20:37:22 -0700999 public List<BerInteger> getSeqOf() {
1000 return seqOf;
1001 }
slowr13fa5b02017-08-08 16:32:31 -07001002
slowr67d05e42017-08-11 20:37:22 -07001003 public void setSeqOf(List<BerInteger> seqOf) {
1004 this.seqOf = seqOf;
1005 }
1006 }
slowr13fa5b02017-08-08 16:32:31 -07001007
slowr67d05e42017-08-11 20:37:22 -07001008 public static class SubframeBitmaskDl implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -07001009
slowr67d05e42017-08-11 20:37:22 -07001010 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
1011 private static final long serialVersionUID = 1L;
slowr73b4eae2017-08-17 16:09:09 -07001012 @JsonIgnore
1013 public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -07001014 private List<BerBitString> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -07001015
slowr67d05e42017-08-11 20:37:22 -07001016 public SubframeBitmaskDl() {
1017 seqOf = new ArrayList<BerBitString>();
1018 }
slowr13fa5b02017-08-08 16:32:31 -07001019
slowr67d05e42017-08-11 20:37:22 -07001020 public SubframeBitmaskDl(byte[] code) {
1021 this.code = code;
1022 }
slowr13fa5b02017-08-08 16:32:31 -07001023
slowr73b4eae2017-08-17 16:09:09 -07001024 public void setSeqOf(List<BerBitString> seqOf) {
1025 this.seqOf = seqOf;
1026 }
1027
slowr60d4d102017-08-16 18:33:58 -07001028 @JsonValue
slowr67d05e42017-08-11 20:37:22 -07001029 public List<BerBitString> getBerBitString() {
1030 if (seqOf == null) {
1031 seqOf = new ArrayList<BerBitString>();
1032 }
1033 return seqOf;
1034 }
slowr13fa5b02017-08-08 16:32:31 -07001035
slowr73b4eae2017-08-17 16:09:09 -07001036
slowr67d05e42017-08-11 20:37:22 -07001037 public void addBerBitString(BerBitString berBitString) {
1038 seqOf.add(berBitString);
1039 }
slowr13fa5b02017-08-08 16:32:31 -07001040
slowr67d05e42017-08-11 20:37:22 -07001041 public int encode(BerByteArrayOutputStream os) throws IOException {
1042 return encode(os, true);
1043 }
slowr13fa5b02017-08-08 16:32:31 -07001044
slowr67d05e42017-08-11 20:37:22 -07001045 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -07001046
slowr67d05e42017-08-11 20:37:22 -07001047 if (code != null) {
1048 for (int i = code.length - 1; i >= 0; i--) {
1049 os.write(code[i]);
1050 }
1051 if (withTag) {
1052 return tag.encode(os) + code.length;
1053 }
1054 return code.length;
1055 }
slowr13fa5b02017-08-08 16:32:31 -07001056
slowr67d05e42017-08-11 20:37:22 -07001057 int codeLength = 0;
1058 for (int i = (seqOf.size() - 1); i >= 0; i--) {
1059 codeLength += seqOf.get(i).encode(os, true);
1060 }
slowr13fa5b02017-08-08 16:32:31 -07001061
slowr67d05e42017-08-11 20:37:22 -07001062 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -07001063
slowr67d05e42017-08-11 20:37:22 -07001064 if (withTag) {
1065 codeLength += tag.encode(os);
1066 }
slowr13fa5b02017-08-08 16:32:31 -07001067
slowr67d05e42017-08-11 20:37:22 -07001068 return codeLength;
1069 }
slowr13fa5b02017-08-08 16:32:31 -07001070
slowr67d05e42017-08-11 20:37:22 -07001071 public int decode(InputStream is) throws IOException {
1072 return decode(is, true);
1073 }
slowr13fa5b02017-08-08 16:32:31 -07001074
slowr67d05e42017-08-11 20:37:22 -07001075 public int decode(InputStream is, boolean withTag) throws IOException {
1076 int codeLength = 0;
1077 int subCodeLength = 0;
1078 if (withTag) {
1079 codeLength += tag.decodeAndCheck(is);
1080 }
slowr13fa5b02017-08-08 16:32:31 -07001081
slowr67d05e42017-08-11 20:37:22 -07001082 BerLength length = new BerLength();
1083 codeLength += length.decode(is);
1084 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -07001085
slowr67d05e42017-08-11 20:37:22 -07001086 while (subCodeLength < totalLength) {
1087 BerBitString element = new BerBitString();
1088 subCodeLength += element.decode(is, true);
1089 seqOf.add(element);
1090 }
1091 if (subCodeLength != totalLength) {
1092 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -07001093
slowr67d05e42017-08-11 20:37:22 -07001094 }
1095 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -07001096
slowr67d05e42017-08-11 20:37:22 -07001097 return codeLength;
1098 }
slowr13fa5b02017-08-08 16:32:31 -07001099
slowr67d05e42017-08-11 20:37:22 -07001100 public void encodeAndSave(int encodingSizeGuess) throws IOException {
1101 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
1102 encode(os, false);
1103 code = os.getArray();
1104 }
slowr13fa5b02017-08-08 16:32:31 -07001105
slowr67d05e42017-08-11 20:37:22 -07001106 public String toString() {
1107 StringBuilder sb = new StringBuilder();
1108 appendAsString(sb, 0);
1109 return sb.toString();
1110 }
1111
1112 public void appendAsString(StringBuilder sb, int indentLevel) {
1113
1114 sb.append("[\n");
1115 for (int i = 0; i < indentLevel + 1; i++) {
1116 sb.append("\t");
1117 }
1118 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -07001119// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -07001120 } else {
1121 Iterator<BerBitString> it = seqOf.iterator();
1122 if (it.hasNext()) {
slowr60d4d102017-08-16 18:33:58 -07001123 sb.append("" + it.next() + "");
slowr67d05e42017-08-11 20:37:22 -07001124 while (it.hasNext()) {
1125 sb.append(",\n");
1126 for (int i = 0; i < indentLevel + 1; i++) {
1127 sb.append("\t");
1128 }
slowr60d4d102017-08-16 18:33:58 -07001129 sb.append("" + it.next() + "");
slowr67d05e42017-08-11 20:37:22 -07001130 }
1131 }
1132 }
slowr13fa5b02017-08-08 16:32:31 -07001133
slowr67d05e42017-08-11 20:37:22 -07001134 sb.append("\n");
1135 for (int i = 0; i < indentLevel; i++) {
1136 sb.append("\t");
1137 }
1138 sb.append("]");
1139 }
slowr67d05e42017-08-11 20:37:22 -07001140 }
slowr13fa5b02017-08-08 16:32:31 -07001141
slowr67d05e42017-08-11 20:37:22 -07001142 public static class P0UePusch implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -07001143
slowr67d05e42017-08-11 20:37:22 -07001144 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
1145 private static final long serialVersionUID = 1L;
slowr73b4eae2017-08-17 16:09:09 -07001146 @JsonIgnore
1147 public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -07001148 private List<BerInteger> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -07001149
slowr67d05e42017-08-11 20:37:22 -07001150 public P0UePusch() {
1151 seqOf = new ArrayList<BerInteger>();
1152 }
slowr13fa5b02017-08-08 16:32:31 -07001153
slowr67d05e42017-08-11 20:37:22 -07001154 public P0UePusch(byte[] code) {
1155 this.code = code;
1156 }
slowr13fa5b02017-08-08 16:32:31 -07001157
slowr73b4eae2017-08-17 16:09:09 -07001158 @JsonValue
1159 public List<BerInteger> getBerInteger() {
slowr67d05e42017-08-11 20:37:22 -07001160 if (seqOf == null) {
1161 seqOf = new ArrayList<BerInteger>();
1162 }
1163 return seqOf;
1164 }
slowr13fa5b02017-08-08 16:32:31 -07001165
slowr67d05e42017-08-11 20:37:22 -07001166 public int encode(BerByteArrayOutputStream os) throws IOException {
1167 return encode(os, true);
1168 }
slowr13fa5b02017-08-08 16:32:31 -07001169
slowr67d05e42017-08-11 20:37:22 -07001170 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -07001171
slowr67d05e42017-08-11 20:37:22 -07001172 if (code != null) {
1173 for (int i = code.length - 1; i >= 0; i--) {
1174 os.write(code[i]);
1175 }
1176 if (withTag) {
1177 return tag.encode(os) + code.length;
1178 }
1179 return code.length;
1180 }
slowr13fa5b02017-08-08 16:32:31 -07001181
slowr67d05e42017-08-11 20:37:22 -07001182 int codeLength = 0;
1183 for (int i = (seqOf.size() - 1); i >= 0; i--) {
1184 codeLength += seqOf.get(i).encode(os, true);
1185 }
slowr13fa5b02017-08-08 16:32:31 -07001186
slowr67d05e42017-08-11 20:37:22 -07001187 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -07001188
slowr67d05e42017-08-11 20:37:22 -07001189 if (withTag) {
1190 codeLength += tag.encode(os);
1191 }
slowr13fa5b02017-08-08 16:32:31 -07001192
slowr67d05e42017-08-11 20:37:22 -07001193 return codeLength;
1194 }
slowr13fa5b02017-08-08 16:32:31 -07001195
slowr67d05e42017-08-11 20:37:22 -07001196 public int decode(InputStream is) throws IOException {
1197 return decode(is, true);
1198 }
slowr13fa5b02017-08-08 16:32:31 -07001199
slowr67d05e42017-08-11 20:37:22 -07001200 public int decode(InputStream is, boolean withTag) throws IOException {
1201 int codeLength = 0;
1202 int subCodeLength = 0;
1203 if (withTag) {
1204 codeLength += tag.decodeAndCheck(is);
1205 }
slowr13fa5b02017-08-08 16:32:31 -07001206
slowr67d05e42017-08-11 20:37:22 -07001207 BerLength length = new BerLength();
1208 codeLength += length.decode(is);
1209 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -07001210
slowr67d05e42017-08-11 20:37:22 -07001211 while (subCodeLength < totalLength) {
1212 BerInteger element = new BerInteger();
1213 subCodeLength += element.decode(is, true);
1214 seqOf.add(element);
1215 }
1216 if (subCodeLength != totalLength) {
1217 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -07001218
slowr67d05e42017-08-11 20:37:22 -07001219 }
1220 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -07001221
slowr67d05e42017-08-11 20:37:22 -07001222 return codeLength;
1223 }
slowr13fa5b02017-08-08 16:32:31 -07001224
slowr67d05e42017-08-11 20:37:22 -07001225 public void encodeAndSave(int encodingSizeGuess) throws IOException {
1226 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
1227 encode(os, false);
1228 code = os.getArray();
1229 }
slowr13fa5b02017-08-08 16:32:31 -07001230
slowr67d05e42017-08-11 20:37:22 -07001231 public String toString() {
1232 StringBuilder sb = new StringBuilder();
1233 appendAsString(sb, 0);
1234 return sb.toString();
1235 }
slowr13fa5b02017-08-08 16:32:31 -07001236
slowr67d05e42017-08-11 20:37:22 -07001237 public void appendAsString(StringBuilder sb, int indentLevel) {
slowr13fa5b02017-08-08 16:32:31 -07001238
slowr67d05e42017-08-11 20:37:22 -07001239 sb.append("[\n");
1240 for (int i = 0; i < indentLevel + 1; i++) {
1241 sb.append("\t");
1242 }
1243 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -07001244// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -07001245 } else {
1246 Iterator<BerInteger> it = seqOf.iterator();
1247 if (it.hasNext()) {
1248 sb.append(it.next());
1249 while (it.hasNext()) {
1250 sb.append(",\n");
1251 for (int i = 0; i < indentLevel + 1; i++) {
1252 sb.append("\t");
1253 }
1254 sb.append(it.next());
1255 }
1256 }
1257 }
slowr13fa5b02017-08-08 16:32:31 -07001258
slowr67d05e42017-08-11 20:37:22 -07001259 sb.append("\n");
1260 for (int i = 0; i < indentLevel; i++) {
1261 sb.append("\t");
1262 }
1263 sb.append("]");
1264 }
slowr13fa5b02017-08-08 16:32:31 -07001265
slowr73b4eae2017-08-17 16:09:09 -07001266 public void setSeqOf(List<BerInteger> seqOf) {
1267 this.seqOf = seqOf;
1268 }
slowr67d05e42017-08-11 20:37:22 -07001269 }
slowr13fa5b02017-08-08 16:32:31 -07001270
slowr67d05e42017-08-11 20:37:22 -07001271 public static class StartPrbUl implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -07001272
slowr67d05e42017-08-11 20:37:22 -07001273 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
1274 private static final long serialVersionUID = 1L;
slowr73b4eae2017-08-17 16:09:09 -07001275 @JsonIgnore
1276 public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -07001277 private List<BerInteger> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -07001278
slowr67d05e42017-08-11 20:37:22 -07001279 public StartPrbUl() {
1280 seqOf = new ArrayList<BerInteger>();
1281 }
slowr13fa5b02017-08-08 16:32:31 -07001282
slowr67d05e42017-08-11 20:37:22 -07001283 public StartPrbUl(byte[] code) {
1284 this.code = code;
1285 }
slowr13fa5b02017-08-08 16:32:31 -07001286
slowr73b4eae2017-08-17 16:09:09 -07001287 @JsonValue
1288 public List<BerInteger> getBerInteger() {
slowr67d05e42017-08-11 20:37:22 -07001289 if (seqOf == null) {
1290 seqOf = new ArrayList<BerInteger>();
1291 }
1292 return seqOf;
1293 }
slowr13fa5b02017-08-08 16:32:31 -07001294
slowr67d05e42017-08-11 20:37:22 -07001295 public int encode(BerByteArrayOutputStream os) throws IOException {
1296 return encode(os, true);
1297 }
slowr13fa5b02017-08-08 16:32:31 -07001298
slowr67d05e42017-08-11 20:37:22 -07001299 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -07001300
slowr67d05e42017-08-11 20:37:22 -07001301 if (code != null) {
1302 for (int i = code.length - 1; i >= 0; i--) {
1303 os.write(code[i]);
1304 }
1305 if (withTag) {
1306 return tag.encode(os) + code.length;
1307 }
1308 return code.length;
1309 }
slowr13fa5b02017-08-08 16:32:31 -07001310
slowr67d05e42017-08-11 20:37:22 -07001311 int codeLength = 0;
1312 for (int i = (seqOf.size() - 1); i >= 0; i--) {
1313 codeLength += seqOf.get(i).encode(os, true);
1314 }
slowr13fa5b02017-08-08 16:32:31 -07001315
slowr67d05e42017-08-11 20:37:22 -07001316 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -07001317
slowr67d05e42017-08-11 20:37:22 -07001318 if (withTag) {
1319 codeLength += tag.encode(os);
1320 }
slowr13fa5b02017-08-08 16:32:31 -07001321
slowr67d05e42017-08-11 20:37:22 -07001322 return codeLength;
1323 }
slowr13fa5b02017-08-08 16:32:31 -07001324
slowr67d05e42017-08-11 20:37:22 -07001325 public int decode(InputStream is) throws IOException {
1326 return decode(is, true);
1327 }
slowr13fa5b02017-08-08 16:32:31 -07001328
slowr67d05e42017-08-11 20:37:22 -07001329 public int decode(InputStream is, boolean withTag) throws IOException {
1330 int codeLength = 0;
1331 int subCodeLength = 0;
1332 if (withTag) {
1333 codeLength += tag.decodeAndCheck(is);
1334 }
slowr13fa5b02017-08-08 16:32:31 -07001335
slowr67d05e42017-08-11 20:37:22 -07001336 BerLength length = new BerLength();
1337 codeLength += length.decode(is);
1338 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -07001339
slowr67d05e42017-08-11 20:37:22 -07001340 while (subCodeLength < totalLength) {
1341 BerInteger element = new BerInteger();
1342 subCodeLength += element.decode(is, true);
1343 seqOf.add(element);
1344 }
1345 if (subCodeLength != totalLength) {
1346 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -07001347
slowr67d05e42017-08-11 20:37:22 -07001348 }
1349 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -07001350
slowr67d05e42017-08-11 20:37:22 -07001351 return codeLength;
1352 }
slowr13fa5b02017-08-08 16:32:31 -07001353
slowr67d05e42017-08-11 20:37:22 -07001354 public void encodeAndSave(int encodingSizeGuess) throws IOException {
1355 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
1356 encode(os, false);
1357 code = os.getArray();
1358 }
slowr13fa5b02017-08-08 16:32:31 -07001359
slowr67d05e42017-08-11 20:37:22 -07001360 public String toString() {
1361 StringBuilder sb = new StringBuilder();
1362 appendAsString(sb, 0);
1363 return sb.toString();
1364 }
slowr13fa5b02017-08-08 16:32:31 -07001365
slowr67d05e42017-08-11 20:37:22 -07001366 public void appendAsString(StringBuilder sb, int indentLevel) {
slowr13fa5b02017-08-08 16:32:31 -07001367
slowr67d05e42017-08-11 20:37:22 -07001368 sb.append("[\n");
1369 for (int i = 0; i < indentLevel + 1; i++) {
1370 sb.append("\t");
1371 }
1372 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -07001373// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -07001374 } else {
1375 Iterator<BerInteger> it = seqOf.iterator();
1376 if (it.hasNext()) {
1377 sb.append(it.next());
1378 while (it.hasNext()) {
1379 sb.append(",\n");
1380 for (int i = 0; i < indentLevel + 1; i++) {
1381 sb.append("\t");
1382 }
1383 sb.append(it.next());
1384 }
1385 }
1386 }
slowr13fa5b02017-08-08 16:32:31 -07001387
slowr67d05e42017-08-11 20:37:22 -07001388 sb.append("\n");
1389 for (int i = 0; i < indentLevel; i++) {
1390 sb.append("\t");
1391 }
1392 sb.append("]");
1393 }
slowr13fa5b02017-08-08 16:32:31 -07001394
slowr67d05e42017-08-11 20:37:22 -07001395 public void addBerInteger(BerInteger berInteger) {
1396 seqOf.add(berInteger);
1397 }
slowr8ddc2b12017-08-14 14:13:38 -07001398
1399 public List<BerInteger> getSeqOf() {
1400 return seqOf;
1401 }
1402
1403 public void setSeqOf(List<BerInteger> seqOf) {
1404 this.seqOf = seqOf;
1405 }
slowr67d05e42017-08-11 20:37:22 -07001406 }
slowr13fa5b02017-08-08 16:32:31 -07001407
slowr67d05e42017-08-11 20:37:22 -07001408 public static class EndPrbUl implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -07001409
slowr67d05e42017-08-11 20:37:22 -07001410 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
1411 private static final long serialVersionUID = 1L;
slowr73b4eae2017-08-17 16:09:09 -07001412 @JsonIgnore
1413 public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -07001414 private List<BerInteger> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -07001415
slowr67d05e42017-08-11 20:37:22 -07001416 public EndPrbUl() {
1417 seqOf = new ArrayList<BerInteger>();
1418 }
slowr13fa5b02017-08-08 16:32:31 -07001419
slowr67d05e42017-08-11 20:37:22 -07001420 public EndPrbUl(byte[] code) {
1421 this.code = code;
1422 }
slowr13fa5b02017-08-08 16:32:31 -07001423
slowr60d4d102017-08-16 18:33:58 -07001424 @JsonValue
slowr67d05e42017-08-11 20:37:22 -07001425 public List<BerInteger> getBerInteger() {
1426 if (seqOf == null) {
1427 seqOf = new ArrayList<BerInteger>();
1428 }
1429 return seqOf;
1430 }
slowr13fa5b02017-08-08 16:32:31 -07001431
slowr67d05e42017-08-11 20:37:22 -07001432 public int encode(BerByteArrayOutputStream os) throws IOException {
1433 return encode(os, true);
1434 }
slowr13fa5b02017-08-08 16:32:31 -07001435
slowr67d05e42017-08-11 20:37:22 -07001436 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -07001437
slowr67d05e42017-08-11 20:37:22 -07001438 if (code != null) {
1439 for (int i = code.length - 1; i >= 0; i--) {
1440 os.write(code[i]);
1441 }
1442 if (withTag) {
1443 return tag.encode(os) + code.length;
1444 }
1445 return code.length;
1446 }
slowr13fa5b02017-08-08 16:32:31 -07001447
slowr67d05e42017-08-11 20:37:22 -07001448 int codeLength = 0;
1449 for (int i = (seqOf.size() - 1); i >= 0; i--) {
1450 codeLength += seqOf.get(i).encode(os, true);
1451 }
slowr13fa5b02017-08-08 16:32:31 -07001452
slowr67d05e42017-08-11 20:37:22 -07001453 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -07001454
slowr67d05e42017-08-11 20:37:22 -07001455 if (withTag) {
1456 codeLength += tag.encode(os);
1457 }
slowr13fa5b02017-08-08 16:32:31 -07001458
slowr67d05e42017-08-11 20:37:22 -07001459 return codeLength;
1460 }
slowr13fa5b02017-08-08 16:32:31 -07001461
slowr67d05e42017-08-11 20:37:22 -07001462 public int decode(InputStream is) throws IOException {
1463 return decode(is, true);
1464 }
slowr13fa5b02017-08-08 16:32:31 -07001465
slowr67d05e42017-08-11 20:37:22 -07001466 public int decode(InputStream is, boolean withTag) throws IOException {
1467 int codeLength = 0;
1468 int subCodeLength = 0;
1469 if (withTag) {
1470 codeLength += tag.decodeAndCheck(is);
1471 }
slowr13fa5b02017-08-08 16:32:31 -07001472
slowr67d05e42017-08-11 20:37:22 -07001473 BerLength length = new BerLength();
1474 codeLength += length.decode(is);
1475 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -07001476
slowr67d05e42017-08-11 20:37:22 -07001477 while (subCodeLength < totalLength) {
1478 BerInteger element = new BerInteger();
1479 subCodeLength += element.decode(is, true);
1480 seqOf.add(element);
1481 }
1482 if (subCodeLength != totalLength) {
1483 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -07001484
slowr67d05e42017-08-11 20:37:22 -07001485 }
1486 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -07001487
slowr67d05e42017-08-11 20:37:22 -07001488 return codeLength;
1489 }
slowr13fa5b02017-08-08 16:32:31 -07001490
slowr67d05e42017-08-11 20:37:22 -07001491 public void encodeAndSave(int encodingSizeGuess) throws IOException {
1492 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
1493 encode(os, false);
1494 code = os.getArray();
1495 }
slowr13fa5b02017-08-08 16:32:31 -07001496
slowr67d05e42017-08-11 20:37:22 -07001497 public String toString() {
1498 StringBuilder sb = new StringBuilder();
1499 appendAsString(sb, 0);
1500 return sb.toString();
1501 }
slowr13fa5b02017-08-08 16:32:31 -07001502
slowr67d05e42017-08-11 20:37:22 -07001503 public void appendAsString(StringBuilder sb, int indentLevel) {
slowr13fa5b02017-08-08 16:32:31 -07001504
slowr67d05e42017-08-11 20:37:22 -07001505 sb.append("[\n");
1506 for (int i = 0; i < indentLevel + 1; i++) {
1507 sb.append("\t");
1508 }
1509 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -07001510// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -07001511 } else {
1512 Iterator<BerInteger> it = seqOf.iterator();
1513 if (it.hasNext()) {
1514 sb.append(it.next());
1515 while (it.hasNext()) {
1516 sb.append(",\n");
1517 for (int i = 0; i < indentLevel + 1; i++) {
1518 sb.append("\t");
1519 }
1520 sb.append(it.next());
1521 }
1522 }
1523 }
slowr13fa5b02017-08-08 16:32:31 -07001524
slowr67d05e42017-08-11 20:37:22 -07001525 sb.append("\n");
1526 for (int i = 0; i < indentLevel; i++) {
1527 sb.append("\t");
1528 }
1529 sb.append("]");
1530 }
slowr13fa5b02017-08-08 16:32:31 -07001531
slowr67d05e42017-08-11 20:37:22 -07001532 public void addBerInteger(BerInteger berInteger) {
1533 seqOf.add(berInteger);
1534 }
slowr8ddc2b12017-08-14 14:13:38 -07001535
1536 public List<BerInteger> getSeqOf() {
1537 return seqOf;
1538 }
1539
1540 public void setSeqOf(List<BerInteger> seqOf) {
1541 this.seqOf = seqOf;
1542 }
slowr67d05e42017-08-11 20:37:22 -07001543 }
slowr13fa5b02017-08-08 16:32:31 -07001544
slowr67d05e42017-08-11 20:37:22 -07001545 public static class SubframeBitmaskUl implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -07001546
slowr67d05e42017-08-11 20:37:22 -07001547 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
1548 private static final long serialVersionUID = 1L;
slowr73b4eae2017-08-17 16:09:09 -07001549 @JsonIgnore
1550 public byte[] code = null;
slowr67d05e42017-08-11 20:37:22 -07001551 private List<BerBitString> seqOf = null;
slowr13fa5b02017-08-08 16:32:31 -07001552
slowr67d05e42017-08-11 20:37:22 -07001553 public SubframeBitmaskUl() {
1554 seqOf = new ArrayList<BerBitString>();
1555 }
slowr13fa5b02017-08-08 16:32:31 -07001556
slowr67d05e42017-08-11 20:37:22 -07001557 public SubframeBitmaskUl(byte[] code) {
1558 this.code = code;
1559 }
slowr13fa5b02017-08-08 16:32:31 -07001560
slowr73b4eae2017-08-17 16:09:09 -07001561 public void setSeqOf(List<BerBitString> seqOf) {
1562 this.seqOf = seqOf;
1563 }
1564
slowr60d4d102017-08-16 18:33:58 -07001565 @JsonValue
slowr67d05e42017-08-11 20:37:22 -07001566 public List<BerBitString> getBerBitString() {
1567 if (seqOf == null) {
1568 seqOf = new ArrayList<BerBitString>();
1569 }
1570 return seqOf;
1571 }
slowr13fa5b02017-08-08 16:32:31 -07001572
slowr67d05e42017-08-11 20:37:22 -07001573 public int encode(BerByteArrayOutputStream os) throws IOException {
1574 return encode(os, true);
1575 }
slowr13fa5b02017-08-08 16:32:31 -07001576
slowr67d05e42017-08-11 20:37:22 -07001577 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -07001578
slowr67d05e42017-08-11 20:37:22 -07001579 if (code != null) {
1580 for (int i = code.length - 1; i >= 0; i--) {
1581 os.write(code[i]);
1582 }
1583 if (withTag) {
1584 return tag.encode(os) + code.length;
1585 }
1586 return code.length;
1587 }
slowr13fa5b02017-08-08 16:32:31 -07001588
slowr67d05e42017-08-11 20:37:22 -07001589 int codeLength = 0;
1590 for (int i = (seqOf.size() - 1); i >= 0; i--) {
1591 codeLength += seqOf.get(i).encode(os, true);
1592 }
slowr13fa5b02017-08-08 16:32:31 -07001593
slowr67d05e42017-08-11 20:37:22 -07001594 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -07001595
slowr67d05e42017-08-11 20:37:22 -07001596 if (withTag) {
1597 codeLength += tag.encode(os);
1598 }
slowr13fa5b02017-08-08 16:32:31 -07001599
slowr67d05e42017-08-11 20:37:22 -07001600 return codeLength;
1601 }
slowr13fa5b02017-08-08 16:32:31 -07001602
slowr67d05e42017-08-11 20:37:22 -07001603 public int decode(InputStream is) throws IOException {
1604 return decode(is, true);
1605 }
slowr13fa5b02017-08-08 16:32:31 -07001606
slowr67d05e42017-08-11 20:37:22 -07001607 public int decode(InputStream is, boolean withTag) throws IOException {
1608 int codeLength = 0;
1609 int subCodeLength = 0;
1610 if (withTag) {
1611 codeLength += tag.decodeAndCheck(is);
1612 }
slowr13fa5b02017-08-08 16:32:31 -07001613
slowr67d05e42017-08-11 20:37:22 -07001614 BerLength length = new BerLength();
1615 codeLength += length.decode(is);
1616 int totalLength = length.val;
slowr13fa5b02017-08-08 16:32:31 -07001617
slowr67d05e42017-08-11 20:37:22 -07001618 while (subCodeLength < totalLength) {
1619 BerBitString element = new BerBitString();
1620 subCodeLength += element.decode(is, true);
1621 seqOf.add(element);
1622 }
1623 if (subCodeLength != totalLength) {
1624 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
slowr13fa5b02017-08-08 16:32:31 -07001625
slowr67d05e42017-08-11 20:37:22 -07001626 }
1627 codeLength += subCodeLength;
slowr13fa5b02017-08-08 16:32:31 -07001628
slowr67d05e42017-08-11 20:37:22 -07001629 return codeLength;
1630 }
slowr13fa5b02017-08-08 16:32:31 -07001631
slowr67d05e42017-08-11 20:37:22 -07001632 public void encodeAndSave(int encodingSizeGuess) throws IOException {
1633 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
1634 encode(os, false);
1635 code = os.getArray();
1636 }
slowr13fa5b02017-08-08 16:32:31 -07001637
slowr67d05e42017-08-11 20:37:22 -07001638 public String toString() {
1639 StringBuilder sb = new StringBuilder();
1640 appendAsString(sb, 0);
1641 return sb.toString();
1642 }
slowr13fa5b02017-08-08 16:32:31 -07001643
slowr67d05e42017-08-11 20:37:22 -07001644 public void appendAsString(StringBuilder sb, int indentLevel) {
slowr13fa5b02017-08-08 16:32:31 -07001645
slowr67d05e42017-08-11 20:37:22 -07001646 sb.append("[\n");
1647 for (int i = 0; i < indentLevel + 1; i++) {
1648 sb.append("\t");
1649 }
1650 if (seqOf == null) {
slowr13fa5b02017-08-08 16:32:31 -07001651// sb.append("null");
slowr67d05e42017-08-11 20:37:22 -07001652 } else {
1653 Iterator<BerBitString> it = seqOf.iterator();
1654 if (it.hasNext()) {
1655 sb.append(it.next());
1656 while (it.hasNext()) {
1657 sb.append(",\n");
1658 for (int i = 0; i < indentLevel + 1; i++) {
1659 sb.append("\t");
1660 }
1661 sb.append(it.next());
1662 }
1663 }
1664 }
slowr13fa5b02017-08-08 16:32:31 -07001665
slowr67d05e42017-08-11 20:37:22 -07001666 sb.append("\n");
1667 for (int i = 0; i < indentLevel; i++) {
1668 sb.append("\t");
1669 }
1670 sb.append("]");
1671 }
slowr13fa5b02017-08-08 16:32:31 -07001672
slowr67d05e42017-08-11 20:37:22 -07001673 }
slowr13fa5b02017-08-08 16:32:31 -07001674
slowr13fa5b02017-08-08 16:32:31 -07001675}
1676