blob: a43fc70db6f5ad23af40c26fa4e71ddf72995166 [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.pdu;
6
slowr60d4d102017-08-16 18:33:58 -07007import com.fasterxml.jackson.annotation.JsonIgnore;
slowr13fa5b02017-08-08 16:32:31 -07008import org.onosproject.xran.codecs.api.CRNTI;
9import org.onosproject.xran.codecs.api.ECGI;
10import org.onosproject.xran.codecs.api.ENBUES1APID;
11import org.onosproject.xran.codecs.api.MMEUES1APID;
slowr60d4d102017-08-16 18:33:58 -070012import org.onosproject.xran.codecs.ber.BerByteArrayOutputStream;
13import org.onosproject.xran.codecs.ber.BerLength;
14import org.onosproject.xran.codecs.ber.BerTag;
slowr73b4eae2017-08-17 16:09:09 -070015import org.onosproject.xran.codecs.ber.types.string.BerUTF8String;
slowr13fa5b02017-08-08 16:32:31 -070016
17import java.io.IOException;
18import java.io.InputStream;
19import java.io.Serializable;
20
slowr8ddc2b12017-08-14 14:13:38 -070021public class UEContextUpdate implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -070022
slowr73b4eae2017-08-17 16:09:09 -070023 private static final long serialVersionUID = 1L;
slowr13fa5b02017-08-08 16:32:31 -070024
slowr73b4eae2017-08-17 16:09:09 -070025 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
slowr13fa5b02017-08-08 16:32:31 -070026
slowr73b4eae2017-08-17 16:09:09 -070027 @JsonIgnore
28 public byte[] code = null;
29 private CRNTI crnti = null;
30 private ECGI ecgi = null;
31 private MMEUES1APID mMEUES1APID = null;
32 private ENBUES1APID eNBUES1APID = null;
33 private BerUTF8String imsi = null;
slowr13fa5b02017-08-08 16:32:31 -070034
slowr73b4eae2017-08-17 16:09:09 -070035 public UEContextUpdate() {
36 }
slowr13fa5b02017-08-08 16:32:31 -070037
slowr73b4eae2017-08-17 16:09:09 -070038 public UEContextUpdate(byte[] code) {
39 this.code = code;
40 }
slowr13fa5b02017-08-08 16:32:31 -070041
slowr73b4eae2017-08-17 16:09:09 -070042 public void setCrnti(CRNTI crnti) {
43 this.crnti = crnti;
44 }
slowr13fa5b02017-08-08 16:32:31 -070045
slowr73b4eae2017-08-17 16:09:09 -070046 public CRNTI getCrnti() {
47 return crnti;
48 }
slowr13fa5b02017-08-08 16:32:31 -070049
slowr73b4eae2017-08-17 16:09:09 -070050 public void setEcgi(ECGI ecgi) {
51 this.ecgi = ecgi;
52 }
slowr13fa5b02017-08-08 16:32:31 -070053
slowr73b4eae2017-08-17 16:09:09 -070054 public ECGI getEcgi() {
55 return ecgi;
56 }
slowr13fa5b02017-08-08 16:32:31 -070057
slowr73b4eae2017-08-17 16:09:09 -070058 public void setMMEUES1APID(MMEUES1APID mMEUES1APID) {
59 this.mMEUES1APID = mMEUES1APID;
60 }
slowr13fa5b02017-08-08 16:32:31 -070061
slowr73b4eae2017-08-17 16:09:09 -070062 public MMEUES1APID getMMEUES1APID() {
63 return mMEUES1APID;
64 }
slowr13fa5b02017-08-08 16:32:31 -070065
slowr73b4eae2017-08-17 16:09:09 -070066 public void setENBUES1APID(ENBUES1APID eNBUES1APID) {
67 this.eNBUES1APID = eNBUES1APID;
68 }
slowr13fa5b02017-08-08 16:32:31 -070069
slowr73b4eae2017-08-17 16:09:09 -070070 public ENBUES1APID getENBUES1APID() {
71 return eNBUES1APID;
72 }
slowr13fa5b02017-08-08 16:32:31 -070073
slowr73b4eae2017-08-17 16:09:09 -070074 public void setImsi(BerUTF8String imsi) {
75 this.imsi = imsi;
76 }
slowr13fa5b02017-08-08 16:32:31 -070077
slowr73b4eae2017-08-17 16:09:09 -070078 public BerUTF8String getImsi() {
79 return imsi;
80 }
81
82 public int encode(BerByteArrayOutputStream os) throws IOException {
83 return encode(os, true);
84 }
85
86 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
87
88 if (code != null) {
89 for (int i = code.length - 1; i >= 0; i--) {
90 os.write(code[i]);
91 }
92 if (withTag) {
93 return tag.encode(os) + code.length;
94 }
95 return code.length;
slowr13fa5b02017-08-08 16:32:31 -070096 }
slowr73b4eae2017-08-17 16:09:09 -070097
98 int codeLength = 0;
99 if (imsi != null) {
100 codeLength += imsi.encode(os, false);
101 // write tag: CONTEXT_CLASS, PRIMITIVE, 4
102 os.write(0x84);
103 codeLength += 1;
104 }
105
106 codeLength += eNBUES1APID.encode(os, false);
107 // write tag: CONTEXT_CLASS, PRIMITIVE, 3
108 os.write(0x83);
109 codeLength += 1;
110
111 codeLength += mMEUES1APID.encode(os, false);
112 // write tag: CONTEXT_CLASS, PRIMITIVE, 2
113 os.write(0x82);
114 codeLength += 1;
115
116 codeLength += ecgi.encode(os, false);
117 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
118 os.write(0xA1);
119 codeLength += 1;
120
121 codeLength += crnti.encode(os, false);
122 // write tag: CONTEXT_CLASS, PRIMITIVE, 0
123 os.write(0x80);
124 codeLength += 1;
125
126 codeLength += BerLength.encodeLength(os, codeLength);
127
slowr13fa5b02017-08-08 16:32:31 -0700128 if (withTag) {
slowr73b4eae2017-08-17 16:09:09 -0700129 codeLength += tag.encode(os);
slowr13fa5b02017-08-08 16:32:31 -0700130 }
slowr73b4eae2017-08-17 16:09:09 -0700131
132 return codeLength;
133
slowr13fa5b02017-08-08 16:32:31 -0700134 }
135
slowr73b4eae2017-08-17 16:09:09 -0700136 public int decode(InputStream is) throws IOException {
137 return decode(is, true);
slowr13fa5b02017-08-08 16:32:31 -0700138 }
139
slowr73b4eae2017-08-17 16:09:09 -0700140 public int decode(InputStream is, boolean withTag) throws IOException {
141 int codeLength = 0;
142 int subCodeLength = 0;
143 BerTag berTag = new BerTag();
slowr13fa5b02017-08-08 16:32:31 -0700144
slowr73b4eae2017-08-17 16:09:09 -0700145 if (withTag) {
146 codeLength += tag.decodeAndCheck(is);
slowr13fa5b02017-08-08 16:32:31 -0700147 }
slowr13fa5b02017-08-08 16:32:31 -0700148
slowr73b4eae2017-08-17 16:09:09 -0700149 BerLength length = new BerLength();
150 codeLength += length.decode(is);
slowr13fa5b02017-08-08 16:32:31 -0700151
slowr73b4eae2017-08-17 16:09:09 -0700152 int totalLength = length.val;
153 codeLength += totalLength;
slowr13fa5b02017-08-08 16:32:31 -0700154
slowr73b4eae2017-08-17 16:09:09 -0700155 subCodeLength += berTag.decode(is);
156 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
157 crnti = new CRNTI();
158 subCodeLength += crnti.decode(is, false);
159 subCodeLength += berTag.decode(is);
160 }
161 else {
162 throw new IOException("Tag does not match the mandatory sequence element tag.");
163 }
slowr13fa5b02017-08-08 16:32:31 -0700164
slowr73b4eae2017-08-17 16:09:09 -0700165 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
166 ecgi = new ECGI();
167 subCodeLength += ecgi.decode(is, false);
168 subCodeLength += berTag.decode(is);
169 }
170 else {
171 throw new IOException("Tag does not match the mandatory sequence element tag.");
172 }
slowr13fa5b02017-08-08 16:32:31 -0700173
slowr73b4eae2017-08-17 16:09:09 -0700174 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
175 mMEUES1APID = new MMEUES1APID();
176 subCodeLength += mMEUES1APID.decode(is, false);
177 subCodeLength += berTag.decode(is);
178 }
179 else {
180 throw new IOException("Tag does not match the mandatory sequence element tag.");
181 }
slowr13fa5b02017-08-08 16:32:31 -0700182
slowr73b4eae2017-08-17 16:09:09 -0700183 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
184 eNBUES1APID = new ENBUES1APID();
185 subCodeLength += eNBUES1APID.decode(is, false);
186 if (subCodeLength == totalLength) {
187 return codeLength;
188 }
189 subCodeLength += berTag.decode(is);
190 }
191 else {
192 throw new IOException("Tag does not match the mandatory sequence element tag.");
193 }
194
195 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) {
196 imsi = new BerUTF8String();
197 subCodeLength += imsi.decode(is, false);
198 if (subCodeLength == totalLength) {
199 return codeLength;
200 }
201 }
202 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
203
204
205 }
206
207 public void encodeAndSave(int encodingSizeGuess) throws IOException {
208 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
209 encode(os, false);
210 code = os.getArray();
211 }
212
213 public String toString() {
214 StringBuilder sb = new StringBuilder();
215 appendAsString(sb, 0);
216 return sb.toString();
217 }
218
219 public void appendAsString(StringBuilder sb, int indentLevel) {
220
221 sb.append("{");
222 sb.append("\n");
223 for (int i = 0; i < indentLevel + 1; i++) {
224 sb.append("\t");
225 }
226 if (crnti != null) {
227 sb.append("crnti: ").append(crnti);
228 }
229 else {
230 sb.append("crnti: <empty-required-field>");
231 }
232
233 sb.append(",\n");
234 for (int i = 0; i < indentLevel + 1; i++) {
235 sb.append("\t");
236 }
237 if (ecgi != null) {
238 sb.append("ecgi: ");
239 ecgi.appendAsString(sb, indentLevel + 1);
240 }
241 else {
242 sb.append("ecgi: <empty-required-field>");
243 }
244
245 sb.append(",\n");
246 for (int i = 0; i < indentLevel + 1; i++) {
247 sb.append("\t");
248 }
249 if (mMEUES1APID != null) {
250 sb.append("mMEUES1APID: ").append(mMEUES1APID);
251 }
252 else {
253 sb.append("mMEUES1APID: <empty-required-field>");
254 }
255
256 sb.append(",\n");
257 for (int i = 0; i < indentLevel + 1; i++) {
258 sb.append("\t");
259 }
260 if (eNBUES1APID != null) {
261 sb.append("eNBUES1APID: ").append(eNBUES1APID);
262 }
263 else {
264 sb.append("eNBUES1APID: <empty-required-field>");
265 }
266
267 if (imsi != null) {
268 sb.append(",\n");
269 for (int i = 0; i < indentLevel + 1; i++) {
270 sb.append("\t");
271 }
272 sb.append("imsi: ").append(imsi);
273 }
274
275 sb.append("\n");
276 for (int i = 0; i < indentLevel; i++) {
277 sb.append("\t");
278 }
279 sb.append("}");
280 }
slowr13fa5b02017-08-08 16:32:31 -0700281}
282