Revision: 15515
Author: baranowb
Date: Fri Nov 26 04:10:47 2010
Log: [No log message]
http://code.google.com/p/mobicents/source/detail?r=15515
Modified:
/trunk/protocols/ss7/mtp/mtp-impl/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3.java
/trunk/protocols/ss7/mtp/mtp-impl/src/main/java/org/mobicents/protocols/ss7/mtp/provider/MtpProvider.java
/trunk/protocols/ss7/mtp/mtp-impl/src/main/java/org/mobicents/protocols/ss7/mtp/provider/m3ua/Provider.java
=======================================
---
/trunk/protocols/ss7/mtp/mtp-impl/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3.java
Thu Oct 7 06:31:02 2010
+++
/trunk/protocols/ss7/mtp/mtp-impl/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3.java
Fri Nov 26 04:10:47 2010
@@ -59,9 +59,13 @@
//FIXME: MOVE THIS TO LINKSET?
protected volatile boolean started = false;
+ /** defautl value of SSI */
+ public static final int DEFAULT_SSI = 2;//NATIONAL, as default.
private int dpc;
private int opc;
+ private int ssi=DEFAULT_SSI;;
+
/** List of signaling channels wrapped with MTP2*/
private List<Mtp2> links = new ArrayList();
@@ -127,7 +131,15 @@
return opc;
}
- /** (non-Javadoc)
+ public int getSsi() {
+ return ssi;
+ }
+
+ public void setSsi(int ssi) {
+ this.ssi = 0x0F & ssi; //0x0F, since its 4 bits, first two are used,
rest is free area.
+ }
+
+ /** (non-Javadoc)
* @see
org.mobicents.protocols.ss7.mtp.Mtp3#addMtp3Listener(org.mobicents.protocols.ss7.mtp.Mtp3Listener)
*/
public void addMtp3Listener(Mtp3Listener lst) {
@@ -223,12 +235,21 @@
int dpc = dpc(sif, 1);
int opc = opc(sif, 1);
int sls = sls(sif, 1);
-
- //FIXME: change back to trace
- if (logger.isTraceEnabled()) {
+
+ //check SSI, Q.704 Figure 25, seems like if its bad, we
discard.
+ if(this.ssi!=subserviceIndicator)
+ {
+ if (logger.isTraceEnabled()) {
+ logger.trace(
+ String.format("(%s) Received MSSU with bad
SSI, [si=" + serviceIndicator + ",ssi=" + subserviceIndicator + ", dpc=" +
dpc + ", opc=" + opc + ", sls=" + sls + "] data: ", mtp2.getName()) +
Arrays.toString(sif));
+ }
+ return;
+ }else if (logger.isTraceEnabled()) {
logger.trace(
String.format("(%s) Received MSSU [si=" +
serviceIndicator + ",ssi=" + subserviceIndicator + ", dpc=" + dpc + ",
opc=" + opc + ", sls=" + sls + "] data: ", mtp2.getName()) +
Arrays.toString(sif));
}
+
+
switch (serviceIndicator) {
case LINK_MANAGEMENT:
int h0 = sif[5] & 0x0f;
@@ -254,7 +275,7 @@
h1 = (sif[5] & 0xf0) >>> 4;
int len = (sif[6] & 0xf0) >>> 4;
- System.out.println("Length=" +len);
+
if (h0 == 1 && h1 == 1) {
if (logger.isTraceEnabled()) {
logger.trace(String.format("(%s) Received
SLTM", mtp2.getName()));
@@ -305,11 +326,7 @@
}
if (mtp3Listener != null) {
- //lets create byte[] which is actuall upper layer
msg.
- //msbBuff.len = sif.len - 4 (routing label), after
routing label there should be msg code
- //byte[] msgBuff = new byte[sif.length - 4];
- //System.arraycopy(sif, 4, msgBuff, 0,
msgBuff.length);
-// mtpUser.receive(mtp2.getSls(),
mtp2.getLinkSet().getId(), SERVICE_SCCP, subserviceIndicator, msgBuff);
+
byte[] message = new byte[sif.length + 1];
System.arraycopy(sif, 0, message, 1, sif.length);
message[0] = (byte) sio;
@@ -326,16 +343,13 @@
}
if (mtp3Listener != null) {
- //lets create byte[] which is actuall upper layer
msg.
- //msbBuff.len = sif.len - 4 (routing label), after
routing label there should be msg code
- //byte[] msgBuff = new byte[sif.length - 4];
- //System.arraycopy(sif, 4, msgBuff, 0,
msgBuff.length);
-// mtpUser.receive(mtp2.getSls(),
mtp2.getLinkSet().getId(), SERVICE_ISUP, subserviceIndicator, msgBuff);
-// byte[] message = new byte[sif.length + 1];
-// System.arraycopy(sif, 0, message, 1, sif.length);
-// message[0] = (byte) sio;
+ //baranowb: pushed this, unless someone can tell me
+ //why there was diff in code for SCCP && ISUP
+ byte[] message = new byte[sif.length + 1];
+ System.arraycopy(sif, 0, message, 1, sif.length);
+ message[0] = (byte) sio;
try {
- mtp3Listener.receive(sif);
+ mtp3Listener.receive(message);
} catch (Exception e) {
e.printStackTrace();
}
=======================================
---
/trunk/protocols/ss7/mtp/mtp-impl/src/main/java/org/mobicents/protocols/ss7/mtp/provider/MtpProvider.java
Sun Nov 14 22:18:07 2010
+++
/trunk/protocols/ss7/mtp/mtp-impl/src/main/java/org/mobicents/protocols/ss7/mtp/provider/MtpProvider.java
Fri Nov 26 04:10:47 2010
@@ -20,30 +20,6 @@
* @return
*/
public String getName();
-
- /**
- * Assigns originated point code
- *
- * @param opc the originated point code
- */
- public void setOriginalPointCode(int opc);
-
- /**
- * Assigns destination point code.
- *
- * @param dpc destination point code in decimal format.
- */
- public void setAdjacentPointCode(int dpc);
-
- /**
- * @return the dpc
- */
- public int getAdjacentPointCode();
-
- /**
- * @return the opc
- */
- public int getOriginalPointCode();
/**
* Sets listener for MTP callbacks. If null is passed internal refence
is
=======================================
---
/trunk/protocols/ss7/mtp/mtp-impl/src/main/java/org/mobicents/protocols/ss7/mtp/provider/m3ua/Provider.java
Sun Nov 14 22:18:07 2010
+++
/trunk/protocols/ss7/mtp/mtp-impl/src/main/java/org/mobicents/protocols/ss7/mtp/provider/m3ua/Provider.java
Fri Nov 26 04:10:47 2010
@@ -56,9 +56,6 @@
public static final String PROPERTY_LADDRESS = "mtp.address.local";
public static final String PROPERTY_RADDRESS = "mtp.address.remote";
- public static final String PROPERTY_APC = "mtp.apc";
- public static final String PROPERTY_OPC = "mtp.opc";
-
protected SocketAddress localAddress = new
InetSocketAddress("127.0.0.1", 8998);;
protected SocketAddress remoteAddress = new
InetSocketAddress("127.0.0.1", 1345);
@@ -78,9 +75,7 @@
private ReentrantLock lock = new ReentrantLock();
private Condition sendCompleted = lock.newCondition();
-
- private int opc;
- private int apc;
+
/**
*
@@ -125,20 +120,6 @@
this.remoteAddress = parseStringAddress(s);
}
- //opc/dpc
- s = p.getProperty(PROPERTY_APC);
- if(s == null)
- {
- throw new ConfigurationException("APC must be specified
with: "+PROPERTY_APC+" property.");
- }
- this.apc = Integer.parseInt(s);
-
- s = p.getProperty(PROPERTY_OPC);
- if(s == null)
- {
- throw new ConfigurationException("OPC must be specified
with: "+PROPERTY_OPC+" property.");
- }
- this.opc = Integer.parseInt(s);
} catch (Exception e) {
throw new ConfigurationException(e);
}
@@ -197,22 +178,6 @@
throw new StartFailedException(e);
}
}
-
- public void setOriginalPointCode(int opc) {
- this.opc = opc;
- }
-
- public void setAdjacentPointCode(int apc) {
- this.apc = apc;
- }
-
- public int getAdjacentPointCode() {
- return apc;
- }
-
- public int getOriginalPointCode() {
- return opc;
- }
public void setMtpListener(MtpListener listener) {
this.listener = listener;