Example #1
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);
    }
  }
Example #2
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);
    }
  }
  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);
    }
  }