コード例 #1
0
  private void _decode(AsnInputStream ansIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {

    AsnInputStream ais = ansIS.readSequenceStreamData(length);

    int tag = ais.readTag();

    // ussd-DataCodingScheme USSD-DataCodingScheme
    if (ais.getTagClass() != Tag.CLASS_UNIVERSAL || !ais.isTagPrimitive())
      throw new MAPParsingComponentException(
          "Error while decoding UnstructuredSSResponseIndication: Parameter ussd-DataCodingScheme bad tag class or not primitive",
          MAPParsingComponentExceptionReason.MistypedParameter);

    int length1 = ais.readLength();
    this.ussdDataCodingSch = new CBSDataCodingSchemeImpl(ais.readOctetStringData(length1)[0]);

    tag = ais.readTag();

    // ussd-String USSD-String
    if (ais.getTagClass() != Tag.CLASS_UNIVERSAL || !ais.isTagPrimitive())
      throw new MAPParsingComponentException(
          "Error while decoding UnstructuredSSResponseIndication: Parameter ussd-String bad tag class or not primitive",
          MAPParsingComponentExceptionReason.MistypedParameter);

    this.ussdString = new USSDStringImpl(this.ussdDataCodingSch);
    ((USSDStringImpl) this.ussdString).decodeAll(ais);
  }
コード例 #2
0
  @Test(groups = {"functional.decode", "isup"})
  public void testDecode() throws Exception {

    byte[] data = this.getData();
    AsnInputStream ais = new AsnInputStream(data);
    OriginalCalledNumberCapImpl elem = new OriginalCalledNumberCapImpl();
    int tag = ais.readTag();
    elem.decodeAll(ais);
    OriginalCalledNumber ocn = elem.getOriginalCalledNumber();
    assertTrue(Arrays.equals(elem.getData(), this.getIntData()));
    assertEquals(ocn.getNatureOfAddressIndicator(), 3);
    assertTrue(ocn.getAddress().equals("7010900"));
    assertEquals(ocn.getNumberingPlanIndicator(), 1);
    assertEquals(ocn.getAddressRepresentationRestrictedIndicator(), 1);

    data = this.getData2();
    ais = new AsnInputStream(data);
    elem = new OriginalCalledNumberCapImpl();
    tag = ais.readTag();
    elem.decodeAll(ais);
    ocn = elem.getOriginalCalledNumber();
    assertEquals(ocn.getNumberingPlanIndicator(), 1);
    assertEquals(ocn.getAddressRepresentationRestrictedIndicator(), 0);
    assertEquals(ocn.getNatureOfAddressIndicator(), 4);
    assertEquals(ocn.getAddress(), "c48980491770922937");
  }
コード例 #3
0
ファイル: LocationAreaTest.java プロジェクト: SergeyLee/jss7
  @Test(groups = {"functional.decode", "primitives"})
  public void testDecode() throws Exception {

    byte[] data = this.getData1();

    AsnInputStream asn = new AsnInputStream(data);
    int tag = asn.readTag();

    LocationAreaImpl prim = new LocationAreaImpl();
    prim.decodeAll(asn);

    assertEquals(tag, LocationAreaImpl._TAG_laiFixedLength);
    assertEquals(asn.getTagClass(), Tag.CLASS_CONTEXT_SPECIFIC);

    LAIFixedLength lai = prim.getLAIFixedLength();
    assertEquals(lai.getMCC(), 249);
    assertEquals(lai.getMNC(), 1);
    assertEquals(lai.getLac(), 14010);
    assertNull(prim.getLAC());

    data = this.getData2();

    asn = new AsnInputStream(data);
    tag = asn.readTag();

    prim = new LocationAreaImpl();
    prim.decodeAll(asn);

    assertEquals(tag, LocationAreaImpl._TAG_lac);
    assertEquals(asn.getTagClass(), Tag.CLASS_CONTEXT_SPECIFIC);

    assertNull(prim.getLAIFixedLength());
    LAC lac = prim.getLAC();
    assertEquals(lac.getLac(), 14010);
  }
コード例 #4
0
ファイル: DialogPortionImpl.java プロジェクト: SergeyLee/jss7
  public void decode(AsnInputStream aisA) throws ParseException {

    // TAG has been decoded already, now, lets get LEN
    try {
      AsnInputStream ais = aisA.readSequenceStream();

      int tag = ais.readTag();
      if (tag != Tag.EXTERNAL)
        throw new ParseException(
            PAbortCauseType.IncorrectTxPortion,
            null,
            "Error decoding DialogPortion: wrong value of tag, expected EXTERNAL, found: " + tag);

      ext.decode(ais);

      if (!isAsn() || !isOid()) {
        throw new ParseException(
            PAbortCauseType.IncorrectTxPortion,
            null,
            "Error decoding DialogPortion: Oid and Asd parts not found");
      }

      // Check Oid
      if (Arrays.equals(_DIALG_UNI, this.getOidValue())) this.uniDirectional = true;
      else if (Arrays.equals(_DIALG_STRUCTURED, this.getOidValue())) this.uniDirectional = false;
      else
        throw new ParseException(
            PAbortCauseType.IncorrectTxPortion,
            null,
            "Error decoding DialogPortion: bad Oid value");

      AsnInputStream loaclAsnIS = new AsnInputStream(ext.getEncodeType());

      // now lets get APDU
      tag = loaclAsnIS.readTag();
      this.dialogAPDU = TcapFactory.createDialogAPDU(loaclAsnIS, tag, isUnidirectional());

    } catch (IOException e) {
      throw new ParseException(
          PAbortCauseType.BadlyFormattedTxPortion,
          null,
          "IOException when decoding DialogPortion: " + e.getMessage(),
          e);
    } catch (AsnException e) {
      throw new ParseException(
          PAbortCauseType.BadlyFormattedTxPortion,
          null,
          "AsnException when decoding DialogPortion: " + e.getMessage(),
          e);
    }
  }
コード例 #5
0
  private void _decode(AsnInputStream ansIS, int length)
      throws CAPParsingComponentException, IOException, AsnException {

    this.elementaryMessageID = 0;
    this.variableParts = null;
    boolean elementaryMessageIDFound = false;

    AsnInputStream ais = ansIS.readSequenceStreamData(length);
    while (true) {
      if (ais.available() == 0) break;

      int tag = ais.readTag();

      if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {
        switch (tag) {
          case _ID_elementaryMessageID:
            this.elementaryMessageID = (int) ais.readInteger();
            elementaryMessageIDFound = true;
            break;
          case _ID_variableParts:
            this.variableParts = new ArrayList<VariablePart>();

            AsnInputStream ais2 = ais.readSequenceStream();
            while (true) {
              if (ais2.available() == 0) break;

              ais2.readTag();
              VariablePartImpl val = new VariablePartImpl();
              val.decodeAll(ais2);
              this.variableParts.add(val);
            }
            break;

          default:
            ais.advanceElement();
            break;
        }
      } else {
        ais.advanceElement();
      }
    }

    if (this.variableParts == null || !elementaryMessageIDFound)
      throw new CAPParsingComponentException(
          "Error while decoding "
              + _PrimitiveName
              + ": elementaryMessageID and variableParts are mandatory but not found",
          CAPParsingComponentExceptionReason.MistypedParameter);
  }
コード例 #6
0
  @Test(groups = {"functional.decode"})
  public void testDecode() throws Exception {

    byte[] rawData = getEncodedData();
    AsnInputStream asn = new AsnInputStream(rawData);

    int tag = asn.readTag();
    EpsAuthenticationSetListImpl asc = new EpsAuthenticationSetListImpl();
    asc.decodeAll(asn);

    assertEquals(tag, Tag.SEQUENCE);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);

    ArrayList<EpcAv> epcAvs = asc.getEpcAv();
    assertEquals(epcAvs.size(), 2);

    assertTrue(Arrays.equals(epcAvs.get(0).getRand(), EpcAvTest.getRandData()));
    assertTrue(Arrays.equals(epcAvs.get(0).getXres(), EpcAvTest.getXresData()));
    assertTrue(Arrays.equals(epcAvs.get(0).getAutn(), EpcAvTest.getAutnData()));
    assertTrue(Arrays.equals(epcAvs.get(0).getKasme(), EpcAvTest.getKasmeData()));

    assertTrue(Arrays.equals(epcAvs.get(1).getRand(), EpcAvTest.getRandData()));
    assertTrue(Arrays.equals(epcAvs.get(1).getXres(), getXresData()));
    assertTrue(Arrays.equals(epcAvs.get(1).getAutn(), EpcAvTest.getAutnData()));
    assertTrue(Arrays.equals(epcAvs.get(1).getKasme(), EpcAvTest.getKasmeData()));
  }
