Exemplo n.º 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);
  }
Exemplo n.º 2
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);
  }
Exemplo n.º 3
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);
  }
Exemplo n.º 4
0
  private void _decode(AsnInputStream asnIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {

    if (asnIS.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || !asnIS.isTagPrimitive())
      throw new MAPParsingComponentException(
          "Error while decoding "
              + _PrimitiveName
              + ": bad tag class or is not primitive: TagClass="
              + asnIS.getTagClass(),
          MAPParsingComponentExceptionReason.MistypedParameter);

    switch (asnIS.getTag()) {
      case _TAG_MSC_NUMBER:
        this.mSCNumber = new ISDNAddressStringImpl();
        ((ISDNAddressStringImpl) this.mSCNumber).decodeData(asnIS, length);
        break;
      case _TAG_SGSN_NUMBER:
        this.sGSNNumber = new ISDNAddressStringImpl();
        ((ISDNAddressStringImpl) this.sGSNNumber).decodeData(asnIS, length);
        break;
      default:
        throw new MAPParsingComponentException(
            "Error while decoding "
                + _PrimitiveName
                + ": Expexted msc-Number [0] ISDN-AddressString or sgsn-Number [1] ISDN-AddressString, but found "
                + asnIS.getTag(),
            MAPParsingComponentExceptionReason.MistypedParameter);
    }
  }
Exemplo n.º 5
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();
      }
    }
  }
Exemplo n.º 6
0
  private void _decode(AsnInputStream ais, int length)
      throws CAPParsingComponentException, IOException, AsnException, MAPParsingComponentException {

    this.volumeIfNoTariffSwitch = null;
    this.volumeIfTariffSwitch = null;

    int tag = ais.getTag();

    if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {
      switch (tag) {
        case _ID_volumeIfNoTariffSwitch:
          if (!ais.isTagPrimitive())
            throw new CAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + ".volumeIfNoTariffSwitch: Parameter is not primitive",
                CAPParsingComponentExceptionReason.MistypedParameter);
          this.volumeIfNoTariffSwitch = ais.readIntegerData(length);
          break;
        case _ID_volumeIfTariffSwitch:
          if (ais.isTagPrimitive())
            throw new CAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + ".volumeIfTariffSwitch: Parameter is primitive",
                CAPParsingComponentExceptionReason.MistypedParameter);
          this.volumeIfTariffSwitch = new VolumeIfTariffSwitchImpl();
          ((VolumeIfTariffSwitchImpl) this.volumeIfTariffSwitch).decodeData(ais, length);
          break;

        default:
          throw new CAPParsingComponentException(
              "Error while decoding " + _PrimitiveName + ": bad choice tag",
              CAPParsingComponentExceptionReason.MistypedParameter);
      }
    } else {
      throw new CAPParsingComponentException(
          "Error while decoding " + _PrimitiveName + ": bad choice tagClass",
          CAPParsingComponentExceptionReason.MistypedParameter);
    }
  }
  private void _decode(AsnInputStream ais, int length)
      throws CAPParsingComponentException, IOException, AsnException, MAPParsingComponentException {

    this.maxTransferredVolume = -1;
    this.maxElapsedTime = -1;

    int tag = ais.getTag();

    if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {
      switch (tag) {
        case _ID_maxTransferredVolume:
          if (!ais.isTagPrimitive())
            throw new CAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + ".maxTransferredVolume: Parameter is not primitive",
                CAPParsingComponentExceptionReason.MistypedParameter);
          this.maxTransferredVolume = (long) ais.readIntegerData(length);
          break;
        case _ID_maxElapsedTime:
          if (!ais.isTagPrimitive())
            throw new CAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + ".maxElapsedTime: Parameter is not primitive",
                CAPParsingComponentExceptionReason.MistypedParameter);
          this.maxElapsedTime = (int) ais.readIntegerData(length);
          break;

        default:
          throw new CAPParsingComponentException(
              "Error while decoding " + _PrimitiveName + ": bad choice tag",
              CAPParsingComponentExceptionReason.MistypedParameter);
      }
    } else {
      throw new CAPParsingComponentException(
          "Error while decoding " + _PrimitiveName + ": bad choice tagClass",
          CAPParsingComponentExceptionReason.MistypedParameter);
    }
  }
