slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 1 | /** |
| 2 | * This class file was automatically generated by jASN1 v1.8.0 (http://www.openmuc.org) |
| 3 | */ |
| 4 | package org.onosproject.xran.codecs.pdu; |
| 5 | |
| 6 | import org.onosproject.xran.codecs.api.CRNTI; |
| 7 | import org.onosproject.xran.codecs.api.ECGI; |
| 8 | import org.onosproject.xran.codecs.api.PCIARFCN; |
| 9 | import org.onosproject.xran.codecs.api.XICICPA; |
| 10 | import org.openmuc.jasn1.ber.BerByteArrayOutputStream; |
| 11 | import org.openmuc.jasn1.ber.BerLength; |
| 12 | import org.openmuc.jasn1.ber.BerTag; |
| 13 | import org.openmuc.jasn1.ber.types.BerBitString; |
| 14 | import org.openmuc.jasn1.ber.types.BerInteger; |
| 15 | import java.io.IOException; |
| 16 | import java.io.InputStream; |
| 17 | import java.io.Serializable; |
| 18 | |
| 19 | public class XICICConfig 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 ECGI ecgi = null; |
| 27 | private PCIARFCN pciArfcn = null; |
| 28 | private CRNTI crnti = null; |
| 29 | private XICICPA pa = null; |
| 30 | private BerInteger startPrbDl = null; |
| 31 | private BerInteger endPrbDl = null; |
| 32 | private BerBitString subframeBitmaskDl = null; |
| 33 | private BerInteger p0UePusch = null; |
| 34 | private BerInteger startPrbUl = null; |
| 35 | private BerInteger endPrbUl = null; |
| 36 | private BerBitString subframeBitmaskUl = null; |
| 37 | |
| 38 | public XICICConfig() { |
| 39 | } |
| 40 | |
| 41 | public XICICConfig(byte[] code) { |
| 42 | this.code = code; |
| 43 | } |
| 44 | |
| 45 | public void setEcgi(ECGI ecgi) { |
| 46 | this.ecgi = ecgi; |
| 47 | } |
| 48 | |
| 49 | public ECGI getEcgi() { |
| 50 | return ecgi; |
| 51 | } |
| 52 | |
| 53 | public void setPciArfcn(PCIARFCN pciArfcn) { |
| 54 | this.pciArfcn = pciArfcn; |
| 55 | } |
| 56 | |
| 57 | public PCIARFCN getPciArfcn() { |
| 58 | return pciArfcn; |
| 59 | } |
| 60 | |
| 61 | public void setCrnti(CRNTI crnti) { |
| 62 | this.crnti = crnti; |
| 63 | } |
| 64 | |
| 65 | public CRNTI getCrnti() { |
| 66 | return crnti; |
| 67 | } |
| 68 | |
| 69 | public void setPa(XICICPA pa) { |
| 70 | this.pa = pa; |
| 71 | } |
| 72 | |
| 73 | public XICICPA getPa() { |
| 74 | return pa; |
| 75 | } |
| 76 | |
| 77 | public void setStartPrbDl(BerInteger startPrbDl) { |
| 78 | this.startPrbDl = startPrbDl; |
| 79 | } |
| 80 | |
| 81 | public BerInteger getStartPrbDl() { |
| 82 | return startPrbDl; |
| 83 | } |
| 84 | |
| 85 | public void setEndPrbDl(BerInteger endPrbDl) { |
| 86 | this.endPrbDl = endPrbDl; |
| 87 | } |
| 88 | |
| 89 | public BerInteger getEndPrbDl() { |
| 90 | return endPrbDl; |
| 91 | } |
| 92 | |
| 93 | public void setSubframeBitmaskDl(BerBitString subframeBitmaskDl) { |
| 94 | this.subframeBitmaskDl = subframeBitmaskDl; |
| 95 | } |
| 96 | |
| 97 | public BerBitString getSubframeBitmaskDl() { |
| 98 | return subframeBitmaskDl; |
| 99 | } |
| 100 | |
| 101 | public void setP0UePusch(BerInteger p0UePusch) { |
| 102 | this.p0UePusch = p0UePusch; |
| 103 | } |
| 104 | |
| 105 | public BerInteger getP0UePusch() { |
| 106 | return p0UePusch; |
| 107 | } |
| 108 | |
| 109 | public void setStartPrbUl(BerInteger startPrbUl) { |
| 110 | this.startPrbUl = startPrbUl; |
| 111 | } |
| 112 | |
| 113 | public BerInteger getStartPrbUl() { |
| 114 | return startPrbUl; |
| 115 | } |
| 116 | |
| 117 | public void setEndPrbUl(BerInteger endPrbUl) { |
| 118 | this.endPrbUl = endPrbUl; |
| 119 | } |
| 120 | |
| 121 | public BerInteger getEndPrbUl() { |
| 122 | return endPrbUl; |
| 123 | } |
| 124 | |
| 125 | public void setSubframeBitmaskUl(BerBitString subframeBitmaskUl) { |
| 126 | this.subframeBitmaskUl = subframeBitmaskUl; |
| 127 | } |
| 128 | |
| 129 | public BerBitString getSubframeBitmaskUl() { |
| 130 | return subframeBitmaskUl; |
| 131 | } |
| 132 | |
| 133 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 134 | return encode(os, true); |
| 135 | } |
| 136 | |
| 137 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 138 | |
| 139 | if (code != null) { |
| 140 | for (int i = code.length - 1; i >= 0; i--) { |
| 141 | os.write(code[i]); |
| 142 | } |
| 143 | if (withTag) { |
| 144 | return tag.encode(os) + code.length; |
| 145 | } |
| 146 | return code.length; |
| 147 | } |
| 148 | |
| 149 | int codeLength = 0; |
| 150 | codeLength += subframeBitmaskUl.encode(os, false); |
| 151 | // write tag: CONTEXT_CLASS, PRIMITIVE, 10 |
| 152 | os.write(0x8A); |
| 153 | codeLength += 1; |
| 154 | |
| 155 | codeLength += endPrbUl.encode(os, false); |
| 156 | // write tag: CONTEXT_CLASS, PRIMITIVE, 9 |
| 157 | os.write(0x89); |
| 158 | codeLength += 1; |
| 159 | |
| 160 | codeLength += startPrbUl.encode(os, false); |
| 161 | // write tag: CONTEXT_CLASS, PRIMITIVE, 8 |
| 162 | os.write(0x88); |
| 163 | codeLength += 1; |
| 164 | |
| 165 | codeLength += p0UePusch.encode(os, false); |
| 166 | // write tag: CONTEXT_CLASS, PRIMITIVE, 7 |
| 167 | os.write(0x87); |
| 168 | codeLength += 1; |
| 169 | |
| 170 | codeLength += subframeBitmaskDl.encode(os, false); |
| 171 | // write tag: CONTEXT_CLASS, PRIMITIVE, 6 |
| 172 | os.write(0x86); |
| 173 | codeLength += 1; |
| 174 | |
| 175 | codeLength += endPrbDl.encode(os, false); |
| 176 | // write tag: CONTEXT_CLASS, PRIMITIVE, 5 |
| 177 | os.write(0x85); |
| 178 | codeLength += 1; |
| 179 | |
| 180 | codeLength += startPrbDl.encode(os, false); |
| 181 | // write tag: CONTEXT_CLASS, PRIMITIVE, 4 |
| 182 | os.write(0x84); |
| 183 | codeLength += 1; |
| 184 | |
| 185 | codeLength += pa.encode(os, false); |
| 186 | // write tag: CONTEXT_CLASS, PRIMITIVE, 3 |
| 187 | os.write(0x83); |
| 188 | codeLength += 1; |
| 189 | |
| 190 | codeLength += crnti.encode(os, false); |
| 191 | // write tag: CONTEXT_CLASS, PRIMITIVE, 2 |
| 192 | os.write(0x82); |
| 193 | codeLength += 1; |
| 194 | |
| 195 | codeLength += pciArfcn.encode(os, false); |
| 196 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 |
| 197 | os.write(0xA1); |
| 198 | codeLength += 1; |
| 199 | |
| 200 | codeLength += ecgi.encode(os, false); |
| 201 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 |
| 202 | os.write(0xA0); |
| 203 | codeLength += 1; |
| 204 | |
| 205 | codeLength += BerLength.encodeLength(os, codeLength); |
| 206 | |
| 207 | if (withTag) { |
| 208 | codeLength += tag.encode(os); |
| 209 | } |
| 210 | |
| 211 | return codeLength; |
| 212 | |
| 213 | } |
| 214 | |
| 215 | public int decode(InputStream is) throws IOException { |
| 216 | return decode(is, true); |
| 217 | } |
| 218 | |
| 219 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 220 | int codeLength = 0; |
| 221 | int subCodeLength = 0; |
| 222 | BerTag berTag = new BerTag(); |
| 223 | |
| 224 | if (withTag) { |
| 225 | codeLength += tag.decodeAndCheck(is); |
| 226 | } |
| 227 | |
| 228 | BerLength length = new BerLength(); |
| 229 | codeLength += length.decode(is); |
| 230 | |
| 231 | int totalLength = length.val; |
| 232 | codeLength += totalLength; |
| 233 | |
| 234 | subCodeLength += berTag.decode(is); |
| 235 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { |
| 236 | ecgi = new ECGI(); |
| 237 | subCodeLength += ecgi.decode(is, false); |
| 238 | subCodeLength += berTag.decode(is); |
| 239 | } |
| 240 | else { |
| 241 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 242 | } |
| 243 | |
| 244 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { |
| 245 | pciArfcn = new PCIARFCN(); |
| 246 | subCodeLength += pciArfcn.decode(is, false); |
| 247 | subCodeLength += berTag.decode(is); |
| 248 | } |
| 249 | else { |
| 250 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 251 | } |
| 252 | |
| 253 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { |
| 254 | crnti = new CRNTI(); |
| 255 | subCodeLength += crnti.decode(is, false); |
| 256 | subCodeLength += berTag.decode(is); |
| 257 | } |
| 258 | else { |
| 259 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 260 | } |
| 261 | |
| 262 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) { |
| 263 | pa = new XICICPA(); |
| 264 | subCodeLength += pa.decode(is, false); |
| 265 | subCodeLength += berTag.decode(is); |
| 266 | } |
| 267 | else { |
| 268 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 269 | } |
| 270 | |
| 271 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) { |
| 272 | startPrbDl = new BerInteger(); |
| 273 | subCodeLength += startPrbDl.decode(is, false); |
| 274 | subCodeLength += berTag.decode(is); |
| 275 | } |
| 276 | else { |
| 277 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 278 | } |
| 279 | |
| 280 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) { |
| 281 | endPrbDl = new BerInteger(); |
| 282 | subCodeLength += endPrbDl.decode(is, false); |
| 283 | subCodeLength += berTag.decode(is); |
| 284 | } |
| 285 | else { |
| 286 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 287 | } |
| 288 | |
| 289 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) { |
| 290 | subframeBitmaskDl = new BerBitString(); |
| 291 | subCodeLength += subframeBitmaskDl.decode(is, false); |
| 292 | subCodeLength += berTag.decode(is); |
| 293 | } |
| 294 | else { |
| 295 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 296 | } |
| 297 | |
| 298 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) { |
| 299 | p0UePusch = new BerInteger(); |
| 300 | subCodeLength += p0UePusch.decode(is, false); |
| 301 | subCodeLength += berTag.decode(is); |
| 302 | } |
| 303 | else { |
| 304 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 305 | } |
| 306 | |
| 307 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) { |
| 308 | startPrbUl = new BerInteger(); |
| 309 | subCodeLength += startPrbUl.decode(is, false); |
| 310 | subCodeLength += berTag.decode(is); |
| 311 | } |
| 312 | else { |
| 313 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 314 | } |
| 315 | |
| 316 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) { |
| 317 | endPrbUl = new BerInteger(); |
| 318 | subCodeLength += endPrbUl.decode(is, false); |
| 319 | subCodeLength += berTag.decode(is); |
| 320 | } |
| 321 | else { |
| 322 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 323 | } |
| 324 | |
| 325 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) { |
| 326 | subframeBitmaskUl = new BerBitString(); |
| 327 | subCodeLength += subframeBitmaskUl.decode(is, false); |
| 328 | if (subCodeLength == totalLength) { |
| 329 | return codeLength; |
| 330 | } |
| 331 | } |
| 332 | throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength); |
| 333 | |
| 334 | |
| 335 | } |
| 336 | |
| 337 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 338 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 339 | encode(os, false); |
| 340 | code = os.getArray(); |
| 341 | } |
| 342 | |
| 343 | public String toString() { |
| 344 | StringBuilder sb = new StringBuilder(); |
| 345 | appendAsString(sb, 0); |
| 346 | return sb.toString(); |
| 347 | } |
| 348 | |
| 349 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 350 | |
| 351 | sb.append("{"); |
| 352 | sb.append("\n"); |
| 353 | for (int i = 0; i < indentLevel + 1; i++) { |
| 354 | sb.append("\t"); |
| 355 | } |
| 356 | if (ecgi != null) { |
| 357 | sb.append("\"ecgi\": "); |
| 358 | ecgi.appendAsString(sb, indentLevel + 1); |
| 359 | } |
| 360 | |
| 361 | sb.append(",\n"); |
| 362 | for (int i = 0; i < indentLevel + 1; i++) { |
| 363 | sb.append("\t"); |
| 364 | } |
| 365 | if (pciArfcn != null) { |
| 366 | sb.append("\"pciArfcn\": "); |
| 367 | pciArfcn.appendAsString(sb, indentLevel + 1); |
| 368 | } |
| 369 | |
| 370 | sb.append(",\n"); |
| 371 | for (int i = 0; i < indentLevel + 1; i++) { |
| 372 | sb.append("\t"); |
| 373 | } |
| 374 | if (crnti != null) { |
| 375 | sb.append("\"crnti\": ").append(crnti); |
| 376 | } |
| 377 | |
| 378 | sb.append(",\n"); |
| 379 | for (int i = 0; i < indentLevel + 1; i++) { |
| 380 | sb.append("\t"); |
| 381 | } |
| 382 | if (pa != null) { |
| 383 | sb.append("\"pa\": ").append(pa); |
| 384 | } |
| 385 | |
| 386 | sb.append(",\n"); |
| 387 | for (int i = 0; i < indentLevel + 1; i++) { |
| 388 | sb.append("\t"); |
| 389 | } |
| 390 | if (startPrbDl != null) { |
| 391 | sb.append("\"startPrbDl\": ").append(startPrbDl); |
| 392 | } |
| 393 | |
| 394 | sb.append(",\n"); |
| 395 | for (int i = 0; i < indentLevel + 1; i++) { |
| 396 | sb.append("\t"); |
| 397 | } |
| 398 | if (endPrbDl != null) { |
| 399 | sb.append("\"endPrbDl\": ").append(endPrbDl); |
| 400 | } |
| 401 | |
| 402 | sb.append(",\n"); |
| 403 | for (int i = 0; i < indentLevel + 1; i++) { |
| 404 | sb.append("\t"); |
| 405 | } |
| 406 | if (subframeBitmaskDl != null) { |
| 407 | sb.append("\"subframeBitmaskDl\": ").append(subframeBitmaskDl); |
| 408 | } |
| 409 | |
| 410 | sb.append(",\n"); |
| 411 | for (int i = 0; i < indentLevel + 1; i++) { |
| 412 | sb.append("\t"); |
| 413 | } |
| 414 | if (p0UePusch != null) { |
| 415 | sb.append("\"p0UePusch\": ").append(p0UePusch); |
| 416 | } |
| 417 | |
| 418 | sb.append(",\n"); |
| 419 | for (int i = 0; i < indentLevel + 1; i++) { |
| 420 | sb.append("\t"); |
| 421 | } |
| 422 | if (startPrbUl != null) { |
| 423 | sb.append("\"startPrbUl\": ").append(startPrbUl); |
| 424 | } |
| 425 | |
| 426 | sb.append(",\n"); |
| 427 | for (int i = 0; i < indentLevel + 1; i++) { |
| 428 | sb.append("\t"); |
| 429 | } |
| 430 | if (endPrbUl != null) { |
| 431 | sb.append("\"endPrbUl\": ").append(endPrbUl); |
| 432 | } |
| 433 | |
| 434 | sb.append(",\n"); |
| 435 | for (int i = 0; i < indentLevel + 1; i++) { |
| 436 | sb.append("\t"); |
| 437 | } |
| 438 | if (subframeBitmaskUl != null) { |
| 439 | sb.append("\"subframeBitmaskUl\": ").append(subframeBitmaskUl); |
| 440 | } |
| 441 | |
| 442 | sb.append("\n"); |
| 443 | for (int i = 0; i < indentLevel; i++) { |
| 444 | sb.append("\t"); |
| 445 | } |
| 446 | sb.append("}"); |
| 447 | } |
| 448 | |
| 449 | } |
| 450 | |