blob: 140b234a630cc4e4d36dd56cb184cd11c3f93f1c [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;
6
slowr13fa5b02017-08-08 16:32:31 -07007
slowr60d4d102017-08-16 18:33:58 -07008import com.fasterxml.jackson.annotation.JsonIgnore;
9import com.fasterxml.jackson.annotation.JsonValue;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080010import org.onosproject.xran.asn1lib.api.CRNTI;
11import org.onosproject.xran.asn1lib.api.ECGI;
12import org.onosproject.xran.asn1lib.api.RXSigReport;
13import org.onosproject.xran.asn1lib.ber.BerByteArrayOutputStream;
14import org.onosproject.xran.asn1lib.ber.BerLength;
15import org.onosproject.xran.asn1lib.ber.BerTag;
16import org.onosproject.xran.asn1lib.ber.types.BerBitString;
slowr13fa5b02017-08-08 16:32:31 -070017
18import java.io.IOException;
19import java.io.InputStream;
20import java.io.Serializable;
21import java.util.ArrayList;
22import java.util.Iterator;
23import java.util.List;
24
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080025public class HOCause implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -070026
slowr89c2ac12017-08-15 16:20:06 -070027 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
28 private static final long serialVersionUID = 1L;
slowr60d4d102017-08-16 18:33:58 -070029 @JsonIgnore
slowr89c2ac12017-08-15 16:20:06 -070030 public byte[] code = null;
31 private CRNTI crnti = null;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080032 private ECGI ecgiS = null;
33 private ECGI ecgiT = null;
34 private BerBitString hoCause = null;
35 private HoTrigger hoTrigger = null;
36 public HOCause() {
slowr89c2ac12017-08-15 16:20:06 -070037 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080038
39 public HOCause(byte[] code) {
slowr89c2ac12017-08-15 16:20:06 -070040 this.code = code;
41 }
slowr13fa5b02017-08-08 16:32:31 -070042
slowr89c2ac12017-08-15 16:20:06 -070043 public CRNTI getCrnti() {
44 return crnti;
45 }
slowr13fa5b02017-08-08 16:32:31 -070046
slowr89c2ac12017-08-15 16:20:06 -070047 public void setCrnti(CRNTI crnti) {
48 this.crnti = crnti;
49 }
slowr13fa5b02017-08-08 16:32:31 -070050
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080051 public ECGI getEcgiS() {
52 return ecgiS;
slowr89c2ac12017-08-15 16:20:06 -070053 }
slowr13fa5b02017-08-08 16:32:31 -070054
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080055 public void setEcgiS(ECGI ecgiS) {
56 this.ecgiS = ecgiS;
slowr89c2ac12017-08-15 16:20:06 -070057 }
slowr13fa5b02017-08-08 16:32:31 -070058
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080059 public ECGI getEcgiT() {
60 return ecgiT;
slowr89c2ac12017-08-15 16:20:06 -070061 }
slowr13fa5b02017-08-08 16:32:31 -070062
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080063 public void setEcgiT(ECGI ecgiT) {
64 this.ecgiT = ecgiT;
65 }
66
67 public BerBitString getHoCause() {
68 return hoCause;
69 }
70
71 public void setHoCause(BerBitString hoCause) {
72 this.hoCause = hoCause;
73 }
74
75 public HoTrigger getHoTrigger() {
76 return hoTrigger;
77 }
78
79 public void setHoTrigger(HoTrigger hoTrigger) {
80 this.hoTrigger = hoTrigger;
slowr89c2ac12017-08-15 16:20:06 -070081 }
slowr13fa5b02017-08-08 16:32:31 -070082
slowr89c2ac12017-08-15 16:20:06 -070083 public int encode(BerByteArrayOutputStream os) throws IOException {
84 return encode(os, true);
85 }
slowr13fa5b02017-08-08 16:32:31 -070086
slowr89c2ac12017-08-15 16:20:06 -070087 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -070088
slowr89c2ac12017-08-15 16:20:06 -070089 if (code != null) {
90 for (int i = code.length - 1; i >= 0; i--) {
91 os.write(code[i]);
92 }
93 if (withTag) {
94 return tag.encode(os) + code.length;
95 }
96 return code.length;
97 }
slowr13fa5b02017-08-08 16:32:31 -070098
slowr89c2ac12017-08-15 16:20:06 -070099 int codeLength = 0;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800100 codeLength += hoTrigger.encode(os, false);
101 // write tag: CONTEXT_CLASS, CONSTRUCTED, 4
102 os.write(0xA4);
103 codeLength += 1;
104
105 codeLength += hoCause.encode(os, false);
106 // write tag: CONTEXT_CLASS, PRIMITIVE, 3
107 os.write(0x83);
108 codeLength += 1;
109
110 codeLength += ecgiT.encode(os, false);
slowr89c2ac12017-08-15 16:20:06 -0700111 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
112 os.write(0xA2);
113 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -0700114
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800115 codeLength += ecgiS.encode(os, false);
slowr89c2ac12017-08-15 16:20:06 -0700116 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
117 os.write(0xA1);
118 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -0700119
slowr89c2ac12017-08-15 16:20:06 -0700120 codeLength += crnti.encode(os, false);
121 // write tag: CONTEXT_CLASS, PRIMITIVE, 0
122 os.write(0x80);
123 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -0700124
slowr89c2ac12017-08-15 16:20:06 -0700125 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -0700126
slowr89c2ac12017-08-15 16:20:06 -0700127 if (withTag) {
128 codeLength += tag.encode(os);
129 }
slowr13fa5b02017-08-08 16:32:31 -0700130
slowr89c2ac12017-08-15 16:20:06 -0700131 return codeLength;
slowr13fa5b02017-08-08 16:32:31 -0700132
slowr89c2ac12017-08-15 16:20:06 -0700133 }
134
135 public int decode(InputStream is) throws IOException {
136 return decode(is, true);
137 }
138
139 public int decode(InputStream is, boolean withTag) throws IOException {
140 int codeLength = 0;
141 int subCodeLength = 0;
142 BerTag berTag = new BerTag();
143
144 if (withTag) {
145 codeLength += tag.decodeAndCheck(is);
146 }
147
148 BerLength length = new BerLength();
149 codeLength += length.decode(is);
150
151 int totalLength = length.val;
152 codeLength += totalLength;
153
154 subCodeLength += berTag.decode(is);
155 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
156 crnti = new CRNTI();
157 subCodeLength += crnti.decode(is, false);
158 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, 1)) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800164 ecgiS = new ECGI();
165 subCodeLength += ecgiS.decode(is, false);
slowr89c2ac12017-08-15 16:20:06 -0700166 subCodeLength += berTag.decode(is);
167 } else {
168 throw new IOException("Tag does not match the mandatory sequence element tag.");
169 }
170
171 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800172 ecgiT = new ECGI();
173 subCodeLength += ecgiT.decode(is, false);
174 subCodeLength += berTag.decode(is);
175 } else {
176 throw new IOException("Tag does not match the mandatory sequence element tag.");
177 }
178
179 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
180 hoCause = new BerBitString();
181 subCodeLength += hoCause.decode(is, false);
182 subCodeLength += berTag.decode(is);
183 } else {
184 throw new IOException("Tag does not match the mandatory sequence element tag.");
185 }
186
187 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
188 hoTrigger = new HoTrigger();
189 subCodeLength += hoTrigger.decode(is, false);
slowr89c2ac12017-08-15 16:20:06 -0700190 if (subCodeLength == totalLength) {
191 return codeLength;
192 }
193 }
194 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
195
196
197 }
198
199 public void encodeAndSave(int encodingSizeGuess) throws IOException {
200 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
201 encode(os, false);
202 code = os.getArray();
203 }
204
205 public String toString() {
206 StringBuilder sb = new StringBuilder();
207 appendAsString(sb, 0);
208 return sb.toString();
209 }
210
211 public void appendAsString(StringBuilder sb, int indentLevel) {
212
213 sb.append("{");
214 sb.append("\n");
215 for (int i = 0; i < indentLevel + 1; i++) {
216 sb.append("\t");
217 }
218 if (crnti != null) {
slowr60d4d102017-08-16 18:33:58 -0700219 sb.append("crnti: ").append(crnti);
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800220 } else {
221 sb.append("crnti: <empty-required-field>");
slowr89c2ac12017-08-15 16:20:06 -0700222 }
223
224 sb.append(",\n");
225 for (int i = 0; i < indentLevel + 1; i++) {
226 sb.append("\t");
227 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800228 if (ecgiS != null) {
229 sb.append("ecgiS: ");
230 ecgiS.appendAsString(sb, indentLevel + 1);
231 } else {
232 sb.append("ecgiS: <empty-required-field>");
slowr89c2ac12017-08-15 16:20:06 -0700233 }
234
235 sb.append(",\n");
236 for (int i = 0; i < indentLevel + 1; i++) {
237 sb.append("\t");
238 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800239 if (ecgiT != null) {
240 sb.append("ecgiT: ");
241 ecgiT.appendAsString(sb, indentLevel + 1);
242 } else {
243 sb.append("ecgiT: <empty-required-field>");
244 }
245
246 sb.append(",\n");
247 for (int i = 0; i < indentLevel + 1; i++) {
248 sb.append("\t");
249 }
250 if (hoCause != null) {
251 sb.append("hoCause: ").append(hoCause);
252 } else {
253 sb.append("hoCause: <empty-required-field>");
254 }
255
256 sb.append(",\n");
257 for (int i = 0; i < indentLevel + 1; i++) {
258 sb.append("\t");
259 }
260 if (hoTrigger != null) {
261 sb.append("hoTrigger: ");
262 hoTrigger.appendAsString(sb, indentLevel + 1);
263 } else {
264 sb.append("hoTrigger: <empty-required-field>");
slowr89c2ac12017-08-15 16:20:06 -0700265 }
266
267 sb.append("\n");
268 for (int i = 0; i < indentLevel; i++) {
269 sb.append("\t");
270 }
271 sb.append("}");
272 }
273
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800274 public static class HoTrigger implements Serializable {
slowr89c2ac12017-08-15 16:20:06 -0700275
276 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
277 private static final long serialVersionUID = 1L;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800278 @JsonIgnore
279 public byte[] code = null;
280 private List<RXSigReport> seqOf = null;
slowr89c2ac12017-08-15 16:20:06 -0700281
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800282 public HoTrigger() {
283 seqOf = new ArrayList<RXSigReport>();
slowr89c2ac12017-08-15 16:20:06 -0700284 }
285
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800286 public HoTrigger(byte[] code) {
slowr89c2ac12017-08-15 16:20:06 -0700287 this.code = code;
288 }
289
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800290
slowr60d4d102017-08-16 18:33:58 -0700291 @JsonValue
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800292 public List<RXSigReport> getRXSigReport() {
slowr89c2ac12017-08-15 16:20:06 -0700293 if (seqOf == null) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800294 seqOf = new ArrayList<RXSigReport>();
slowr89c2ac12017-08-15 16:20:06 -0700295 }
296 return seqOf;
297 }
298
299 public int encode(BerByteArrayOutputStream os) throws IOException {
300 return encode(os, true);
301 }
302
303 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
304
305 if (code != null) {
306 for (int i = code.length - 1; i >= 0; i--) {
307 os.write(code[i]);
308 }
309 if (withTag) {
310 return tag.encode(os) + code.length;
311 }
312 return code.length;
313 }
314
315 int codeLength = 0;
316 for (int i = (seqOf.size() - 1); i >= 0; i--) {
317 codeLength += seqOf.get(i).encode(os, true);
318 }
319
320 codeLength += BerLength.encodeLength(os, codeLength);
321
322 if (withTag) {
323 codeLength += tag.encode(os);
324 }
325
326 return codeLength;
327 }
328
329 public int decode(InputStream is) throws IOException {
330 return decode(is, true);
331 }
332
333 public int decode(InputStream is, boolean withTag) throws IOException {
334 int codeLength = 0;
335 int subCodeLength = 0;
336 if (withTag) {
337 codeLength += tag.decodeAndCheck(is);
338 }
339
340 BerLength length = new BerLength();
341 codeLength += length.decode(is);
342 int totalLength = length.val;
343
344 while (subCodeLength < totalLength) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800345 RXSigReport element = new RXSigReport();
slowr89c2ac12017-08-15 16:20:06 -0700346 subCodeLength += element.decode(is, true);
347 seqOf.add(element);
348 }
349 if (subCodeLength != totalLength) {
350 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
351
352 }
353 codeLength += subCodeLength;
354
355 return codeLength;
356 }
357
358 public void encodeAndSave(int encodingSizeGuess) throws IOException {
359 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
360 encode(os, false);
361 code = os.getArray();
362 }
363
364 public String toString() {
365 StringBuilder sb = new StringBuilder();
366 appendAsString(sb, 0);
367 return sb.toString();
368 }
369
370 public void appendAsString(StringBuilder sb, int indentLevel) {
371
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800372 sb.append("{\n");
slowr89c2ac12017-08-15 16:20:06 -0700373 for (int i = 0; i < indentLevel + 1; i++) {
374 sb.append("\t");
375 }
376 if (seqOf == null) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800377 sb.append("null");
slowr89c2ac12017-08-15 16:20:06 -0700378 } else {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800379 Iterator<RXSigReport> it = seqOf.iterator();
slowr89c2ac12017-08-15 16:20:06 -0700380 if (it.hasNext()) {
381 it.next().appendAsString(sb, indentLevel + 1);
382 while (it.hasNext()) {
383 sb.append(",\n");
384 for (int i = 0; i < indentLevel + 1; i++) {
385 sb.append("\t");
386 }
387 it.next().appendAsString(sb, indentLevel + 1);
388 }
389 }
390 }
slowr13fa5b02017-08-08 16:32:31 -0700391
slowr89c2ac12017-08-15 16:20:06 -0700392 sb.append("\n");
393 for (int i = 0; i < indentLevel; i++) {
394 sb.append("\t");
395 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800396 sb.append("}");
slowr89c2ac12017-08-15 16:20:06 -0700397 }
slowr13fa5b02017-08-08 16:32:31 -0700398
slowr89c2ac12017-08-15 16:20:06 -0700399 }
slowr13fa5b02017-08-08 16:32:31 -0700400
401}
402