コード例 #7
0
  @Test(groups = {"functional.decode", "primitives"})
  public void testDecode() throws Exception {
    byte[] data = this.getData();
    AsnInputStream asn = new AsnInputStream(data);
    int tag = asn.readTag();
    EPSQoSSubscribedImpl prim = new EPSQoSSubscribedImpl();

    prim.decodeAll(asn);

    assertEquals(tag, Tag.SEQUENCE);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);

    AllocationRetentionPriority allocationRetentionPriority = prim.getAllocationRetentionPriority();
    MAPExtensionContainer extensionContainer = prim.getExtensionContainer();
    assertEquals(allocationRetentionPriority.getPriorityLevel(), 1);
    assertTrue(allocationRetentionPriority.getPreEmptionCapability());
    assertTrue(allocationRetentionPriority.getPreEmptionVulnerability());
    assertNotNull(allocationRetentionPriority.getExtensionContainer());
    ;
    assertTrue(
        MAPExtensionContainerTest.CheckTestExtensionContainer(
            allocationRetentionPriority.getExtensionContainer()));
    assertNotNull(extensionContainer);
    assertEquals(prim.getQoSClassIdentifier(), QoSClassIdentifier.QCI_1);
    assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(extensionContainer));
  }
コード例 #8
0
  @Test(groups = {"functional.decode", "circuitSwitchedCall.primitive"})
  public void testDecode() throws Exception {

    byte[] data = this.getData();
    AsnInputStream ais = new AsnInputStream(data);
    TDisconnectSpecificInfoImpl elem = new TDisconnectSpecificInfoImpl();
    int tag = ais.readTag();
    assertEquals(tag, EventSpecificInformationBCSMImpl._ID_tDisconnectSpecificInfo);
    assertEquals(ais.getTagClass(), Tag.CLASS_CONTEXT_SPECIFIC);
    elem.decodeAll(ais);
    assertTrue(Arrays.equals(elem.getReleaseCause().getData(), this.getIntData()));
  }
コード例 #9
0
  @Override
  protected void _decode(AsnInputStream asnIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {

    AsnInputStream ais = asnIS.readSequenceStreamData(length);
    int num = 0;
    while (true) {
      if (ais.available() == 0) break;

      int tag = ais.readTag();
      switch (num) {
        case 0:
          if (tag != Tag.STRING_OCTET
              || ais.getTagClass() != Tag.CLASS_UNIVERSAL
              || !ais.isTagPrimitive()) {
            throw new MAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + ".kc: Parameter 0 bad tag or tag class or not primitive",
                MAPParsingComponentExceptionReason.MistypedParameter);
          }
          this.kc = new KcImpl();
          ((KcImpl) this.kc).decodeAll(ais);
          break;
        case 1:
          if (tag != Tag.STRING_OCTET
              || ais.getTagClass() != Tag.CLASS_UNIVERSAL
              || !ais.isTagPrimitive()) {
            throw new MAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + ".cksn: Parameter 1 bad tag or tag class or not primitive",
                MAPParsingComponentExceptionReason.MistypedParameter);
          }
          this.cksn = new CksnImpl();
          ((CksnImpl) this.cksn).decodeAll(ais);
          break;
        default:
          ais.advanceElement();
          break;
      }

      num++;
    }
    if (num < 2)
      throw new MAPParsingComponentException(
          "Error while decoding "
              + _PrimitiveName
              + ": Needs at least 2 mandatory parameters, found "
              + num,
          MAPParsingComponentExceptionReason.MistypedParameter);
  }