Exemplo n.º 8
0
  private void _decode(AsnInputStream ais, int length)
      throws MAPParsingComponentException, IOException, AsnException {
    this.forwardingInfo = null;
    this.callBarringInfo = null;
    this.cugInfo = null;
    this.ssData = null;
    this.emlppInfo = null;

    if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC || ais.isTagPrimitive())
      throw new MAPParsingComponentException(
          "Error while decoding "
              + _PrimitiveName
              + ": bad tag class or is primitive: TagClass="
              + ais.getTagClass(),
          MAPParsingComponentExceptionReason.MistypedParameter);

    switch (ais.getTag()) {
      case _TAG_forwardingInfo:
        this.forwardingInfo = new ExtForwInfoImpl();
        ((ExtForwInfoImpl) this.forwardingInfo).decodeData(ais, length);
        break;
      case _TAG_callBarringInfo:
        this.callBarringInfo = new ExtCallBarInfoImpl();
        ((ExtCallBarInfoImpl) this.callBarringInfo).decodeData(ais, length);
        break;
      case _TAG_cugInfo:
        this.cugInfo = new CUGInfoImpl();
        ((CUGInfoImpl) this.cugInfo).decodeData(ais, length);
        break;
      case _TAG_ssData:
        this.ssData = new ExtSSDataImpl();
        ((ExtSSDataImpl) this.ssData).decodeData(ais, length);
        break;
      case _TAG_emlppInfo:
        this.emlppInfo = new EMLPPInfoImpl();
        ((EMLPPInfoImpl) this.emlppInfo).decodeData(ais, length);
        break;

      default:
        throw new MAPParsingComponentException(
            "Error while " + _PrimitiveName + ": bad tag: " + ais.getTag(),
            MAPParsingComponentExceptionReason.MistypedParameter);
    }
  }
Exemplo n.º 9
0
  protected void _decode(AsnInputStream ansIS, int length)
      throws CAPParsingComponentException, IOException {

    if (!ansIS.isTagPrimitive())
      throw new CAPParsingComponentException(
          "Error decoding " + _PrimitiveName + ": field must be primitive",
          CAPParsingComponentExceptionReason.MistypedParameter);

    if (length < this.minLength || length > this.maxLength)
      throw new CAPParsingComponentException(
          "Error decoding "
              + _PrimitiveName
              + ": the field must contain from "
              + this.minLength
              + " to "
              + this.maxLength
              + " octets. Contains: "
              + length,
          CAPParsingComponentExceptionReason.MistypedParameter);

    data = new byte[length];
    ansIS.read(data);
  }
Exemplo n.º 10
0
  @Override
  protected void _decode(AsnInputStream asnIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {

    this.ssCode = null;
    this.basicService = null;
    this.longFtnSupported = false;

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

      int tag = ais.readTag();

      switch (num) {
        case 0:
          // ssCode
          if (ais.getTagClass() != Tag.CLASS_UNIVERSAL
              || !ais.isTagPrimitive()
              || tag != Tag.STRING_OCTET)
            throw new MAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + ".ssCode: Parameter 0 bad tag or tag class or not primitive",
                MAPParsingComponentExceptionReason.MistypedParameter);
          this.ssCode = new SSCodeImpl();
          ((SSCodeImpl) this.ssCode).decodeAll(ais);
          break;

        default:
          if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {
            switch (tag) {
              case BasicServiceCodeImpl._TAG_bearerService:
              case BasicServiceCodeImpl._TAG_teleservice:
                if (!ais.isTagPrimitive())
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ".basicService: Parameter is not primitive",
                      MAPParsingComponentExceptionReason.MistypedParameter);
                this.basicService = new BasicServiceCodeImpl();
                ((BasicServiceCodeImpl) this.basicService).decodeAll(ais);
                break;
              case _ID_longFTNSupported:
                if (!ais.isTagPrimitive())
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ".longFtnSupported: Parameter is not primitive",
                      MAPParsingComponentExceptionReason.MistypedParameter);
                ais.readNull();
                this.longFtnSupported = true;
                break;

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

      num++;
    }

    if (num < 1)
      throw new MAPParsingComponentException(
          "Error while decoding "
              + _PrimitiveName
              + ": Needs at least 1 mandatory parameter, found "
              + num,
          MAPParsingComponentExceptionReason.MistypedParameter);
  }
