コード例 #1
0
  public void encode(AsnOutputStream aos) throws EncodeException {

    if (this.component == null || this.component.length == 0)
      throw new EncodeException(
          "Error encoding TC-Uni: Component portion is mandatory but not defined");

    try {

      aos.writeTag(Tag.CLASS_APPLICATION, false, _TAG);
      int pos = aos.StartContentDefiniteLength();

      if (this.dp != null) this.dp.encode(aos);

      aos.writeTag(Tag.CLASS_APPLICATION, false, Component._COMPONENT_TAG);
      int pos2 = aos.StartContentDefiniteLength();
      for (Component c : this.component) {
        c.encode(aos);
      }
      aos.FinalizeContent(pos2);

      aos.FinalizeContent(pos);

    } catch (AsnException e) {
      throw new EncodeException("AsnException while encoding TC-Uni: " + e.getMessage(), e);
    }
  }
コード例 #2
0
  public void encodeData(AsnOutputStream aos) throws MAPException {

    if (this.extensionContainer == null
        && (this.shapeOfLocationEstimateNotSupported == null
            || this.shapeOfLocationEstimateNotSupported == false)
        && (this.neededLcsCapabilityNotSupportedInServingNode == null
            || this.neededLcsCapabilityNotSupportedInServingNode == false)) return;

    try {
      if (this.extensionContainer != null)
        ((MAPExtensionContainerImpl) this.extensionContainer).encodeAll(aos);

      if (this.shapeOfLocationEstimateNotSupported != null
          && this.shapeOfLocationEstimateNotSupported == true)
        aos.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, shapeOfLocationEstimateNotSupported_TAG);
      if (this.neededLcsCapabilityNotSupportedInServingNode != null
          && this.neededLcsCapabilityNotSupportedInServingNode == true)
        aos.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, neededLcsCapabilityNotSupportedInServingNode_TAG);

    } catch (IOException e) {
      throw new MAPException(
          "IOException when encoding MAPErrorMessageFacilityNotSup: " + e.getMessage(), e);
    } catch (AsnException e) {
      throw new MAPException(
          "AsnException when encoding MAPErrorMessageFacilityNotSup: " + e.getMessage(), e);
    }
  }
コード例 #3
0
  public void decode(AsnInputStream ais) throws ParseException {
    try {
      AsnInputStream localAis = ais.readSequenceStream();

      while (true) {
        if (localAis.available() == 0) return;

        int tag = localAis.readTag();
        if (localAis.isTagPrimitive() || localAis.getTagClass() != Tag.CLASS_APPLICATION)
          throw new ParseException(
              PAbortCauseType.IncorrectTxPortion,
              null,
              "Error decoding TC-Uni: DialogPortion and Component portion must be constructive and has "
                  + "tag class CLASS_APPLICATION");

        switch (tag) {
          case DialogPortion._TAG:
            this.dp = TcapFactory.createDialogPortion(localAis);
            break;

          case Component._COMPONENT_TAG:
            AsnInputStream compAis = localAis.readSequenceStream();
            List<Component> cps = new ArrayList<Component>();
            // its iterator :)
            while (compAis.available() > 0) {
              Component c = TcapFactory.createComponent(compAis);
              if (c == null) {
                break;
              }
              cps.add(c);
            }

            this.component = new Component[cps.size()];
            this.component = cps.toArray(this.component);
            break;

          default:
            throw new ParseException(
                PAbortCauseType.IncorrectTxPortion,
                null,
                "Error decoding TC-Uni: DialogPortion and Componebt parsing: bad tag - " + tag);
        }
      }
    } catch (IOException e) {
      throw new ParseException(
          PAbortCauseType.BadlyFormattedTxPortion,
          null,
          "IOException while decoding " + "TC-Uni: " + e.getMessage(),
          e);
    } catch (AsnException e) {
      throw new ParseException(
          PAbortCauseType.BadlyFormattedTxPortion,
          null,
          "AsnException while decoding " + "TC-Uni: " + e.getMessage(),
          e);
    }
  }