コード例 #10
0
ファイル: MAPRefuseInfoTest.java プロジェクト: nacerix/jss7
  @Test(groups = {"functional.decode", "dialog"})
  public void testDecode() throws Exception {
    // The raw data is from last packet of long ussd-abort from msc2.txt
    byte[] data = this.getData();

    AsnInputStream asnIs = new AsnInputStream(data);

    int tag = asnIs.readTag();
    assertEquals(tag, 3);

    MAPRefuseInfoImpl mapRefuseInfoImpl = new MAPRefuseInfoImpl();
    mapRefuseInfoImpl.decodeAll(asnIs);

    Reason reason = mapRefuseInfoImpl.getReason();

    assertNotNull(reason);

    assertEquals(reason, Reason.noReasonGiven);

    data = this.getDataFull();
    asnIs = new AsnInputStream(data);

    tag = asnIs.readTag();
    assertEquals(tag, 3);

    mapRefuseInfoImpl = new MAPRefuseInfoImpl();
    mapRefuseInfoImpl.decodeAll(asnIs);

    reason = mapRefuseInfoImpl.getReason();
    assertNotNull(reason);
    assertEquals(reason, Reason.invalidOriginatingReference);
    assertTrue(
        MAPExtensionContainerTest.CheckTestExtensionContainer(
            mapRefuseInfoImpl.getExtensionContainer()));
    assertNotNull(mapRefuseInfoImpl.getAlternativeAcn());
    assertTrue(
        Arrays.equals(
            new long[] {1, 2, 3, 4, 5, 6}, mapRefuseInfoImpl.getAlternativeAcn().getOid()));
  }
コード例 #11
0
ファイル: ResetTimerTest.java プロジェクト: nacerix/jss7
  @Test(groups = {"functional.decode", "circuitSwitchedCall"})
  public void testDecode() throws Exception {

    byte[] data = this.getData1();
    AsnInputStream ais = new AsnInputStream(data);
    ResetTimerRequestImpl elem = new ResetTimerRequestImpl();
    int tag = ais.readTag();
    elem.decodeAll(ais);
    assertEquals(elem.getTimerID(), TimerID.tssf);
    assertEquals(elem.getTimerValue(), 1000);
    assertTrue(CAPExtensionsTest.checkTestCAPExtensions(elem.getExtensions()));
    assertEquals((int) elem.getCallSegmentID(), 100);
  }
コード例 #12
0
  @Test(groups = {"functional.decode", "primitives"})
  public void testDecode() throws Exception {

    byte[] rawData = getData();
    AsnInputStream asn = new AsnInputStream(rawData);

    int tag = asn.readTag();
    AccessRestrictionDataImpl imp = new AccessRestrictionDataImpl();
    imp.decodeAll(asn);

    assertEquals(tag, Tag.STRING_BIT);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);

    assertTrue(!imp.getUtranNotAllowed());
    assertTrue(imp.getGeranNotAllowed());
    assertTrue(!imp.getGanNotAllowed());
    assertTrue(imp.getIHspaEvolutionNotAllowed());
    assertTrue(!imp.getEUtranNotAllowed());
    assertTrue(imp.getHoToNon3GPPAccessNotAllowed());

    rawData = getData1();
    asn = new AsnInputStream(rawData);

    tag = asn.readTag();
    imp = new AccessRestrictionDataImpl();
    imp.decodeAll(asn);

    assertEquals(tag, Tag.STRING_BIT);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);

    assertTrue(imp.getUtranNotAllowed());
    assertTrue(!imp.getGeranNotAllowed());
    assertTrue(imp.getGanNotAllowed());
    assertTrue(!imp.getIHspaEvolutionNotAllowed());
    assertTrue(imp.getEUtranNotAllowed());
    assertTrue(!imp.getHoToNon3GPPAccessNotAllowed());
  }
コード例 #13
0
ファイル: RequestedInfoTest.java プロジェクト: nacerix/jss7
  @Test(groups = {"functional.decode", "subscriberInformation"})
  public void testDecode() throws Exception {

    AsnInputStream asn = new AsnInputStream(data);
    int tag = asn.readTag();
    assertEquals(tag, 1);

    RequestedInfoImpl requestedInfo = new RequestedInfoImpl();
    requestedInfo.decodeAll(asn);

    assertTrue(requestedInfo.getLocationInformation());
    assertTrue(requestedInfo.getSubscriberState());
    assertNull(requestedInfo.getExtensionContainer());
    assertFalse(requestedInfo.getCurrentLocation());
    assertNull(requestedInfo.getRequestedDomain());
    assertFalse(requestedInfo.getImei());
    assertFalse(requestedInfo.getMsClassmark());
    assertFalse(requestedInfo.getMnpRequestedInfo());

    asn = new AsnInputStream(dataFull);
    tag = asn.readTag();
    assertEquals(tag, Tag.SEQUENCE);

    requestedInfo = new RequestedInfoImpl();
    requestedInfo.decodeAll(asn);

    assertTrue(requestedInfo.getLocationInformation());
    assertTrue(requestedInfo.getSubscriberState());
    assertTrue(
        MAPExtensionContainerTest.CheckTestExtensionContainer(
            requestedInfo.getExtensionContainer()));
    assertTrue(requestedInfo.getCurrentLocation());
    assertEquals(requestedInfo.getRequestedDomain(), DomainType.psDomain);
    assertTrue(requestedInfo.getImei());
    assertTrue(requestedInfo.getMsClassmark());
    assertTrue(requestedInfo.getMnpRequestedInfo());
  }
コード例 #14
0
  private void _decode(AsnInputStream ansIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {
    this.signalInfo = null;
    this.protocolId = null;
    this.extensionContainer = null;

    AsnInputStream ais = ansIS.readSequenceStreamData(length);
    while (true) {
      if (ais.available() == 0) break;

      int tag = ais.readTag();
      if (ais.getTagClass() == Tag.CLASS_UNIVERSAL) {
        switch (tag) {
          case Tag.ENUMERATED:
            int code = (int) ais.readInteger();
            this.protocolId = ProtocolId.getProtocolId(code);
            break;
          case Tag.STRING_OCTET:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ".signalInfo: Parameter extensionContainer is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            this.signalInfo = new SignalInfoImpl();
            ((SignalInfoImpl) this.signalInfo).decodeAll(ais);
            break;
          case Tag.SEQUENCE:
            if (ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ".extensionContainer: Parameter extensionContainer is primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            this.extensionContainer = new MAPExtensionContainerImpl();
            ((MAPExtensionContainerImpl) this.extensionContainer).decodeAll(ais);
            break;
          default:
            ais.advanceElement();
            break;
        }
      }
    }

    if (this.protocolId == null || this.signalInfo == null)
      throw new MAPParsingComponentException(
          "Error while decoding " + _PrimitiveName + ": protocolId and signalInfo must not be null",
          MAPParsingComponentExceptionReason.MistypedParameter);
  }
コード例 #15
0
  @Test(groups = {"functional.decode", "circuitSwitchedCall.primitive"})
  public void testDecode() throws Exception {

    byte[] data = this.getData1();
    AsnInputStream ais = new AsnInputStream(data);
    VariableMessageImpl elem = new VariableMessageImpl();
    int tag = ais.readTag();
    assertEquals(tag, Tag.SEQUENCE);
    elem.decodeAll(ais);
    assertEquals(elem.getElementaryMessageID(), 800);
    assertEquals(elem.getVariableParts().size(), 2);
    assertEquals((int) elem.getVariableParts().get(0).getInteger(), 111);
    assertEquals((int) elem.getVariableParts().get(1).getTime().getHour(), 23);
    assertEquals((int) elem.getVariableParts().get(1).getTime().getMinute(), 59);
  }
コード例 #16
0
  @Test(groups = {"functional.decode", "service.supplementary"})
  public void testDecode() throws Exception {

    byte[] rawData = getEncodedData();

    AsnInputStream asn = new AsnInputStream(rawData);

    int tag = asn.readTag();
    assertEquals(tag, Tag.STRING_NUMERIC);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);

    GetPasswordResponseImpl impl = new GetPasswordResponseImpl();
    impl.decodeAll(asn);

    assertEquals(impl.getPassword().getData(), "0123");
  }
コード例 #17
0
  @Test(groups = {"functional.decode", "service.sms"})
  public void testDecode() throws Exception {

    byte[] rawData = getEncodedData();

    AsnInputStream asn = new AsnInputStream(rawData);

    int tag = asn.readTag();
    assertEquals(tag, Tag.SEQUENCE);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);

    ReadyForSMResponseImpl impl = new ReadyForSMResponseImpl();
    impl.decodeAll(asn);

    assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(impl.getExtensionContainer()));
  }
