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