Example #1
0
  @Override
  public void encodeData(AsnOutputStream asnOs) throws MAPException {

    try {
      if (this.cgiList != null) {
        asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _ID_cgiList);
        int pos = asnOs.StartContentDefiniteLength();
        for (GlobalCellId globalCellId : this.cgiList) {
          ((GlobalCellIdImpl) globalCellId).encodeAll(asnOs);
        }
        asnOs.FinalizeContent(pos);
      }
      if (this.eUtranCgiList != null) {
        asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _ID_eUtranCgiList);
        int pos = asnOs.StartContentDefiniteLength();
        for (EUtranCgi eUtranCgi : this.eUtranCgiList) {
          ((EUtranCgiImpl) eUtranCgi).encodeAll(asnOs);
        }
        asnOs.FinalizeContent(pos);
      }
      if (this.routingAreaIdList != null) {
        asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _ID_routingAreaIdList);
        int pos = asnOs.StartContentDefiniteLength();
        for (RAIdentity raIdentity : this.routingAreaIdList) {
          ((RAIdentityImpl) raIdentity).encodeAll(asnOs);
        }
        asnOs.FinalizeContent(pos);
      }
      if (this.locationAreaIdList != null) {
        asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _ID_locationAreaIdList);
        int pos = asnOs.StartContentDefiniteLength();
        for (LAIFixedLength laiFixedLength : this.locationAreaIdList) {
          ((LAIFixedLengthImpl) laiFixedLength).encodeAll(asnOs);
        }
        asnOs.FinalizeContent(pos);
      }
      if (this.trackingAreaIdList != null) {
        asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _ID_trackingAreaIdList);
        int pos = asnOs.StartContentDefiniteLength();
        for (TAId taId : this.trackingAreaIdList) {
          ((TAIdImpl) taId).encodeAll(asnOs);
        }
        asnOs.FinalizeContent(pos);
      }

      if (this.extensionContainer != null)
        ((MAPExtensionContainerImpl) this.extensionContainer)
            .encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _ID_extensionContainer);

    } catch (AsnException e) {
      throw new MAPException(
          "AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
    }
  }
Example #2
0
  public void encode(AsnOutputStream aos) throws EncodeException {

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

      if (this.dialogAPDU == null) {
        throw new EncodeException(
            "No APDU in DialogPortion is defined when encoding DialogPortion");
      }

      if (this.getOidValue() == null) {
        throw new EncodeException(
            "No setUnidirectional() for DialogPortion is defined when encoding DialogPortion");
      }

      AsnOutputStream aos2 = new AsnOutputStream();
      dialogAPDU.encode(aos2);
      ext.setEncodeType(aos2.toByteArray());

      ext.encode(aos);

      aos.FinalizeContent(pos);

    } catch (AsnException e) {
      throw new EncodeException("AsnException when encoding DialogPortion: " + e.getMessage(), e);
    }
  }
Example #3
0
 /*
  * (non-Javadoc)
  *
  * @see org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#encodeAll
  * (org.mobicents.protocols.asn.AsnOutputStream, int, int)
  */
 public void encodeAll(AsnOutputStream asnOs, int tagClass, int tag) throws MAPException {
   try {
     asnOs.writeTag(tagClass, true, tag);
     int pos = asnOs.StartContentDefiniteLength();
     this.encodeData(asnOs);
     asnOs.FinalizeContent(pos);
   } catch (AsnException e) {
     throw new MAPException(
         "AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
   }
 }
  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 UnstructuredSSResponseIndication", e);
    }
  }
Example #5
0
    @Override
    public void encode(AsnOutputStream aos) throws EncodeException {
      try {
        aos.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, 20);
        int pos = aos.StartContentDefiniteLength();

        aos.writeNull();

        aos.FinalizeContent(pos);

      } catch (IOException e) {
        throw new EncodeException("IOException while encoding Reject: " + e.getMessage(), e);
      } catch (AsnException e) {
        throw new EncodeException("AsnException while encoding Reject: " + e.getMessage(), e);
      }
    }