コード例 #18
0
  @Test(groups = {"functional.decode", "circuitSwitchedCall"})
  public void testDecode() throws Exception {

    byte[] data = this.getData1();
    AsnInputStream ais = new AsnInputStream(data);
    FurnishChargingInformationRequestImpl elem = new FurnishChargingInformationRequestImpl();
    int tag = ais.readTag();
    assertEquals(tag, Tag.STRING_OCTET);
    elem.decodeAll(ais);
    assertTrue(
        Arrays.equals(
            elem.getFCIBCCCAMELsequence1().getFreeFormatData().getData(), this.getDataFFD()));
    assertEquals(
        elem.getFCIBCCCAMELsequence1().getPartyToCharge().getSendingSideID(), LegType.leg2);
    assertEquals(
        elem.getFCIBCCCAMELsequence1().getAppendFreeFormatData(), AppendFreeFormatData.append);
  }
コード例 #19
0
  @Test(groups = {"functional.decode", "subscriberInformation"})
  public void testDecode() throws Exception {

    byte[] rawData = getEncodedData();

    AsnInputStream asn = new AsnInputStream(rawData);

    int tag = asn.readTag();
    GeodeticInformationImpl impl = new GeodeticInformationImpl();
    impl.decodeAll(asn);

    assertEquals(impl.getScreeningAndPresentationIndicators(), 3);
    assertEquals(impl.getTypeOfShape(), TypeOfShape.EllipsoidPointWithUncertaintyCircle);
    assertTrue(Math.abs(impl.getLatitude() - 21.5) < 0.0001);
    assertTrue(Math.abs(impl.getLongitude() - 171) < 0.0001);
    assertTrue(Math.abs(impl.getUncertainty() - 0) < 0.01);
    assertEquals(impl.getConfidence(), 11);
  }
コード例 #20
0
  @Override
  protected void _decode(AsnInputStream asnIS, int length)
      throws CAPParsingComponentException, IOException, AsnException {

    this.roVolumeSinceLastTariffSwitch = -1;
    this.roVolumeTariffSwitchInterval = -1;

    AsnInputStream ais = asnIS.readSequenceStreamData(length);
    while (true) {
      if (ais.available() == 0) break;

      int tag = ais.readTag();

      if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {

        switch (tag) {
          case _ID_roVolumeSinceLastTariffSwitch:
            if (!ais.isTagPrimitive())
              throw new CAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ".roVolumeSinceLastTariffSwitch: Parameter is not primitive",
                  CAPParsingComponentExceptionReason.MistypedParameter);
            this.roVolumeSinceLastTariffSwitch = (int) ais.readInteger();
            break;
          case _ID_roVolumeTariffSwitchInterval:
            if (!ais.isTagPrimitive())
              throw new CAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ".roVolumeTariffSwitchInterval: Parameter is not primitive",
                  CAPParsingComponentExceptionReason.MistypedParameter);
            this.roVolumeTariffSwitchInterval = (int) ais.readInteger();
            break;
          default:
            ais.advanceElement();
            break;
        }
      } else {
        ais.advanceElement();
      }
    }
  }
コード例 #21
0
  @Test(groups = {"functional.decode", "service.lsm"})
  public void testDecode() throws Exception {
    byte[] data = getEncodedData();

    AsnInputStream asn = new AsnInputStream(data);
    int tag = asn.readTag();
    assertEquals(tag, Tag.SEQUENCE);

    DeferredmtlrDataImpl imp = new DeferredmtlrDataImpl();
    imp.decodeAll(asn);

    assertFalse(imp.getDeferredLocationEventType().getMsAvailable());
    assertTrue(imp.getDeferredLocationEventType().getEnteringIntoArea());
    assertFalse(imp.getDeferredLocationEventType().getLeavingFromArea());
    assertTrue(imp.getDeferredLocationEventType().getBeingInsideArea());

    assertEquals(imp.getTerminationCause(), TerminationCause.mtlrRestart);

    assertTrue(imp.getLCSLocationInfo().getNetworkNodeNumber().getAddress().equals("330044005500"));
  }
コード例 #22
0
ファイル: ExtCwFeatureTest.java プロジェクト: vetss/jss7
  @Test(groups = {"functional.decode", "subscriberInformation"})
  public void testDecode() throws Exception {
    AsnInputStream ansIS = new AsnInputStream(data);
    int tag = ansIS.readTag();
    assertEquals(tag, Tag.SEQUENCE);

    ExtCwFeatureImpl extCwFeature = new ExtCwFeatureImpl();
    extCwFeature.decodeAll(ansIS);

    ExtBasicServiceCode extBasicServiceCode = extCwFeature.getBasicService();
    assertEquals(
        extBasicServiceCode.getExtTeleservice().getTeleserviceCodeValue(),
        TeleserviceCodeValue.allShortMessageServices);

    ExtSSStatus extSSStatus = extCwFeature.getSsStatus();
    assertTrue(extSSStatus.getBitQ());
    assertTrue(extSSStatus.getBitP());
    assertFalse(extSSStatus.getBitR());
    assertFalse(extSSStatus.getBitA());
  }
