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