slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 1 | /** |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 2 | * This class file was automatically generated by jASN1 v1.8.2 (http://www.openmuc.org) |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 3 | */ |
| 4 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 5 | package org.onosproject.xran.asn1lib.pdu; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 6 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 7 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 8 | import com.fasterxml.jackson.annotation.JsonValue; |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 9 | import org.onosproject.xran.asn1lib.api.CRNTI; |
| 10 | import org.onosproject.xran.asn1lib.api.ECGI; |
| 11 | import org.onosproject.xran.asn1lib.api.SchedMeasRepPerServCell; |
| 12 | import org.onosproject.xran.asn1lib.ber.BerByteArrayOutputStream; |
| 13 | import org.onosproject.xran.asn1lib.ber.BerLength; |
| 14 | import org.onosproject.xran.asn1lib.ber.BerTag; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 15 | |
| 16 | import java.io.IOException; |
| 17 | import java.io.InputStream; |
| 18 | import java.io.Serializable; |
| 19 | import java.util.ArrayList; |
| 20 | import java.util.Iterator; |
| 21 | import java.util.List; |
| 22 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 23 | public class SchedMeasReportPerUE implements Serializable { |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 24 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 25 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 26 | private static final long serialVersionUID = 1L; |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 27 | @JsonIgnore |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 28 | public byte[] code = null; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 29 | private ECGI ecgi = null; |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 30 | private CRNTI crnti = null; |
| 31 | private SchedReportServCells schedReportServCells = null; |
| 32 | |
| 33 | public SchedMeasReportPerUE() { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 34 | } |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 35 | |
| 36 | public SchedMeasReportPerUE(byte[] code) { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 37 | this.code = code; |
| 38 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 39 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 40 | public ECGI getEcgi() { |
| 41 | return ecgi; |
| 42 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 43 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 44 | public void setEcgi(ECGI ecgi) { |
| 45 | this.ecgi = ecgi; |
| 46 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 47 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 48 | public CRNTI getCrnti() { |
| 49 | return crnti; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 50 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 51 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 52 | public void setCrnti(CRNTI crnti) { |
| 53 | this.crnti = crnti; |
| 54 | } |
| 55 | |
| 56 | public SchedReportServCells getSchedReportServCells() { |
| 57 | return schedReportServCells; |
| 58 | } |
| 59 | |
| 60 | public void setSchedReportServCells(SchedReportServCells schedReportServCells) { |
| 61 | this.schedReportServCells = schedReportServCells; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 62 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 63 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 64 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 65 | return encode(os, true); |
| 66 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 67 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 68 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 69 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 70 | if (code != null) { |
| 71 | for (int i = code.length - 1; i >= 0; i--) { |
| 72 | os.write(code[i]); |
| 73 | } |
| 74 | if (withTag) { |
| 75 | return tag.encode(os) + code.length; |
| 76 | } |
| 77 | return code.length; |
| 78 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 79 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 80 | int codeLength = 0; |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 81 | codeLength += schedReportServCells.encode(os, false); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 82 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 |
| 83 | os.write(0xA2); |
| 84 | codeLength += 1; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 85 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 86 | codeLength += crnti.encode(os, false); |
| 87 | // write tag: CONTEXT_CLASS, PRIMITIVE, 1 |
| 88 | os.write(0x81); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 89 | codeLength += 1; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 90 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 91 | codeLength += ecgi.encode(os, false); |
| 92 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 |
| 93 | os.write(0xA0); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 94 | codeLength += 1; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 95 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 96 | codeLength += BerLength.encodeLength(os, codeLength); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 97 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 98 | if (withTag) { |
| 99 | codeLength += tag.encode(os); |
| 100 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 101 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 102 | return codeLength; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 103 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | public int decode(InputStream is) throws IOException { |
| 107 | return decode(is, true); |
| 108 | } |
| 109 | |
| 110 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 111 | int codeLength = 0; |
| 112 | int subCodeLength = 0; |
| 113 | BerTag berTag = new BerTag(); |
| 114 | |
| 115 | if (withTag) { |
| 116 | codeLength += tag.decodeAndCheck(is); |
| 117 | } |
| 118 | |
| 119 | BerLength length = new BerLength(); |
| 120 | codeLength += length.decode(is); |
| 121 | |
| 122 | int totalLength = length.val; |
| 123 | codeLength += totalLength; |
| 124 | |
| 125 | subCodeLength += berTag.decode(is); |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 126 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 127 | ecgi = new ECGI(); |
| 128 | subCodeLength += ecgi.decode(is, false); |
| 129 | subCodeLength += berTag.decode(is); |
| 130 | } else { |
| 131 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 132 | } |
| 133 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 134 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { |
| 135 | crnti = new CRNTI(); |
| 136 | subCodeLength += crnti.decode(is, false); |
| 137 | subCodeLength += berTag.decode(is); |
| 138 | } else { |
| 139 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 140 | } |
| 141 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 142 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 143 | schedReportServCells = new SchedReportServCells(); |
| 144 | subCodeLength += schedReportServCells.decode(is, false); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 145 | if (subCodeLength == totalLength) { |
| 146 | return codeLength; |
| 147 | } |
| 148 | } |
| 149 | throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength); |
| 150 | |
| 151 | |
| 152 | } |
| 153 | |
| 154 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 155 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 156 | encode(os, false); |
| 157 | code = os.getArray(); |
| 158 | } |
| 159 | |
| 160 | public String toString() { |
| 161 | StringBuilder sb = new StringBuilder(); |
| 162 | appendAsString(sb, 0); |
| 163 | return sb.toString(); |
| 164 | } |
| 165 | |
| 166 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 167 | |
| 168 | sb.append("{"); |
| 169 | sb.append("\n"); |
| 170 | for (int i = 0; i < indentLevel + 1; i++) { |
| 171 | sb.append("\t"); |
| 172 | } |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 173 | if (ecgi != null) { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 174 | sb.append("ecgi: "); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 175 | ecgi.appendAsString(sb, indentLevel + 1); |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 176 | } else { |
| 177 | sb.append("ecgi: <empty-required-field>"); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | sb.append(",\n"); |
| 181 | for (int i = 0; i < indentLevel + 1; i++) { |
| 182 | sb.append("\t"); |
| 183 | } |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 184 | if (crnti != null) { |
| 185 | sb.append("crnti: ").append(crnti); |
| 186 | } else { |
| 187 | sb.append("crnti: <empty-required-field>"); |
| 188 | } |
| 189 | |
| 190 | sb.append(",\n"); |
| 191 | for (int i = 0; i < indentLevel + 1; i++) { |
| 192 | sb.append("\t"); |
| 193 | } |
| 194 | if (schedReportServCells != null) { |
| 195 | sb.append("schedReportServCells: "); |
| 196 | schedReportServCells.appendAsString(sb, indentLevel + 1); |
| 197 | } else { |
| 198 | sb.append("schedReportServCells: <empty-required-field>"); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | sb.append("\n"); |
| 202 | for (int i = 0; i < indentLevel; i++) { |
| 203 | sb.append("\t"); |
| 204 | } |
| 205 | sb.append("}"); |
| 206 | } |
| 207 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 208 | public static class SchedReportServCells implements Serializable { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 209 | |
| 210 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 211 | private static final long serialVersionUID = 1L; |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 212 | @JsonIgnore |
| 213 | public byte[] code = null; |
| 214 | private List<SchedMeasRepPerServCell> seqOf = null; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 215 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 216 | public SchedReportServCells() { |
| 217 | seqOf = new ArrayList<SchedMeasRepPerServCell>(); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 218 | } |
| 219 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 220 | public SchedReportServCells(byte[] code) { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 221 | this.code = code; |
| 222 | } |
| 223 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 224 | @JsonValue |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 225 | public List<SchedMeasRepPerServCell> getSchedMeasRepPerServCell() { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 226 | if (seqOf == null) { |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 227 | seqOf = new ArrayList<SchedMeasRepPerServCell>(); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 228 | } |
| 229 | return seqOf; |
| 230 | } |
| 231 | |
| 232 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 233 | return encode(os, true); |
| 234 | } |
| 235 | |
| 236 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 237 | |
| 238 | if (code != null) { |
| 239 | for (int i = code.length - 1; i >= 0; i--) { |
| 240 | os.write(code[i]); |
| 241 | } |
| 242 | if (withTag) { |
| 243 | return tag.encode(os) + code.length; |
| 244 | } |
| 245 | return code.length; |
| 246 | } |
| 247 | |
| 248 | int codeLength = 0; |
| 249 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 250 | codeLength += seqOf.get(i).encode(os, true); |
| 251 | } |
| 252 | |
| 253 | codeLength += BerLength.encodeLength(os, codeLength); |
| 254 | |
| 255 | if (withTag) { |
| 256 | codeLength += tag.encode(os); |
| 257 | } |
| 258 | |
| 259 | return codeLength; |
| 260 | } |
| 261 | |
| 262 | public int decode(InputStream is) throws IOException { |
| 263 | return decode(is, true); |
| 264 | } |
| 265 | |
| 266 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 267 | int codeLength = 0; |
| 268 | int subCodeLength = 0; |
| 269 | if (withTag) { |
| 270 | codeLength += tag.decodeAndCheck(is); |
| 271 | } |
| 272 | |
| 273 | BerLength length = new BerLength(); |
| 274 | codeLength += length.decode(is); |
| 275 | int totalLength = length.val; |
| 276 | |
| 277 | while (subCodeLength < totalLength) { |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 278 | SchedMeasRepPerServCell element = new SchedMeasRepPerServCell(); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 279 | subCodeLength += element.decode(is, true); |
| 280 | seqOf.add(element); |
| 281 | } |
| 282 | if (subCodeLength != totalLength) { |
| 283 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 284 | |
| 285 | } |
| 286 | codeLength += subCodeLength; |
| 287 | |
| 288 | return codeLength; |
| 289 | } |
| 290 | |
| 291 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 292 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 293 | encode(os, false); |
| 294 | code = os.getArray(); |
| 295 | } |
| 296 | |
| 297 | public String toString() { |
| 298 | StringBuilder sb = new StringBuilder(); |
| 299 | appendAsString(sb, 0); |
| 300 | return sb.toString(); |
| 301 | } |
| 302 | |
| 303 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 304 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 305 | sb.append("{\n"); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 306 | for (int i = 0; i < indentLevel + 1; i++) { |
| 307 | sb.append("\t"); |
| 308 | } |
| 309 | if (seqOf == null) { |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 310 | sb.append("null"); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 311 | } else { |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 312 | Iterator<SchedMeasRepPerServCell> it = seqOf.iterator(); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 313 | if (it.hasNext()) { |
| 314 | it.next().appendAsString(sb, indentLevel + 1); |
| 315 | while (it.hasNext()) { |
| 316 | sb.append(",\n"); |
| 317 | for (int i = 0; i < indentLevel + 1; i++) { |
| 318 | sb.append("\t"); |
| 319 | } |
| 320 | it.next().appendAsString(sb, indentLevel + 1); |
| 321 | } |
| 322 | } |
| 323 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 324 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 325 | sb.append("\n"); |
| 326 | for (int i = 0; i < indentLevel; i++) { |
| 327 | sb.append("\t"); |
| 328 | } |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame^] | 329 | sb.append("}"); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 330 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 331 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 332 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 333 | |
| 334 | } |
| 335 | |