コード例 #23
0
  @Test(groups = {"functional.decode", "service.oam"})
  public void testDecode() throws Exception {

    byte[] rawData = getEncodedData();
    AsnInputStream asn = new AsnInputStream(rawData);

    int tag = asn.readTag();
    PGWInterfaceListImpl asc = new PGWInterfaceListImpl();
    asc.decodeAll(asn);

    assertEquals(tag, Tag.STRING_BIT);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);

    assertTrue(asc.getS2a());
    assertFalse(asc.getS2b());
    assertTrue(asc.getS2c());
    assertFalse(asc.getS5());
    assertTrue(asc.getS6b());
    assertTrue(asc.getGx());
    assertFalse(asc.getS8b());
    assertTrue(asc.getSgi());
  }
コード例 #24
0
  private void _decode(AsnInputStream ansIS, int length)
      throws CAPParsingComponentException, IOException, AsnException {

    this.aocInitial = null;
    this.aocSubsequent = null;

    AsnInputStream ais = ansIS.readSequenceStreamData(length);
    while (true) {
      if (ais.available() == 0) break;

      int tag = ais.readTag();

      if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {
        switch (tag) {
          case _ID_cAI_GSM0224:
            this.aocInitial = new CAI_GSM0224Impl();
            ((CAI_GSM0224Impl) this.aocInitial).decodeAll(ais);
            break;
          case _ID_aOCSubsequent:
            this.aocSubsequent = new AOCSubsequentImpl();
            ((AOCSubsequentImpl) this.aocSubsequent).decodeAll(ais);
            break;

          default:
            ais.advanceElement();
            break;
        }
      } else {
        ais.advanceElement();
      }
    }

    if (this.aocInitial == null)
      throw new CAPParsingComponentException(
          "Error while decoding " + _PrimitiveName + ": aocInitial is mandatory but not found",
          CAPParsingComponentExceptionReason.MistypedParameter);
  }
コード例 #25
0
  @Test(groups = {"functional.decode", "service.lsm"})
  public void testDecode() throws Exception {
    byte[] rawData = getEncodedData();
    AsnInputStream asn = new AsnInputStream(rawData);

    int tag = asn.readTag();
    SupportedGADShapesImpl supportedLCSCapabilityTest = new SupportedGADShapesImpl();
    supportedLCSCapabilityTest.decodeAll(asn);

    assertEquals(tag, Tag.STRING_BIT);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);

    assertEquals((boolean) supportedLCSCapabilityTest.getEllipsoidArc(), true);
    assertEquals((boolean) supportedLCSCapabilityTest.getEllipsoidPoint(), true);
    assertEquals((boolean) supportedLCSCapabilityTest.getEllipsoidPointWithAltitude(), true);
    assertEquals(
        (boolean) supportedLCSCapabilityTest.getEllipsoidPointWithAltitudeAndUncertaintyElipsoid(),
        true);
    assertEquals(
        (boolean) supportedLCSCapabilityTest.getEllipsoidPointWithUncertaintyCircle(), true);
    assertEquals(
        (boolean) supportedLCSCapabilityTest.getEllipsoidPointWithUncertaintyEllipse(), true);
    assertEquals((boolean) supportedLCSCapabilityTest.getPolygon(), true);
  }
コード例 #26
0
  @Test(groups = {"functional.decode", "circuitSwitchedCall"})
  public void testDecode() throws Exception {

    byte[] data = this.getData1();
    AsnInputStream ais = new AsnInputStream(data);
    EstablishTemporaryConnectionRequestImpl elem =
        new EstablishTemporaryConnectionRequestImpl(false);
    int tag = ais.readTag();
    elem.decodeAll(ais);

    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNatureOfAddressIndicator(), 1);
    assertTrue(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getAddress().equals("1122"));
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNumberQualifierIndicator(), 1);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNumberingPlanIndicator(), 0);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress()
            .getGenericNumber()
            .getAddressRepresentationRestrictedIndicator(),
        0);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getScreeningIndicator(), 1);
    assertEquals(elem.getCorrelationID().getGenericDigits().getEncodingScheme(), 2);
    assertEquals(elem.getCorrelationID().getGenericDigits().getTypeOfDigits(), 0);
    assertTrue(
        Arrays.equals(
            elem.getCorrelationID().getGenericDigits().getEncodedDigits(),
            getCorrelationIDDigits()));
    assertTrue(Arrays.equals(elem.getScfID().getData(), getScfIDData()));
    assertEquals(
        elem.getServiceInteractionIndicatorsTwo().getBothwayThroughConnectionInd(),
        BothwayThroughConnectionInd.bothwayPathNotRequired);
    assertNull(elem.getCallSegmentID());
    assertEquals((int) elem.getNAOliInfo().getData(), 11);
    assertTrue(CAPExtensionsTest.checkTestCAPExtensions(elem.getExtensions()));
    assertNull(elem.getCarrier());
    assertNull(elem.getChargeNumber());
    assertNull(elem.getOriginalCalledPartyID());
    assertNull(elem.getCallingPartyNumber());

    data = this.getData2();
    ais = new AsnInputStream(data);
    elem = new EstablishTemporaryConnectionRequestImpl(true);
    tag = ais.readTag();
    elem.decodeAll(ais);

    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNatureOfAddressIndicator(), 1);
    assertTrue(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getAddress().equals("1122"));
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNumberQualifierIndicator(), 1);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNumberingPlanIndicator(), 0);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress()
            .getGenericNumber()
            .getAddressRepresentationRestrictedIndicator(),
        0);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getScreeningIndicator(), 1);
    assertEquals(elem.getCorrelationID().getGenericDigits().getEncodingScheme(), 2);
    assertEquals(elem.getCorrelationID().getGenericDigits().getTypeOfDigits(), 0);
    assertTrue(
        Arrays.equals(
            elem.getCorrelationID().getGenericDigits().getEncodedDigits(),
            getCorrelationIDDigits()));
    assertTrue(Arrays.equals(elem.getScfID().getData(), getScfIDData()));
    assertEquals(
        elem.getServiceInteractionIndicatorsTwo().getBothwayThroughConnectionInd(),
        BothwayThroughConnectionInd.bothwayPathNotRequired);
    assertEquals((int) elem.getCallSegmentID(), 8);
    assertEquals((int) elem.getNAOliInfo().getData(), 11);
    assertTrue(CAPExtensionsTest.checkTestCAPExtensions(elem.getExtensions()));
    assertNull(elem.getCarrier());
    assertNull(elem.getChargeNumber());
    assertNull(elem.getOriginalCalledPartyID());
    assertNull(elem.getCallingPartyNumber());

    data = this.getData3();
    ais = new AsnInputStream(data);
    elem = new EstablishTemporaryConnectionRequestImpl(true);
    tag = ais.readTag();
    elem.decodeAll(ais);

    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNatureOfAddressIndicator(), 1);
    assertTrue(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getAddress().equals("1122"));
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNumberQualifierIndicator(), 1);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getNumberingPlanIndicator(), 0);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress()
            .getGenericNumber()
            .getAddressRepresentationRestrictedIndicator(),
        0);
    assertEquals(
        elem.getAssistingSSPIPRoutingAddress().getGenericNumber().getScreeningIndicator(), 1);
    assertNull(elem.getCorrelationID());
    assertNull(elem.getScfID());
    assertNull(elem.getCallSegmentID());
    assertNull(elem.getNAOliInfo());
    assertNull(elem.getExtensions());
    assertEquals(elem.getCarrier().getData(), getCarrierData());
    assertEquals(
        elem.getChargeNumber().getLocationNumber().getNatureOfAddressIndicator(),
        LocationNumber._NAI_INTERNATIONAL_NUMBER);
    assertEquals(elem.getChargeNumber().getLocationNumber().getAddress(), "0000077777");
    assertEquals(
        elem.getOriginalCalledPartyID().getOriginalCalledNumber().getAddress(), "1111188888");
    assertEquals(elem.getCallingPartyNumber().getCallingPartyNumber().getAddress(), "2222288888");
  }