コード例 #4
0
ファイル: LCSQoSImpl.java プロジェクト: davidtekeshe/vasgw
 /*
  * (non-Javadoc)
  *
  * @see org.mobicents.protocols.protocols.ss7.cap.api.map.api.primitives.MAPAsnPrimitive#encodeAll
  * (com.ebridge.protocols.asn.AsnOutputStream, int, int)
  */
 public void encodeAll(AsnOutputStream asnOs, int tagClass, int tag) throws MAPException {
   try {
     asnOs.writeTag(tagClass, this.getIsPrimitive(), tag);
     int pos = asnOs.StartContentDefiniteLength();
     this.encodeData(asnOs);
     asnOs.FinalizeContent(pos);
   } catch (AsnException e) {
     throw new MAPException(
         "AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
   }
 }
コード例 #5
0
  public void encodeAll(AsnOutputStream asnOs, int tagClass, int tag) throws MAPException {

    try {
      asnOs.writeTag(tagClass, false, tag);
      int pos = asnOs.StartContentDefiniteLength();
      this.encodeData(asnOs);
      asnOs.FinalizeContent(pos);
    } catch (AsnException e) {
      throw new MAPException(
          "AsnException when encoding MAPErrorMessageFacilityNotSup: " + e.getMessage(), e);
    }
  }
コード例 #6
0
ファイル: LCSQoSImpl.java プロジェクト: davidtekeshe/vasgw
 /*
  * (non-Javadoc)
  *
  * @see org.mobicents.protocols.protocols.ss7.cap.api.map.api.primitives.MAPAsnPrimitive#decodeData
  * (com.ebridge.protocols.asn.AsnInputStream, int)
  */
 public void decodeData(AsnInputStream ansIS, int length) throws MAPParsingComponentException {
   try {
     this._decode(ansIS, length);
   } catch (IOException e) {
     throw new MAPParsingComponentException(
         "IOException when decoding " + _PrimitiveName + ": " + e.getMessage(),
         e,
         MAPParsingComponentExceptionReason.MistypedParameter);
   } catch (AsnException e) {
     throw new MAPParsingComponentException(
         "AsnException when decoding " + _PrimitiveName + ": " + e.getMessage(),
         e,
         MAPParsingComponentExceptionReason.MistypedParameter);
   }
 }
コード例 #7
0
  public void decodeAll(AsnInputStream ansIS) throws MAPParsingComponentException {

    try {
      int length = ansIS.readLength();
      this._decode(ansIS, length);
    } catch (IOException e) {
      throw new MAPParsingComponentException(
          "IOException when decoding MAPErrorMessageFacilityNotSup: " + e.getMessage(),
          e,
          MAPParsingComponentExceptionReason.MistypedParameter);
    } catch (AsnException e) {
      throw new MAPParsingComponentException(
          "AsnException when decoding MAPErrorMessageFacilityNotSup: " + e.getMessage(),
          e,
          MAPParsingComponentExceptionReason.MistypedParameter);
    }
  }
コード例 #8
0
  public void encodeData(AsnOutputStream asnOs) throws MAPException {

    if (this.plmnId == null) throw new MAPException("plmnId parameter must not be null");

    try {
      ((PlmnIdImpl) plmnId).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _ID_plmn_Id);

      if (this.ranTechnology != null) {
        asnOs.writeInteger(
            Tag.CLASS_CONTEXT_SPECIFIC, _ID_ran_Technology, this.ranTechnology.getCode());
      }

      if (this.ranPeriodicLocationSupport) {
        asnOs.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, _ID_ran_PeriodicLocationSupport);
      }
    } catch (IOException e) {
      throw new MAPException(
          "IOException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
    } catch (AsnException e) {
      throw new MAPException(
          "AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
    }
  }