Example #6
0
    @Override
    public void encode(AsnOutputStream aos) throws EncodeException {
      try {
        aos.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _TAG);
        int pos = aos.StartContentDefiniteLength();

        OperationCode oc = new OperationCodeImpl();
        oc.setLocalOperationCode(20L);
        oc.encode(aos);

        aos.FinalizeContent(pos);

      } catch (AsnException e) {
        throw new EncodeException("AsnException while encoding Invoke: " + e.getMessage(), e);
      }
    }
Example #7
0
  /*
   * (non-Javadoc)
   *
   * @see org.mobicents.protocols.ss7.map.primitives.MAPAsnPrimitive#encodeData (org.mobicents.protocols.asn.AsnOutputStream)
   */
  public void encodeData(AsnOutputStream asnOs) throws MAPException {

    if (this.ssCode == null)
      throw new MAPException("Error while encoding " + _PrimitiveName + ": ssCode required.");

    if (this.ssStatus == null)
      throw new MAPException("Error while encoding " + _PrimitiveName + ": ssStatus required.");

    if (this.basicServiceGroupList != null
        && (this.basicServiceGroupList.size() < 1 || this.basicServiceGroupList.size() > 32)) {
      throw new MAPException(
          "Error while encoding "
              + _PrimitiveName
              + ": Parameter basicServiceGroupList size must be from 1 to 32, found: "
              + this.basicServiceGroupList.size());
    }

    try {

      ((SSCodeImpl) this.ssCode).encodeAll(asnOs);

      ((ExtSSStatusImpl) this.ssStatus)
          .encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_ss_Status);

      if (this.ssSubscriptionOption != null) {
        ((SSSubscriptionOptionImpl) this.ssSubscriptionOption).encodeAll(asnOs);
      }

      if (this.basicServiceGroupList != null) {
        asnOs.writeTag(Tag.CLASS_UNIVERSAL, false, Tag.SEQUENCE);
        int pos = asnOs.StartContentDefiniteLength();
        for (ExtBasicServiceCode serviceItem : this.basicServiceGroupList) {
          ((ExtBasicServiceCodeImpl) serviceItem).encodeAll(asnOs);
        }
        asnOs.FinalizeContent(pos);
      }

      if (this.extensionContainer != null)
        ((MAPExtensionContainerImpl) this.extensionContainer)
            .encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_extensionContainer);
    } catch (AsnException e) {
      throw new MAPException(
          "AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
    }
  }
  @Override
  public void encodeData(AsnOutputStream aos) throws CAPException {

    if (this.variableParts == null)
      throw new CAPException(
          "Error while encoding " + _PrimitiveName + ": variableParts must not be null");
    if (this.variableParts.size() < 1 || this.variableParts.size() > 5)
      throw new CAPException(
          "Error while encoding "
              + _PrimitiveName
              + ": variableParts size must not be from 1 to 5, found: "
              + this.variableParts.size());

    try {
      aos.writeInteger(
          Tag.CLASS_CONTEXT_SPECIFIC, _ID_elementaryMessageID, this.elementaryMessageID);

      aos.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _ID_variableParts);
      int pos = aos.StartContentDefiniteLength();
      for (VariablePart val : this.variableParts) {
        if (val == null)
          throw new CAPException(
              "Error while encoding "
                  + _PrimitiveName
                  + ": the variableParts array has null values");
        ((VariablePartImpl) val).encodeAll(aos);
      }
      aos.FinalizeContent(pos);

    } catch (IOException e) {
      throw new CAPException(
          "IOException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
    } catch (AsnException e) {
      throw new CAPException(
          "AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
    }
  }
  public void encodeData(AsnOutputStream asnOs) throws MAPException {

    if (this.privateExtensionList == null && this.slrArgPcsExtensions == null)
      throw new MAPException(
          "Error when encoding "
              + _PrimitiveName
              + ": Both PrivateExtensionList and slrArgPcsExtensions are empty when ExtensionContainer encoding");
    if (this.privateExtensionList != null
        && (this.privateExtensionList.size() == 0 || this.privateExtensionList.size() > 10))
      throw new MAPException(
          "Error when encoding "
              + _PrimitiveName
              + ": PrivateExtensionList must contains from 1 to 10 elements when ExtensionContainer encoding");

    try {

      if (this.privateExtensionList != null) {
        asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _TAG_privateExtensionList);
        int pos2 = asnOs.StartContentDefiniteLength();

        for (MAPPrivateExtension pe : this.privateExtensionList) {
          ((MAPPrivateExtensionImpl) pe).encodeAll(asnOs);
        }

        asnOs.FinalizeContent(pos2);
      }

      if (this.slrArgPcsExtensions != null) {
        ((SLRArgPCSExtensionsImpl) this.slrArgPcsExtensions)
            .encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_slr_Arg_PCS_Extensions);
      }
    } catch (AsnException e) {
      throw new MAPException(
          "AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
    }
  }
