private MAPApplicationContext(MAPApplicationContextName contextName, MAPApplicationContextVersion contextVersion) { this.contextName = contextName; this.contextVersion = contextVersion; this.res[6] = this.contextName.getApplicationContextCode(); this.res[7] = this.contextVersion.getVersion(); }
public static MAPApplicationContext getInstance(long[] oid) { if (oid == null || oid.length != oidTemplate.length) return null; for (int i1 = 0; i1 < oidTemplate.length - 2; i1++) { if (oid[i1] != oidTemplate[i1]) return null; } MAPApplicationContextName contextName = MAPApplicationContextName.getInstance(oid[6]); MAPApplicationContextVersion contextVersion = MAPApplicationContextVersion.getInstance(oid[7]); if (contextName == null || contextVersion == null) return null; if (!MAPApplicationContext.availableApplicationContextVersion(contextName, (int) oid[7])) return null; return getMAPApplicationContext(contextName, contextVersion); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((contextName == null) ? 0 : contextName.hashCode()); result = prime * result + ((contextVersion == null) ? 0 : contextVersion.hashCode()); result = prime * result + Arrays.hashCode(res); return result; }
@Override public String toString() { StringBuffer s = new StringBuffer(); s.append("MAPApplicationContext [Name="); s.append(this.contextName.toString()); s.append(", Version="); s.append(this.contextVersion.toString()); s.append(", Oid="); for (long l : this.getOID()) { s.append(l).append(", "); } s.append("]"); return s.toString(); }
public static MAPApplicationContext getInstance(MAPApplicationContextName contextName, MAPApplicationContextVersion contextVersion) { if (MAPApplicationContext.availableApplicationContextVersion(contextName, contextVersion.getVersion())) return getMAPApplicationContext(contextName, contextVersion); else return null; }
public ServingCheckData isServingService(MAPApplicationContext dialogApplicationContext) { MAPApplicationContextName ctx = dialogApplicationContext.getApplicationContextName(); int vers = dialogApplicationContext.getApplicationContextVersion().getVersion(); switch (ctx) { case gprsLocationInfoRetrievalContext: if (vers >= 3 && vers <= 4) { return new ServingCheckDataImpl(ServingCheckResult.AC_Serving); } else if (vers > 4) { long[] altOid = dialogApplicationContext.getOID(); altOid[7] = 2; ApplicationContextName alt = TcapFactory.createApplicationContextName(altOid); return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect, alt); } else { return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect); } } return new ServingCheckDataImpl(ServingCheckResult.AC_NotServing); }
public ServingCheckData isServingService(MAPApplicationContext dialogApplicationContext) { int vers = dialogApplicationContext.getApplicationContextVersion().getVersion(); switch (dialogApplicationContext.getApplicationContextName()) { case locationSvcEnquiryContext: case locationSvcGatewayContext: if (vers == 3) { return new ServingCheckDataImpl(ServingCheckResult.AC_Serving); } else if (vers > 3) { long[] altOid = dialogApplicationContext.getOID(); altOid[7] = 3; ApplicationContextName alt = TcapFactory.createApplicationContextName(altOid); return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect, alt); } else { return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect); } } return new ServingCheckDataImpl(ServingCheckResult.AC_NotServing); }
private void resetRequest(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { if (parameter == null) throw new MAPParsingComponentException("Error while decoding resetRequest: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException("Error while decoding resetRequest: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); ResetRequestImpl ind = new ResetRequestImpl(version); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onResetRequest(ind); } catch (Exception e) { loger.error("Error processing resetRequest: " + e.getMessage(), e); } } }
private void updateLocationRequest(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); if (parameter == null) throw new MAPParsingComponentException( "Error while decoding updateLocationRequest: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding updateLocationRequest: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); UpdateLocationRequestImpl ind = new UpdateLocationRequestImpl(version); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onUpdateLocationRequest(ind); } catch (Exception e) { loger.error("Error processing updateLocationRequest: " + e.getMessage(), e); } } }
private void processInsertSubscriberDataResponse(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId, boolean returnResultNotLast) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); InsertSubscriberDataResponseImpl ind = new InsertSubscriberDataResponseImpl(version); if (parameter != null) { if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding InsertSubscriberDataResponse: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); } ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); ind.setReturnResultNotLast(returnResultNotLast); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onInsertSubscriberDataResponse(ind); } catch (Exception e) { loger.error("Error processing processInsertSubscriberDataResponse: " + e.getMessage(), e); } } }
private void cancelLocationResponse(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId, boolean returnResultNotLast) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); CancelLocationResponseImpl ind = new CancelLocationResponseImpl(); if (parameter != null) { if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding cancelLocationResponse V2_3: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); } ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); ind.setReturnResultNotLast(returnResultNotLast); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onCancelLocationResponse(ind); } catch (Exception e) { loger.error("Error processing cancelLocationResponse: " + e.getMessage(), e); } } }
private void processInsertSubscriberDataRequest(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { if (parameter == null) throw new MAPParsingComponentException( "Error while decoding InsertSubscriberDataRequest: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding InsertSubscriberDataRequest: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); InsertSubscriberDataRequestImpl ind = new InsertSubscriberDataRequestImpl(version); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onInsertSubscriberDataRequest(ind); } catch (Exception e) { loger.error("Error processing processInsertSubscriberDataRequest: " + e.getMessage(), e); } } }
private void reportSMDeliveryStatusRequest(Parameter parameter, MAPDialogSmsImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { if (parameter == null) throw new MAPParsingComponentException( "Error while decoding sendRoutingInfoForSMRequest: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding sendRoutingInfoForSMRequest: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ReportSMDeliveryStatusRequestImpl ind = new ReportSMDeliveryStatusRequestImpl(mapDialogImpl.getApplicationContext() .getApplicationContextVersion().getVersion()); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceSmsListener) serLis).onReportSMDeliveryStatusRequest(ind); } catch (Exception e) { loger.error("Error processing onReportSMDeliveryStatusIndication: " + e.getMessage(), e); } } }
private void sendRoutingInformationRequest(Parameter parameter, MAPDialogCallHandlingImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); SendRoutingInformationRequestImpl ind = new SendRoutingInformationRequestImpl(version); if (parameter == null) throw new MAPParsingComponentException( "Error while decoding SendRoutingInformationRequestIndication: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); // No matter what MAP version V1,V2,V3: tag=Tag.SEQUENCE and tagClass=Tag.CLASS_UNIVERSAL if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding SendRoutingInformationRequestIndication: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceCallHandlingListener) serLis).onSendRoutingInformationRequest(ind); } catch (Exception e) { loger.error("Error processing SendRoutingInformationRequestIndication: " + e.getMessage(), e); } } }
private void provideRoamingNumberRequest(Parameter parameter, MAPDialogCallHandlingImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); ProvideRoamingNumberRequestImpl ind = new ProvideRoamingNumberRequestImpl(version); if (parameter == null) throw new MAPParsingComponentException( "Error while decoding ProvideRoamingNumberRequestIndication: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); // No matter what MAP version V1,V2,V3: tag=Tag.SEQUENCE and tagClass=Tag.CLASS_UNIVERSAL if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding ProvideRoamingNumberRequestIndication: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceCallHandlingListener) serLis).onProvideRoamingNumberRequest(ind); } catch (Exception e) { loger.error("Error processing ProvideRoamingNumberRequestIndication: " + e.getMessage(), e); } } }
@Override public ServingCheckData isServingService(MAPApplicationContext dialogApplicationContext) { MAPApplicationContextName ctx = dialogApplicationContext.getApplicationContextName(); int vers = dialogApplicationContext.getApplicationContextVersion().getVersion(); switch (ctx) { case locationInfoRetrievalContext: if (vers >= 1 && vers <= 3) { return new ServingCheckDataImpl(ServingCheckResult.AC_Serving); } else { return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect); } case roamingNumberEnquiryContext: if (vers >= 1 && vers <= 3) { return new ServingCheckDataImpl(ServingCheckResult.AC_Serving); } else { return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect); } case ServiceTerminationContext: if (vers == 3) { return new ServingCheckDataImpl(ServingCheckResult.AC_Serving); } else { return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect); } } return new ServingCheckDataImpl(ServingCheckResult.AC_NotServing); }
private void updateGprsLocationResponse(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId, boolean returnResultNotLast) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); UpdateGprsLocationResponseImpl ind = new UpdateGprsLocationResponseImpl(); if (parameter == null) throw new MAPParsingComponentException( "Error while decoding updateGprsLocationResponse: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding updateGprsLocationResponse V3: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); ind.setReturnResultNotLast(returnResultNotLast); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onUpdateGprsLocationResponse(ind); } catch (Exception e) { loger.error("Error processing UpdateGprsLocationResponse: " + e.getMessage(), e); } } }
public void addReportSMDeliveryStatusResponse(long invokeId, ISDNAddressString storedMSISDN, MAPExtensionContainer extensionContainer) throws MAPException { MAPApplicationContextVersion vers = this.appCntx.getApplicationContextVersion(); if (this.appCntx.getApplicationContextName() != MAPApplicationContextName.shortMsgGatewayContext || (vers != MAPApplicationContextVersion.version1 && vers != MAPApplicationContextVersion.version2 && vers != MAPApplicationContextVersion.version3)) throw new MAPException( "Bad application context name for addReportSMDeliveryStatusResponse: must be shortMsgGatewayContext_V1, V2 or V3"); ReturnResultLast resultLast = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory() .createTCResultLastRequest(); resultLast.setInvokeId(invokeId); // Operation Code OperationCode oc = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createOperationCode(); oc.setLocalOperationCode((long) MAPOperationCode.reportSM_DeliveryStatus); resultLast.setOperationCode(oc); if (vers.getVersion() == 3 && (storedMSISDN != null || extensionContainer != null) || vers.getVersion() == 2 && storedMSISDN != null) { ReportSMDeliveryStatusResponseImpl resp = new ReportSMDeliveryStatusResponseImpl(vers.getVersion(), storedMSISDN, extensionContainer); AsnOutputStream aos = new AsnOutputStream(); resp.encodeData(aos); Parameter p = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createParameter(); p.setTagClass(resp.getTagClass()); p.setPrimitive(resp.getIsPrimitive()); p.setTag(resp.getTag()); p.setData(aos.toByteArray()); resultLast.setParameter(p); } this.sendReturnResultLastComponent(resultLast); }
new MAPParsingComponentException("", MAPParsingComponentExceptionReason.UnrecognizedOperation); MAPApplicationContextName acn = mapDialog.getApplicationContext().getApplicationContextName(); int vers = mapDialog.getApplicationContext().getApplicationContextVersion().getVersion(); int ocValueInt = (int) (long) ocValue;
private void updateGprsLocationRequest(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); if (parameter == null) throw new MAPParsingComponentException( "Error while decoding updateGprsLocationRequest: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); if (version == 3) { if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding updateGprsLocationRequest: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); } byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf, parameter.getTagClass(), parameter.isPrimitive(), parameter.getTag()); UpdateGprsLocationRequestImpl ind = new UpdateGprsLocationRequestImpl(); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onUpdateGprsLocationRequest(ind); } catch (Exception e) { loger.error("Error processing UpdateGprsLocationRequest: " + e.getMessage(), e); } } }