slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame^] | 1 | /** |
| 2 | * This class file was automatically generated by jASN1 v1.8.0 (http://www.openmuc.org) |
| 3 | */ |
| 4 | |
| 5 | package org.onosproject.xran.codecs.pdu; |
| 6 | |
| 7 | import org.onosproject.xran.codecs.api.CRNTI; |
| 8 | import org.onosproject.xran.codecs.api.ECGI; |
| 9 | import org.onosproject.xran.codecs.api.XICICPA; |
| 10 | import org.openmuc.jasn1.ber.BerByteArrayOutputStream; |
| 11 | import org.openmuc.jasn1.ber.BerLength; |
| 12 | import org.openmuc.jasn1.ber.BerTag; |
| 13 | import org.openmuc.jasn1.ber.types.BerBitString; |
| 14 | import org.openmuc.jasn1.ber.types.BerInteger; |
| 15 | import java.io.IOException; |
| 16 | import java.io.InputStream; |
| 17 | import java.io.Serializable; |
| 18 | import java.util.ArrayList; |
| 19 | import java.util.Iterator; |
| 20 | import java.util.List; |
| 21 | |
| 22 | public class RRMConfig implements Serializable { |
| 23 | |
| 24 | private static final long serialVersionUID = 1L; |
| 25 | |
| 26 | public static class Crnti implements Serializable { |
| 27 | |
| 28 | private static final long serialVersionUID = 1L; |
| 29 | |
| 30 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 31 | public byte[] code = null; |
| 32 | private List<CRNTI> seqOf = null; |
| 33 | |
| 34 | public Crnti() { |
| 35 | seqOf = new ArrayList<CRNTI>(); |
| 36 | } |
| 37 | |
| 38 | public Crnti(byte[] code) { |
| 39 | this.code = code; |
| 40 | } |
| 41 | |
| 42 | public List<CRNTI> getCRNTI() { |
| 43 | if (seqOf == null) { |
| 44 | seqOf = new ArrayList<CRNTI>(); |
| 45 | } |
| 46 | return seqOf; |
| 47 | } |
| 48 | |
| 49 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 50 | return encode(os, true); |
| 51 | } |
| 52 | |
| 53 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 54 | |
| 55 | if (code != null) { |
| 56 | for (int i = code.length - 1; i >= 0; i--) { |
| 57 | os.write(code[i]); |
| 58 | } |
| 59 | if (withTag) { |
| 60 | return tag.encode(os) + code.length; |
| 61 | } |
| 62 | return code.length; |
| 63 | } |
| 64 | |
| 65 | int codeLength = 0; |
| 66 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 67 | codeLength += seqOf.get(i).encode(os, true); |
| 68 | } |
| 69 | |
| 70 | codeLength += BerLength.encodeLength(os, codeLength); |
| 71 | |
| 72 | if (withTag) { |
| 73 | codeLength += tag.encode(os); |
| 74 | } |
| 75 | |
| 76 | return codeLength; |
| 77 | } |
| 78 | |
| 79 | public int decode(InputStream is) throws IOException { |
| 80 | return decode(is, true); |
| 81 | } |
| 82 | |
| 83 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 84 | int codeLength = 0; |
| 85 | int subCodeLength = 0; |
| 86 | if (withTag) { |
| 87 | codeLength += tag.decodeAndCheck(is); |
| 88 | } |
| 89 | |
| 90 | BerLength length = new BerLength(); |
| 91 | codeLength += length.decode(is); |
| 92 | int totalLength = length.val; |
| 93 | |
| 94 | while (subCodeLength < totalLength) { |
| 95 | CRNTI element = new CRNTI(); |
| 96 | subCodeLength += element.decode(is, true); |
| 97 | seqOf.add(element); |
| 98 | } |
| 99 | if (subCodeLength != totalLength) { |
| 100 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 101 | |
| 102 | } |
| 103 | codeLength += subCodeLength; |
| 104 | |
| 105 | return codeLength; |
| 106 | } |
| 107 | |
| 108 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 109 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 110 | encode(os, false); |
| 111 | code = os.getArray(); |
| 112 | } |
| 113 | |
| 114 | public String toString() { |
| 115 | StringBuilder sb = new StringBuilder(); |
| 116 | appendAsString(sb, 0); |
| 117 | return sb.toString(); |
| 118 | } |
| 119 | |
| 120 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 121 | |
| 122 | sb.append("[\n"); |
| 123 | for (int i = 0; i < indentLevel + 1; i++) { |
| 124 | sb.append("\t"); |
| 125 | } |
| 126 | if (seqOf == null) { |
| 127 | // sb.append("null"); |
| 128 | } |
| 129 | else { |
| 130 | Iterator<CRNTI> it = seqOf.iterator(); |
| 131 | if (it.hasNext()) { |
| 132 | sb.append(it.next()); |
| 133 | while (it.hasNext()) { |
| 134 | sb.append(",\n"); |
| 135 | for (int i = 0; i < indentLevel + 1; i++) { |
| 136 | sb.append("\t"); |
| 137 | } |
| 138 | sb.append(it.next()); |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | sb.append("\n"); |
| 144 | for (int i = 0; i < indentLevel; i++) { |
| 145 | sb.append("\t"); |
| 146 | } |
| 147 | sb.append("]"); |
| 148 | } |
| 149 | |
| 150 | } |
| 151 | |
| 152 | public static class Pa implements Serializable { |
| 153 | |
| 154 | private static final long serialVersionUID = 1L; |
| 155 | |
| 156 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 157 | public byte[] code = null; |
| 158 | private List<XICICPA> seqOf = null; |
| 159 | |
| 160 | public Pa() { |
| 161 | seqOf = new ArrayList<XICICPA>(); |
| 162 | } |
| 163 | |
| 164 | public Pa(byte[] code) { |
| 165 | this.code = code; |
| 166 | } |
| 167 | |
| 168 | public List<XICICPA> getXICICPA() { |
| 169 | if (seqOf == null) { |
| 170 | seqOf = new ArrayList<XICICPA>(); |
| 171 | } |
| 172 | return seqOf; |
| 173 | } |
| 174 | |
| 175 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 176 | return encode(os, true); |
| 177 | } |
| 178 | |
| 179 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 180 | |
| 181 | if (code != null) { |
| 182 | for (int i = code.length - 1; i >= 0; i--) { |
| 183 | os.write(code[i]); |
| 184 | } |
| 185 | if (withTag) { |
| 186 | return tag.encode(os) + code.length; |
| 187 | } |
| 188 | return code.length; |
| 189 | } |
| 190 | |
| 191 | int codeLength = 0; |
| 192 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 193 | codeLength += seqOf.get(i).encode(os, true); |
| 194 | } |
| 195 | |
| 196 | codeLength += BerLength.encodeLength(os, codeLength); |
| 197 | |
| 198 | if (withTag) { |
| 199 | codeLength += tag.encode(os); |
| 200 | } |
| 201 | |
| 202 | return codeLength; |
| 203 | } |
| 204 | |
| 205 | public int decode(InputStream is) throws IOException { |
| 206 | return decode(is, true); |
| 207 | } |
| 208 | |
| 209 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 210 | int codeLength = 0; |
| 211 | int subCodeLength = 0; |
| 212 | if (withTag) { |
| 213 | codeLength += tag.decodeAndCheck(is); |
| 214 | } |
| 215 | |
| 216 | BerLength length = new BerLength(); |
| 217 | codeLength += length.decode(is); |
| 218 | int totalLength = length.val; |
| 219 | |
| 220 | while (subCodeLength < totalLength) { |
| 221 | XICICPA element = new XICICPA(); |
| 222 | subCodeLength += element.decode(is, true); |
| 223 | seqOf.add(element); |
| 224 | } |
| 225 | if (subCodeLength != totalLength) { |
| 226 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 227 | |
| 228 | } |
| 229 | codeLength += subCodeLength; |
| 230 | |
| 231 | return codeLength; |
| 232 | } |
| 233 | |
| 234 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 235 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 236 | encode(os, false); |
| 237 | code = os.getArray(); |
| 238 | } |
| 239 | |
| 240 | public String toString() { |
| 241 | StringBuilder sb = new StringBuilder(); |
| 242 | appendAsString(sb, 0); |
| 243 | return sb.toString(); |
| 244 | } |
| 245 | |
| 246 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 247 | |
| 248 | sb.append("[\n"); |
| 249 | for (int i = 0; i < indentLevel + 1; i++) { |
| 250 | sb.append("\t"); |
| 251 | } |
| 252 | if (seqOf == null) { |
| 253 | // sb.append("null"); |
| 254 | } |
| 255 | else { |
| 256 | Iterator<XICICPA> it = seqOf.iterator(); |
| 257 | if (it.hasNext()) { |
| 258 | sb.append(it.next()); |
| 259 | while (it.hasNext()) { |
| 260 | sb.append(",\n"); |
| 261 | for (int i = 0; i < indentLevel + 1; i++) { |
| 262 | sb.append("\t"); |
| 263 | } |
| 264 | sb.append(it.next()); |
| 265 | } |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | sb.append("\n"); |
| 270 | for (int i = 0; i < indentLevel; i++) { |
| 271 | sb.append("\t"); |
| 272 | } |
| 273 | sb.append("]"); |
| 274 | } |
| 275 | |
| 276 | } |
| 277 | |
| 278 | public static class StartPrbDl implements Serializable { |
| 279 | |
| 280 | private static final long serialVersionUID = 1L; |
| 281 | |
| 282 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 283 | public byte[] code = null; |
| 284 | private List<BerInteger> seqOf = null; |
| 285 | |
| 286 | public StartPrbDl() { |
| 287 | seqOf = new ArrayList<BerInteger>(); |
| 288 | } |
| 289 | |
| 290 | public StartPrbDl(byte[] code) { |
| 291 | this.code = code; |
| 292 | } |
| 293 | |
| 294 | public List<BerInteger> getBerInteger() { |
| 295 | if (seqOf == null) { |
| 296 | seqOf = new ArrayList<BerInteger>(); |
| 297 | } |
| 298 | return seqOf; |
| 299 | } |
| 300 | |
| 301 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 302 | return encode(os, true); |
| 303 | } |
| 304 | |
| 305 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 306 | |
| 307 | if (code != null) { |
| 308 | for (int i = code.length - 1; i >= 0; i--) { |
| 309 | os.write(code[i]); |
| 310 | } |
| 311 | if (withTag) { |
| 312 | return tag.encode(os) + code.length; |
| 313 | } |
| 314 | return code.length; |
| 315 | } |
| 316 | |
| 317 | int codeLength = 0; |
| 318 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 319 | codeLength += seqOf.get(i).encode(os, true); |
| 320 | } |
| 321 | |
| 322 | codeLength += BerLength.encodeLength(os, codeLength); |
| 323 | |
| 324 | if (withTag) { |
| 325 | codeLength += tag.encode(os); |
| 326 | } |
| 327 | |
| 328 | return codeLength; |
| 329 | } |
| 330 | |
| 331 | public int decode(InputStream is) throws IOException { |
| 332 | return decode(is, true); |
| 333 | } |
| 334 | |
| 335 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 336 | int codeLength = 0; |
| 337 | int subCodeLength = 0; |
| 338 | if (withTag) { |
| 339 | codeLength += tag.decodeAndCheck(is); |
| 340 | } |
| 341 | |
| 342 | BerLength length = new BerLength(); |
| 343 | codeLength += length.decode(is); |
| 344 | int totalLength = length.val; |
| 345 | |
| 346 | while (subCodeLength < totalLength) { |
| 347 | BerInteger element = new BerInteger(); |
| 348 | subCodeLength += element.decode(is, true); |
| 349 | seqOf.add(element); |
| 350 | } |
| 351 | if (subCodeLength != totalLength) { |
| 352 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 353 | |
| 354 | } |
| 355 | codeLength += subCodeLength; |
| 356 | |
| 357 | return codeLength; |
| 358 | } |
| 359 | |
| 360 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 361 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 362 | encode(os, false); |
| 363 | code = os.getArray(); |
| 364 | } |
| 365 | |
| 366 | public String toString() { |
| 367 | StringBuilder sb = new StringBuilder(); |
| 368 | appendAsString(sb, 0); |
| 369 | return sb.toString(); |
| 370 | } |
| 371 | |
| 372 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 373 | |
| 374 | sb.append("[\n"); |
| 375 | for (int i = 0; i < indentLevel + 1; i++) { |
| 376 | sb.append("\t"); |
| 377 | } |
| 378 | if (seqOf == null) { |
| 379 | // sb.append("null"); |
| 380 | } |
| 381 | else { |
| 382 | Iterator<BerInteger> it = seqOf.iterator(); |
| 383 | if (it.hasNext()) { |
| 384 | sb.append(it.next()); |
| 385 | while (it.hasNext()) { |
| 386 | sb.append(",\n"); |
| 387 | for (int i = 0; i < indentLevel + 1; i++) { |
| 388 | sb.append("\t"); |
| 389 | } |
| 390 | sb.append(it.next()); |
| 391 | } |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | sb.append("\n"); |
| 396 | for (int i = 0; i < indentLevel; i++) { |
| 397 | sb.append("\t"); |
| 398 | } |
| 399 | sb.append("]"); |
| 400 | } |
| 401 | |
| 402 | } |
| 403 | |
| 404 | public static class EndPrbDl implements Serializable { |
| 405 | |
| 406 | private static final long serialVersionUID = 1L; |
| 407 | |
| 408 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 409 | public byte[] code = null; |
| 410 | private List<BerInteger> seqOf = null; |
| 411 | |
| 412 | public EndPrbDl() { |
| 413 | seqOf = new ArrayList<BerInteger>(); |
| 414 | } |
| 415 | |
| 416 | public EndPrbDl(byte[] code) { |
| 417 | this.code = code; |
| 418 | } |
| 419 | |
| 420 | public List<BerInteger> getBerInteger() { |
| 421 | if (seqOf == null) { |
| 422 | seqOf = new ArrayList<BerInteger>(); |
| 423 | } |
| 424 | return seqOf; |
| 425 | } |
| 426 | |
| 427 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 428 | return encode(os, true); |
| 429 | } |
| 430 | |
| 431 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 432 | |
| 433 | if (code != null) { |
| 434 | for (int i = code.length - 1; i >= 0; i--) { |
| 435 | os.write(code[i]); |
| 436 | } |
| 437 | if (withTag) { |
| 438 | return tag.encode(os) + code.length; |
| 439 | } |
| 440 | return code.length; |
| 441 | } |
| 442 | |
| 443 | int codeLength = 0; |
| 444 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 445 | codeLength += seqOf.get(i).encode(os, true); |
| 446 | } |
| 447 | |
| 448 | codeLength += BerLength.encodeLength(os, codeLength); |
| 449 | |
| 450 | if (withTag) { |
| 451 | codeLength += tag.encode(os); |
| 452 | } |
| 453 | |
| 454 | return codeLength; |
| 455 | } |
| 456 | |
| 457 | public int decode(InputStream is) throws IOException { |
| 458 | return decode(is, true); |
| 459 | } |
| 460 | |
| 461 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 462 | int codeLength = 0; |
| 463 | int subCodeLength = 0; |
| 464 | if (withTag) { |
| 465 | codeLength += tag.decodeAndCheck(is); |
| 466 | } |
| 467 | |
| 468 | BerLength length = new BerLength(); |
| 469 | codeLength += length.decode(is); |
| 470 | int totalLength = length.val; |
| 471 | |
| 472 | while (subCodeLength < totalLength) { |
| 473 | BerInteger element = new BerInteger(); |
| 474 | subCodeLength += element.decode(is, true); |
| 475 | seqOf.add(element); |
| 476 | } |
| 477 | if (subCodeLength != totalLength) { |
| 478 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 479 | |
| 480 | } |
| 481 | codeLength += subCodeLength; |
| 482 | |
| 483 | return codeLength; |
| 484 | } |
| 485 | |
| 486 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 487 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 488 | encode(os, false); |
| 489 | code = os.getArray(); |
| 490 | } |
| 491 | |
| 492 | public String toString() { |
| 493 | StringBuilder sb = new StringBuilder(); |
| 494 | appendAsString(sb, 0); |
| 495 | return sb.toString(); |
| 496 | } |
| 497 | |
| 498 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 499 | |
| 500 | sb.append("[\n"); |
| 501 | for (int i = 0; i < indentLevel + 1; i++) { |
| 502 | sb.append("\t"); |
| 503 | } |
| 504 | if (seqOf == null) { |
| 505 | // sb.append("null"); |
| 506 | } |
| 507 | else { |
| 508 | Iterator<BerInteger> it = seqOf.iterator(); |
| 509 | if (it.hasNext()) { |
| 510 | sb.append(it.next()); |
| 511 | while (it.hasNext()) { |
| 512 | sb.append(",\n"); |
| 513 | for (int i = 0; i < indentLevel + 1; i++) { |
| 514 | sb.append("\t"); |
| 515 | } |
| 516 | sb.append(it.next()); |
| 517 | } |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | sb.append("\n"); |
| 522 | for (int i = 0; i < indentLevel; i++) { |
| 523 | sb.append("\t"); |
| 524 | } |
| 525 | sb.append("]"); |
| 526 | } |
| 527 | |
| 528 | } |
| 529 | |
| 530 | public static class SubframeBitmaskDl implements Serializable { |
| 531 | |
| 532 | private static final long serialVersionUID = 1L; |
| 533 | |
| 534 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 535 | public byte[] code = null; |
| 536 | private List<BerBitString> seqOf = null; |
| 537 | |
| 538 | public SubframeBitmaskDl() { |
| 539 | seqOf = new ArrayList<BerBitString>(); |
| 540 | } |
| 541 | |
| 542 | public SubframeBitmaskDl(byte[] code) { |
| 543 | this.code = code; |
| 544 | } |
| 545 | |
| 546 | public List<BerBitString> getBerBitString() { |
| 547 | if (seqOf == null) { |
| 548 | seqOf = new ArrayList<BerBitString>(); |
| 549 | } |
| 550 | return seqOf; |
| 551 | } |
| 552 | |
| 553 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 554 | return encode(os, true); |
| 555 | } |
| 556 | |
| 557 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 558 | |
| 559 | if (code != null) { |
| 560 | for (int i = code.length - 1; i >= 0; i--) { |
| 561 | os.write(code[i]); |
| 562 | } |
| 563 | if (withTag) { |
| 564 | return tag.encode(os) + code.length; |
| 565 | } |
| 566 | return code.length; |
| 567 | } |
| 568 | |
| 569 | int codeLength = 0; |
| 570 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 571 | codeLength += seqOf.get(i).encode(os, true); |
| 572 | } |
| 573 | |
| 574 | codeLength += BerLength.encodeLength(os, codeLength); |
| 575 | |
| 576 | if (withTag) { |
| 577 | codeLength += tag.encode(os); |
| 578 | } |
| 579 | |
| 580 | return codeLength; |
| 581 | } |
| 582 | |
| 583 | public int decode(InputStream is) throws IOException { |
| 584 | return decode(is, true); |
| 585 | } |
| 586 | |
| 587 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 588 | int codeLength = 0; |
| 589 | int subCodeLength = 0; |
| 590 | if (withTag) { |
| 591 | codeLength += tag.decodeAndCheck(is); |
| 592 | } |
| 593 | |
| 594 | BerLength length = new BerLength(); |
| 595 | codeLength += length.decode(is); |
| 596 | int totalLength = length.val; |
| 597 | |
| 598 | while (subCodeLength < totalLength) { |
| 599 | BerBitString element = new BerBitString(); |
| 600 | subCodeLength += element.decode(is, true); |
| 601 | seqOf.add(element); |
| 602 | } |
| 603 | if (subCodeLength != totalLength) { |
| 604 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 605 | |
| 606 | } |
| 607 | codeLength += subCodeLength; |
| 608 | |
| 609 | return codeLength; |
| 610 | } |
| 611 | |
| 612 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 613 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 614 | encode(os, false); |
| 615 | code = os.getArray(); |
| 616 | } |
| 617 | |
| 618 | public String toString() { |
| 619 | StringBuilder sb = new StringBuilder(); |
| 620 | appendAsString(sb, 0); |
| 621 | return sb.toString(); |
| 622 | } |
| 623 | |
| 624 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 625 | |
| 626 | sb.append("[\n"); |
| 627 | for (int i = 0; i < indentLevel + 1; i++) { |
| 628 | sb.append("\t"); |
| 629 | } |
| 630 | if (seqOf == null) { |
| 631 | // sb.append("null"); |
| 632 | } |
| 633 | else { |
| 634 | Iterator<BerBitString> it = seqOf.iterator(); |
| 635 | if (it.hasNext()) { |
| 636 | sb.append(it.next()); |
| 637 | while (it.hasNext()) { |
| 638 | sb.append(",\n"); |
| 639 | for (int i = 0; i < indentLevel + 1; i++) { |
| 640 | sb.append("\t"); |
| 641 | } |
| 642 | sb.append(it.next()); |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | |
| 647 | sb.append("\n"); |
| 648 | for (int i = 0; i < indentLevel; i++) { |
| 649 | sb.append("\t"); |
| 650 | } |
| 651 | sb.append("]"); |
| 652 | } |
| 653 | |
| 654 | } |
| 655 | |
| 656 | public static class P0UePusch implements Serializable { |
| 657 | |
| 658 | private static final long serialVersionUID = 1L; |
| 659 | |
| 660 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 661 | public byte[] code = null; |
| 662 | private List<BerInteger> seqOf = null; |
| 663 | |
| 664 | public P0UePusch() { |
| 665 | seqOf = new ArrayList<BerInteger>(); |
| 666 | } |
| 667 | |
| 668 | public P0UePusch(byte[] code) { |
| 669 | this.code = code; |
| 670 | } |
| 671 | |
| 672 | public List<BerInteger> getBerInteger() { |
| 673 | if (seqOf == null) { |
| 674 | seqOf = new ArrayList<BerInteger>(); |
| 675 | } |
| 676 | return seqOf; |
| 677 | } |
| 678 | |
| 679 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 680 | return encode(os, true); |
| 681 | } |
| 682 | |
| 683 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 684 | |
| 685 | if (code != null) { |
| 686 | for (int i = code.length - 1; i >= 0; i--) { |
| 687 | os.write(code[i]); |
| 688 | } |
| 689 | if (withTag) { |
| 690 | return tag.encode(os) + code.length; |
| 691 | } |
| 692 | return code.length; |
| 693 | } |
| 694 | |
| 695 | int codeLength = 0; |
| 696 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 697 | codeLength += seqOf.get(i).encode(os, true); |
| 698 | } |
| 699 | |
| 700 | codeLength += BerLength.encodeLength(os, codeLength); |
| 701 | |
| 702 | if (withTag) { |
| 703 | codeLength += tag.encode(os); |
| 704 | } |
| 705 | |
| 706 | return codeLength; |
| 707 | } |
| 708 | |
| 709 | public int decode(InputStream is) throws IOException { |
| 710 | return decode(is, true); |
| 711 | } |
| 712 | |
| 713 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 714 | int codeLength = 0; |
| 715 | int subCodeLength = 0; |
| 716 | if (withTag) { |
| 717 | codeLength += tag.decodeAndCheck(is); |
| 718 | } |
| 719 | |
| 720 | BerLength length = new BerLength(); |
| 721 | codeLength += length.decode(is); |
| 722 | int totalLength = length.val; |
| 723 | |
| 724 | while (subCodeLength < totalLength) { |
| 725 | BerInteger element = new BerInteger(); |
| 726 | subCodeLength += element.decode(is, true); |
| 727 | seqOf.add(element); |
| 728 | } |
| 729 | if (subCodeLength != totalLength) { |
| 730 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 731 | |
| 732 | } |
| 733 | codeLength += subCodeLength; |
| 734 | |
| 735 | return codeLength; |
| 736 | } |
| 737 | |
| 738 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 739 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 740 | encode(os, false); |
| 741 | code = os.getArray(); |
| 742 | } |
| 743 | |
| 744 | public String toString() { |
| 745 | StringBuilder sb = new StringBuilder(); |
| 746 | appendAsString(sb, 0); |
| 747 | return sb.toString(); |
| 748 | } |
| 749 | |
| 750 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 751 | |
| 752 | sb.append("[\n"); |
| 753 | for (int i = 0; i < indentLevel + 1; i++) { |
| 754 | sb.append("\t"); |
| 755 | } |
| 756 | if (seqOf == null) { |
| 757 | // sb.append("null"); |
| 758 | } |
| 759 | else { |
| 760 | Iterator<BerInteger> it = seqOf.iterator(); |
| 761 | if (it.hasNext()) { |
| 762 | sb.append(it.next()); |
| 763 | while (it.hasNext()) { |
| 764 | sb.append(",\n"); |
| 765 | for (int i = 0; i < indentLevel + 1; i++) { |
| 766 | sb.append("\t"); |
| 767 | } |
| 768 | sb.append(it.next()); |
| 769 | } |
| 770 | } |
| 771 | } |
| 772 | |
| 773 | sb.append("\n"); |
| 774 | for (int i = 0; i < indentLevel; i++) { |
| 775 | sb.append("\t"); |
| 776 | } |
| 777 | sb.append("]"); |
| 778 | } |
| 779 | |
| 780 | } |
| 781 | |
| 782 | public static class StartPrbUl implements Serializable { |
| 783 | |
| 784 | private static final long serialVersionUID = 1L; |
| 785 | |
| 786 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 787 | public byte[] code = null; |
| 788 | private List<BerInteger> seqOf = null; |
| 789 | |
| 790 | public StartPrbUl() { |
| 791 | seqOf = new ArrayList<BerInteger>(); |
| 792 | } |
| 793 | |
| 794 | public StartPrbUl(byte[] code) { |
| 795 | this.code = code; |
| 796 | } |
| 797 | |
| 798 | public List<BerInteger> getBerInteger() { |
| 799 | if (seqOf == null) { |
| 800 | seqOf = new ArrayList<BerInteger>(); |
| 801 | } |
| 802 | return seqOf; |
| 803 | } |
| 804 | |
| 805 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 806 | return encode(os, true); |
| 807 | } |
| 808 | |
| 809 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 810 | |
| 811 | if (code != null) { |
| 812 | for (int i = code.length - 1; i >= 0; i--) { |
| 813 | os.write(code[i]); |
| 814 | } |
| 815 | if (withTag) { |
| 816 | return tag.encode(os) + code.length; |
| 817 | } |
| 818 | return code.length; |
| 819 | } |
| 820 | |
| 821 | int codeLength = 0; |
| 822 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 823 | codeLength += seqOf.get(i).encode(os, true); |
| 824 | } |
| 825 | |
| 826 | codeLength += BerLength.encodeLength(os, codeLength); |
| 827 | |
| 828 | if (withTag) { |
| 829 | codeLength += tag.encode(os); |
| 830 | } |
| 831 | |
| 832 | return codeLength; |
| 833 | } |
| 834 | |
| 835 | public int decode(InputStream is) throws IOException { |
| 836 | return decode(is, true); |
| 837 | } |
| 838 | |
| 839 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 840 | int codeLength = 0; |
| 841 | int subCodeLength = 0; |
| 842 | if (withTag) { |
| 843 | codeLength += tag.decodeAndCheck(is); |
| 844 | } |
| 845 | |
| 846 | BerLength length = new BerLength(); |
| 847 | codeLength += length.decode(is); |
| 848 | int totalLength = length.val; |
| 849 | |
| 850 | while (subCodeLength < totalLength) { |
| 851 | BerInteger element = new BerInteger(); |
| 852 | subCodeLength += element.decode(is, true); |
| 853 | seqOf.add(element); |
| 854 | } |
| 855 | if (subCodeLength != totalLength) { |
| 856 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 857 | |
| 858 | } |
| 859 | codeLength += subCodeLength; |
| 860 | |
| 861 | return codeLength; |
| 862 | } |
| 863 | |
| 864 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 865 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 866 | encode(os, false); |
| 867 | code = os.getArray(); |
| 868 | } |
| 869 | |
| 870 | public String toString() { |
| 871 | StringBuilder sb = new StringBuilder(); |
| 872 | appendAsString(sb, 0); |
| 873 | return sb.toString(); |
| 874 | } |
| 875 | |
| 876 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 877 | |
| 878 | sb.append("[\n"); |
| 879 | for (int i = 0; i < indentLevel + 1; i++) { |
| 880 | sb.append("\t"); |
| 881 | } |
| 882 | if (seqOf == null) { |
| 883 | // sb.append("null"); |
| 884 | } |
| 885 | else { |
| 886 | Iterator<BerInteger> it = seqOf.iterator(); |
| 887 | if (it.hasNext()) { |
| 888 | sb.append(it.next()); |
| 889 | while (it.hasNext()) { |
| 890 | sb.append(",\n"); |
| 891 | for (int i = 0; i < indentLevel + 1; i++) { |
| 892 | sb.append("\t"); |
| 893 | } |
| 894 | sb.append(it.next()); |
| 895 | } |
| 896 | } |
| 897 | } |
| 898 | |
| 899 | sb.append("\n"); |
| 900 | for (int i = 0; i < indentLevel; i++) { |
| 901 | sb.append("\t"); |
| 902 | } |
| 903 | sb.append("]"); |
| 904 | } |
| 905 | |
| 906 | } |
| 907 | |
| 908 | public static class EndPrbUl implements Serializable { |
| 909 | |
| 910 | private static final long serialVersionUID = 1L; |
| 911 | |
| 912 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 913 | public byte[] code = null; |
| 914 | private List<BerInteger> seqOf = null; |
| 915 | |
| 916 | public EndPrbUl() { |
| 917 | seqOf = new ArrayList<BerInteger>(); |
| 918 | } |
| 919 | |
| 920 | public EndPrbUl(byte[] code) { |
| 921 | this.code = code; |
| 922 | } |
| 923 | |
| 924 | public List<BerInteger> getBerInteger() { |
| 925 | if (seqOf == null) { |
| 926 | seqOf = new ArrayList<BerInteger>(); |
| 927 | } |
| 928 | return seqOf; |
| 929 | } |
| 930 | |
| 931 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 932 | return encode(os, true); |
| 933 | } |
| 934 | |
| 935 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 936 | |
| 937 | if (code != null) { |
| 938 | for (int i = code.length - 1; i >= 0; i--) { |
| 939 | os.write(code[i]); |
| 940 | } |
| 941 | if (withTag) { |
| 942 | return tag.encode(os) + code.length; |
| 943 | } |
| 944 | return code.length; |
| 945 | } |
| 946 | |
| 947 | int codeLength = 0; |
| 948 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 949 | codeLength += seqOf.get(i).encode(os, true); |
| 950 | } |
| 951 | |
| 952 | codeLength += BerLength.encodeLength(os, codeLength); |
| 953 | |
| 954 | if (withTag) { |
| 955 | codeLength += tag.encode(os); |
| 956 | } |
| 957 | |
| 958 | return codeLength; |
| 959 | } |
| 960 | |
| 961 | public int decode(InputStream is) throws IOException { |
| 962 | return decode(is, true); |
| 963 | } |
| 964 | |
| 965 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 966 | int codeLength = 0; |
| 967 | int subCodeLength = 0; |
| 968 | if (withTag) { |
| 969 | codeLength += tag.decodeAndCheck(is); |
| 970 | } |
| 971 | |
| 972 | BerLength length = new BerLength(); |
| 973 | codeLength += length.decode(is); |
| 974 | int totalLength = length.val; |
| 975 | |
| 976 | while (subCodeLength < totalLength) { |
| 977 | BerInteger element = new BerInteger(); |
| 978 | subCodeLength += element.decode(is, true); |
| 979 | seqOf.add(element); |
| 980 | } |
| 981 | if (subCodeLength != totalLength) { |
| 982 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 983 | |
| 984 | } |
| 985 | codeLength += subCodeLength; |
| 986 | |
| 987 | return codeLength; |
| 988 | } |
| 989 | |
| 990 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 991 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 992 | encode(os, false); |
| 993 | code = os.getArray(); |
| 994 | } |
| 995 | |
| 996 | public String toString() { |
| 997 | StringBuilder sb = new StringBuilder(); |
| 998 | appendAsString(sb, 0); |
| 999 | return sb.toString(); |
| 1000 | } |
| 1001 | |
| 1002 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 1003 | |
| 1004 | sb.append("[\n"); |
| 1005 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1006 | sb.append("\t"); |
| 1007 | } |
| 1008 | if (seqOf == null) { |
| 1009 | // sb.append("null"); |
| 1010 | } |
| 1011 | else { |
| 1012 | Iterator<BerInteger> it = seqOf.iterator(); |
| 1013 | if (it.hasNext()) { |
| 1014 | sb.append(it.next()); |
| 1015 | while (it.hasNext()) { |
| 1016 | sb.append(",\n"); |
| 1017 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1018 | sb.append("\t"); |
| 1019 | } |
| 1020 | sb.append(it.next()); |
| 1021 | } |
| 1022 | } |
| 1023 | } |
| 1024 | |
| 1025 | sb.append("\n"); |
| 1026 | for (int i = 0; i < indentLevel; i++) { |
| 1027 | sb.append("\t"); |
| 1028 | } |
| 1029 | sb.append("]"); |
| 1030 | } |
| 1031 | |
| 1032 | } |
| 1033 | |
| 1034 | public static class SubframeBitmaskUl implements Serializable { |
| 1035 | |
| 1036 | private static final long serialVersionUID = 1L; |
| 1037 | |
| 1038 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 1039 | public byte[] code = null; |
| 1040 | private List<BerBitString> seqOf = null; |
| 1041 | |
| 1042 | public SubframeBitmaskUl() { |
| 1043 | seqOf = new ArrayList<BerBitString>(); |
| 1044 | } |
| 1045 | |
| 1046 | public SubframeBitmaskUl(byte[] code) { |
| 1047 | this.code = code; |
| 1048 | } |
| 1049 | |
| 1050 | public List<BerBitString> getBerBitString() { |
| 1051 | if (seqOf == null) { |
| 1052 | seqOf = new ArrayList<BerBitString>(); |
| 1053 | } |
| 1054 | return seqOf; |
| 1055 | } |
| 1056 | |
| 1057 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 1058 | return encode(os, true); |
| 1059 | } |
| 1060 | |
| 1061 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 1062 | |
| 1063 | if (code != null) { |
| 1064 | for (int i = code.length - 1; i >= 0; i--) { |
| 1065 | os.write(code[i]); |
| 1066 | } |
| 1067 | if (withTag) { |
| 1068 | return tag.encode(os) + code.length; |
| 1069 | } |
| 1070 | return code.length; |
| 1071 | } |
| 1072 | |
| 1073 | int codeLength = 0; |
| 1074 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 1075 | codeLength += seqOf.get(i).encode(os, true); |
| 1076 | } |
| 1077 | |
| 1078 | codeLength += BerLength.encodeLength(os, codeLength); |
| 1079 | |
| 1080 | if (withTag) { |
| 1081 | codeLength += tag.encode(os); |
| 1082 | } |
| 1083 | |
| 1084 | return codeLength; |
| 1085 | } |
| 1086 | |
| 1087 | public int decode(InputStream is) throws IOException { |
| 1088 | return decode(is, true); |
| 1089 | } |
| 1090 | |
| 1091 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 1092 | int codeLength = 0; |
| 1093 | int subCodeLength = 0; |
| 1094 | if (withTag) { |
| 1095 | codeLength += tag.decodeAndCheck(is); |
| 1096 | } |
| 1097 | |
| 1098 | BerLength length = new BerLength(); |
| 1099 | codeLength += length.decode(is); |
| 1100 | int totalLength = length.val; |
| 1101 | |
| 1102 | while (subCodeLength < totalLength) { |
| 1103 | BerBitString element = new BerBitString(); |
| 1104 | subCodeLength += element.decode(is, true); |
| 1105 | seqOf.add(element); |
| 1106 | } |
| 1107 | if (subCodeLength != totalLength) { |
| 1108 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 1109 | |
| 1110 | } |
| 1111 | codeLength += subCodeLength; |
| 1112 | |
| 1113 | return codeLength; |
| 1114 | } |
| 1115 | |
| 1116 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 1117 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 1118 | encode(os, false); |
| 1119 | code = os.getArray(); |
| 1120 | } |
| 1121 | |
| 1122 | public String toString() { |
| 1123 | StringBuilder sb = new StringBuilder(); |
| 1124 | appendAsString(sb, 0); |
| 1125 | return sb.toString(); |
| 1126 | } |
| 1127 | |
| 1128 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 1129 | |
| 1130 | sb.append("[\n"); |
| 1131 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1132 | sb.append("\t"); |
| 1133 | } |
| 1134 | if (seqOf == null) { |
| 1135 | // sb.append("null"); |
| 1136 | } |
| 1137 | else { |
| 1138 | Iterator<BerBitString> it = seqOf.iterator(); |
| 1139 | if (it.hasNext()) { |
| 1140 | sb.append(it.next()); |
| 1141 | while (it.hasNext()) { |
| 1142 | sb.append(",\n"); |
| 1143 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1144 | sb.append("\t"); |
| 1145 | } |
| 1146 | sb.append(it.next()); |
| 1147 | } |
| 1148 | } |
| 1149 | } |
| 1150 | |
| 1151 | sb.append("\n"); |
| 1152 | for (int i = 0; i < indentLevel; i++) { |
| 1153 | sb.append("\t"); |
| 1154 | } |
| 1155 | sb.append("]"); |
| 1156 | } |
| 1157 | |
| 1158 | } |
| 1159 | |
| 1160 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 1161 | |
| 1162 | public byte[] code = null; |
| 1163 | private ECGI ecgi = null; |
| 1164 | private Crnti crnti = null; |
| 1165 | private Pa pa = null; |
| 1166 | private StartPrbDl startPrbDl = null; |
| 1167 | private EndPrbDl endPrbDl = null; |
| 1168 | private SubframeBitmaskDl subframeBitmaskDl = null; |
| 1169 | private P0UePusch p0UePusch = null; |
| 1170 | private StartPrbUl startPrbUl = null; |
| 1171 | private EndPrbUl endPrbUl = null; |
| 1172 | private SubframeBitmaskUl subframeBitmaskUl = null; |
| 1173 | |
| 1174 | public RRMConfig() { |
| 1175 | } |
| 1176 | |
| 1177 | public RRMConfig(byte[] code) { |
| 1178 | this.code = code; |
| 1179 | } |
| 1180 | |
| 1181 | public void setEcgi(ECGI ecgi) { |
| 1182 | this.ecgi = ecgi; |
| 1183 | } |
| 1184 | |
| 1185 | public ECGI getEcgi() { |
| 1186 | return ecgi; |
| 1187 | } |
| 1188 | |
| 1189 | public void setCrnti(Crnti crnti) { |
| 1190 | this.crnti = crnti; |
| 1191 | } |
| 1192 | |
| 1193 | public Crnti getCrnti() { |
| 1194 | return crnti; |
| 1195 | } |
| 1196 | |
| 1197 | public void setPa(Pa pa) { |
| 1198 | this.pa = pa; |
| 1199 | } |
| 1200 | |
| 1201 | public Pa getPa() { |
| 1202 | return pa; |
| 1203 | } |
| 1204 | |
| 1205 | public void setStartPrbDl(StartPrbDl startPrbDl) { |
| 1206 | this.startPrbDl = startPrbDl; |
| 1207 | } |
| 1208 | |
| 1209 | public StartPrbDl getStartPrbDl() { |
| 1210 | return startPrbDl; |
| 1211 | } |
| 1212 | |
| 1213 | public void setEndPrbDl(EndPrbDl endPrbDl) { |
| 1214 | this.endPrbDl = endPrbDl; |
| 1215 | } |
| 1216 | |
| 1217 | public EndPrbDl getEndPrbDl() { |
| 1218 | return endPrbDl; |
| 1219 | } |
| 1220 | |
| 1221 | public void setSubframeBitmaskDl(SubframeBitmaskDl subframeBitmaskDl) { |
| 1222 | this.subframeBitmaskDl = subframeBitmaskDl; |
| 1223 | } |
| 1224 | |
| 1225 | public SubframeBitmaskDl getSubframeBitmaskDl() { |
| 1226 | return subframeBitmaskDl; |
| 1227 | } |
| 1228 | |
| 1229 | public void setP0UePusch(P0UePusch p0UePusch) { |
| 1230 | this.p0UePusch = p0UePusch; |
| 1231 | } |
| 1232 | |
| 1233 | public P0UePusch getP0UePusch() { |
| 1234 | return p0UePusch; |
| 1235 | } |
| 1236 | |
| 1237 | public void setStartPrbUl(StartPrbUl startPrbUl) { |
| 1238 | this.startPrbUl = startPrbUl; |
| 1239 | } |
| 1240 | |
| 1241 | public StartPrbUl getStartPrbUl() { |
| 1242 | return startPrbUl; |
| 1243 | } |
| 1244 | |
| 1245 | public void setEndPrbUl(EndPrbUl endPrbUl) { |
| 1246 | this.endPrbUl = endPrbUl; |
| 1247 | } |
| 1248 | |
| 1249 | public EndPrbUl getEndPrbUl() { |
| 1250 | return endPrbUl; |
| 1251 | } |
| 1252 | |
| 1253 | public void setSubframeBitmaskUl(SubframeBitmaskUl subframeBitmaskUl) { |
| 1254 | this.subframeBitmaskUl = subframeBitmaskUl; |
| 1255 | } |
| 1256 | |
| 1257 | public SubframeBitmaskUl getSubframeBitmaskUl() { |
| 1258 | return subframeBitmaskUl; |
| 1259 | } |
| 1260 | |
| 1261 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 1262 | return encode(os, true); |
| 1263 | } |
| 1264 | |
| 1265 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 1266 | |
| 1267 | if (code != null) { |
| 1268 | for (int i = code.length - 1; i >= 0; i--) { |
| 1269 | os.write(code[i]); |
| 1270 | } |
| 1271 | if (withTag) { |
| 1272 | return tag.encode(os) + code.length; |
| 1273 | } |
| 1274 | return code.length; |
| 1275 | } |
| 1276 | |
| 1277 | int codeLength = 0; |
| 1278 | if (subframeBitmaskUl != null) { |
| 1279 | codeLength += subframeBitmaskUl.encode(os, false); |
| 1280 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 9 |
| 1281 | os.write(0xA9); |
| 1282 | codeLength += 1; |
| 1283 | } |
| 1284 | |
| 1285 | if (endPrbUl != null) { |
| 1286 | codeLength += endPrbUl.encode(os, false); |
| 1287 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 8 |
| 1288 | os.write(0xA8); |
| 1289 | codeLength += 1; |
| 1290 | } |
| 1291 | |
| 1292 | if (startPrbUl != null) { |
| 1293 | codeLength += startPrbUl.encode(os, false); |
| 1294 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 7 |
| 1295 | os.write(0xA7); |
| 1296 | codeLength += 1; |
| 1297 | } |
| 1298 | |
| 1299 | if (p0UePusch != null) { |
| 1300 | codeLength += p0UePusch.encode(os, false); |
| 1301 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 6 |
| 1302 | os.write(0xA6); |
| 1303 | codeLength += 1; |
| 1304 | } |
| 1305 | |
| 1306 | if (subframeBitmaskDl != null) { |
| 1307 | codeLength += subframeBitmaskDl.encode(os, false); |
| 1308 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 5 |
| 1309 | os.write(0xA5); |
| 1310 | codeLength += 1; |
| 1311 | } |
| 1312 | |
| 1313 | if (endPrbDl != null) { |
| 1314 | codeLength += endPrbDl.encode(os, false); |
| 1315 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 4 |
| 1316 | os.write(0xA4); |
| 1317 | codeLength += 1; |
| 1318 | } |
| 1319 | |
| 1320 | if (startPrbDl != null) { |
| 1321 | codeLength += startPrbDl.encode(os, false); |
| 1322 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 3 |
| 1323 | os.write(0xA3); |
| 1324 | codeLength += 1; |
| 1325 | } |
| 1326 | |
| 1327 | if (pa != null) { |
| 1328 | codeLength += pa.encode(os, false); |
| 1329 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 |
| 1330 | os.write(0xA2); |
| 1331 | codeLength += 1; |
| 1332 | } |
| 1333 | |
| 1334 | if (crnti != null) { |
| 1335 | codeLength += crnti.encode(os, false); |
| 1336 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 |
| 1337 | os.write(0xA1); |
| 1338 | codeLength += 1; |
| 1339 | } |
| 1340 | |
| 1341 | codeLength += ecgi.encode(os, false); |
| 1342 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 |
| 1343 | os.write(0xA0); |
| 1344 | codeLength += 1; |
| 1345 | |
| 1346 | codeLength += BerLength.encodeLength(os, codeLength); |
| 1347 | |
| 1348 | if (withTag) { |
| 1349 | codeLength += tag.encode(os); |
| 1350 | } |
| 1351 | |
| 1352 | return codeLength; |
| 1353 | |
| 1354 | } |
| 1355 | |
| 1356 | public int decode(InputStream is) throws IOException { |
| 1357 | return decode(is, true); |
| 1358 | } |
| 1359 | |
| 1360 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 1361 | int codeLength = 0; |
| 1362 | int subCodeLength = 0; |
| 1363 | BerTag berTag = new BerTag(); |
| 1364 | |
| 1365 | if (withTag) { |
| 1366 | codeLength += tag.decodeAndCheck(is); |
| 1367 | } |
| 1368 | |
| 1369 | BerLength length = new BerLength(); |
| 1370 | codeLength += length.decode(is); |
| 1371 | |
| 1372 | int totalLength = length.val; |
| 1373 | codeLength += totalLength; |
| 1374 | |
| 1375 | subCodeLength += berTag.decode(is); |
| 1376 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { |
| 1377 | ecgi = new ECGI(); |
| 1378 | subCodeLength += ecgi.decode(is, false); |
| 1379 | if (subCodeLength == totalLength) { |
| 1380 | return codeLength; |
| 1381 | } |
| 1382 | subCodeLength += berTag.decode(is); |
| 1383 | } |
| 1384 | else { |
| 1385 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 1386 | } |
| 1387 | |
| 1388 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { |
| 1389 | crnti = new Crnti(); |
| 1390 | subCodeLength += crnti.decode(is, false); |
| 1391 | if (subCodeLength == totalLength) { |
| 1392 | return codeLength; |
| 1393 | } |
| 1394 | subCodeLength += berTag.decode(is); |
| 1395 | } |
| 1396 | |
| 1397 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { |
| 1398 | pa = new Pa(); |
| 1399 | subCodeLength += pa.decode(is, false); |
| 1400 | if (subCodeLength == totalLength) { |
| 1401 | return codeLength; |
| 1402 | } |
| 1403 | subCodeLength += berTag.decode(is); |
| 1404 | } |
| 1405 | |
| 1406 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) { |
| 1407 | startPrbDl = new StartPrbDl(); |
| 1408 | subCodeLength += startPrbDl.decode(is, false); |
| 1409 | if (subCodeLength == totalLength) { |
| 1410 | return codeLength; |
| 1411 | } |
| 1412 | subCodeLength += berTag.decode(is); |
| 1413 | } |
| 1414 | |
| 1415 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) { |
| 1416 | endPrbDl = new EndPrbDl(); |
| 1417 | subCodeLength += endPrbDl.decode(is, false); |
| 1418 | if (subCodeLength == totalLength) { |
| 1419 | return codeLength; |
| 1420 | } |
| 1421 | subCodeLength += berTag.decode(is); |
| 1422 | } |
| 1423 | |
| 1424 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) { |
| 1425 | subframeBitmaskDl = new SubframeBitmaskDl(); |
| 1426 | subCodeLength += subframeBitmaskDl.decode(is, false); |
| 1427 | if (subCodeLength == totalLength) { |
| 1428 | return codeLength; |
| 1429 | } |
| 1430 | subCodeLength += berTag.decode(is); |
| 1431 | } |
| 1432 | |
| 1433 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) { |
| 1434 | p0UePusch = new P0UePusch(); |
| 1435 | subCodeLength += p0UePusch.decode(is, false); |
| 1436 | if (subCodeLength == totalLength) { |
| 1437 | return codeLength; |
| 1438 | } |
| 1439 | subCodeLength += berTag.decode(is); |
| 1440 | } |
| 1441 | |
| 1442 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 7)) { |
| 1443 | startPrbUl = new StartPrbUl(); |
| 1444 | subCodeLength += startPrbUl.decode(is, false); |
| 1445 | if (subCodeLength == totalLength) { |
| 1446 | return codeLength; |
| 1447 | } |
| 1448 | subCodeLength += berTag.decode(is); |
| 1449 | } |
| 1450 | |
| 1451 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 8)) { |
| 1452 | endPrbUl = new EndPrbUl(); |
| 1453 | subCodeLength += endPrbUl.decode(is, false); |
| 1454 | if (subCodeLength == totalLength) { |
| 1455 | return codeLength; |
| 1456 | } |
| 1457 | subCodeLength += berTag.decode(is); |
| 1458 | } |
| 1459 | |
| 1460 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 9)) { |
| 1461 | subframeBitmaskUl = new SubframeBitmaskUl(); |
| 1462 | subCodeLength += subframeBitmaskUl.decode(is, false); |
| 1463 | if (subCodeLength == totalLength) { |
| 1464 | return codeLength; |
| 1465 | } |
| 1466 | } |
| 1467 | throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength); |
| 1468 | |
| 1469 | |
| 1470 | } |
| 1471 | |
| 1472 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 1473 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 1474 | encode(os, false); |
| 1475 | code = os.getArray(); |
| 1476 | } |
| 1477 | |
| 1478 | public String toString() { |
| 1479 | StringBuilder sb = new StringBuilder(); |
| 1480 | appendAsString(sb, 0); |
| 1481 | return sb.toString(); |
| 1482 | } |
| 1483 | |
| 1484 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 1485 | |
| 1486 | sb.append("{"); |
| 1487 | sb.append("\n"); |
| 1488 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1489 | sb.append("\t"); |
| 1490 | } |
| 1491 | if (ecgi != null) { |
| 1492 | sb.append("\"ecgi\": "); |
| 1493 | ecgi.appendAsString(sb, indentLevel + 1); |
| 1494 | } |
| 1495 | |
| 1496 | if (crnti != null) { |
| 1497 | sb.append(",\n"); |
| 1498 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1499 | sb.append("\t"); |
| 1500 | } |
| 1501 | sb.append("\"crnti\": "); |
| 1502 | crnti.appendAsString(sb, indentLevel + 1); |
| 1503 | } |
| 1504 | |
| 1505 | if (pa != null) { |
| 1506 | sb.append(",\n"); |
| 1507 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1508 | sb.append("\t"); |
| 1509 | } |
| 1510 | sb.append("\"pa\": "); |
| 1511 | pa.appendAsString(sb, indentLevel + 1); |
| 1512 | } |
| 1513 | |
| 1514 | if (startPrbDl != null) { |
| 1515 | sb.append(",\n"); |
| 1516 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1517 | sb.append("\t"); |
| 1518 | } |
| 1519 | sb.append("\"startPrbDl\": "); |
| 1520 | startPrbDl.appendAsString(sb, indentLevel + 1); |
| 1521 | } |
| 1522 | |
| 1523 | if (endPrbDl != null) { |
| 1524 | sb.append(",\n"); |
| 1525 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1526 | sb.append("\t"); |
| 1527 | } |
| 1528 | sb.append("\"endPrbDl\": "); |
| 1529 | endPrbDl.appendAsString(sb, indentLevel + 1); |
| 1530 | } |
| 1531 | |
| 1532 | if (subframeBitmaskDl != null) { |
| 1533 | sb.append(",\n"); |
| 1534 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1535 | sb.append("\t"); |
| 1536 | } |
| 1537 | sb.append("\"subframeBitmaskDl\": "); |
| 1538 | subframeBitmaskDl.appendAsString(sb, indentLevel + 1); |
| 1539 | } |
| 1540 | |
| 1541 | if (p0UePusch != null) { |
| 1542 | sb.append(",\n"); |
| 1543 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1544 | sb.append("\t"); |
| 1545 | } |
| 1546 | sb.append("\"p0UePusch\": "); |
| 1547 | p0UePusch.appendAsString(sb, indentLevel + 1); |
| 1548 | } |
| 1549 | |
| 1550 | if (startPrbUl != null) { |
| 1551 | sb.append(",\n"); |
| 1552 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1553 | sb.append("\t"); |
| 1554 | } |
| 1555 | sb.append("\"startPrbUl\": "); |
| 1556 | startPrbUl.appendAsString(sb, indentLevel + 1); |
| 1557 | } |
| 1558 | |
| 1559 | if (endPrbUl != null) { |
| 1560 | sb.append(",\n"); |
| 1561 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1562 | sb.append("\t"); |
| 1563 | } |
| 1564 | sb.append("\"endPrbUl\": "); |
| 1565 | endPrbUl.appendAsString(sb, indentLevel + 1); |
| 1566 | } |
| 1567 | |
| 1568 | if (subframeBitmaskUl != null) { |
| 1569 | sb.append(",\n"); |
| 1570 | for (int i = 0; i < indentLevel + 1; i++) { |
| 1571 | sb.append("\t"); |
| 1572 | } |
| 1573 | sb.append("\"subframeBitmaskUl\": "); |
| 1574 | subframeBitmaskUl.appendAsString(sb, indentLevel + 1); |
| 1575 | } |
| 1576 | |
| 1577 | sb.append("\n"); |
| 1578 | for (int i = 0; i < indentLevel; i++) { |
| 1579 | sb.append("\t"); |
| 1580 | } |
| 1581 | sb.append("}"); |
| 1582 | } |
| 1583 | |
| 1584 | } |
| 1585 | |