Exemplo n.º 11
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);
    }
  }
  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();
      }
    }
  }
Exemplo n.º 13
0
  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();
      }
    }
  }
Exemplo n.º 14
0
  protected void _decode(AsnInputStream ansIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {
    ExtBasicServiceCode serviceItem = null;
    this.ssCode = null;
    this.ssStatus = null;
    this.ssSubscriptionOption = null;
    this.basicServiceGroupList = null;
    this.extensionContainer = null;

    AsnInputStream ais = ansIS.readSequenceStreamData(length);

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

      int tag = ais.readTag();

      switch (num) {
        case 0: // ssCode
          if (ais.getTagClass() != Tag.CLASS_UNIVERSAL
              || tag != Tag.STRING_OCTET
              || !ais.isTagPrimitive())
            throw new MAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + ".ssCode: bad tag or tag class or not primitive",
                MAPParsingComponentExceptionReason.MistypedParameter);
          this.ssCode = new SSCodeImpl();
          ((SSCodeImpl) this.ssCode).decodeAll(ais);
          break;

        case 1: // ss-Status
          if (ais.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC
              || tag != _TAG_ss_Status
              || !ais.isTagPrimitive())
            throw new MAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + "._TAG_ss_Status: bad tag or tag class or not primitive",
                MAPParsingComponentExceptionReason.MistypedParameter);
          this.ssStatus = new ExtSSStatusImpl();
          ((ExtSSStatusImpl) this.ssStatus).decodeAll(ais);
          break;

        default:
          switch (ais.getTagClass()) {
            case Tag.CLASS_CONTEXT_SPECIFIC:
              switch (tag) {
                case SSSubscriptionOptionImpl._TAG_overrideCategory:
                case SSSubscriptionOptionImpl._TAG_cliRestrictionOption:
                  this.ssSubscriptionOption = new SSSubscriptionOptionImpl();
                  ((SSSubscriptionOptionImpl) this.ssSubscriptionOption).decodeAll(ais);
                  break;

                case _TAG_extensionContainer:
                  if (ais.isTagPrimitive())
                    throw new MAPParsingComponentException(
                        "Error while decoding "
                            + _PrimitiveName
                            + ".extensionContainer: is primitive",
                        MAPParsingComponentExceptionReason.MistypedParameter);
                  this.extensionContainer = new MAPExtensionContainerImpl();
                  ((MAPExtensionContainerImpl) this.extensionContainer).decodeAll(ais);
                  break;

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

            case Tag.CLASS_UNIVERSAL: // basicServiceGroupList
              switch (tag) {
                case Tag.SEQUENCE:
                  AsnInputStream ais2 = ais.readSequenceStream();
                  this.basicServiceGroupList = new ArrayList<ExtBasicServiceCode>();
                  while (true) {
                    if (ais2.available() == 0) break;

                    ais2.readTag();
                    serviceItem = new ExtBasicServiceCodeImpl();
                    ((ExtBasicServiceCodeImpl) serviceItem).decodeAll(ais2);
                    this.basicServiceGroupList.add(serviceItem);
                  }
                  if (this.basicServiceGroupList.size() < 1
                      && this.basicServiceGroupList.size() > 32) {
                    throw new MAPParsingComponentException(
                        "Error while decoding "
                            + _PrimitiveName
                            + ": Parameter basicServiceGroupList size must be from 1 to 32, found: "
                            + this.basicServiceGroupList.size(),
                        MAPParsingComponentExceptionReason.MistypedParameter);
                  }
                  break;
                default:
                  ais.advanceElement();
                  break;
              }
              break;

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

      num++;
    }

    if (this.ssCode == null)
      throw new MAPParsingComponentException(
          "Error while decoding " + _PrimitiveName + ": ssCode required.",
          MAPParsingComponentExceptionReason.MistypedParameter);

    if (this.ssStatus == null)
      throw new MAPParsingComponentException(
          "Error while decoding " + _PrimitiveName + ": ssStatus required.",
          MAPParsingComponentExceptionReason.MistypedParameter);
  }
Exemplo n.º 15
0
  @Override
  protected void _decode(AsnInputStream asnIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {

    this.cgiList = null;
    this.eUtranCgiList = null;
    this.routingAreaIdList = null;
    this.locationAreaIdList = null;
    this.trackingAreaIdList = null;
    this.extensionContainer = null;

    AsnInputStream ais = asnIS.readSequenceStreamData(length);

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

      int tag = ais.readTag();

      switch (ais.getTagClass()) {
        case Tag.CLASS_CONTEXT_SPECIFIC:
          {
            switch (tag) {
              case _ID_cgiList:
                if (ais.isTagPrimitive())
                  throw new MAPParsingComponentException(
                      "Error while decoding " + _PrimitiveName + ".cgiList: is primitive",
                      MAPParsingComponentExceptionReason.MistypedParameter);
                AsnInputStream ais2 = ais.readSequenceStream();
                GlobalCellId globalCellId = null;
                this.cgiList = new ArrayList<GlobalCellId>();
                while (true) {
                  if (ais2.available() == 0) break;

                  int tag2 = ais2.readTag();
                  if (tag2 != Tag.STRING_OCTET
                      || ais2.getTagClass() != Tag.CLASS_UNIVERSAL
                      || !ais2.isTagPrimitive())
                    throw new MAPParsingComponentException(
                        "Error while decoding "
                            + _PrimitiveName
                            + ": bad tag or tagClass or is not primitive when decoding cgiList",
                        MAPParsingComponentExceptionReason.MistypedParameter);

                  globalCellId = new GlobalCellIdImpl();
                  ((GlobalCellIdImpl) globalCellId).decodeAll(ais2);
                  this.cgiList.add(globalCellId);
                }
                if (this.cgiList.size() < 1 && this.cgiList.size() > 32) {
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ": Parameter cgiList size must be from 1 to 32, found: "
                          + this.cgiList.size(),
                      MAPParsingComponentExceptionReason.MistypedParameter);
                }
                break;

              case _ID_eUtranCgiList:
                if (ais.isTagPrimitive())
                  throw new MAPParsingComponentException(
                      "Error while decoding " + _PrimitiveName + ".eUtranCgiList: is primitive",
                      MAPParsingComponentExceptionReason.MistypedParameter);
                ais2 = ais.readSequenceStream();
                EUtranCgi eUtranCgi = null;
                this.eUtranCgiList = new ArrayList<EUtranCgi>();
                while (true) {
                  if (ais2.available() == 0) break;

                  int tag2 = ais2.readTag();
                  if (tag2 != Tag.STRING_OCTET
                      || ais2.getTagClass() != Tag.CLASS_UNIVERSAL
                      || !ais2.isTagPrimitive())
                    throw new MAPParsingComponentException(
                        "Error while decoding "
                            + _PrimitiveName
                            + ": bad tag or tagClass or is not primitive when decoding eUtranCgiList",
                        MAPParsingComponentExceptionReason.MistypedParameter);

                  eUtranCgi = new EUtranCgiImpl();
                  ((EUtranCgiImpl) eUtranCgi).decodeAll(ais2);
                  this.eUtranCgiList.add(eUtranCgi);
                }
                if (this.eUtranCgiList.size() < 1 && this.eUtranCgiList.size() > 32) {
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ": Parameter eUtranCgiList size must be from 1 to 32, found: "
                          + this.eUtranCgiList.size(),
                      MAPParsingComponentExceptionReason.MistypedParameter);
                }
                break;

              case _ID_routingAreaIdList:
                if (ais.isTagPrimitive())
                  throw new MAPParsingComponentException(
                      "Error while decoding " + _PrimitiveName + ".routingAreaIdList: is primitive",
                      MAPParsingComponentExceptionReason.MistypedParameter);
                ais2 = ais.readSequenceStream();
                RAIdentity raIdentity = null;
                this.routingAreaIdList = new ArrayList<RAIdentity>();
                while (true) {
                  if (ais2.available() == 0) break;

                  int tag2 = ais2.readTag();
                  if (tag2 != Tag.STRING_OCTET
                      || ais2.getTagClass() != Tag.CLASS_UNIVERSAL
                      || !ais2.isTagPrimitive())
                    throw new MAPParsingComponentException(
                        "Error while decoding "
                            + _PrimitiveName
                            + ": bad tag or tagClass or is not primitive when decoding routingAreaIdList",
                        MAPParsingComponentExceptionReason.MistypedParameter);

                  raIdentity = new RAIdentityImpl();
                  ((RAIdentityImpl) raIdentity).decodeAll(ais2);
                  this.routingAreaIdList.add(raIdentity);
                }
                if (this.routingAreaIdList.size() < 1 && this.routingAreaIdList.size() > 8) {
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ": Parameter routingAreaIdList size must be from 1 to 8, found: "
                          + this.routingAreaIdList.size(),
                      MAPParsingComponentExceptionReason.MistypedParameter);
                }
                break;

              case _ID_locationAreaIdList:
                if (ais.isTagPrimitive())
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ".locationAreaIdList: is primitive",
                      MAPParsingComponentExceptionReason.MistypedParameter);
                ais2 = ais.readSequenceStream();
                LAIFixedLength laiFixedLength = null;
                this.locationAreaIdList = new ArrayList<LAIFixedLength>();
                while (true) {
                  if (ais2.available() == 0) break;

                  int tag2 = ais2.readTag();
                  if (tag2 != Tag.STRING_OCTET
                      || ais2.getTagClass() != Tag.CLASS_UNIVERSAL
                      || !ais2.isTagPrimitive())
                    throw new MAPParsingComponentException(
                        "Error while decoding "
                            + _PrimitiveName
                            + ": bad tag or tagClass or is not primitive when decoding locationAreaIdList",
                        MAPParsingComponentExceptionReason.MistypedParameter);

                  laiFixedLength = new LAIFixedLengthImpl();
                  ((LAIFixedLengthImpl) laiFixedLength).decodeAll(ais2);
                  this.locationAreaIdList.add(laiFixedLength);
                }
                if (this.locationAreaIdList.size() < 1 && this.locationAreaIdList.size() > 8) {
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ": Parameter locationAreaIdList size must be from 1 to 8, found: "
                          + this.locationAreaIdList.size(),
                      MAPParsingComponentExceptionReason.MistypedParameter);
                }
                break;

              case _ID_trackingAreaIdList:
                if (ais.isTagPrimitive())
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ".trackingAreaIdList: is primitive",
                      MAPParsingComponentExceptionReason.MistypedParameter);
                ais2 = ais.readSequenceStream();
                TAId taId = null;
                this.trackingAreaIdList = new ArrayList<TAId>();
                while (true) {
                  if (ais2.available() == 0) break;

                  int tag2 = ais2.readTag();
                  if (tag2 != Tag.STRING_OCTET
                      || ais2.getTagClass() != Tag.CLASS_UNIVERSAL
                      || !ais2.isTagPrimitive())
                    throw new MAPParsingComponentException(
                        "Error while decoding "
                            + _PrimitiveName
                            + ": bad tag or tagClass or is not primitive when decoding trackingAreaIdList",
                        MAPParsingComponentExceptionReason.MistypedParameter);

                  taId = new TAIdImpl();
                  ((TAIdImpl) taId).decodeAll(ais2);
                  this.trackingAreaIdList.add(taId);
                }
                if (this.trackingAreaIdList.size() < 1 && this.trackingAreaIdList.size() > 8) {
                  throw new MAPParsingComponentException(
                      "Error while decoding "
                          + _PrimitiveName
                          + ": Parameter trackingAreaIdList size must be from 1 to 8, found: "
                          + this.trackingAreaIdList.size(),
                      MAPParsingComponentExceptionReason.MistypedParameter);
                }
                break;

              case _ID_extensionContainer:
                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;
            }
          }
          break;
        default:
          ais.advanceElement();
          break;
      }
    }
  }
  private void _decode(AsnInputStream ansIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {

    this.authenticationSetList = null;
    this.extensionContainer = null;
    this.epsAuthenticationSetList = null;

    if (mapProtocolVersion >= 3) {

      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 AuthenticationSetListImpl._TAG_tripletList:
            case AuthenticationSetListImpl._TAG_quintupletList:
              // authenticationSetList
              this.authenticationSetList = new AuthenticationSetListImpl();
              ((AuthenticationSetListImpl) this.authenticationSetList).decodeAll(ais);
              break;
            case _TAG_eps_AuthenticationSetList:
              // epsAuthenticationSetList
              if (ais.isTagPrimitive())
                throw new MAPParsingComponentException(
                    "Error while decoding "
                        + _PrimitiveName
                        + ".epsAuthenticationSetList: Parameter epsAuthenticationSetList is primitive",
                    MAPParsingComponentExceptionReason.MistypedParameter);
              this.epsAuthenticationSetList = new EpsAuthenticationSetListImpl();
              ((EpsAuthenticationSetListImpl) this.epsAuthenticationSetList).decodeAll(ais);
              break;

            default:
              ais.advanceElement();
              break;
          }
        } else if (ais.getTagClass() == Tag.CLASS_UNIVERSAL) {

          switch (tag) {
            case Tag.SEQUENCE:
              // extensionContainer
              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;
          }
        } else {

          ais.advanceElement();
        }
      }
    } else {
      this.authenticationSetList = new AuthenticationSetListImpl();
      ((AuthenticationSetListImpl) this.authenticationSetList).decodeData(ansIS, length);
    }
  }
