private SccpAddress createSccpAddress(int ai, int pc, int ssn, int tt, int np, int nao, String digits) throws Exception { AddressIndicator aiObj = new AddressIndicator((byte) ai, SccpProtocolVersion.ITU); if (aiObj.isSSNPresent() && ssn == 0) { throw new Exception(String.format("Address Indicator %d indicates that SSN is present, however SSN passed is 0", ai)); if (aiObj.isPCPresent() && pc == 0) { throw new Exception(String.format("Address Indicator %d indicates that PointCode is present, however PointCode passed is 0", ai)); if (aiObj.getGlobalTitleIndicator() == null) { throw new Exception(String.format("GlobalTitle type is not recognizes, possible bad AddressIndicator value")); switch (aiObj.getGlobalTitleIndicator()) { case GLOBAL_TITLE_INCLUDES_NATURE_OF_ADDRESS_INDICATOR_ONLY: gt = this.parameterFactory.createGlobalTitle(digits,naiObj); SccpAddress sccpAddress = this.parameterFactory.createSccpAddress(aiObj.getRoutingIndicator(), gt, pc, ssn);
@Override public void encode(final OutputStream os, final boolean removeSpc, SccpProtocolVersion sccpProtocolVersion) throws ParseException { try { byte aiValue = ai.getValue(sccpProtocolVersion); if (ai.isSSNPresent()) { os.write((byte) this.ssn); if (ai.isSSNPresent()) { os.write((byte) this.ssn); if (ai.getGlobalTitleIndicator() != GlobalTitleIndicator.NO_GLOBAL_TITLE_INCLUDED) { ((AbstractGlobalTitle) this.gt).encode(os, removeSpc, sccpProtocolVersion);
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((ai == null) ? 0 : ai.hashCode()); result = prime * result + ((gt == null) ? 0 : gt.hashCode()); result = prime * result + pc; result = prime * result + ssn; //result = prime * result + (translated ? 1231 : 1237); return result; }
try { int b = bin.read() & 0xff; this.ai = new AddressIndicator((byte) b, sccpProtocolVersion); if (this.ai.isSSNPresent()) { this.ssn = bin.read() & 0xff; if (this.ai.isPCPresent()) { int b1 = bin.read() & 0xff; int b2 = bin.read() & 0xff; if (this.ai.isPCPresent()) { int b1 = bin.read() & 0xff; int b2 = bin.read() & 0xff; if (this.ai.isSSNPresent()) { this.ssn = bin.read() & 0xff; if(this.ai.getGlobalTitleIndicator()!=GlobalTitleIndicator.NO_GLOBAL_TITLE_INCLUDED){ this.gt = factory.createGlobalTitle(this.ai.getGlobalTitleIndicator()); ((AbstractGlobalTitle) this.gt).decode(bin, factory, sccpProtocolVersion);
if (!translationAddress.getAddressIndicator().isPCPresent()) { if (translationAddress.getAddressIndicator().getRoutingIndicator() == RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN) { if (targetSsn != 1) { RemoteSubSystem remoteSubSystem = this.sccpStackImpl.getSccpResource().getRemoteSsn(
private SccpAddress createAddress(int ai, int pc, int ssn, int tt, int npValue, int naiValue, String digits, boolean isRule) throws Exception { SccpAddress sccpAddress = null; AddressIndicator aiObj = new AddressIndicator((byte) ai, SccpProtocolVersion.ITU); if (aiObj.getGlobalTitleIndicator() == null) { throw new Exception(String.format("GlobalTitle type is not recognizes, possible bad AddressIndicator value")); switch (aiObj.getGlobalTitleIndicator()) { case GLOBAL_TITLE_INCLUDES_NATURE_OF_ADDRESS_INDICATOR_ONLY: gt = sccpStack.getSccpProvider().getParameterFactory().createGlobalTitle(digits, nai); sccpAddress = new SccpAddressImpl(aiObj.getRoutingIndicator(), gt, pc, ssn);
if (address.getAddressIndicator().getRoutingIndicator() == RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN) { if (logger.isDebugEnabled()) { logger.debug("RoutingIndicator == ROUTING_BASED_ON_DPC_AND_SSN. Return");
GlobalTitleIndicator gti = ruleAddress.getAddressIndicator().getGlobalTitleIndicator(); GlobalTitle primaryGt = ruleAddress.getGlobalTitle(); gt = createNewGT(gti, primaryGt, translatedDigits); gt = createNewGT(address.getAddressIndicator().getGlobalTitleIndicator(), address.getGlobalTitle(), translatedDigits); if (ruleAddress.getSubsystemNumber() > 0) ssn = ruleAddress.getSubsystemNumber(); SccpAddress sccpAddress = new SccpAddressImpl(ruleAddress.getAddressIndicator().getRoutingIndicator(), gt,ruleAddress.getSignalingPointCode(), ssn);
public String toString() { return ((new StringBuffer()).append("pc=").append(pc).append(",ssn=").append(ssn).append(",AI=").append(ai.getValue(SccpProtocolVersion.ITU)) .append(",gt=").append(gt)).toString(); }
protected int getMaxUserDataLength(SccpAddress calledPartyAddress, SccpAddress callingPartyAddress, int msgNetworkId) { GlobalTitle gt = calledPartyAddress.getGlobalTitle(); int dpc = calledPartyAddress.getSignalingPointCode(); int ssn = calledPartyAddress.getSubsystemNumber(); if (calledPartyAddress.getAddressIndicator().isPCPresent()) { if (this.router.spcIsLocal(dpc)) { if (ssn > 0) { // local destination - unlimited length return this.getMaxDataMessage(); } else if (gt != null) { return getMaxUserDataLengthForGT(calledPartyAddress, callingPartyAddress, msgNetworkId); } else { return 0; } } else { return getMaxUserDataLengthForDpc(dpc, calledPartyAddress, callingPartyAddress); } } else { if (gt != null) { return getMaxUserDataLengthForGT(calledPartyAddress, callingPartyAddress, msgNetworkId); } else { return 0; } } }
public SccpAddressImpl(final RoutingIndicator ri, final GlobalTitle gt, final int dpc, final int ssn) { this.gt = gt; this.pc = dpc; this.ssn = ssn; this.ai = new AddressIndicator(dpc > 0, ssn > 0, ri, gt == null ? GlobalTitleIndicator.NO_GLOBAL_TITLE_INCLUDED : gt.getGlobalTitleIndicator()); }
/** * Checks if SSN matches between rule address pattern and provided destination address. SSN is assumed to always match in * case it has insignificant value or pattern AI SSNPresent flag is set to false. * * @param address - a provided address to match * @param pattern - a rule pattern address * @return true if SSN is present in both pattern and received addresses and they are the same or pattern has SSN flag unset * in AI (bit 7)(isSsnPresent = false for pattern) or pattern SSN value is insignificant */ private boolean isSsnMatch(SccpAddress address, SccpAddress pattern) { if (!isSsnSignificant(pattern.getSubsystemNumber()) || !pattern.getAddressIndicator().isSSNPresent()) { if (logger.isTraceEnabled()) { logger.trace(String.format("SSN is not present or insignificant [%s]. Assume SSN matches. Return True", pattern.getSubsystemNumber())); } return true; } if (pattern.getAddressIndicator().isSSNPresent() && address.getAddressIndicator().isSSNPresent()) { if (address.getSubsystemNumber() == pattern.getSubsystemNumber()) { return true; } } if (logger.isTraceEnabled()) { logger.trace(String.format( "SSN didn't match. Pattern: isSsnPresent=%s, SSN=%s Address: isSsnPresent=%s, SSN=%s Return False", pattern.getAddressIndicator().isSSNPresent(), pattern.getSubsystemNumber(), address.getAddressIndicator() .isSSNPresent(), address.getSubsystemNumber())); } return false; }
private boolean matchGt( SccpAddress address, SccpAddress patternAddress ) { GlobalTitleIndicator gti = address.getAddressIndicator().getGlobalTitleIndicator(); GlobalTitle patternGT = patternAddress.getGlobalTitle(); switch (gti) {
GlobalTitle gt = calledPartyAddress.getGlobalTitle(); if (calledPartyAddress.getAddressIndicator().isPCPresent()) { if (calledPartyAddress.getAddressIndicator().getRoutingIndicator() == RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN) {
private void rewriteLocalAddressIfGTPresentAndRouteOnSsn(Dialog d) { SccpAddress localAddress = d.getLocalAddress(); if (localAddress.getGlobalTitle() != null && localAddress.getAddressIndicator().getRoutingIndicator() != RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE) { SccpAddress newLocalAddress = new SccpAddressImpl(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, localAddress.getGlobalTitle(), localAddress.getSignalingPointCode(), localAddress.getSubsystemNumber()); d.setLocalAddress(newLocalAddress); LOGGER.debug("rewriteCalledPartyIfGTPresent from={} to={}", localAddress, newLocalAddress); } }
public void write(AddressIndicator ai, OutputElement xml) throws XMLStreamException { xml.setAttribute(VALUE, ai.getValue(SccpProtocolVersion.ITU)); }
private NetworkIdStateImpl getRoutingAddressStatusForRoutingAddress(SccpAddress routingAddress, int affectedPc) { if (routingAddress != null && routingAddress.getAddressIndicator().isPCPresent()) { boolean affectedByPc = true; if ((affectedPc >= 0 && routingAddress.getSignalingPointCode() != affectedPc)) affectedByPc = false; boolean spcIsLocal = spcIsLocal(routingAddress.getSignalingPointCode()); if (spcIsLocal) { return new NetworkIdStateImpl(affectedByPc); } RemoteSignalingPointCode remoteSpc = sccpStack.getSccpResource().getRemoteSpcByPC( routingAddress.getSignalingPointCode()); if (remoteSpc == null) { return new NetworkIdStateImpl(affectedByPc); } if (remoteSpc.isRemoteSpcProhibited()) { return new NetworkIdStateImpl(false, affectedByPc); } int congLevel = SccpCongestionControl.generateSccpUserCongLevel(remoteSpc.getCurrentRestrictionLevel()); if (congLevel > 0) { return new NetworkIdStateImpl(congLevel, affectedByPc); } return new NetworkIdStateImpl(affectedByPc); } // we return here value that this affectedPc does not affect this rule return new NetworkIdStateImpl(false); }
&& addr.getAddressIndicator().getRoutingIndicator() == RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN) { if (!addr.getAddressIndicator().isPCPresent()) { msgAddr.setCallingPartyAddress(new SccpAddressImpl(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, null, msgAddr.getIncomingOpc(), addr .getSubsystemNumber()));
RoutingIndicator ri = calledPartyAddress.getAddressIndicator().getRoutingIndicator(); switch (ri) { case ROUTING_BASED_ON_DPC_AND_SSN:
SccpAddress locAddr2 = sccpParameterFact.createSccpAddress(locAddr.getAddressIndicator().getRoutingIndicator(), locAddr.getGlobalTitle(), locAddr.getSignalingPointCode(), smscPropertiesManagement.getHlrSsn()); dialog.setLocalAddress(locAddr2);