blob: 7b4e15c39da87ed84816610297d36b1178bc02f5 [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.ERABID;
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.BerInteger;
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 BearerReleaseInd 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;
32 private ECGI ecgi = null;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080033 private BerInteger numErabs = null;
34 private ErabIds erabIds = null;
35 public BearerReleaseInd() {
slowr89c2ac12017-08-15 16:20:06 -070036 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080037
38 public BearerReleaseInd(byte[] code) {
slowr89c2ac12017-08-15 16:20:06 -070039 this.code = code;
40 }
slowr13fa5b02017-08-08 16:32:31 -070041
slowr89c2ac12017-08-15 16:20:06 -070042 public CRNTI getCrnti() {
43 return crnti;
44 }
slowr13fa5b02017-08-08 16:32:31 -070045
slowr89c2ac12017-08-15 16:20:06 -070046 public void setCrnti(CRNTI crnti) {
47 this.crnti = crnti;
48 }
slowr13fa5b02017-08-08 16:32:31 -070049
slowr89c2ac12017-08-15 16:20:06 -070050 public ECGI getEcgi() {
51 return ecgi;
52 }
slowr13fa5b02017-08-08 16:32:31 -070053
slowr89c2ac12017-08-15 16:20:06 -070054 public void setEcgi(ECGI ecgi) {
55 this.ecgi = ecgi;
56 }
slowr13fa5b02017-08-08 16:32:31 -070057
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080058 public BerInteger getNumErabs() {
59 return numErabs;
slowr89c2ac12017-08-15 16:20:06 -070060 }
slowr13fa5b02017-08-08 16:32:31 -070061
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080062 public void setNumErabs(BerInteger numErabs) {
63 this.numErabs = numErabs;
64 }
65
66 public ErabIds getErabIds() {
67 return erabIds;
68 }
69
70 public void setErabIds(ErabIds erabIds) {
71 this.erabIds = erabIds;
slowr89c2ac12017-08-15 16:20:06 -070072 }
slowr13fa5b02017-08-08 16:32:31 -070073
slowr89c2ac12017-08-15 16:20:06 -070074 public int encode(BerByteArrayOutputStream os) throws IOException {
75 return encode(os, true);
76 }
slowr13fa5b02017-08-08 16:32:31 -070077
slowr89c2ac12017-08-15 16:20:06 -070078 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -070079
slowr89c2ac12017-08-15 16:20:06 -070080 if (code != null) {
81 for (int i = code.length - 1; i >= 0; i--) {
82 os.write(code[i]);
83 }
84 if (withTag) {
85 return tag.encode(os) + code.length;
86 }
87 return code.length;
88 }
slowr13fa5b02017-08-08 16:32:31 -070089
slowr89c2ac12017-08-15 16:20:06 -070090 int codeLength = 0;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080091 codeLength += erabIds.encode(os, false);
92 // write tag: CONTEXT_CLASS, CONSTRUCTED, 3
93 os.write(0xA3);
94 codeLength += 1;
95
96 codeLength += numErabs.encode(os, false);
97 // write tag: CONTEXT_CLASS, PRIMITIVE, 2
98 os.write(0x82);
slowr89c2ac12017-08-15 16:20:06 -070099 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -0700100
slowr89c2ac12017-08-15 16:20:06 -0700101 codeLength += ecgi.encode(os, false);
102 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
103 os.write(0xA1);
104 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -0700105
slowr89c2ac12017-08-15 16:20:06 -0700106 codeLength += crnti.encode(os, false);
107 // write tag: CONTEXT_CLASS, PRIMITIVE, 0
108 os.write(0x80);
109 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -0700110
slowr89c2ac12017-08-15 16:20:06 -0700111 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -0700112
slowr89c2ac12017-08-15 16:20:06 -0700113 if (withTag) {
114 codeLength += tag.encode(os);
115 }
slowr13fa5b02017-08-08 16:32:31 -0700116
slowr89c2ac12017-08-15 16:20:06 -0700117 return codeLength;
slowr13fa5b02017-08-08 16:32:31 -0700118
slowr89c2ac12017-08-15 16:20:06 -0700119 }
120
121 public int decode(InputStream is) throws IOException {
122 return decode(is, true);
123 }
124
125 public int decode(InputStream is, boolean withTag) throws IOException {
126 int codeLength = 0;
127 int subCodeLength = 0;
128 BerTag berTag = new BerTag();
129
130 if (withTag) {
131 codeLength += tag.decodeAndCheck(is);
132 }
133
134 BerLength length = new BerLength();
135 codeLength += length.decode(is);
136
137 int totalLength = length.val;
138 codeLength += totalLength;
139
140 subCodeLength += berTag.decode(is);
141 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
142 crnti = new CRNTI();
143 subCodeLength += crnti.decode(is, false);
144 subCodeLength += berTag.decode(is);
145 } else {
146 throw new IOException("Tag does not match the mandatory sequence element tag.");
147 }
148
149 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
150 ecgi = new ECGI();
151 subCodeLength += ecgi.decode(is, false);
152 subCodeLength += berTag.decode(is);
153 } else {
154 throw new IOException("Tag does not match the mandatory sequence element tag.");
155 }
156
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800157 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
158 numErabs = new BerInteger();
159 subCodeLength += numErabs.decode(is, false);
160 subCodeLength += berTag.decode(is);
161 } else {
162 throw new IOException("Tag does not match the mandatory sequence element tag.");
163 }
164
165 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
166 erabIds = new ErabIds();
167 subCodeLength += erabIds.decode(is, false);
slowr89c2ac12017-08-15 16:20:06 -0700168 if (subCodeLength == totalLength) {
169 return codeLength;
170 }
171 }
172 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
173
174
175 }
176
177 public void encodeAndSave(int encodingSizeGuess) throws IOException {
178 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
179 encode(os, false);
180 code = os.getArray();
181 }
182
183 public String toString() {
184 StringBuilder sb = new StringBuilder();
185 appendAsString(sb, 0);
186 return sb.toString();
187 }
188
189 public void appendAsString(StringBuilder sb, int indentLevel) {
190
191 sb.append("{");
192 sb.append("\n");
193 for (int i = 0; i < indentLevel + 1; i++) {
194 sb.append("\t");
195 }
196 if (crnti != null) {
slowr60d4d102017-08-16 18:33:58 -0700197 sb.append("crnti: ").append(crnti);
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800198 } else {
199 sb.append("crnti: <empty-required-field>");
slowr89c2ac12017-08-15 16:20:06 -0700200 }
201
202 sb.append(",\n");
203 for (int i = 0; i < indentLevel + 1; i++) {
204 sb.append("\t");
205 }
206 if (ecgi != null) {
slowr60d4d102017-08-16 18:33:58 -0700207 sb.append("ecgi: ");
slowr89c2ac12017-08-15 16:20:06 -0700208 ecgi.appendAsString(sb, indentLevel + 1);
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800209 } else {
210 sb.append("ecgi: <empty-required-field>");
slowr89c2ac12017-08-15 16:20:06 -0700211 }
212
213 sb.append(",\n");
214 for (int i = 0; i < indentLevel + 1; i++) {
215 sb.append("\t");
216 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800217 if (numErabs != null) {
218 sb.append("numErabs: ").append(numErabs);
219 } else {
220 sb.append("numErabs: <empty-required-field>");
221 }
222
223 sb.append(",\n");
224 for (int i = 0; i < indentLevel + 1; i++) {
225 sb.append("\t");
226 }
227 if (erabIds != null) {
228 sb.append("erabIds: ");
229 erabIds.appendAsString(sb, indentLevel + 1);
230 } else {
231 sb.append("erabIds: <empty-required-field>");
slowr89c2ac12017-08-15 16:20:06 -0700232 }
233
234 sb.append("\n");
235 for (int i = 0; i < indentLevel; i++) {
236 sb.append("\t");
237 }
238 sb.append("}");
239 }
240
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800241 public static class ErabIds implements Serializable {
slowr89c2ac12017-08-15 16:20:06 -0700242
243 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
244 private static final long serialVersionUID = 1L;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800245 @JsonIgnore
246 public byte[] code = null;
247 private List<ERABID> seqOf = null;
slowr89c2ac12017-08-15 16:20:06 -0700248
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800249 public ErabIds() {
250 seqOf = new ArrayList<ERABID>();
slowr89c2ac12017-08-15 16:20:06 -0700251 }
252
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800253 public ErabIds(byte[] code) {
slowr89c2ac12017-08-15 16:20:06 -0700254 this.code = code;
255 }
256
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800257
slowr60d4d102017-08-16 18:33:58 -0700258 @JsonValue
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800259 public List<ERABID> getERABID() {
slowr89c2ac12017-08-15 16:20:06 -0700260 if (seqOf == null) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800261 seqOf = new ArrayList<ERABID>();
slowr89c2ac12017-08-15 16:20:06 -0700262 }
263 return seqOf;
264 }
265
266 public int encode(BerByteArrayOutputStream os) throws IOException {
267 return encode(os, true);
268 }
269
270 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
271
272 if (code != null) {
273 for (int i = code.length - 1; i >= 0; i--) {
274 os.write(code[i]);
275 }
276 if (withTag) {
277 return tag.encode(os) + code.length;
278 }
279 return code.length;
280 }
281
282 int codeLength = 0;
283 for (int i = (seqOf.size() - 1); i >= 0; i--) {
284 codeLength += seqOf.get(i).encode(os, true);
285 }
286
287 codeLength += BerLength.encodeLength(os, codeLength);
288
289 if (withTag) {
290 codeLength += tag.encode(os);
291 }
292
293 return codeLength;
294 }
295
296 public int decode(InputStream is) throws IOException {
297 return decode(is, true);
298 }
299
300 public int decode(InputStream is, boolean withTag) throws IOException {
301 int codeLength = 0;
302 int subCodeLength = 0;
303 if (withTag) {
304 codeLength += tag.decodeAndCheck(is);
305 }
306
307 BerLength length = new BerLength();
308 codeLength += length.decode(is);
309 int totalLength = length.val;
310
311 while (subCodeLength < totalLength) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800312 ERABID element = new ERABID();
slowr89c2ac12017-08-15 16:20:06 -0700313 subCodeLength += element.decode(is, true);
314 seqOf.add(element);
315 }
316 if (subCodeLength != totalLength) {
317 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
318
319 }
320 codeLength += subCodeLength;
321
322 return codeLength;
323 }
324
325 public void encodeAndSave(int encodingSizeGuess) throws IOException {
326 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
327 encode(os, false);
328 code = os.getArray();
329 }
330
331 public String toString() {
332 StringBuilder sb = new StringBuilder();
333 appendAsString(sb, 0);
334 return sb.toString();
335 }
336
337 public void appendAsString(StringBuilder sb, int indentLevel) {
338
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800339 sb.append("{\n");
slowr89c2ac12017-08-15 16:20:06 -0700340 for (int i = 0; i < indentLevel + 1; i++) {
341 sb.append("\t");
342 }
343 if (seqOf == null) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800344 sb.append("null");
slowr89c2ac12017-08-15 16:20:06 -0700345 } else {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800346 Iterator<ERABID> it = seqOf.iterator();
slowr89c2ac12017-08-15 16:20:06 -0700347 if (it.hasNext()) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800348 sb.append(it.next());
slowr89c2ac12017-08-15 16:20:06 -0700349 while (it.hasNext()) {
350 sb.append(",\n");
351 for (int i = 0; i < indentLevel + 1; i++) {
352 sb.append("\t");
353 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800354 sb.append(it.next());
slowr89c2ac12017-08-15 16:20:06 -0700355 }
356 }
357 }
slowr13fa5b02017-08-08 16:32:31 -0700358
slowr89c2ac12017-08-15 16:20:06 -0700359 sb.append("\n");
360 for (int i = 0; i < indentLevel; i++) {
361 sb.append("\t");
362 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800363 sb.append("}");
slowr89c2ac12017-08-15 16:20:06 -0700364 }
slowr13fa5b02017-08-08 16:32:31 -0700365
slowr89c2ac12017-08-15 16:20:06 -0700366 }
slowr13fa5b02017-08-08 16:32:31 -0700367
368}
369