blob: 32a4eda76c6930051799e9dfc5b081ea274e1824 [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.BerBoolean;
12import org.onosproject.xran.asn1lib.ber.types.BerEnum;
13import org.onosproject.xran.asn1lib.ber.types.BerInteger;
14
15import java.io.IOException;
16import java.io.InputStream;
17import java.io.Serializable;
18
19
20public class CACap implements Serializable {
21
22 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
23 private static final long serialVersionUID = 1L;
24 @JsonIgnore
25 public byte[] code = null;
26 private BerInteger band = null;
27 private BerEnum caclassdl = null;
28 private BerEnum caclassul = null;
29 private BerBoolean crossCarrierSched = null;
30
31 public CACap() {
32 }
33
34 public CACap(byte[] code) {
35 this.code = code;
36 }
37
38 public BerInteger getBand() {
39 return band;
40 }
41
42 public void setBand(BerInteger band) {
43 this.band = band;
44 }
45
46 public BerEnum getCaclassdl() {
47 return caclassdl;
48 }
49
50 public void setCaclassdl(BerEnum caclassdl) {
51 this.caclassdl = caclassdl;
52 }
53
54 public BerEnum getCaclassul() {
55 return caclassul;
56 }
57
58 public void setCaclassul(BerEnum caclassul) {
59 this.caclassul = caclassul;
60 }
61
62 public BerBoolean getCrossCarrierSched() {
63 return crossCarrierSched;
64 }
65
66 public void setCrossCarrierSched(BerBoolean crossCarrierSched) {
67 this.crossCarrierSched = crossCarrierSched;
68 }
69
70 public int encode(BerByteArrayOutputStream os) throws IOException {
71 return encode(os, true);
72 }
73
74 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
75
76 if (code != null) {
77 for (int i = code.length - 1; i >= 0; i--) {
78 os.write(code[i]);
79 }
80 if (withTag) {
81 return tag.encode(os) + code.length;
82 }
83 return code.length;
84 }
85
86 int codeLength = 0;
87 codeLength += crossCarrierSched.encode(os, false);
88 // write tag: CONTEXT_CLASS, PRIMITIVE, 3
89 os.write(0x83);
90 codeLength += 1;
91
92 codeLength += caclassul.encode(os, false);
93 // write tag: CONTEXT_CLASS, PRIMITIVE, 2
94 os.write(0x82);
95 codeLength += 1;
96
97 codeLength += caclassdl.encode(os, false);
98 // write tag: CONTEXT_CLASS, PRIMITIVE, 1
99 os.write(0x81);
100 codeLength += 1;
101
102 codeLength += band.encode(os, false);
103 // write tag: CONTEXT_CLASS, PRIMITIVE, 0
104 os.write(0x80);
105 codeLength += 1;
106
107 codeLength += BerLength.encodeLength(os, codeLength);
108
109 if (withTag) {
110 codeLength += tag.encode(os);
111 }
112
113 return codeLength;
114
115 }
116
117 public int decode(InputStream is) throws IOException {
118 return decode(is, true);
119 }
120
121 public int decode(InputStream is, boolean withTag) throws IOException {
122 int codeLength = 0;
123 int subCodeLength = 0;
124 BerTag berTag = new BerTag();
125
126 if (withTag) {
127 codeLength += tag.decodeAndCheck(is);
128 }
129
130 BerLength length = new BerLength();
131 codeLength += length.decode(is);
132
133 int totalLength = length.val;
134 codeLength += totalLength;
135
136 subCodeLength += berTag.decode(is);
137 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
138 band = new BerInteger();
139 subCodeLength += band.decode(is, false);
140 subCodeLength += berTag.decode(is);
141 } else {
142 throw new IOException("Tag does not match the mandatory sequence element tag.");
143 }
144
145 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
146 caclassdl = new BerEnum();
147 subCodeLength += caclassdl.decode(is, false);
148 subCodeLength += berTag.decode(is);
149 } else {
150 throw new IOException("Tag does not match the mandatory sequence element tag.");
151 }
152
153 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
154 caclassul = new BerEnum();
155 subCodeLength += caclassul.decode(is, false);
156 subCodeLength += berTag.decode(is);
157 } else {
158 throw new IOException("Tag does not match the mandatory sequence element tag.");
159 }
160
161 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
162 crossCarrierSched = new BerBoolean();
163 subCodeLength += crossCarrierSched.decode(is, false);
164 if (subCodeLength == totalLength) {
165 return codeLength;
166 }
167 }
168 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
169
170
171 }
172
173 public void encodeAndSave(int encodingSizeGuess) throws IOException {
174 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
175 encode(os, false);
176 code = os.getArray();
177 }
178
179 public String toString() {
180 StringBuilder sb = new StringBuilder();
181 appendAsString(sb, 0);
182 return sb.toString();
183 }
184
185 public void appendAsString(StringBuilder sb, int indentLevel) {
186
187 sb.append("{");
188 sb.append("\n");
189 for (int i = 0; i < indentLevel + 1; i++) {
190 sb.append("\t");
191 }
192 if (band != null) {
193 sb.append("band: ").append(band);
194 } else {
195 sb.append("band: <empty-required-field>");
196 }
197
198 sb.append(",\n");
199 for (int i = 0; i < indentLevel + 1; i++) {
200 sb.append("\t");
201 }
202 if (caclassdl != null) {
203 sb.append("caclassdl: ").append(caclassdl);
204 } else {
205 sb.append("caclassdl: <empty-required-field>");
206 }
207
208 sb.append(",\n");
209 for (int i = 0; i < indentLevel + 1; i++) {
210 sb.append("\t");
211 }
212 if (caclassul != null) {
213 sb.append("caclassul: ").append(caclassul);
214 } else {
215 sb.append("caclassul: <empty-required-field>");
216 }
217
218 sb.append(",\n");
219 for (int i = 0; i < indentLevel + 1; i++) {
220 sb.append("\t");
221 }
222 if (crossCarrierSched != null) {
223 sb.append("crossCarrierSched: ").append(crossCarrierSched);
224 } else {
225 sb.append("crossCarrierSched: <empty-required-field>");
226 }
227
228 sb.append("\n");
229 for (int i = 0; i < indentLevel; i++) {
230 sb.append("\t");
231 }
232 sb.append("}");
233 }
234
235}
236