Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 1 | /** |
| 2 | * This class file was automatically generated by jASN1 v1.8.2 (http://www.openmuc.org) |
| 3 | */ |
| 4 | |
| 5 | package org.onosproject.xran.asn1lib.api; |
| 6 | |
| 7 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 8 | import com.fasterxml.jackson.annotation.JsonValue; |
| 9 | import org.onosproject.xran.asn1lib.ber.BerByteArrayOutputStream; |
| 10 | import org.onosproject.xran.asn1lib.ber.BerLength; |
| 11 | import org.onosproject.xran.asn1lib.ber.BerTag; |
| 12 | import org.onosproject.xran.asn1lib.ber.types.BerBoolean; |
| 13 | import org.onosproject.xran.asn1lib.ber.types.BerInteger; |
| 14 | |
| 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 | |
| 23 | public class MeasID implements Serializable { |
| 24 | |
| 25 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 26 | private static final long serialVersionUID = 1L; |
| 27 | @JsonIgnore |
| 28 | public byte[] code = null; |
| 29 | private BerInteger measobjectId = null; |
| 30 | private BerInteger reportconfigId = null; |
| 31 | private Action action = null; |
| 32 | public MeasID() { |
| 33 | } |
| 34 | |
| 35 | public MeasID(byte[] code) { |
| 36 | this.code = code; |
| 37 | } |
| 38 | |
| 39 | public BerInteger getMeasobjectId() { |
| 40 | return measobjectId; |
| 41 | } |
| 42 | |
| 43 | public void setMeasobjectId(BerInteger measobjectId) { |
| 44 | this.measobjectId = measobjectId; |
| 45 | } |
| 46 | |
| 47 | public BerInteger getReportconfigId() { |
| 48 | return reportconfigId; |
| 49 | } |
| 50 | |
| 51 | public void setReportconfigId(BerInteger reportconfigId) { |
| 52 | this.reportconfigId = reportconfigId; |
| 53 | } |
| 54 | |
| 55 | public Action getAction() { |
| 56 | return action; |
| 57 | } |
| 58 | |
| 59 | public void setAction(Action action) { |
| 60 | this.action = action; |
| 61 | } |
| 62 | |
| 63 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 64 | return encode(os, true); |
| 65 | } |
| 66 | |
| 67 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 68 | |
| 69 | if (code != null) { |
| 70 | for (int i = code.length - 1; i >= 0; i--) { |
| 71 | os.write(code[i]); |
| 72 | } |
| 73 | if (withTag) { |
| 74 | return tag.encode(os) + code.length; |
| 75 | } |
| 76 | return code.length; |
| 77 | } |
| 78 | |
| 79 | int codeLength = 0; |
| 80 | int sublength; |
| 81 | |
| 82 | sublength = action.encode(os); |
| 83 | codeLength += sublength; |
| 84 | codeLength += BerLength.encodeLength(os, sublength); |
| 85 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 |
| 86 | os.write(0xA2); |
| 87 | codeLength += 1; |
| 88 | |
| 89 | codeLength += reportconfigId.encode(os, false); |
| 90 | // write tag: CONTEXT_CLASS, PRIMITIVE, 1 |
| 91 | os.write(0x81); |
| 92 | codeLength += 1; |
| 93 | |
| 94 | codeLength += measobjectId.encode(os, false); |
| 95 | // write tag: CONTEXT_CLASS, PRIMITIVE, 0 |
| 96 | os.write(0x80); |
| 97 | codeLength += 1; |
| 98 | |
| 99 | codeLength += BerLength.encodeLength(os, codeLength); |
| 100 | |
| 101 | if (withTag) { |
| 102 | codeLength += tag.encode(os); |
| 103 | } |
| 104 | |
| 105 | return codeLength; |
| 106 | |
| 107 | } |
| 108 | |
| 109 | public int decode(InputStream is) throws IOException { |
| 110 | return decode(is, true); |
| 111 | } |
| 112 | |
| 113 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 114 | int codeLength = 0; |
| 115 | int subCodeLength = 0; |
| 116 | BerTag berTag = new BerTag(); |
| 117 | |
| 118 | if (withTag) { |
| 119 | codeLength += tag.decodeAndCheck(is); |
| 120 | } |
| 121 | |
| 122 | BerLength length = new BerLength(); |
| 123 | codeLength += length.decode(is); |
| 124 | |
| 125 | int totalLength = length.val; |
| 126 | codeLength += totalLength; |
| 127 | |
| 128 | subCodeLength += berTag.decode(is); |
| 129 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) { |
| 130 | measobjectId = new BerInteger(); |
| 131 | subCodeLength += measobjectId.decode(is, false); |
| 132 | subCodeLength += berTag.decode(is); |
| 133 | } else { |
| 134 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 135 | } |
| 136 | |
| 137 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { |
| 138 | reportconfigId = new BerInteger(); |
| 139 | subCodeLength += reportconfigId.decode(is, false); |
| 140 | subCodeLength += berTag.decode(is); |
| 141 | } else { |
| 142 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 143 | } |
| 144 | |
| 145 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { |
| 146 | subCodeLength += length.decode(is); |
| 147 | action = new Action(); |
| 148 | subCodeLength += action.decode(is, null); |
| 149 | if (subCodeLength == totalLength) { |
| 150 | return codeLength; |
| 151 | } |
| 152 | } |
| 153 | throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength); |
| 154 | |
| 155 | |
| 156 | } |
| 157 | |
| 158 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 159 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 160 | encode(os, false); |
| 161 | code = os.getArray(); |
| 162 | } |
| 163 | |
| 164 | public String toString() { |
| 165 | StringBuilder sb = new StringBuilder(); |
| 166 | appendAsString(sb, 0); |
| 167 | return sb.toString(); |
| 168 | } |
| 169 | |
| 170 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 171 | |
| 172 | sb.append("{"); |
| 173 | sb.append("\n"); |
| 174 | for (int i = 0; i < indentLevel + 1; i++) { |
| 175 | sb.append("\t"); |
| 176 | } |
| 177 | if (measobjectId != null) { |
| 178 | sb.append("measobjectId: ").append(measobjectId); |
| 179 | } else { |
| 180 | sb.append("measobjectId: <empty-required-field>"); |
| 181 | } |
| 182 | |
| 183 | sb.append(",\n"); |
| 184 | for (int i = 0; i < indentLevel + 1; i++) { |
| 185 | sb.append("\t"); |
| 186 | } |
| 187 | if (reportconfigId != null) { |
| 188 | sb.append("reportconfigId: ").append(reportconfigId); |
| 189 | } else { |
| 190 | sb.append("reportconfigId: <empty-required-field>"); |
| 191 | } |
| 192 | |
| 193 | sb.append(",\n"); |
| 194 | for (int i = 0; i < indentLevel + 1; i++) { |
| 195 | sb.append("\t"); |
| 196 | } |
| 197 | if (action != null) { |
| 198 | sb.append("action: "); |
| 199 | action.appendAsString(sb, indentLevel + 1); |
| 200 | } else { |
| 201 | sb.append("action: <empty-required-field>"); |
| 202 | } |
| 203 | |
| 204 | sb.append("\n"); |
| 205 | for (int i = 0; i < indentLevel; i++) { |
| 206 | sb.append("\t"); |
| 207 | } |
| 208 | sb.append("}"); |
| 209 | } |
| 210 | |
| 211 | public static class Action implements Serializable { |
| 212 | |
| 213 | private static final long serialVersionUID = 1L; |
| 214 | |
| 215 | @JsonIgnore |
| 216 | public byte[] code = null; |
| 217 | private Addmeasid addmeasid = null; |
| 218 | private Delmeasid delmeasid = null; |
| 219 | private BerBoolean hototarget = null; |
| 220 | public Action() { |
| 221 | } |
| 222 | public Action(byte[] code) { |
| 223 | this.code = code; |
| 224 | } |
| 225 | |
| 226 | public Addmeasid getAddmeasid() { |
| 227 | return addmeasid; |
| 228 | } |
| 229 | |
| 230 | public void setAddmeasid(Addmeasid addmeasid) { |
| 231 | this.addmeasid = addmeasid; |
| 232 | } |
| 233 | |
| 234 | public Delmeasid getDelmeasid() { |
| 235 | return delmeasid; |
| 236 | } |
| 237 | |
| 238 | public void setDelmeasid(Delmeasid delmeasid) { |
| 239 | this.delmeasid = delmeasid; |
| 240 | } |
| 241 | |
| 242 | public BerBoolean getHototarget() { |
| 243 | return hototarget; |
| 244 | } |
| 245 | |
| 246 | public void setHototarget(BerBoolean hototarget) { |
| 247 | this.hototarget = hototarget; |
| 248 | } |
| 249 | |
| 250 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 251 | |
| 252 | if (code != null) { |
| 253 | for (int i = code.length - 1; i >= 0; i--) { |
| 254 | os.write(code[i]); |
| 255 | } |
| 256 | return code.length; |
| 257 | } |
| 258 | |
| 259 | int codeLength = 0; |
| 260 | if (hototarget != null) { |
| 261 | codeLength += hototarget.encode(os, false); |
| 262 | // write tag: CONTEXT_CLASS, PRIMITIVE, 2 |
| 263 | os.write(0x82); |
| 264 | codeLength += 1; |
| 265 | return codeLength; |
| 266 | } |
| 267 | |
| 268 | if (delmeasid != null) { |
| 269 | codeLength += delmeasid.encode(os, false); |
| 270 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 |
| 271 | os.write(0xA1); |
| 272 | codeLength += 1; |
| 273 | return codeLength; |
| 274 | } |
| 275 | |
| 276 | if (addmeasid != null) { |
| 277 | codeLength += addmeasid.encode(os, false); |
| 278 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 |
| 279 | os.write(0xA0); |
| 280 | codeLength += 1; |
| 281 | return codeLength; |
| 282 | } |
| 283 | |
| 284 | throw new IOException("Error encoding CHOICE: No element of CHOICE was selected."); |
| 285 | } |
| 286 | |
| 287 | public int decode(InputStream is) throws IOException { |
| 288 | return decode(is, null); |
| 289 | } |
| 290 | |
| 291 | public int decode(InputStream is, BerTag berTag) throws IOException { |
| 292 | |
| 293 | int codeLength = 0; |
| 294 | BerTag passedTag = berTag; |
| 295 | |
| 296 | if (berTag == null) { |
| 297 | berTag = new BerTag(); |
| 298 | codeLength += berTag.decode(is); |
| 299 | } |
| 300 | |
| 301 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { |
| 302 | addmeasid = new Addmeasid(); |
| 303 | codeLength += addmeasid.decode(is, false); |
| 304 | return codeLength; |
| 305 | } |
| 306 | |
| 307 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { |
| 308 | delmeasid = new Delmeasid(); |
| 309 | codeLength += delmeasid.decode(is, false); |
| 310 | return codeLength; |
| 311 | } |
| 312 | |
| 313 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { |
| 314 | hototarget = new BerBoolean(); |
| 315 | codeLength += hototarget.decode(is, false); |
| 316 | return codeLength; |
| 317 | } |
| 318 | |
| 319 | if (passedTag != null) { |
| 320 | return 0; |
| 321 | } |
| 322 | |
| 323 | throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); |
| 324 | } |
| 325 | |
| 326 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 327 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 328 | encode(os); |
| 329 | code = os.getArray(); |
| 330 | } |
| 331 | |
| 332 | public String toString() { |
| 333 | StringBuilder sb = new StringBuilder(); |
| 334 | appendAsString(sb, 0); |
| 335 | return sb.toString(); |
| 336 | } |
| 337 | |
| 338 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 339 | |
| 340 | if (addmeasid != null) { |
| 341 | sb.append("addmeasid: "); |
| 342 | addmeasid.appendAsString(sb, indentLevel + 1); |
| 343 | return; |
| 344 | } |
| 345 | |
| 346 | if (delmeasid != null) { |
| 347 | sb.append("delmeasid: "); |
| 348 | delmeasid.appendAsString(sb, indentLevel + 1); |
| 349 | return; |
| 350 | } |
| 351 | |
| 352 | if (hototarget != null) { |
| 353 | sb.append("hototarget: ").append(hototarget); |
| 354 | return; |
| 355 | } |
| 356 | |
| 357 | sb.append("<none>"); |
| 358 | } |
| 359 | |
| 360 | public static class Addmeasid implements Serializable { |
| 361 | |
| 362 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 363 | private static final long serialVersionUID = 1L; |
| 364 | @JsonIgnore |
| 365 | public byte[] code = null; |
| 366 | private List<BerInteger> seqOf = null; |
| 367 | |
| 368 | public Addmeasid() { |
| 369 | seqOf = new ArrayList<BerInteger>(); |
| 370 | } |
| 371 | |
| 372 | public Addmeasid(byte[] code) { |
| 373 | this.code = code; |
| 374 | } |
| 375 | |
| 376 | @JsonValue |
| 377 | public List<BerInteger> getBerInteger() { |
| 378 | if (seqOf == null) { |
| 379 | seqOf = new ArrayList<BerInteger>(); |
| 380 | } |
| 381 | return seqOf; |
| 382 | } |
| 383 | |
| 384 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 385 | return encode(os, true); |
| 386 | } |
| 387 | |
| 388 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 389 | |
| 390 | if (code != null) { |
| 391 | for (int i = code.length - 1; i >= 0; i--) { |
| 392 | os.write(code[i]); |
| 393 | } |
| 394 | if (withTag) { |
| 395 | return tag.encode(os) + code.length; |
| 396 | } |
| 397 | return code.length; |
| 398 | } |
| 399 | |
| 400 | int codeLength = 0; |
| 401 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 402 | codeLength += seqOf.get(i).encode(os, true); |
| 403 | } |
| 404 | |
| 405 | codeLength += BerLength.encodeLength(os, codeLength); |
| 406 | |
| 407 | if (withTag) { |
| 408 | codeLength += tag.encode(os); |
| 409 | } |
| 410 | |
| 411 | return codeLength; |
| 412 | } |
| 413 | |
| 414 | public int decode(InputStream is) throws IOException { |
| 415 | return decode(is, true); |
| 416 | } |
| 417 | |
| 418 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 419 | int codeLength = 0; |
| 420 | int subCodeLength = 0; |
| 421 | if (withTag) { |
| 422 | codeLength += tag.decodeAndCheck(is); |
| 423 | } |
| 424 | |
| 425 | BerLength length = new BerLength(); |
| 426 | codeLength += length.decode(is); |
| 427 | int totalLength = length.val; |
| 428 | |
| 429 | while (subCodeLength < totalLength) { |
| 430 | BerInteger element = new BerInteger(); |
| 431 | subCodeLength += element.decode(is, true); |
| 432 | seqOf.add(element); |
| 433 | } |
| 434 | if (subCodeLength != totalLength) { |
| 435 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 436 | |
| 437 | } |
| 438 | codeLength += subCodeLength; |
| 439 | |
| 440 | return codeLength; |
| 441 | } |
| 442 | |
| 443 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 444 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 445 | encode(os, false); |
| 446 | code = os.getArray(); |
| 447 | } |
| 448 | |
| 449 | public String toString() { |
| 450 | StringBuilder sb = new StringBuilder(); |
| 451 | appendAsString(sb, 0); |
| 452 | return sb.toString(); |
| 453 | } |
| 454 | |
| 455 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 456 | |
| 457 | sb.append("{\n"); |
| 458 | for (int i = 0; i < indentLevel + 1; i++) { |
| 459 | sb.append("\t"); |
| 460 | } |
| 461 | if (seqOf == null) { |
| 462 | sb.append("null"); |
| 463 | } else { |
| 464 | Iterator<BerInteger> it = seqOf.iterator(); |
| 465 | if (it.hasNext()) { |
| 466 | sb.append(it.next()); |
| 467 | while (it.hasNext()) { |
| 468 | sb.append(",\n"); |
| 469 | for (int i = 0; i < indentLevel + 1; i++) { |
| 470 | sb.append("\t"); |
| 471 | } |
| 472 | sb.append(it.next()); |
| 473 | } |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | sb.append("\n"); |
| 478 | for (int i = 0; i < indentLevel; i++) { |
| 479 | sb.append("\t"); |
| 480 | } |
| 481 | sb.append("}"); |
| 482 | } |
| 483 | |
| 484 | } |
| 485 | |
| 486 | public static class Delmeasid implements Serializable { |
| 487 | |
| 488 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 489 | private static final long serialVersionUID = 1L; |
| 490 | @JsonIgnore |
| 491 | public byte[] code = null; |
| 492 | private List<BerInteger> seqOf = null; |
| 493 | |
| 494 | public Delmeasid() { |
| 495 | seqOf = new ArrayList<BerInteger>(); |
| 496 | } |
| 497 | |
| 498 | public Delmeasid(byte[] code) { |
| 499 | this.code = code; |
| 500 | } |
| 501 | |
| 502 | @JsonValue |
| 503 | public List<BerInteger> getBerInteger() { |
| 504 | if (seqOf == null) { |
| 505 | seqOf = new ArrayList<BerInteger>(); |
| 506 | } |
| 507 | return seqOf; |
| 508 | } |
| 509 | |
| 510 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 511 | return encode(os, true); |
| 512 | } |
| 513 | |
| 514 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 515 | |
| 516 | if (code != null) { |
| 517 | for (int i = code.length - 1; i >= 0; i--) { |
| 518 | os.write(code[i]); |
| 519 | } |
| 520 | if (withTag) { |
| 521 | return tag.encode(os) + code.length; |
| 522 | } |
| 523 | return code.length; |
| 524 | } |
| 525 | |
| 526 | int codeLength = 0; |
| 527 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 528 | codeLength += seqOf.get(i).encode(os, true); |
| 529 | } |
| 530 | |
| 531 | codeLength += BerLength.encodeLength(os, codeLength); |
| 532 | |
| 533 | if (withTag) { |
| 534 | codeLength += tag.encode(os); |
| 535 | } |
| 536 | |
| 537 | return codeLength; |
| 538 | } |
| 539 | |
| 540 | public int decode(InputStream is) throws IOException { |
| 541 | return decode(is, true); |
| 542 | } |
| 543 | |
| 544 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 545 | int codeLength = 0; |
| 546 | int subCodeLength = 0; |
| 547 | if (withTag) { |
| 548 | codeLength += tag.decodeAndCheck(is); |
| 549 | } |
| 550 | |
| 551 | BerLength length = new BerLength(); |
| 552 | codeLength += length.decode(is); |
| 553 | int totalLength = length.val; |
| 554 | |
| 555 | while (subCodeLength < totalLength) { |
| 556 | BerInteger element = new BerInteger(); |
| 557 | subCodeLength += element.decode(is, true); |
| 558 | seqOf.add(element); |
| 559 | } |
| 560 | if (subCodeLength != totalLength) { |
| 561 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 562 | |
| 563 | } |
| 564 | codeLength += subCodeLength; |
| 565 | |
| 566 | return codeLength; |
| 567 | } |
| 568 | |
| 569 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 570 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 571 | encode(os, false); |
| 572 | code = os.getArray(); |
| 573 | } |
| 574 | |
| 575 | public String toString() { |
| 576 | StringBuilder sb = new StringBuilder(); |
| 577 | appendAsString(sb, 0); |
| 578 | return sb.toString(); |
| 579 | } |
| 580 | |
| 581 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 582 | |
| 583 | sb.append("{\n"); |
| 584 | for (int i = 0; i < indentLevel + 1; i++) { |
| 585 | sb.append("\t"); |
| 586 | } |
| 587 | if (seqOf == null) { |
| 588 | sb.append("null"); |
| 589 | } else { |
| 590 | Iterator<BerInteger> it = seqOf.iterator(); |
| 591 | if (it.hasNext()) { |
| 592 | sb.append(it.next()); |
| 593 | while (it.hasNext()) { |
| 594 | sb.append(",\n"); |
| 595 | for (int i = 0; i < indentLevel + 1; i++) { |
| 596 | sb.append("\t"); |
| 597 | } |
| 598 | sb.append(it.next()); |
| 599 | } |
| 600 | } |
| 601 | } |
| 602 | |
| 603 | sb.append("\n"); |
| 604 | for (int i = 0; i < indentLevel; i++) { |
| 605 | sb.append("\t"); |
| 606 | } |
| 607 | sb.append("}"); |
| 608 | } |
| 609 | |
| 610 | } |
| 611 | |
| 612 | } |
| 613 | |
| 614 | } |
| 615 | |