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