blob: d36acb00fd9174b8cedd2f5eb7ea5ad9c6cbdcf2 [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.api;
6
7import java.io.IOException;
8import java.io.EOFException;
9import java.io.InputStream;
10import java.util.List;
11import java.util.ArrayList;
12import java.util.Iterator;
13import java.io.UnsupportedEncodingException;
14import java.math.BigInteger;
15import java.io.Serializable;
slowr60d4d102017-08-16 18:33:58 -070016
17import com.fasterxml.jackson.annotation.JsonIgnore;
18import org.onosproject.xran.codecs.ber.*;
19import org.onosproject.xran.codecs.ber.types.*;
20import org.onosproject.xran.codecs.ber.types.string.*;
slowr13fa5b02017-08-08 16:32:31 -070021
22
23public class ERABParamsItem implements Serializable {
24
25 private static final long serialVersionUID = 1L;
26
27 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
28
slowr60d4d102017-08-16 18:33:58 -070029 @JsonIgnore
slowr13fa5b02017-08-08 16:32:31 -070030 public byte[] code = null;
31 private ERABID id = null;
32 private ERABDirection direction = null;
33 private ERABType type = null;
34 private QCI qci = null;
35 private BerInteger arp = null;
36 private BitRate gbrDl = null;
37 private BitRate gbrUl = null;
38 private BitRate mbrDl = null;
39 private BitRate mbrUl = null;
40
41 public ERABParamsItem() {
42 }
43
44 public ERABParamsItem(byte[] code) {
45 this.code = code;
46 }
47
48 public void setId(ERABID id) {
49 this.id = id;
50 }
51
52 public ERABID getId() {
53 return id;
54 }
55
56 public void setDirection(ERABDirection direction) {
57 this.direction = direction;
58 }
59
60 public ERABDirection getDirection() {
61 return direction;
62 }
63
64 public void setType(ERABType type) {
65 this.type = type;
66 }
67
68 public ERABType getType() {
69 return type;
70 }
71
72 public void setQci(QCI qci) {
73 this.qci = qci;
74 }
75
76 public QCI getQci() {
77 return qci;
78 }
79
80 public void setArp(BerInteger arp) {
81 this.arp = arp;
82 }
83
84 public BerInteger getArp() {
85 return arp;
86 }
87
88 public void setGbrDl(BitRate gbrDl) {
89 this.gbrDl = gbrDl;
90 }
91
92 public BitRate getGbrDl() {
93 return gbrDl;
94 }
95
96 public void setGbrUl(BitRate gbrUl) {
97 this.gbrUl = gbrUl;
98 }
99
100 public BitRate getGbrUl() {
101 return gbrUl;
102 }
103
104 public void setMbrDl(BitRate mbrDl) {
105 this.mbrDl = mbrDl;
106 }
107
108 public BitRate getMbrDl() {
109 return mbrDl;
110 }
111
112 public void setMbrUl(BitRate mbrUl) {
113 this.mbrUl = mbrUl;
114 }
115
116 public BitRate getMbrUl() {
117 return mbrUl;
118 }
119
120 public int encode(BerByteArrayOutputStream os) throws IOException {
121 return encode(os, true);
122 }
123
124 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
125
126 if (code != null) {
127 for (int i = code.length - 1; i >= 0; i--) {
128 os.write(code[i]);
129 }
130 if (withTag) {
131 return tag.encode(os) + code.length;
132 }
133 return code.length;
134 }
135
136 int codeLength = 0;
137 codeLength += mbrUl.encode(os, false);
138 // write tag: CONTEXT_CLASS, PRIMITIVE, 8
139 os.write(0x88);
140 codeLength += 1;
141
142 codeLength += mbrDl.encode(os, false);
143 // write tag: CONTEXT_CLASS, PRIMITIVE, 7
144 os.write(0x87);
145 codeLength += 1;
146
147 codeLength += gbrUl.encode(os, false);
148 // write tag: CONTEXT_CLASS, PRIMITIVE, 6
149 os.write(0x86);
150 codeLength += 1;
151
152 codeLength += gbrDl.encode(os, false);
153 // write tag: CONTEXT_CLASS, PRIMITIVE, 5
154 os.write(0x85);
155 codeLength += 1;
156
157 codeLength += arp.encode(os, false);
158 // write tag: CONTEXT_CLASS, PRIMITIVE, 4
159 os.write(0x84);
160 codeLength += 1;
161
162 codeLength += qci.encode(os, false);
163 // write tag: CONTEXT_CLASS, PRIMITIVE, 3
164 os.write(0x83);
165 codeLength += 1;
166
167 codeLength += type.encode(os, false);
168 // write tag: CONTEXT_CLASS, PRIMITIVE, 2
169 os.write(0x82);
170 codeLength += 1;
171
172 codeLength += direction.encode(os, false);
173 // write tag: CONTEXT_CLASS, PRIMITIVE, 1
174 os.write(0x81);
175 codeLength += 1;
176
177 codeLength += id.encode(os, false);
178 // write tag: CONTEXT_CLASS, PRIMITIVE, 0
179 os.write(0x80);
180 codeLength += 1;
181
182 codeLength += BerLength.encodeLength(os, codeLength);
183
184 if (withTag) {
185 codeLength += tag.encode(os);
186 }
187
188 return codeLength;
189
190 }
191
192 public int decode(InputStream is) throws IOException {
193 return decode(is, true);
194 }
195
196 public int decode(InputStream is, boolean withTag) throws IOException {
197 int codeLength = 0;
198 int subCodeLength = 0;
199 BerTag berTag = new BerTag();
200
201 if (withTag) {
202 codeLength += tag.decodeAndCheck(is);
203 }
204
205 BerLength length = new BerLength();
206 codeLength += length.decode(is);
207
208 int totalLength = length.val;
209 codeLength += totalLength;
210
211 subCodeLength += berTag.decode(is);
212 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
213 id = new ERABID();
214 subCodeLength += id.decode(is, false);
215 subCodeLength += berTag.decode(is);
216 }
217 else {
218 throw new IOException("Tag does not match the mandatory sequence element tag.");
219 }
220
221 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
222 direction = new ERABDirection();
223 subCodeLength += direction.decode(is, false);
224 subCodeLength += berTag.decode(is);
225 }
226 else {
227 throw new IOException("Tag does not match the mandatory sequence element tag.");
228 }
229
230 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
231 type = new ERABType();
232 subCodeLength += type.decode(is, false);
233 subCodeLength += berTag.decode(is);
234 }
235 else {
236 throw new IOException("Tag does not match the mandatory sequence element tag.");
237 }
238
239 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
240 qci = new QCI();
241 subCodeLength += qci.decode(is, false);
242 subCodeLength += berTag.decode(is);
243 }
244 else {
245 throw new IOException("Tag does not match the mandatory sequence element tag.");
246 }
247
248 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) {
249 arp = new BerInteger();
250 subCodeLength += arp.decode(is, false);
251 subCodeLength += berTag.decode(is);
252 }
253 else {
254 throw new IOException("Tag does not match the mandatory sequence element tag.");
255 }
256
257 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) {
258 gbrDl = new BitRate();
259 subCodeLength += gbrDl.decode(is, false);
260 subCodeLength += berTag.decode(is);
261 }
262 else {
263 throw new IOException("Tag does not match the mandatory sequence element tag.");
264 }
265
266 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) {
267 gbrUl = new BitRate();
268 subCodeLength += gbrUl.decode(is, false);
269 subCodeLength += berTag.decode(is);
270 }
271 else {
272 throw new IOException("Tag does not match the mandatory sequence element tag.");
273 }
274
275 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) {
276 mbrDl = new BitRate();
277 subCodeLength += mbrDl.decode(is, false);
278 subCodeLength += berTag.decode(is);
279 }
280 else {
281 throw new IOException("Tag does not match the mandatory sequence element tag.");
282 }
283
284 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) {
285 mbrUl = new BitRate();
286 subCodeLength += mbrUl.decode(is, false);
287 if (subCodeLength == totalLength) {
288 return codeLength;
289 }
290 }
291 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
292
293
294 }
295
296 public void encodeAndSave(int encodingSizeGuess) throws IOException {
297 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
298 encode(os, false);
299 code = os.getArray();
300 }
301
302 public String toString() {
303 StringBuilder sb = new StringBuilder();
304 appendAsString(sb, 0);
305 return sb.toString();
306 }
307
308 public void appendAsString(StringBuilder sb, int indentLevel) {
309
310 sb.append("{");
311 sb.append("\n");
312 for (int i = 0; i < indentLevel + 1; i++) {
313 sb.append("\t");
314 }
315 if (id != null) {
slowr60d4d102017-08-16 18:33:58 -0700316 sb.append("id: ").append(id);
slowr13fa5b02017-08-08 16:32:31 -0700317 }
318 sb.append(",\n");
319 for (int i = 0; i < indentLevel + 1; i++) {
320 sb.append("\t");
321 }
322 if (direction != null) {
slowr60d4d102017-08-16 18:33:58 -0700323 sb.append("direction: ").append(direction);
slowr13fa5b02017-08-08 16:32:31 -0700324 }
325 sb.append(",\n");
326 for (int i = 0; i < indentLevel + 1; i++) {
327 sb.append("\t");
328 }
329 if (type != null) {
slowr60d4d102017-08-16 18:33:58 -0700330 sb.append("type: ").append(type);
slowr13fa5b02017-08-08 16:32:31 -0700331 }
332
333 sb.append(",\n");
334 for (int i = 0; i < indentLevel + 1; i++) {
335 sb.append("\t");
336 }
337 if (qci != null) {
slowr60d4d102017-08-16 18:33:58 -0700338 sb.append("qci: ").append(qci);
slowr13fa5b02017-08-08 16:32:31 -0700339 }
340
341 sb.append(",\n");
342 for (int i = 0; i < indentLevel + 1; i++) {
343 sb.append("\t");
344 }
345 if (arp != null) {
slowr60d4d102017-08-16 18:33:58 -0700346 sb.append("arp: ").append(arp);
slowr13fa5b02017-08-08 16:32:31 -0700347 }
348
349 sb.append(",\n");
350 for (int i = 0; i < indentLevel + 1; i++) {
351 sb.append("\t");
352 }
353 if (gbrDl != null) {
slowr60d4d102017-08-16 18:33:58 -0700354 sb.append("gbrDl: ").append(gbrDl);
slowr13fa5b02017-08-08 16:32:31 -0700355 }
356
357 sb.append(",\n");
358 for (int i = 0; i < indentLevel + 1; i++) {
359 sb.append("\t");
360 }
361 if (gbrUl != null) {
slowr60d4d102017-08-16 18:33:58 -0700362 sb.append("gbrUl: ").append(gbrUl);
slowr13fa5b02017-08-08 16:32:31 -0700363 }
364
365 sb.append(",\n");
366 for (int i = 0; i < indentLevel + 1; i++) {
367 sb.append("\t");
368 }
369 if (mbrDl != null) {
slowr60d4d102017-08-16 18:33:58 -0700370 sb.append("mbrDl: ").append(mbrDl);
slowr13fa5b02017-08-08 16:32:31 -0700371 }
372
373 sb.append(",\n");
374 for (int i = 0; i < indentLevel + 1; i++) {
375 sb.append("\t");
376 }
377 if (mbrUl != null) {
slowr60d4d102017-08-16 18:33:58 -0700378 sb.append("mbrUl: ").append(mbrUl);
slowr13fa5b02017-08-08 16:32:31 -0700379 }
380
381 sb.append("\n");
382 for (int i = 0; i < indentLevel; i++) {
383 sb.append("\t");
384 }
385 sb.append("}");
386 }
387
388}
389