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); }
private static MAPApplicationContext getMAPApplicationContext(MAPApplicationContextName contextName, MAPApplicationContextVersion contextVersion) { FastMap<MAPApplicationContextVersion, MAPApplicationContext> verCache = appContextCache.get(contextName); if (verCache == null) { verCache = new FastMap<MAPApplicationContextVersion, MAPApplicationContext>(); appContextCache.put(contextName, verCache); } MAPApplicationContext mapApplicationContext = verCache.get(contextVersion); if (mapApplicationContext == null) { mapApplicationContext = new MAPApplicationContext(contextName, contextVersion); verCache.put(contextVersion, mapApplicationContext); } return mapApplicationContext; }
public static MAPApplicationContext getInstance(MAPApplicationContextName contextName, MAPApplicationContextVersion contextVersion) { if (MAPApplicationContext.availableApplicationContextVersion(contextName, contextVersion.getVersion())) return getMAPApplicationContext(contextName, contextVersion); else return null; }
public void addForwardShortMessageResponse(long invokeId) throws MAPException { if ((this.appCntx.getApplicationContextName() != MAPApplicationContextName.shortMsgMORelayContext && this.appCntx .getApplicationContextName() != MAPApplicationContextName.shortMsgMTRelayContext) || (this.appCntx.getApplicationContextVersion() != MAPApplicationContextVersion.version1 && this.appCntx .getApplicationContextVersion() != MAPApplicationContextVersion.version2)) throw new MAPException( "Bad application context name for addForwardShortMessageResponse: must be shortMsgMORelayContext_V1 or V2 or shortMsgMTRelayContext_V1 or V2"); ReturnResultLast resultLast = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory() .createTCResultLastRequest(); resultLast.setInvokeId(invokeId); // we need not Operation Code because no answer this.sendReturnResultLastComponent(resultLast); }
@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(); }
if (mapDialogImpl.getApplicationContext().getApplicationContextVersion() != MAPApplicationContextVersion.version1) { MAPApplicationContext mapAcn = MAPApplicationContext.getInstance(acn.getOid()); if (mapAcn == null || !mapAcn.equals(mapDialogImpl.getApplicationContext())) {
if (MAPApplicationContext.getProtocolVersion(acn.getOid()) < 2) { mapAppCtx = MAPApplicationContext.getInstance(acn.getOid()); if (mapAppCtx.getApplicationContextName() == MAPApplicationContextName.callCompletionContext || mapAppCtx.getApplicationContextName() == MAPApplicationContextName.networkFunctionalSsContext || mapAppCtx.getApplicationContextName() == MAPApplicationContextName.networkUnstructuredSsContext) { loger.error("When parsing TC-BEGIN: userInfo is mandatory for ACN==" + mapAppCtx.getApplicationContextName() + " but not found"); try {
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); } } }
@Override public MAPApplicationContext getMAPv1ApplicationContext(int operationCode, Invoke invoke) { switch (operationCode) { case MAPOperationCode.sendRoutingInfo: return MAPApplicationContext.getInstance(MAPApplicationContextName.locationInfoRetrievalContext, MAPApplicationContextVersion.version1); case MAPOperationCode.provideRoamingNumber: return MAPApplicationContext.getInstance(MAPApplicationContextName.roamingNumberEnquiryContext, MAPApplicationContextVersion.version1); } return null; }
protected TCContinueRequest encodeTCContinue(Dialog tcapDialog, Boolean sendMapAcceptInfo, ApplicationContextName acn, MAPExtensionContainer mapExtensionContainer) throws MAPException { TCContinueRequest tcContinueReq = this.getTCAPProvider().getDialogPrimitiveFactory().createContinue(tcapDialog); // we do not set ApplicationContextName if MAP Version 1 if (acn != null && MAPApplicationContext.getProtocolVersion(acn.getOid()) > 1) tcContinueReq.setApplicationContextName(acn); if (sendMapAcceptInfo && mapExtensionContainer != null && MAPApplicationContext.getProtocolVersion(acn.getOid()) > 1) { MAPAcceptInfoImpl mapAccept = new MAPAcceptInfoImpl(); mapAccept.setExtensionContainer(mapExtensionContainer); AsnOutputStream localasnOs = new AsnOutputStream(); mapAccept.encodeAll(localasnOs); UserInformation userInformation = TcapFactory.createUserInformation(); userInformation.setOid(true); userInformation.setOidValue(MAPDialogueAS.MAP_DialogueAS.getOID()); userInformation.setAsn(true); userInformation.setEncodeType(localasnOs.toByteArray()); tcContinueReq.setUserInformation(userInformation); } return tcContinueReq; }
public void addAlertServiceCentreResponse(long invokeId) throws MAPException { if (this.appCntx.getApplicationContextName() != MAPApplicationContextName.shortMsgAlertContext || (this.appCntx.getApplicationContextVersion() != MAPApplicationContextVersion.version2)) throw new MAPException( "Bad application context name for addAlertServiceCentreResponse: must be shortMsgAlertContext_V2"); ReturnResultLast resultLast = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory() .createTCResultLastRequest(); resultLast.setInvokeId(invokeId); // we need not Operation Code because no answer // OperationCode oc = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createOperationCode(); // oc.setLocalOperationCode((long) MAPOperationCode.alertServiceCentre); // resultLast.setOperationCode(oc); this.sendReturnResultLastComponent(resultLast); }
if (mapDialogImpl.getApplicationContext().getApplicationContextVersion() != MAPApplicationContextVersion.version1) { MAPApplicationContext mapAcn = MAPApplicationContext.getInstance(acn.getOid()); if (mapAcn == null || !mapAcn.equals(mapDialogImpl.getApplicationContext())) { loger.error(String.format("Received first TC-END. MAPDialog=%s. But MAPApplicationContext=%s", mapDialogImpl, mapAcn));
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); } } }
@Override public MAPApplicationContext getMAPv1ApplicationContext(int operationCode, Invoke invoke) { switch (operationCode) { case MAPOperationCode.activateTraceMode: return MAPApplicationContext.getInstance(MAPApplicationContextName.tracingContext, MAPApplicationContextVersion.version1); } return null; }
protected TCEndRequest encodeTCEnd(Dialog tcapDialog, Boolean sendMapCloseInfo, boolean prearrangedEnd, ApplicationContextName acn, MAPExtensionContainer mapExtensionContainer) throws MAPException { TCEndRequest endRequest = this.getTCAPProvider().getDialogPrimitiveFactory().createEnd(tcapDialog); if (!prearrangedEnd) { endRequest.setTermination(TerminationType.Basic); } else { endRequest.setTermination(TerminationType.PreArranged); } // we do not set ApplicationContextName if MAP Version 1 if (acn != null && MAPApplicationContext.getProtocolVersion(acn.getOid()) > 1) endRequest.setApplicationContextName(acn); if (sendMapCloseInfo && mapExtensionContainer != null && MAPApplicationContext.getProtocolVersion(acn.getOid()) > 1) { MAPAcceptInfoImpl mapAccept = new MAPAcceptInfoImpl(); mapAccept.setExtensionContainer(mapExtensionContainer); AsnOutputStream localasnOs = new AsnOutputStream(); mapAccept.encodeAll(localasnOs); UserInformation userInformation = TcapFactory.createUserInformation(); userInformation.setOid(true); userInformation.setOidValue(MAPDialogueAS.MAP_DialogueAS.getOID()); userInformation.setAsn(true); userInformation.setEncodeType(localasnOs.toByteArray()); endRequest.setUserInformation(userInformation); } return endRequest; }
boolean isNetworkLocUpContext = false; boolean isGprsLocationUpdateContext = false; if ((this.appCntx.getApplicationContextName() == MAPApplicationContextName.tracingContext) && (this.appCntx.getApplicationContextVersion() == MAPApplicationContextVersion.version1 || this.appCntx.getApplicationContextVersion() == MAPApplicationContextVersion.version2 || this.appCntx.getApplicationContextVersion() == MAPApplicationContextVersion.version3)) isTracingContext = true; if ((this.appCntx.getApplicationContextName() == MAPApplicationContextName.networkLocUpContext) && (this.appCntx.getApplicationContextVersion() == MAPApplicationContextVersion.version1 || this.appCntx.getApplicationContextVersion() == MAPApplicationContextVersion.version2 || this.appCntx.getApplicationContextVersion() == MAPApplicationContextVersion.version3)) isNetworkLocUpContext = true; if ((this.appCntx.getApplicationContextName() == MAPApplicationContextName.gprsLocationUpdateContext) && (this.appCntx.getApplicationContextVersion() == MAPApplicationContextVersion.version3)) isGprsLocationUpdateContext = true; if ((traceSupportIndicator || extensionContainer != null) && this.appCntx.getApplicationContextVersion().getVersion() >= 3) {
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 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); } } }