コード例 #27
0
ファイル: LCSLocationInfoImpl.java プロジェクト: nacerix/jss7
  protected void _decode(AsnInputStream asnIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {

    this.networkNodeNumber = null;
    this.lmsi = null;
    this.extensionContainer = null;
    this.gprsNodeIndicator = false;
    this.additionalNumber = null;
    this.supportedLCSCapabilitySets = null;
    this.additionalLCSCapabilitySets = null;
    this.mmeName = null;
    this.aaaServerName = null;

    AsnInputStream ais = asnIS.readSequenceStreamData(length);

    int tag = ais.readTag();
    if (ais.getTagClass() != Tag.CLASS_UNIVERSAL
        || !ais.isTagPrimitive()
        || tag != Tag.STRING_OCTET) {
      throw new MAPParsingComponentException(
          "Error while decoding "
              + _PrimitiveName
              + ": Parameter [networkNode-Number ISDN-AddressString] bad tag class, tag or not primitive",
          MAPParsingComponentExceptionReason.MistypedParameter);
    }
    this.networkNodeNumber = new ISDNAddressStringImpl();
    ((ISDNAddressStringImpl) this.networkNodeNumber).decodeAll(ais);

    while (true) {
      if (ais.available() == 0) break;

      tag = ais.readTag();

      if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {
        switch (tag) {
          case _TAG_LMSI:
            // lmsi [0] LMSI OPTIONAL,
            if (!ais.isTagPrimitive()) {
              throw new MAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ": Parameter [lmsi [0] LMSI ] bad tag class, tag or not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            }
            this.lmsi = new LMSIImpl();
            ((LMSIImpl) this.lmsi).decodeAll(ais);

            break;
          case _TAG_EXTENSION_CONTAINER:
            // extensionContainer [1] ExtensionContainer
            if (ais.isTagPrimitive()) {
              throw new MAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ": Parameter [extensionContainer [1] ExtensionContainer ] is primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            }
            this.extensionContainer = new MAPExtensionContainerImpl();
            ((MAPExtensionContainerImpl) this.extensionContainer).decodeAll(ais);
            break;
          case _TAG_GPRS_NODE_IND:
            // gprsNodeIndicator [2] NULL
            if (!ais.isTagPrimitive()) {
              throw new MAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ": Parameter [gprsNodeIndicator [2] NULL ] is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            }
            ais.readNull();
            this.gprsNodeIndicator = true;
            break;
          case _TAG_ADDITIONAL_NUMBER:
            // additional-Number [3] Additional-Number OPTIONAL
            if (ais.isTagPrimitive()) {
              throw new MAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ": Parameter [additional-Number [3] Additional-Number] is primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            }
            this.additionalNumber = new AdditionalNumberImpl();
            AsnInputStream ais2 = ais.readSequenceStream();
            ais2.readTag();
            ((AdditionalNumberImpl) this.additionalNumber).decodeAll(ais2);
            break;
          case _TAG_SUPPORTED_LCS_CAPBILITY_SET:
            // supportedLCS-CapabilitySets [4]
            // SupportedLCS-CapabilitySets
            if (!ais.isTagPrimitive()) {
              throw new MAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ": Parameter [supportedLCS-CapabilitySets [4] SupportedLCS-CapabilitySets] is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            }
            this.supportedLCSCapabilitySets = new SupportedLCSCapabilitySetsImpl();
            ((SupportedLCSCapabilitySetsImpl) this.supportedLCSCapabilitySets).decodeAll(ais);
            break;
          case _TAG_ADDITIONAL_LCS_CAPBILITY_SET:
            // additional-LCS-CapabilitySets [5]
            // SupportedLCS-CapabilitySets OPTIONAL
            if (!ais.isTagPrimitive()) {
              throw new MAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ": Parameter [additional-LCS-CapabilitySets [5] SupportedLCS-CapabilitySets] is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            }
            this.additionalLCSCapabilitySets = new SupportedLCSCapabilitySetsImpl();
            ((SupportedLCSCapabilitySetsImpl) this.additionalLCSCapabilitySets).decodeAll(ais);
            break;
          case _TAG_mme_Name:
            // mmeName
            if (!ais.isTagPrimitive()) {
              throw new MAPParsingComponentException(
                  "Error while decoding " + _PrimitiveName + ": Parameter mmeName is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            }
            this.mmeName = new DiameterIdentityImpl();
            ((DiameterIdentityImpl) this.mmeName).decodeAll(ais);
            break;
          case _TAG_aaa_Server_Name:
            // aaaServerName
            if (!ais.isTagPrimitive()) {
              throw new MAPParsingComponentException(
                  "Error while decoding "
                      + _PrimitiveName
                      + ": Parameter aaaServerName is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            }
            this.aaaServerName = new DiameterIdentityImpl();
            ((DiameterIdentityImpl) this.aaaServerName).decodeAll(ais);
            break;
          default:
            ais.advanceElement();
        }
      } else {
        ais.advanceElement();
      }
    }
  }
コード例 #28
0
  @Test(groups = {"functional.decode"})
  public void testDecode() throws Exception {

    byte[] rawData = getEncodedData();
    AsnInputStream asn = new AsnInputStream(rawData);

    int tag = asn.readTag();
    UpdateLocationRequestImpl asc = new UpdateLocationRequestImpl(3);
    asc.decodeAll(asn);

    assertEquals(tag, Tag.SEQUENCE);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);
    assertEquals(asc.getMapProtocolVersion(), 3);

    IMSI imsi = asc.getImsi();
    assertTrue(imsi.getData().equals("1111122222"));

    assertNull(asc.getRoamingNumber());
    ISDNAddressString mscNumber = asc.getMscNumber();
    assertTrue(mscNumber.getAddress().equals("22228"));
    assertEquals(mscNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(mscNumber.getNumberingPlan(), NumberingPlan.ISDN);

    ISDNAddressString vlrNumber = asc.getVlrNumber();
    assertTrue(vlrNumber.getAddress().equals("22229"));
    assertEquals(vlrNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(vlrNumber.getNumberingPlan(), NumberingPlan.ISDN);

    VLRCapability vlrCap = asc.getVlrCapability();
    assertTrue(vlrCap.getSupportedLCSCapabilitySets().getCapabilitySetRelease98_99());
    assertFalse(vlrCap.getSupportedLCSCapabilitySets().getCapabilitySetRelease4());

    assertNull(asc.getLmsi());
    assertNull(asc.getExtensionContainer());

    assertFalse(asc.getInformPreviousNetworkEntity());
    assertFalse(asc.getCsLCSNotSupportedByUE());
    assertFalse(asc.getSkipSubscriberDataUpdate());
    assertFalse(asc.getRestorationIndicator());

    rawData = getEncodedData2();
    asn = new AsnInputStream(rawData);

    tag = asn.readTag();
    asc = new UpdateLocationRequestImpl(3);
    asc.decodeAll(asn);

    assertEquals(tag, Tag.SEQUENCE);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);
    assertEquals(asc.getMapProtocolVersion(), 3);

    imsi = asc.getImsi();
    assertTrue(imsi.getData().equals("1111122233"));

    assertNull(asc.getRoamingNumber());
    mscNumber = asc.getMscNumber();
    assertTrue(mscNumber.getAddress().equals("22228"));
    assertEquals(mscNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(mscNumber.getNumberingPlan(), NumberingPlan.ISDN);

    vlrNumber = asc.getVlrNumber();
    assertTrue(vlrNumber.getAddress().equals("22229"));
    assertEquals(vlrNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(vlrNumber.getNumberingPlan(), NumberingPlan.ISDN);

    vlrCap = asc.getVlrCapability();
    assertTrue(vlrCap.getSupportedLCSCapabilitySets().getCapabilitySetRelease98_99());
    assertFalse(vlrCap.getSupportedLCSCapabilitySets().getCapabilitySetRelease4());

    assertTrue(Arrays.equals(asc.getLmsi().getData(), getLmsiData()));
    assertTrue(MAPExtensionContainerTest.CheckTestExtensionContainer(asc.getExtensionContainer()));

    assertTrue(asc.getInformPreviousNetworkEntity());
    assertTrue(asc.getCsLCSNotSupportedByUE());
    assertTrue(asc.getSkipSubscriberDataUpdate());
    assertTrue(asc.getRestorationIndicator());

    rawData = getEncodedData3();
    asn = new AsnInputStream(rawData);

    tag = asn.readTag();
    asc = new UpdateLocationRequestImpl(3);
    asc.decodeAll(asn);

    assertEquals(tag, Tag.SEQUENCE);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);
    assertEquals(asc.getMapProtocolVersion(), 3);

    imsi = asc.getImsi();
    assertTrue(imsi.getData().equals("1111122233"));

    assertNull(asc.getRoamingNumber());
    mscNumber = asc.getMscNumber();
    assertTrue(mscNumber.getAddress().equals("22228"));
    assertEquals(mscNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(mscNumber.getNumberingPlan(), NumberingPlan.ISDN);

    vlrNumber = asc.getVlrNumber();
    assertTrue(vlrNumber.getAddress().equals("22229"));
    assertEquals(vlrNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(vlrNumber.getNumberingPlan(), NumberingPlan.ISDN);

    vlrCap = asc.getVlrCapability();
    assertTrue(vlrCap.getSupportedLCSCapabilitySets().getCapabilitySetRelease98_99());
    assertFalse(vlrCap.getSupportedLCSCapabilitySets().getCapabilitySetRelease4());

    assertTrue(Arrays.equals(asc.getLmsi().getData(), getLmsiData()));
    assertNull(asc.getExtensionContainer());

    assertTrue(asc.getInformPreviousNetworkEntity());
    assertTrue(asc.getCsLCSNotSupportedByUE());
    assertTrue(asc.getSkipSubscriberDataUpdate());
    assertTrue(asc.getRestorationIndicator());

    assertTrue(Arrays.equals(asc.getVGmlcAddress().getData(), getGSNAddressData()));
    assertTrue(asc.getADDInfo().getImeisv().getIMEI().equals("123456789009876"));
    assertFalse(asc.getADDInfo().getSkipSubscriberDataUpdate());
    assertEquals(asc.getPagingArea().getLocationAreas().size(), 1);
    assertEquals(asc.getPagingArea().getLocationAreas().get(0).getLAC().getLac(), 123);

    rawData = getEncodedData_V1();
    asn = new AsnInputStream(rawData);

    tag = asn.readTag();
    asc = new UpdateLocationRequestImpl(1);
    asc.decodeAll(asn);

    assertEquals(tag, Tag.SEQUENCE);
    assertEquals(asn.getTagClass(), Tag.CLASS_UNIVERSAL);
    assertEquals(asc.getMapProtocolVersion(), 1);

    imsi = asc.getImsi();
    assertTrue(imsi.getData().equals("1111122233"));

    assertNull(asc.getMscNumber());
    ISDNAddressString roamingNumber = asc.getRoamingNumber();
    assertTrue(roamingNumber.getAddress().equals("22220"));
    assertEquals(roamingNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(roamingNumber.getNumberingPlan(), NumberingPlan.ISDN);

    vlrNumber = asc.getVlrNumber();
    assertTrue(vlrNumber.getAddress().equals("22221"));
    assertEquals(vlrNumber.getAddressNature(), AddressNature.international_number);
    assertEquals(vlrNumber.getNumberingPlan(), NumberingPlan.ISDN);

    assertNull(asc.getVlrCapability());
    assertNull(asc.getLmsi());
    assertNull(asc.getExtensionContainer());
    assertFalse(asc.getInformPreviousNetworkEntity());
    assertFalse(asc.getCsLCSNotSupportedByUE());
    assertFalse(asc.getSkipSubscriberDataUpdate());
    assertFalse(asc.getRestorationIndicator());
  }
コード例 #29
0
  protected void _decode(AsnInputStream ansIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {

    this.privateExtensionList = null;
    this.slrArgPcsExtensions = null;

    AsnInputStream ais = ansIS.readSequenceStreamData(length);

    while (true) {
      if (ais.available() == 0) break;

      int tag = ais.readTag();

      if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {
        switch (tag) {
          case _TAG_privateExtensionList:
            if (ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while " + _PrimitiveName + " decoding: privateExtensionList is primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            if (this.privateExtensionList != null)
              throw new MAPParsingComponentException(
                  "Error while "
                      + _PrimitiveName
                      + " decoding: More than one PrivateExtensionList has found",
                  MAPParsingComponentExceptionReason.MistypedParameter);

            AsnInputStream localAis2 = ais.readSequenceStream();
            this.privateExtensionList = new ArrayList<MAPPrivateExtension>();
            while (localAis2.available() > 0) {
              tag = localAis2.readTag();
              if (tag != Tag.SEQUENCE
                  || localAis2.getTagClass() != Tag.CLASS_UNIVERSAL
                  || localAis2.isTagPrimitive())
                throw new MAPParsingComponentException(
                    "Error while "
                        + _PrimitiveName
                        + " decoding: Bad tag, tagClass or primitiveFactor of PrivateExtension",
                    MAPParsingComponentExceptionReason.MistypedParameter);
              if (this.privateExtensionList.size() >= 10)
                throw new MAPParsingComponentException(
                    "More then 10 " + _PrimitiveName + " found when PrivateExtensionList decoding",
                    MAPParsingComponentExceptionReason.MistypedParameter);

              MAPPrivateExtensionImpl privateExtension = new MAPPrivateExtensionImpl();
              privateExtension.decodeAll(localAis2);
              this.privateExtensionList.add(privateExtension);
            }
            break;

          case _TAG_slr_Arg_PCS_Extensions:
            if (ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while " + _PrimitiveName + " decoding: slrArgPcsExtensions is primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            if (this.slrArgPcsExtensions != null)
              throw new MAPParsingComponentException(
                  "Error while "
                      + _PrimitiveName
                      + " decoding: More than one slrArgPcsExtensions has found",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            this.slrArgPcsExtensions = new SLRArgPCSExtensionsImpl();
            ((SLRArgPCSExtensionsImpl) this.slrArgPcsExtensions).decodeAll(ais);
            break;

          default:
            ais.advanceElement();
            break;
        }
      } else {
        ais.advanceElement();
      }
    }
  }
コード例 #30
0
  @Override
  protected void _decode(AsnInputStream asnIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {

    this.groupId = null;
    this.extensionContainer = null;
    this.additionalSubscriptions = null;
    this.additionalInfo = null;
    this.longGroupId = null;

    AsnInputStream ais = asnIS.readSequenceStreamData(length);
    int num = 0;
    while (true) {
      if (ais.available() == 0) break;

      int tag = ais.readTag();

      switch (num) {
        case 0:
          if (!ais.isTagPrimitive()
              || tag != Tag.STRING_OCTET
              || ais.getTagClass() != Tag.CLASS_UNIVERSAL)
            throw new MAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + ".groupId:  Bad tab or tag class or Parameter not primitive",
                MAPParsingComponentExceptionReason.MistypedParameter);
          this.groupId = new GroupIdImpl();
          ((GroupIdImpl) this.groupId).decodeAll(ais);
          break;
        default:
          switch (ais.getTagClass()) {
            case Tag.CLASS_UNIVERSAL:
              {
                switch (tag) {
                  case Tag.SEQUENCE:
                    if (ais.isTagPrimitive())
                      throw new MAPParsingComponentException(
                          "Error while decoding "
                              + _PrimitiveName
                              + ".extensionContainer: Parameter extensionContainer is primitive",
                          MAPParsingComponentExceptionReason.MistypedParameter);
                    this.extensionContainer = new MAPExtensionContainerImpl();
                    ((MAPExtensionContainerImpl) this.extensionContainer).decodeAll(ais);
                    break;
                  case Tag.STRING_BIT:
                    if (!ais.isTagPrimitive())
                      throw new MAPParsingComponentException(
                          "Error while decoding "
                              + _PrimitiveName
                              + ".additionalSubscriptions: Parameter is not primitive",
                          MAPParsingComponentExceptionReason.MistypedParameter);
                    this.additionalSubscriptions = new AdditionalSubscriptionsImpl();
                    ((AdditionalSubscriptionsImpl) this.additionalSubscriptions).decodeAll(ais);
                    break;
                  default:
                    ais.advanceElement();
                    break;
                }
              }
              break;
            case Tag.CLASS_CONTEXT_SPECIFIC:
              {
                switch (tag) {
                  case _TAG_additionalInfo:
                    if (!ais.isTagPrimitive())
                      throw new MAPParsingComponentException(
                          "Error while decoding "
                              + _PrimitiveName
                              + ".additionalInfo: Parameter not primitive",
                          MAPParsingComponentExceptionReason.MistypedParameter);
                    this.additionalInfo = new AdditionalInfoImpl();
                    ((AdditionalInfoImpl) this.additionalInfo).decodeAll(ais);
                    break;
                  case _TAG_longGroupId:
                    if (!ais.isTagPrimitive())
                      throw new MAPParsingComponentException(
                          "Error while decoding "
                              + _PrimitiveName
                              + ".longGroupId: Parameter not primitive",
                          MAPParsingComponentExceptionReason.MistypedParameter);
                    this.longGroupId = new LongGroupIdImpl();
                    ((LongGroupIdImpl) this.longGroupId).decodeAll(ais);
                    break;
                  default:
                    ais.advanceElement();
                    break;
                }
              }
              break;
            default:
              ais.advanceElement();
              break;
          }
          break;
      }
      num++;
    }

    if (this.groupId == null) {
      throw new MAPParsingComponentException(
          "Error while decoding "
              + _PrimitiveName
              + ": Parament groupId is mandatory but does not found",
          MAPParsingComponentExceptionReason.MistypedParameter);
    }
  }