blob: 1efc52fbf5669d7fb96aa4043e23d83e7d172c25 [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.PCIARFCN;
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.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
24public class ScellAddStatus implements Serializable {
25
26 private static final long serialVersionUID = 1L;
27
28 public static class ScellsInd implements Serializable {
29
30 private static final long serialVersionUID = 1L;
31
32 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
slowr60d4d102017-08-16 18:33:58 -070033 @JsonIgnore
slowr13fa5b02017-08-08 16:32:31 -070034 public byte[] code = null;
35 private List<PCIARFCN> seqOf = null;
36
37 public ScellsInd() {
38 seqOf = new ArrayList<PCIARFCN>();
39 }
40
41 public ScellsInd(byte[] code) {
42 this.code = code;
43 }
44
slowr60d4d102017-08-16 18:33:58 -070045 @JsonValue
slowr13fa5b02017-08-08 16:32:31 -070046 public List<PCIARFCN> getPCIARFCN() {
47 if (seqOf == null) {
48 seqOf = new ArrayList<PCIARFCN>();
49 }
50 return seqOf;
51 }
52
53 public int encode(BerByteArrayOutputStream os) throws IOException {
54 return encode(os, true);
55 }
56
57 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
58
59 if (code != null) {
60 for (int i = code.length - 1; i >= 0; i--) {
61 os.write(code[i]);
62 }
63 if (withTag) {
64 return tag.encode(os) + code.length;
65 }
66 return code.length;
67 }
68
69 int codeLength = 0;
70 for (int i = (seqOf.size() - 1); i >= 0; i--) {
71 codeLength += seqOf.get(i).encode(os, true);
72 }
73
74 codeLength += BerLength.encodeLength(os, codeLength);
75
76 if (withTag) {
77 codeLength += tag.encode(os);
78 }
79
80 return codeLength;
81 }
82
83 public int decode(InputStream is) throws IOException {
84 return decode(is, true);
85 }
86
87 public int decode(InputStream is, boolean withTag) throws IOException {
88 int codeLength = 0;
89 int subCodeLength = 0;
90 if (withTag) {
91 codeLength += tag.decodeAndCheck(is);
92 }
93
94 BerLength length = new BerLength();
95 codeLength += length.decode(is);
96 int totalLength = length.val;
97
98 while (subCodeLength < totalLength) {
99 PCIARFCN element = new PCIARFCN();
100 subCodeLength += element.decode(is, true);
101 seqOf.add(element);
102 }
103 if (subCodeLength != totalLength) {
104 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
105
106 }
107 codeLength += subCodeLength;
108
109 return codeLength;
110 }
111
112 public void encodeAndSave(int encodingSizeGuess) throws IOException {
113 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
114 encode(os, false);
115 code = os.getArray();
116 }
117
118 public String toString() {
119 StringBuilder sb = new StringBuilder();
120 appendAsString(sb, 0);
121 return sb.toString();
122 }
123
124 public void appendAsString(StringBuilder sb, int indentLevel) {
125
126 sb.append("[\n");
127 for (int i = 0; i < indentLevel + 1; i++) {
128 sb.append("\t");
129 }
130 if (seqOf == null) {
131// sb.append("null");
132 }
133 else {
134 Iterator<PCIARFCN> it = seqOf.iterator();
135 if (it.hasNext()) {
136 it.next().appendAsString(sb, indentLevel + 1);
137 while (it.hasNext()) {
138 sb.append(",\n");
139 for (int i = 0; i < indentLevel + 1; i++) {
140 sb.append("\t");
141 }
142 it.next().appendAsString(sb, indentLevel + 1);
143 }
144 }
145 }
146
147 sb.append("\n");
148 for (int i = 0; i < indentLevel; i++) {
149 sb.append("\t");
150 }
151 sb.append("]");
152 }
153
154 }
155
156 public static class Status implements Serializable {
157
158 private static final long serialVersionUID = 1L;
159
160 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
slowr60d4d102017-08-16 18:33:58 -0700161 @JsonIgnore public byte[] code = null;
slowr13fa5b02017-08-08 16:32:31 -0700162 private List<BerEnum> seqOf = null;
163
164 public Status() {
165 seqOf = new ArrayList<BerEnum>();
166 }
167
168 public Status(byte[] code) {
169 this.code = code;
170 }
171
slowr60d4d102017-08-16 18:33:58 -0700172 @JsonValue
slowr13fa5b02017-08-08 16:32:31 -0700173 public List<BerEnum> getBerEnum() {
174 if (seqOf == null) {
175 seqOf = new ArrayList<BerEnum>();
176 }
177 return seqOf;
178 }
179
180 public int encode(BerByteArrayOutputStream os) throws IOException {
181 return encode(os, true);
182 }
183
184 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
185
186 if (code != null) {
187 for (int i = code.length - 1; i >= 0; i--) {
188 os.write(code[i]);
189 }
190 if (withTag) {
191 return tag.encode(os) + code.length;
192 }
193 return code.length;
194 }
195
196 int codeLength = 0;
197 for (int i = (seqOf.size() - 1); i >= 0; i--) {
198 codeLength += seqOf.get(i).encode(os, true);
199 }
200
201 codeLength += BerLength.encodeLength(os, codeLength);
202
203 if (withTag) {
204 codeLength += tag.encode(os);
205 }
206
207 return codeLength;
208 }
209
210 public int decode(InputStream is) throws IOException {
211 return decode(is, true);
212 }
213
214 public int decode(InputStream is, boolean withTag) throws IOException {
215 int codeLength = 0;
216 int subCodeLength = 0;
217 if (withTag) {
218 codeLength += tag.decodeAndCheck(is);
219 }
220
221 BerLength length = new BerLength();
222 codeLength += length.decode(is);
223 int totalLength = length.val;
224
225 while (subCodeLength < totalLength) {
226 BerEnum element = new BerEnum();
227 subCodeLength += element.decode(is, true);
228 seqOf.add(element);
229 }
230 if (subCodeLength != totalLength) {
231 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
232
233 }
234 codeLength += subCodeLength;
235
236 return codeLength;
237 }
238
239 public void encodeAndSave(int encodingSizeGuess) throws IOException {
240 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
241 encode(os, false);
242 code = os.getArray();
243 }
244
245 public String toString() {
246 StringBuilder sb = new StringBuilder();
247 appendAsString(sb, 0);
248 return sb.toString();
249 }
250
251 public void appendAsString(StringBuilder sb, int indentLevel) {
252
253 sb.append("[\n");
254 for (int i = 0; i < indentLevel + 1; i++) {
255 sb.append("\t");
256 }
257 if (seqOf == null) {
258// sb.append("null");
259 }
260 else {
261 Iterator<BerEnum> it = seqOf.iterator();
262 if (it.hasNext()) {
263 sb.append(it.next());
264 while (it.hasNext()) {
265 sb.append(",\n");
266 for (int i = 0; i < indentLevel + 1; i++) {
267 sb.append("\t");
268 }
269 sb.append(it.next());
270 }
271 }
272 }
273
274 sb.append("\n");
275 for (int i = 0; i < indentLevel; i++) {
276 sb.append("\t");
277 }
278 sb.append("]");
279 }
280
281 }
282
283 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
284
slowr60d4d102017-08-16 18:33:58 -0700285 @JsonIgnore public byte[] code = null;
slowr13fa5b02017-08-08 16:32:31 -0700286 private CRNTI crnti = null;
287 private ECGI ecgi = null;
288 private ScellsInd scellsInd = null;
289 private Status status = null;
290
291 public ScellAddStatus() {
292 }
293
294 public ScellAddStatus(byte[] code) {
295 this.code = code;
296 }
297
298 public void setCrnti(CRNTI crnti) {
299 this.crnti = crnti;
300 }
301
302 public CRNTI getCrnti() {
303 return crnti;
304 }
305
306 public void setEcgi(ECGI ecgi) {
307 this.ecgi = ecgi;
308 }
309
310 public ECGI getEcgi() {
311 return ecgi;
312 }
313
314 public void setScellsInd(ScellsInd scellsInd) {
315 this.scellsInd = scellsInd;
316 }
317
318 public ScellsInd getScellsInd() {
319 return scellsInd;
320 }
321
322 public void setStatus(Status status) {
323 this.status = status;
324 }
325
326 public Status getStatus() {
327 return status;
328 }
329
330 public int encode(BerByteArrayOutputStream os) throws IOException {
331 return encode(os, true);
332 }
333
334 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
335
336 if (code != null) {
337 for (int i = code.length - 1; i >= 0; i--) {
338 os.write(code[i]);
339 }
340 if (withTag) {
341 return tag.encode(os) + code.length;
342 }
343 return code.length;
344 }
345
346 int codeLength = 0;
347 codeLength += status.encode(os, false);
348 // write tag: CONTEXT_CLASS, CONSTRUCTED, 3
349 os.write(0xA3);
350 codeLength += 1;
351
352 codeLength += scellsInd.encode(os, false);
353 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
354 os.write(0xA2);
355 codeLength += 1;
356
357 codeLength += ecgi.encode(os, false);
358 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
359 os.write(0xA1);
360 codeLength += 1;
361
362 codeLength += crnti.encode(os, false);
363 // write tag: CONTEXT_CLASS, PRIMITIVE, 0
364 os.write(0x80);
365 codeLength += 1;
366
367 codeLength += BerLength.encodeLength(os, codeLength);
368
369 if (withTag) {
370 codeLength += tag.encode(os);
371 }
372
373 return codeLength;
374
375 }
376
377 public int decode(InputStream is) throws IOException {
378 return decode(is, true);
379 }
380
381 public int decode(InputStream is, boolean withTag) throws IOException {
382 int codeLength = 0;
383 int subCodeLength = 0;
384 BerTag berTag = new BerTag();
385
386 if (withTag) {
387 codeLength += tag.decodeAndCheck(is);
388 }
389
390 BerLength length = new BerLength();
391 codeLength += length.decode(is);
392
393 int totalLength = length.val;
394 codeLength += totalLength;
395
396 subCodeLength += berTag.decode(is);
397 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
398 crnti = new CRNTI();
399 subCodeLength += crnti.decode(is, false);
400 subCodeLength += berTag.decode(is);
401 }
402 else {
403 throw new IOException("Tag does not match the mandatory sequence element tag.");
404 }
405
406 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
407 ecgi = new ECGI();
408 subCodeLength += ecgi.decode(is, false);
409 subCodeLength += berTag.decode(is);
410 }
411 else {
412 throw new IOException("Tag does not match the mandatory sequence element tag.");
413 }
414
415 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
416 scellsInd = new ScellsInd();
417 subCodeLength += scellsInd.decode(is, false);
418 subCodeLength += berTag.decode(is);
419 }
420 else {
421 throw new IOException("Tag does not match the mandatory sequence element tag.");
422 }
423
424 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
425 status = new Status();
426 subCodeLength += status.decode(is, false);
427 if (subCodeLength == totalLength) {
428 return codeLength;
429 }
430 }
431 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
432
433
434 }
435
436 public void encodeAndSave(int encodingSizeGuess) throws IOException {
437 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
438 encode(os, false);
439 code = os.getArray();
440 }
441
442 public String toString() {
443 StringBuilder sb = new StringBuilder();
444 appendAsString(sb, 0);
445 return sb.toString();
446 }
447
448 public void appendAsString(StringBuilder sb, int indentLevel) {
449
450 sb.append("{");
451 sb.append("\n");
452 for (int i = 0; i < indentLevel + 1; i++) {
453 sb.append("\t");
454 }
455 if (crnti != null) {
slowr60d4d102017-08-16 18:33:58 -0700456 sb.append("crnti: ").append(crnti);
slowr13fa5b02017-08-08 16:32:31 -0700457 }
458
459 sb.append(",\n");
460 for (int i = 0; i < indentLevel + 1; i++) {
461 sb.append("\t");
462 }
463 if (ecgi != null) {
slowr60d4d102017-08-16 18:33:58 -0700464 sb.append("ecgi: ");
slowr13fa5b02017-08-08 16:32:31 -0700465 ecgi.appendAsString(sb, indentLevel + 1);
466 }
467
468 sb.append(",\n");
469 for (int i = 0; i < indentLevel + 1; i++) {
470 sb.append("\t");
471 }
472 if (scellsInd != null) {
slowr60d4d102017-08-16 18:33:58 -0700473 sb.append("scellsInd: ");
slowr13fa5b02017-08-08 16:32:31 -0700474 scellsInd.appendAsString(sb, indentLevel + 1);
475 }
476
477 sb.append(",\n");
478 for (int i = 0; i < indentLevel + 1; i++) {
479 sb.append("\t");
480 }
481 if (status != null) {
slowr60d4d102017-08-16 18:33:58 -0700482 sb.append("status: ");
slowr13fa5b02017-08-08 16:32:31 -0700483 status.appendAsString(sb, indentLevel + 1);
484 }
485
486 sb.append("\n");
487 for (int i = 0; i < indentLevel; i++) {
488 sb.append("\t");
489 }
490 sb.append("}");
491 }
492
493}
494