blob: dd4f717d30a95aa9f1b05b69b6f64fb20436f198 [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.RelCause;
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 UEReleaseInd 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 crnti = null;
26 private ECGI ecgi = null;
27 private RelCause releaseCause = null;
28
29 public UEReleaseInd() {
30 }
31
32 public UEReleaseInd(byte[] code) {
33 this.code = code;
34 }
35
36 public CRNTI getCrnti() {
37 return crnti;
38 }
39
40 public void setCrnti(CRNTI crnti) {
41 this.crnti = crnti;
42 }
43
44 public ECGI getEcgi() {
45 return ecgi;
46 }
47
48 public void setEcgi(ECGI ecgi) {
49 this.ecgi = ecgi;
50 }
51
52 public RelCause getReleaseCause() {
53 return releaseCause;
54 }
55
56 public void setReleaseCause(RelCause releaseCause) {
57 this.releaseCause = releaseCause;
58 }
59
60 public int encode(BerByteArrayOutputStream os) throws IOException {
61 return encode(os, true);
62 }
63
64 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
65
66 if (code != null) {
67 for (int i = code.length - 1; i >= 0; i--) {
68 os.write(code[i]);
69 }
70 if (withTag) {
71 return tag.encode(os) + code.length;
72 }
73 return code.length;
74 }
75
76 int codeLength = 0;
77 codeLength += releaseCause.encode(os, false);
78 // write tag: CONTEXT_CLASS, PRIMITIVE, 2
79 os.write(0x82);
80 codeLength += 1;
81
82 codeLength += ecgi.encode(os, false);
83 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
84 os.write(0xA1);
85 codeLength += 1;
86
87 codeLength += crnti.encode(os, false);
88 // write tag: CONTEXT_CLASS, PRIMITIVE, 0
89 os.write(0x80);
90 codeLength += 1;
91
92 codeLength += BerLength.encodeLength(os, codeLength);
93
94 if (withTag) {
95 codeLength += tag.encode(os);
96 }
97
98 return codeLength;
99
100 }
101
102 public int decode(InputStream is) throws IOException {
103 return decode(is, true);
104 }
105
106 public int decode(InputStream is, boolean withTag) throws IOException {
107 int codeLength = 0;
108 int subCodeLength = 0;
109 BerTag berTag = new BerTag();
110
111 if (withTag) {
112 codeLength += tag.decodeAndCheck(is);
113 }
114
115 BerLength length = new BerLength();
116 codeLength += length.decode(is);
117
118 int totalLength = length.val;
119 codeLength += totalLength;
120
121 subCodeLength += berTag.decode(is);
122 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
123 crnti = new CRNTI();
124 subCodeLength += crnti.decode(is, false);
125 subCodeLength += berTag.decode(is);
126 } else {
127 throw new IOException("Tag does not match the mandatory sequence element tag.");
128 }
129
130 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
131 ecgi = new ECGI();
132 subCodeLength += ecgi.decode(is, false);
133 subCodeLength += berTag.decode(is);
134 } else {
135 throw new IOException("Tag does not match the mandatory sequence element tag.");
136 }
137
138 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
139 releaseCause = new RelCause();
140 subCodeLength += releaseCause.decode(is, false);
141 if (subCodeLength == totalLength) {
142 return codeLength;
143 }
144 }
145 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
146
147
148 }
149
150 public void encodeAndSave(int encodingSizeGuess) throws IOException {
151 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
152 encode(os, false);
153 code = os.getArray();
154 }
155
156 public String toString() {
157 StringBuilder sb = new StringBuilder();
158 appendAsString(sb, 0);
159 return sb.toString();
160 }
161
162 public void appendAsString(StringBuilder sb, int indentLevel) {
163
164 sb.append("{");
165 sb.append("\n");
166 for (int i = 0; i < indentLevel + 1; i++) {
167 sb.append("\t");
168 }
169 if (crnti != null) {
170 sb.append("crnti: ").append(crnti);
171 } else {
172 sb.append("crnti: <empty-required-field>");
173 }
174
175 sb.append(",\n");
176 for (int i = 0; i < indentLevel + 1; i++) {
177 sb.append("\t");
178 }
179 if (ecgi != null) {
180 sb.append("ecgi: ");
181 ecgi.appendAsString(sb, indentLevel + 1);
182 } else {
183 sb.append("ecgi: <empty-required-field>");
184 }
185
186 sb.append(",\n");
187 for (int i = 0; i < indentLevel + 1; i++) {
188 sb.append("\t");
189 }
190 if (releaseCause != null) {
191 sb.append("releaseCause: ").append(releaseCause);
192 } else {
193 sb.append("releaseCause: <empty-required-field>");
194 }
195
196 sb.append("\n");
197 for (int i = 0; i < indentLevel; i++) {
198 sb.append("\t");
199 }
200 sb.append("}");
201 }
202
203}
204