Example #10
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.mobicents.protocols.ss7.map.api.primitives.MAPAsnPrimitive#encodeData(org.mobicents.protocols.asn.AsnOutputStream)
   */
  public void encodeData(AsnOutputStream asnOs) throws MAPException {

    if (this.networkNodeNumber == null) {
      throw new MAPException(
          "Error while encoding LCSLocationInfo the mandatory parameter networkNode-Number ISDN-AddressString is not defined");
    }

    ((ISDNAddressStringImpl) this.networkNodeNumber).encodeAll(asnOs);

    if (this.lmsi != null) {
      // lmsi [0] LMSI OPTIONAL,
      ((LMSIImpl) this.lmsi).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LMSI);
    }

    if (this.extensionContainer != null) {
      // extensionContainer [1] ExtensionContainer OPTIONAL,
      ((MAPExtensionContainerImpl) this.extensionContainer)
          .encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_EXTENSION_CONTAINER);
    }

    if (this.gprsNodeIndicator) {
      // gprsNodeIndicator [2] NULL OPTIONAL,
      try {
        asnOs.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_GPRS_NODE_IND);
      } catch (IOException e) {
        throw new MAPException(
            "Error while encoding LCSLocationInfo the optional parameter gprsNodeIndicator encoding failed ",
            e);
      } catch (AsnException e) {
        throw new MAPException(
            "Error while encoding LCSLocationInfo the optional parameter gprsNodeIndicator encoding failed ",
            e);
      }
    }

    if (this.additionalNumber != null) {
      // additional-Number [3] Additional-Number OPTIONAL,
      try {
        asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _TAG_ADDITIONAL_NUMBER);
      } catch (AsnException e) {
        throw new MAPException("AsnException while encoding parameter additional-Number");
      }

      int pos = asnOs.StartContentDefiniteLength();
      ((AdditionalNumberImpl) this.additionalNumber)
          .encodeAll(
              asnOs,
              Tag.CLASS_CONTEXT_SPECIFIC,
              ((AdditionalNumberImpl) this.additionalNumber).getTag());
      asnOs.FinalizeContent(pos);
    }

    if (this.supportedLCSCapabilitySets != null) {
      // supportedLCS-CapabilitySets [4] SupportedLCS-CapabilitySets
      // OPTIONAL,
      ((SupportedLCSCapabilitySetsImpl) this.supportedLCSCapabilitySets)
          .encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_SUPPORTED_LCS_CAPBILITY_SET);
    }

    if (this.additionalLCSCapabilitySets != null) {
      // additional-LCS-CapabilitySets [5] SupportedLCS-CapabilitySets
      // OPTIONAL
      ((SupportedLCSCapabilitySetsImpl) this.additionalLCSCapabilitySets)
          .encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_ADDITIONAL_LCS_CAPBILITY_SET);
    }

    if (this.mmeName != null) {
      ((DiameterIdentityImpl) this.mmeName)
          .encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_mme_Name);
    }
    if (this.aaaServerName != null) {
      ((DiameterIdentityImpl) this.aaaServerName)
          .encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_aaa_Server_Name);
    }
  }