blob: 287316ae66e2a104153fd53ce09e6615a9fc9dca [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;
slowr13fa5b02017-08-08 16:32:31 -070015
16import java.io.IOException;
17import java.io.InputStream;
18import java.io.Serializable;
19
slowr8ddc2b12017-08-14 14:13:38 -070020public class UEContextUpdate implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -070021
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 CRNTI crnti = null;
29 private ECGI ecgi = null;
30 private MMEUES1APID mMEUES1APID = null;
31 private ENBUES1APID eNBUES1APID = null;
32
slowr8ddc2b12017-08-14 14:13:38 -070033 public UEContextUpdate() {
slowr13fa5b02017-08-08 16:32:31 -070034 }
35
slowr8ddc2b12017-08-14 14:13:38 -070036 public UEContextUpdate(byte[] code) {
slowr13fa5b02017-08-08 16:32:31 -070037 this.code = code;
38 }
39
40 public void setCrnti(CRNTI crnti) {
41 this.crnti = crnti;
42 }
43
44 public CRNTI getCrnti() {
45 return crnti;
46 }
47
48 public void setEcgi(ECGI ecgi) {
49 this.ecgi = ecgi;
50 }
51
52 public ECGI getEcgi() {
53 return ecgi;
54 }
55
56 public void setMMEUES1APID(MMEUES1APID mMEUES1APID) {
57 this.mMEUES1APID = mMEUES1APID;
58 }
59
60 public MMEUES1APID getMMEUES1APID() {
61 return mMEUES1APID;
62 }
63
64 public void setENBUES1APID(ENBUES1APID eNBUES1APID) {
65 this.eNBUES1APID = eNBUES1APID;
66 }
67
68 public ENBUES1APID getENBUES1APID() {
69 return eNBUES1APID;
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 += eNBUES1APID.encode(os, false);
90 // write tag: CONTEXT_CLASS, PRIMITIVE, 3
91 os.write(0x83);
92 codeLength += 1;
93
94 codeLength += mMEUES1APID.encode(os, false);
95 // write tag: CONTEXT_CLASS, PRIMITIVE, 2
96 os.write(0x82);
97 codeLength += 1;
98
99 codeLength += ecgi.encode(os, false);
100 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
101 os.write(0xA1);
102 codeLength += 1;
103
104 codeLength += crnti.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 crnti = new CRNTI();
141 subCodeLength += crnti.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.CONSTRUCTED, 1)) {
149 ecgi = new ECGI();
150 subCodeLength += ecgi.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 mMEUES1APID = new MMEUES1APID();
159 subCodeLength += mMEUES1APID.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 eNBUES1APID = new ENBUES1APID();
168 subCodeLength += eNBUES1APID.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 (crnti != null) {
slowr60d4d102017-08-16 18:33:58 -0700198 sb.append("crnti: ").append(crnti);
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 (ecgi != null) {
slowr60d4d102017-08-16 18:33:58 -0700206 sb.append("ecgi: ");
slowr13fa5b02017-08-08 16:32:31 -0700207 ecgi.appendAsString(sb, indentLevel + 1);
208 }
209
210 sb.append(",\n");
211 for (int i = 0; i < indentLevel + 1; i++) {
212 sb.append("\t");
213 }
214 if (mMEUES1APID != null) {
slowr60d4d102017-08-16 18:33:58 -0700215 sb.append("mMEUES1APID: ").append(mMEUES1APID);
slowr13fa5b02017-08-08 16:32:31 -0700216 }
217
218 sb.append(",\n");
219 for (int i = 0; i < indentLevel + 1; i++) {
220 sb.append("\t");
221 }
222 if (eNBUES1APID != null) {
slowr60d4d102017-08-16 18:33:58 -0700223 sb.append("eNBUES1APID: ").append(eNBUES1APID);
slowr13fa5b02017-08-08 16:32:31 -0700224 }
225
226 sb.append("\n");
227 for (int i = 0; i < indentLevel; i++) {
228 sb.append("\t");
229 }
230 sb.append("}");
231 }
232
233}
234