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