Exemplo n.º 17
0
  private void _decode(AsnInputStream ansIS, int length)
      throws MAPParsingComponentException, IOException, AsnException {
    AsnInputStream ais = ansIS.readSequenceStreamData(length);

    locationInformation = false;
    subscriberState = false;
    extensionContainer = null;
    currentLocation = false;
    requestedDomain = null;
    imei = false;
    msClassmark = false;
    mnpRequestedInfo = false;

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

      int tag = ais.readTag();

      if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {
        switch (tag) {
          case _ID_locationInformation:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            ais.readNull();
            this.locationInformation = Boolean.TRUE;
            break;
          case _ID_subscriberState:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            ais.readNull();
            this.subscriberState = Boolean.TRUE;
            break;
          case _ID_extensionContainer:
            if (ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            extensionContainer = new MAPExtensionContainerImpl();
            ((MAPExtensionContainerImpl) extensionContainer).decodeAll(ais);
            break;
          case _ID_currentLocation:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            ais.readNull();
            this.currentLocation = Boolean.TRUE;
            break;
          case _ID_requestedDomain:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            int i1 = (int) ais.readInteger();
            this.requestedDomain = DomainType.getInstance(i1);
            break;
          case _ID_msclassmark:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            ais.readNull();
            this.msClassmark = Boolean.TRUE;
            break;
          case _ID_imei:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            ais.readNull();
            this.imei = Boolean.TRUE;
            break;
          case _ID_mnpRequestedInfo:
            if (!ais.isTagPrimitive())
              throw new MAPParsingComponentException(
                  "Error while decoding RequestedInfo: Parameter is not primitive",
                  MAPParsingComponentExceptionReason.MistypedParameter);
            ais.readNull();
            this.mnpRequestedInfo = Boolean.TRUE;
            break;
          default:
            ais.advanceElement();
            break;
        }
      } else {
        ais.advanceElement();
      }
    }
  }