blob: ab88a6d0239f907da4f38298c10e67b016411885 [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.openmuc.jasn1.ber.BerByteArrayOutputStream;
10import org.openmuc.jasn1.ber.BerLength;
11import org.openmuc.jasn1.ber.BerTag;
12import org.openmuc.jasn1.ber.types.BerEnum;
13
14import java.io.IOException;
15import java.io.InputStream;
16import java.io.Serializable;
17import java.util.ArrayList;
18import java.util.Iterator;
19import java.util.List;
20
21
22public class RRMConfigStatus 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 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 ECGI ecgi = null;
282 private Crnti crnti = null;
283 private Status status = null;
284
285 public RRMConfigStatus() {
286 }
287
288 public RRMConfigStatus(byte[] code) {
289 this.code = code;
290 }
291
292 public void setEcgi(ECGI ecgi) {
293 this.ecgi = ecgi;
294 }
295
296 public ECGI getEcgi() {
297 return ecgi;
298 }
299
300 public void setCrnti(Crnti crnti) {
301 this.crnti = crnti;
302 }
303
304 public Crnti getCrnti() {
305 return crnti;
306 }
307
308 public void setStatus(Status status) {
309 this.status = status;
310 }
311
312 public Status getStatus() {
313 return status;
314 }
315
316 public int encode(BerByteArrayOutputStream os) throws IOException {
317 return encode(os, true);
318 }
319
320 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
321
322 if (code != null) {
323 for (int i = code.length - 1; i >= 0; i--) {
324 os.write(code[i]);
325 }
326 if (withTag) {
327 return tag.encode(os) + code.length;
328 }
329 return code.length;
330 }
331
332 int codeLength = 0;
333 codeLength += status.encode(os, false);
334 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
335 os.write(0xA2);
336 codeLength += 1;
337
338 if (crnti != null) {
339 codeLength += crnti.encode(os, false);
340 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
341 os.write(0xA1);
342 codeLength += 1;
343 }
344
345 codeLength += ecgi.encode(os, false);
346 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
347 os.write(0xA0);
348 codeLength += 1;
349
350 codeLength += BerLength.encodeLength(os, codeLength);
351
352 if (withTag) {
353 codeLength += tag.encode(os);
354 }
355
356 return codeLength;
357
358 }
359
360 public int decode(InputStream is) throws IOException {
361 return decode(is, true);
362 }
363
364 public int decode(InputStream is, boolean withTag) throws IOException {
365 int codeLength = 0;
366 int subCodeLength = 0;
367 BerTag berTag = new BerTag();
368
369 if (withTag) {
370 codeLength += tag.decodeAndCheck(is);
371 }
372
373 BerLength length = new BerLength();
374 codeLength += length.decode(is);
375
376 int totalLength = length.val;
377 codeLength += totalLength;
378
379 subCodeLength += berTag.decode(is);
380 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
381 ecgi = new ECGI();
382 subCodeLength += ecgi.decode(is, false);
383 subCodeLength += berTag.decode(is);
384 }
385 else {
386 throw new IOException("Tag does not match the mandatory sequence element tag.");
387 }
388
389 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
390 crnti = new Crnti();
391 subCodeLength += crnti.decode(is, false);
392 subCodeLength += berTag.decode(is);
393 }
394
395 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
396 status = new Status();
397 subCodeLength += status.decode(is, false);
398 if (subCodeLength == totalLength) {
399 return codeLength;
400 }
401 }
402 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
403
404
405 }
406
407 public void encodeAndSave(int encodingSizeGuess) throws IOException {
408 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
409 encode(os, false);
410 code = os.getArray();
411 }
412
413 public String toString() {
414 StringBuilder sb = new StringBuilder();
415 appendAsString(sb, 0);
416 return sb.toString();
417 }
418
419 public void appendAsString(StringBuilder sb, int indentLevel) {
420
421 sb.append("{");
422 sb.append("\n");
423 for (int i = 0; i < indentLevel + 1; i++) {
424 sb.append("\t");
425 }
426 if (ecgi != null) {
427 sb.append("\"ecgi\": ");
428 ecgi.appendAsString(sb, indentLevel + 1);
429 }
430
431 if (crnti != null) {
432 sb.append(",\n");
433 for (int i = 0; i < indentLevel + 1; i++) {
434 sb.append("\t");
435 }
436 sb.append("\"crnti\": ");
437 crnti.appendAsString(sb, indentLevel + 1);
438 }
439
440 sb.append(",\n");
441 for (int i = 0; i < indentLevel + 1; i++) {
442 sb.append("\t");
443 }
444 if (status != null) {
445 sb.append("\"status\": ");
446 status.appendAsString(sb, indentLevel + 1);
447 }
448
449 sb.append("\n");
450 for (int i = 0; i < indentLevel; i++) {
451 sb.append("\t");
452 }
453 sb.append("}");
454 }
455
456}
457