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