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