blob: ea29f544906d18b90fdf558ef114df5e311f2ca0 [file] [log] [blame]
slowr13fa5b02017-08-08 16:32:31 -07001/**
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -08002 * This class file was automatically generated by jASN1 v1.8.2 (http://www.openmuc.org)
slowr13fa5b02017-08-08 16:32:31 -07003 */
4
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -08005package org.onosproject.xran.asn1lib.pdu;
slowr13fa5b02017-08-08 16:32:31 -07006
slowr60d4d102017-08-16 18:33:58 -07007import com.fasterxml.jackson.annotation.JsonIgnore;
8import com.fasterxml.jackson.annotation.JsonValue;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -08009import org.onosproject.xran.asn1lib.api.CRNTI;
10import org.onosproject.xran.asn1lib.api.ECGI;
11import org.onosproject.xran.asn1lib.api.PCIARFCN;
12import org.onosproject.xran.asn1lib.ber.BerByteArrayOutputStream;
13import org.onosproject.xran.asn1lib.ber.BerLength;
14import org.onosproject.xran.asn1lib.ber.BerTag;
15import org.onosproject.xran.asn1lib.ber.types.BerEnum;
slowr13fa5b02017-08-08 16:32:31 -070016
17import java.io.IOException;
18import java.io.InputStream;
19import java.io.Serializable;
20import java.util.ArrayList;
21import java.util.Iterator;
22import java.util.List;
23
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080024public class ScellAddStatus implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -070025
slowr89c2ac12017-08-15 16:20:06 -070026 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
27 private static final long serialVersionUID = 1L;
slowr60d4d102017-08-16 18:33:58 -070028 @JsonIgnore
slowr89c2ac12017-08-15 16:20:06 -070029 public byte[] code = null;
30 private CRNTI crnti = null;
31 private ECGI ecgi = null;
32 private ScellsInd scellsInd = null;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080033 private Status status = null;
34 public ScellAddStatus() {
slowr89c2ac12017-08-15 16:20:06 -070035 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080036 public ScellAddStatus(byte[] code) {
slowr89c2ac12017-08-15 16:20:06 -070037 this.code = code;
38 }
slowr13fa5b02017-08-08 16:32:31 -070039
slowr89c2ac12017-08-15 16:20:06 -070040 public CRNTI getCrnti() {
41 return crnti;
42 }
slowr13fa5b02017-08-08 16:32:31 -070043
slowr89c2ac12017-08-15 16:20:06 -070044 public void setCrnti(CRNTI crnti) {
45 this.crnti = crnti;
46 }
slowr13fa5b02017-08-08 16:32:31 -070047
slowr89c2ac12017-08-15 16:20:06 -070048 public ECGI getEcgi() {
49 return ecgi;
50 }
slowr13fa5b02017-08-08 16:32:31 -070051
slowr89c2ac12017-08-15 16:20:06 -070052 public void setEcgi(ECGI ecgi) {
53 this.ecgi = ecgi;
54 }
slowr13fa5b02017-08-08 16:32:31 -070055
slowr89c2ac12017-08-15 16:20:06 -070056 public ScellsInd getScellsInd() {
57 return scellsInd;
58 }
slowr13fa5b02017-08-08 16:32:31 -070059
slowr89c2ac12017-08-15 16:20:06 -070060 public void setScellsInd(ScellsInd scellsInd) {
61 this.scellsInd = scellsInd;
62 }
slowr13fa5b02017-08-08 16:32:31 -070063
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080064 public Status getStatus() {
65 return status;
66 }
67
68 public void setStatus(Status status) {
69 this.status = status;
70 }
71
slowr89c2ac12017-08-15 16:20:06 -070072 public int encode(BerByteArrayOutputStream os) throws IOException {
73 return encode(os, true);
74 }
slowr13fa5b02017-08-08 16:32:31 -070075
slowr89c2ac12017-08-15 16:20:06 -070076 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -070077
slowr89c2ac12017-08-15 16:20:06 -070078 if (code != null) {
79 for (int i = code.length - 1; i >= 0; i--) {
80 os.write(code[i]);
81 }
82 if (withTag) {
83 return tag.encode(os) + code.length;
84 }
85 return code.length;
86 }
slowr13fa5b02017-08-08 16:32:31 -070087
slowr89c2ac12017-08-15 16:20:06 -070088 int codeLength = 0;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080089 codeLength += status.encode(os, false);
90 // write tag: CONTEXT_CLASS, CONSTRUCTED, 3
91 os.write(0xA3);
92 codeLength += 1;
93
slowr89c2ac12017-08-15 16:20:06 -070094 codeLength += scellsInd.encode(os, false);
95 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
96 os.write(0xA2);
97 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -070098
slowr89c2ac12017-08-15 16:20:06 -070099 codeLength += ecgi.encode(os, false);
100 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
101 os.write(0xA1);
102 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -0700103
slowr89c2ac12017-08-15 16:20:06 -0700104 codeLength += crnti.encode(os, false);
105 // write tag: CONTEXT_CLASS, PRIMITIVE, 0
106 os.write(0x80);
107 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -0700108
slowr89c2ac12017-08-15 16:20:06 -0700109 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -0700110
slowr89c2ac12017-08-15 16:20:06 -0700111 if (withTag) {
112 codeLength += tag.encode(os);
113 }
slowr13fa5b02017-08-08 16:32:31 -0700114
slowr89c2ac12017-08-15 16:20:06 -0700115 return codeLength;
slowr13fa5b02017-08-08 16:32:31 -0700116
slowr89c2ac12017-08-15 16:20:06 -0700117 }
118
119 public int decode(InputStream is) throws IOException {
120 return decode(is, true);
121 }
122
123 public int decode(InputStream is, boolean withTag) throws IOException {
124 int codeLength = 0;
125 int subCodeLength = 0;
126 BerTag berTag = new BerTag();
127
128 if (withTag) {
129 codeLength += tag.decodeAndCheck(is);
130 }
131
132 BerLength length = new BerLength();
133 codeLength += length.decode(is);
134
135 int totalLength = length.val;
136 codeLength += totalLength;
137
138 subCodeLength += berTag.decode(is);
139 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
140 crnti = new CRNTI();
141 subCodeLength += crnti.decode(is, false);
142 subCodeLength += berTag.decode(is);
143 } else {
144 throw new IOException("Tag does not match the mandatory sequence element tag.");
145 }
146
147 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
148 ecgi = new ECGI();
149 subCodeLength += ecgi.decode(is, false);
150 subCodeLength += berTag.decode(is);
151 } else {
152 throw new IOException("Tag does not match the mandatory sequence element tag.");
153 }
154
155 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
156 scellsInd = new ScellsInd();
157 subCodeLength += scellsInd.decode(is, false);
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800158 subCodeLength += berTag.decode(is);
159 } else {
160 throw new IOException("Tag does not match the mandatory sequence element tag.");
161 }
162
163 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
164 status = new Status();
165 subCodeLength += status.decode(is, false);
slowr89c2ac12017-08-15 16:20:06 -0700166 if (subCodeLength == totalLength) {
167 return codeLength;
168 }
169 }
170 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
171
172
173 }
174
175 public void encodeAndSave(int encodingSizeGuess) throws IOException {
176 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
177 encode(os, false);
178 code = os.getArray();
179 }
180
181 public String toString() {
182 StringBuilder sb = new StringBuilder();
183 appendAsString(sb, 0);
184 return sb.toString();
185 }
186
187 public void appendAsString(StringBuilder sb, int indentLevel) {
188
189 sb.append("{");
190 sb.append("\n");
191 for (int i = 0; i < indentLevel + 1; i++) {
192 sb.append("\t");
193 }
194 if (crnti != null) {
slowr60d4d102017-08-16 18:33:58 -0700195 sb.append("crnti: ").append(crnti);
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800196 } else {
197 sb.append("crnti: <empty-required-field>");
slowr89c2ac12017-08-15 16:20:06 -0700198 }
199
200 sb.append(",\n");
201 for (int i = 0; i < indentLevel + 1; i++) {
202 sb.append("\t");
203 }
204 if (ecgi != null) {
slowr60d4d102017-08-16 18:33:58 -0700205 sb.append("ecgi: ");
slowr89c2ac12017-08-15 16:20:06 -0700206 ecgi.appendAsString(sb, indentLevel + 1);
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800207 } else {
208 sb.append("ecgi: <empty-required-field>");
slowr89c2ac12017-08-15 16:20:06 -0700209 }
210
211 sb.append(",\n");
212 for (int i = 0; i < indentLevel + 1; i++) {
213 sb.append("\t");
214 }
215 if (scellsInd != null) {
slowr60d4d102017-08-16 18:33:58 -0700216 sb.append("scellsInd: ");
slowr89c2ac12017-08-15 16:20:06 -0700217 scellsInd.appendAsString(sb, indentLevel + 1);
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800218 } else {
219 sb.append("scellsInd: <empty-required-field>");
220 }
221
222 sb.append(",\n");
223 for (int i = 0; i < indentLevel + 1; i++) {
224 sb.append("\t");
225 }
226 if (status != null) {
227 sb.append("status: ");
228 status.appendAsString(sb, indentLevel + 1);
229 } else {
230 sb.append("status: <empty-required-field>");
slowr89c2ac12017-08-15 16:20:06 -0700231 }
232
233 sb.append("\n");
234 for (int i = 0; i < indentLevel; i++) {
235 sb.append("\t");
236 }
237 sb.append("}");
238 }
239
240 public static class ScellsInd implements Serializable {
241
242 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
243 private static final long serialVersionUID = 1L;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800244 @JsonIgnore
245 public byte[] code = null;
slowr89c2ac12017-08-15 16:20:06 -0700246 private List<PCIARFCN> seqOf = null;
247
248 public ScellsInd() {
249 seqOf = new ArrayList<PCIARFCN>();
250 }
251
252 public ScellsInd(byte[] code) {
253 this.code = code;
254 }
255
slowr60d4d102017-08-16 18:33:58 -0700256 @JsonValue
slowr89c2ac12017-08-15 16:20:06 -0700257 public List<PCIARFCN> getPCIARFCN() {
258 if (seqOf == null) {
259 seqOf = new ArrayList<PCIARFCN>();
260 }
261 return seqOf;
262 }
263
264 public int encode(BerByteArrayOutputStream os) throws IOException {
265 return encode(os, true);
266 }
267
268 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
269
270 if (code != null) {
271 for (int i = code.length - 1; i >= 0; i--) {
272 os.write(code[i]);
273 }
274 if (withTag) {
275 return tag.encode(os) + code.length;
276 }
277 return code.length;
278 }
279
280 int codeLength = 0;
281 for (int i = (seqOf.size() - 1); i >= 0; i--) {
282 codeLength += seqOf.get(i).encode(os, true);
283 }
284
285 codeLength += BerLength.encodeLength(os, codeLength);
286
287 if (withTag) {
288 codeLength += tag.encode(os);
289 }
290
291 return codeLength;
292 }
293
294 public int decode(InputStream is) throws IOException {
295 return decode(is, true);
296 }
297
298 public int decode(InputStream is, boolean withTag) throws IOException {
299 int codeLength = 0;
300 int subCodeLength = 0;
301 if (withTag) {
302 codeLength += tag.decodeAndCheck(is);
303 }
304
305 BerLength length = new BerLength();
306 codeLength += length.decode(is);
307 int totalLength = length.val;
308
309 while (subCodeLength < totalLength) {
310 PCIARFCN element = new PCIARFCN();
311 subCodeLength += element.decode(is, true);
312 seqOf.add(element);
313 }
314 if (subCodeLength != totalLength) {
315 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
316
317 }
318 codeLength += subCodeLength;
319
320 return codeLength;
321 }
322
323 public void encodeAndSave(int encodingSizeGuess) throws IOException {
324 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
325 encode(os, false);
326 code = os.getArray();
327 }
328
329 public String toString() {
330 StringBuilder sb = new StringBuilder();
331 appendAsString(sb, 0);
332 return sb.toString();
333 }
334
335 public void appendAsString(StringBuilder sb, int indentLevel) {
336
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800337 sb.append("{\n");
slowr89c2ac12017-08-15 16:20:06 -0700338 for (int i = 0; i < indentLevel + 1; i++) {
339 sb.append("\t");
340 }
341 if (seqOf == null) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800342 sb.append("null");
slowr89c2ac12017-08-15 16:20:06 -0700343 } else {
344 Iterator<PCIARFCN> it = seqOf.iterator();
345 if (it.hasNext()) {
346 it.next().appendAsString(sb, indentLevel + 1);
347 while (it.hasNext()) {
348 sb.append(",\n");
349 for (int i = 0; i < indentLevel + 1; i++) {
350 sb.append("\t");
351 }
352 it.next().appendAsString(sb, indentLevel + 1);
353 }
354 }
355 }
slowr13fa5b02017-08-08 16:32:31 -0700356
slowr89c2ac12017-08-15 16:20:06 -0700357 sb.append("\n");
358 for (int i = 0; i < indentLevel; i++) {
359 sb.append("\t");
360 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800361 sb.append("}");
slowr89c2ac12017-08-15 16:20:06 -0700362 }
slowr13fa5b02017-08-08 16:32:31 -0700363
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800364 }
365
366 public static class Status implements Serializable {
367
368 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
369 private static final long serialVersionUID = 1L;
370 @JsonIgnore
371 public byte[] code = null;
372 private List<BerEnum> seqOf = null;
373
374 public Status() {
375 seqOf = new ArrayList<BerEnum>();
slowr89c2ac12017-08-15 16:20:06 -0700376 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800377
378 public Status(byte[] code) {
379 this.code = code;
380 }
381
382 @JsonValue
383 public List<BerEnum> getBerEnum() {
384 if (seqOf == null) {
385 seqOf = new ArrayList<BerEnum>();
386 }
387 return seqOf;
388 }
389
390 public int encode(BerByteArrayOutputStream os) throws IOException {
391 return encode(os, true);
392 }
393
394 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
395
396 if (code != null) {
397 for (int i = code.length - 1; i >= 0; i--) {
398 os.write(code[i]);
399 }
400 if (withTag) {
401 return tag.encode(os) + code.length;
402 }
403 return code.length;
404 }
405
406 int codeLength = 0;
407 for (int i = (seqOf.size() - 1); i >= 0; i--) {
408 codeLength += seqOf.get(i).encode(os, true);
409 }
410
411 codeLength += BerLength.encodeLength(os, codeLength);
412
413 if (withTag) {
414 codeLength += tag.encode(os);
415 }
416
417 return codeLength;
418 }
419
420 public int decode(InputStream is) throws IOException {
421 return decode(is, true);
422 }
423
424 public int decode(InputStream is, boolean withTag) throws IOException {
425 int codeLength = 0;
426 int subCodeLength = 0;
427 if (withTag) {
428 codeLength += tag.decodeAndCheck(is);
429 }
430
431 BerLength length = new BerLength();
432 codeLength += length.decode(is);
433 int totalLength = length.val;
434
435 while (subCodeLength < totalLength) {
436 BerEnum element = new BerEnum();
437 subCodeLength += element.decode(is, true);
438 seqOf.add(element);
439 }
440 if (subCodeLength != totalLength) {
441 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
442
443 }
444 codeLength += subCodeLength;
445
446 return codeLength;
447 }
448
449 public void encodeAndSave(int encodingSizeGuess) throws IOException {
450 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
451 encode(os, false);
452 code = os.getArray();
453 }
454
455 public String toString() {
456 StringBuilder sb = new StringBuilder();
457 appendAsString(sb, 0);
458 return sb.toString();
459 }
460
461 public void appendAsString(StringBuilder sb, int indentLevel) {
462
463 sb.append("{\n");
464 for (int i = 0; i < indentLevel + 1; i++) {
465 sb.append("\t");
466 }
467 if (seqOf == null) {
468 sb.append("null");
469 } else {
470 Iterator<BerEnum> it = seqOf.iterator();
471 if (it.hasNext()) {
472 sb.append(it.next());
473 while (it.hasNext()) {
474 sb.append(",\n");
475 for (int i = 0; i < indentLevel + 1; i++) {
476 sb.append("\t");
477 }
478 sb.append(it.next());
479 }
480 }
481 }
482
483 sb.append("\n");
484 for (int i = 0; i < indentLevel; i++) {
485 sb.append("\t");
486 }
487 sb.append("}");
488 }
489
slowr89c2ac12017-08-15 16:20:06 -0700490 }
slowr13fa5b02017-08-08 16:32:31 -0700491
492}
493