blob: 99ddadde1853c308939995ce8b3772a356508e34 [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
7import org.onosproject.xran.codecs.api.CRNTI;
8import org.onosproject.xran.codecs.api.ECGI;
9import org.onosproject.xran.codecs.api.PCIARFCN;
10import org.openmuc.jasn1.ber.BerByteArrayOutputStream;
11import org.openmuc.jasn1.ber.BerLength;
12import org.openmuc.jasn1.ber.BerTag;
13import org.openmuc.jasn1.ber.types.BerEnum;
14
15import java.io.IOException;
16import java.io.InputStream;
17import java.io.Serializable;
18import java.util.ArrayList;
19import java.util.Iterator;
20import java.util.List;
21
22public class ScellAddStatus implements Serializable {
23
24 private static final long serialVersionUID = 1L;
25
26 public static class ScellsInd 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<PCIARFCN> seqOf = null;
33
34 public ScellsInd() {
35 seqOf = new ArrayList<PCIARFCN>();
36 }
37
38 public ScellsInd(byte[] code) {
39 this.code = code;
40 }
41
42 public List<PCIARFCN> getPCIARFCN() {
43 if (seqOf == null) {
44 seqOf = new ArrayList<PCIARFCN>();
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 PCIARFCN element = new PCIARFCN();
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<PCIARFCN> it = seqOf.iterator();
131 if (it.hasNext()) {
132 it.next().appendAsString(sb, indentLevel + 1);
133 while (it.hasNext()) {
134 sb.append(",\n");
135 for (int i = 0; i < indentLevel + 1; i++) {
136 sb.append("\t");
137 }
138 it.next().appendAsString(sb, indentLevel + 1);
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 Status 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<BerEnum> seqOf = null;
159
160 public Status() {
161 seqOf = new ArrayList<BerEnum>();
162 }
163
164 public Status(byte[] code) {
165 this.code = code;
166 }
167
168 public List<BerEnum> getBerEnum() {
169 if (seqOf == null) {
170 seqOf = new ArrayList<BerEnum>();
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 BerEnum element = new BerEnum();
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<BerEnum> 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 final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
279
280 public byte[] code = null;
281 private CRNTI crnti = null;
282 private ECGI ecgi = null;
283 private ScellsInd scellsInd = null;
284 private Status status = null;
285
286 public ScellAddStatus() {
287 }
288
289 public ScellAddStatus(byte[] code) {
290 this.code = code;
291 }
292
293 public void setCrnti(CRNTI crnti) {
294 this.crnti = crnti;
295 }
296
297 public CRNTI getCrnti() {
298 return crnti;
299 }
300
301 public void setEcgi(ECGI ecgi) {
302 this.ecgi = ecgi;
303 }
304
305 public ECGI getEcgi() {
306 return ecgi;
307 }
308
309 public void setScellsInd(ScellsInd scellsInd) {
310 this.scellsInd = scellsInd;
311 }
312
313 public ScellsInd getScellsInd() {
314 return scellsInd;
315 }
316
317 public void setStatus(Status status) {
318 this.status = status;
319 }
320
321 public Status getStatus() {
322 return status;
323 }
324
325 public int encode(BerByteArrayOutputStream os) throws IOException {
326 return encode(os, true);
327 }
328
329 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
330
331 if (code != null) {
332 for (int i = code.length - 1; i >= 0; i--) {
333 os.write(code[i]);
334 }
335 if (withTag) {
336 return tag.encode(os) + code.length;
337 }
338 return code.length;
339 }
340
341 int codeLength = 0;
342 codeLength += status.encode(os, false);
343 // write tag: CONTEXT_CLASS, CONSTRUCTED, 3
344 os.write(0xA3);
345 codeLength += 1;
346
347 codeLength += scellsInd.encode(os, false);
348 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
349 os.write(0xA2);
350 codeLength += 1;
351
352 codeLength += ecgi.encode(os, false);
353 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
354 os.write(0xA1);
355 codeLength += 1;
356
357 codeLength += crnti.encode(os, false);
358 // write tag: CONTEXT_CLASS, PRIMITIVE, 0
359 os.write(0x80);
360 codeLength += 1;
361
362 codeLength += BerLength.encodeLength(os, codeLength);
363
364 if (withTag) {
365 codeLength += tag.encode(os);
366 }
367
368 return codeLength;
369
370 }
371
372 public int decode(InputStream is) throws IOException {
373 return decode(is, true);
374 }
375
376 public int decode(InputStream is, boolean withTag) throws IOException {
377 int codeLength = 0;
378 int subCodeLength = 0;
379 BerTag berTag = new BerTag();
380
381 if (withTag) {
382 codeLength += tag.decodeAndCheck(is);
383 }
384
385 BerLength length = new BerLength();
386 codeLength += length.decode(is);
387
388 int totalLength = length.val;
389 codeLength += totalLength;
390
391 subCodeLength += berTag.decode(is);
392 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
393 crnti = new CRNTI();
394 subCodeLength += crnti.decode(is, false);
395 subCodeLength += berTag.decode(is);
396 }
397 else {
398 throw new IOException("Tag does not match the mandatory sequence element tag.");
399 }
400
401 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
402 ecgi = new ECGI();
403 subCodeLength += ecgi.decode(is, false);
404 subCodeLength += berTag.decode(is);
405 }
406 else {
407 throw new IOException("Tag does not match the mandatory sequence element tag.");
408 }
409
410 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
411 scellsInd = new ScellsInd();
412 subCodeLength += scellsInd.decode(is, false);
413 subCodeLength += berTag.decode(is);
414 }
415 else {
416 throw new IOException("Tag does not match the mandatory sequence element tag.");
417 }
418
419 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
420 status = new Status();
421 subCodeLength += status.decode(is, false);
422 if (subCodeLength == totalLength) {
423 return codeLength;
424 }
425 }
426 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
427
428
429 }
430
431 public void encodeAndSave(int encodingSizeGuess) throws IOException {
432 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
433 encode(os, false);
434 code = os.getArray();
435 }
436
437 public String toString() {
438 StringBuilder sb = new StringBuilder();
439 appendAsString(sb, 0);
440 return sb.toString();
441 }
442
443 public void appendAsString(StringBuilder sb, int indentLevel) {
444
445 sb.append("{");
446 sb.append("\n");
447 for (int i = 0; i < indentLevel + 1; i++) {
448 sb.append("\t");
449 }
450 if (crnti != null) {
451 sb.append("\"crnti\": ").append(crnti);
452 }
453
454 sb.append(",\n");
455 for (int i = 0; i < indentLevel + 1; i++) {
456 sb.append("\t");
457 }
458 if (ecgi != null) {
459 sb.append("\"ecgi\": ");
460 ecgi.appendAsString(sb, indentLevel + 1);
461 }
462
463 sb.append(",\n");
464 for (int i = 0; i < indentLevel + 1; i++) {
465 sb.append("\t");
466 }
467 if (scellsInd != null) {
468 sb.append("\"scellsInd\": ");
469 scellsInd.appendAsString(sb, indentLevel + 1);
470 }
471
472 sb.append(",\n");
473 for (int i = 0; i < indentLevel + 1; i++) {
474 sb.append("\t");
475 }
476 if (status != null) {
477 sb.append("\"status\": ");
478 status.appendAsString(sb, indentLevel + 1);
479 }
480
481 sb.append("\n");
482 for (int i = 0; i < indentLevel; i++) {
483 sb.append("\t");
484 }
485 sb.append("}");
486 }
487
488}
489