Revision: 325b962b5c10
Author: [email protected] <[email protected]>
Date: Fri Aug 17 04:52:58 2012
Log: Issue 3:Allow mobicents SS7 stack to be configurable to use 5 or
8 bit SLS
http://code.google.com/p/jss7/source/detail?r=325b962b5c10
Added:
/mtp/mtp-api/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3TransferPrimitiveFactory.java
Modified:
/hardware/dahdi/java/src/main/java/org/mobicents/ss7/hardware/dahdi/DahdiMtp3UserPart.java
/hardware/dialogic/java/src/main/java/org/mobicents/ss7/hardware/dialogic/DialogicMtp3UserPart.java
/isup/isup-impl/src/main/java/org/mobicents/protocols/ss7/isup/impl/Circuit.java
/isup/isup-impl/src/test/java/org/mobicents/protocols/ss7/isup/impl/stack/timers/EventTestHarness.java
/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/AspFactory.java
/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/TransferMessageHandler.java
/m3ua/impl/src/test/java/org/mobicents/protocols/ss7/m3ua/impl/GatewayTest.java
/mtp/mtp-api/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3TransferPrimitive.java
/mtp/mtp-api/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3UserPart.java
/mtp/mtp-api/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3UserPartListener.java
/mtp/mtp-api/src/test/java/org/mobicents/protocols/ss7/mtp/Mtp3TransferMessageTest.java
/mtp/mtp-impl/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3UserPartBaseImpl.java
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/SccpRoutingControl.java
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/Mtp3UserPartImpl.java
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/oam/SccpExecutorTest.java
/sgw/gateway/src/main/java/org/mobicents/ss7/sgw/NodalInterworkingFunction.java
=======================================
--- /dev/null
+++
/mtp/mtp-api/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3TransferPrimitiveFactory.java
Fri Aug 17 04:52:58 2012
@@ -0,0 +1,97 @@
+/*
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.mobicents.protocols.ss7.mtp;
+
+/**
+ *
+ * @author amit bhayani
+ *
+ */
+public class Mtp3TransferPrimitiveFactory {
+
+ private final int pcLength;
+
+ private final int slsLength;
+
+ protected Mtp3TransferPrimitiveFactory(int pcLength, int slsLength) {
+ this.pcLength = pcLength;
+ this.slsLength = slsLength;
+ }
+
+ public Mtp3TransferPrimitive createMtp3TransferPrimitive(int si, int ni,
int mp, int opc, int dpc, int sls,
+ byte[] data) {
+ Mtp3TransferPrimitive mtp3TransferPrimitive = new
Mtp3TransferPrimitive(si, ni, mp, opc, dpc, sls, data,
+ this.pcLength, this.slsLength);
+ return mtp3TransferPrimitive;
+ }
+
+ public Mtp3TransferPrimitive createMtp3TransferPrimitive(byte[] msg) {
+ Mtp3TransferPrimitive mtp3TransferPrimitive = null;
+
+ // sio
+ int sio = msg[0];
+ int si = sio & 0x0F;
+ int ssi = (sio & 0xF0) >> 4;
+ int ni = ssi >> 2;
+ int mp = ssi & 0x03;
+
+ int dpc = 0;
+ int opc = 0;
+ int sls = 0;
+ byte[] data = null;
+
+ switch (this.pcLength) {
+ case Mtp3UserPart.PC_FORMAT_14:
+ // routing label
+ byte b1 = msg[1];
+ byte b2 = msg[2];
+ byte b3 = msg[3];
+ byte b4 = msg[4];
+ dpc = ((b2 & 0x3f) << 8) | (b1 & 0xff);
+ opc = ((b4 & 0x0f) << 10) | ((b3 & 0xff) << 2) | ((b2 & 0xc0)
>> 6);
+ sls = ((b4 & 0xf0) >> 4);
+
+ // msu data
+ data = new byte[msg.length - 5];
+ System.arraycopy(msg, 5, data, 0, data.length);
+ break;
+ case Mtp3UserPart.PC_FORMAT_24:
+ dpc = ((msg[3] & 0xff) << 16) | ((msg[2] & 0xff) << 8) | (msg[1] &
0xff);
+ opc = ((msg[6] & 0xff) << 16) | ((msg[5] & 0xff) << 8) | (msg[4] &
0xff);
+ sls = (msg[7] & 0xff);
+
+ // msu data
+ data = new byte[msg.length - 8];
+ System.arraycopy(msg, 8, data, 0, data.length);
+ break;
+ case Mtp3UserPart.PC_FORMAT_16:
+ // not implemented yet!
+ break;
+ default:
+ // Error condition. Should never happen
+ break;
+ }
+ mtp3TransferPrimitive = new Mtp3TransferPrimitive(si, ni, mp, opc, dpc,
sls, data, this.pcLength,
+ this.slsLength);
+ return mtp3TransferPrimitive;
+ }
+}
=======================================
---
/hardware/dahdi/java/src/main/java/org/mobicents/ss7/hardware/dahdi/DahdiMtp3UserPart.java
Thu Oct 20 07:45:57 2011
+++
/hardware/dahdi/java/src/main/java/org/mobicents/ss7/hardware/dahdi/DahdiMtp3UserPart.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -25,6 +25,7 @@
import java.io.IOException;
import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitive;
+import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitiveFactory;
import org.mobicents.protocols.ss7.mtp.Mtp3UserPart;
import org.mobicents.protocols.ss7.mtp.Mtp3UserPartListener;
@@ -58,5 +59,50 @@
// TODO Auto-generated method stub
}
+
+ /* (non-Javadoc)
+ * @see
org.mobicents.protocols.ss7.mtp.Mtp3UserPart#getMtp3TransferPrimitiveFactory()
+ */
+ @Override
+ public Mtp3TransferPrimitiveFactory getMtp3TransferPrimitiveFactory() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.mobicents.protocols.ss7.mtp.Mtp3UserPart#getPointCodeLength()
+ */
+ @Override
+ public int getPointCodeLength() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.mobicents.protocols.ss7.mtp.Mtp3UserPart#getSLSLength()
+ */
+ @Override
+ public int getSLSLength() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.mobicents.protocols.ss7.mtp.Mtp3UserPart#setPointCodeLength(int)
+ */
+ @Override
+ public void setPointCodeLength(int arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.mobicents.protocols.ss7.mtp.Mtp3UserPart#setSLSLength(int)
+ */
+ @Override
+ public void setSLSLength(int arg0) {
+ // TODO Auto-generated method stub
+
+ }
}
=======================================
---
/hardware/dialogic/java/src/main/java/org/mobicents/ss7/hardware/dialogic/DialogicMtp3UserPart.java
Mon Apr 23 10:53:14 2012
+++
/hardware/dialogic/java/src/main/java/org/mobicents/ss7/hardware/dialogic/DialogicMtp3UserPart.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -136,8 +136,7 @@
if (buf[0] == 0) {
this.parseMtp3Msg(buf);
} else {
-
Mtp3TransferPrimitive msg = new Mtp3TransferPrimitive();
-
msg.decodeMtp3(buf);
+ Mtp3TransferPrimitive msg =
getMtp3TransferPrimitiveFactory().createMtp3TransferPrimitive(buf);
sendTransferMessageToLocalUser(msg, msg.getSls());
}
} else {
=======================================
---
/isup/isup-impl/src/main/java/org/mobicents/protocols/ss7/isup/impl/Circuit.java
Wed Jun 13 07:20:20 2012
+++
/isup/isup-impl/src/main/java/org/mobicents/protocols/ss7/isup/impl/Circuit.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -24,12 +24,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.util.List;
-import java.util.concurrent.Future;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import javolution.util.FastList;
import javolution.util.ReentrantLock;
import org.mobicents.protocols.ss7.isup.ISUPEvent;
@@ -60,14 +55,15 @@
import org.mobicents.protocols.ss7.isup.message.parameter.CauseIndicators;
import org.mobicents.protocols.ss7.mtp.Mtp3;
import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitive;
-
+import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitiveFactory;
+import org.mobicents.protocols.ss7.scheduler.ConcurrentLinkedList;
import org.mobicents.protocols.ss7.scheduler.Scheduler;
import org.mobicents.protocols.ss7.scheduler.Task;
-import org.mobicents.protocols.ss7.scheduler.ConcurrentLinkedList;
/**
*
* @author baranowb
+ * @author amit bhayani
*
*/
@SuppressWarnings("rawtypes")
@@ -213,8 +209,8 @@
// bout.write(encoded);
// byte[] msg = bout.toByteArray();
-
- Mtp3TransferPrimitive msg = new Mtp3TransferPrimitive(si, ni, 0, opc,
dpc, sls, encoded);
+ Mtp3TransferPrimitiveFactory factory =
this.provider.stack.getMtp3UserPart().getMtp3TransferPrimitiveFactory();
+ Mtp3TransferPrimitive msg = factory.createMtp3TransferPrimitive(si, ni,
0, opc, dpc, sls, encoded);
return msg;
}
=======================================
---
/isup/isup-impl/src/test/java/org/mobicents/protocols/ss7/isup/impl/stack/timers/EventTestHarness.java
Sun Jun 17 08:45:31 2012
+++
/isup/isup-impl/src/test/java/org/mobicents/protocols/ss7/isup/impl/stack/timers/EventTestHarness.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -25,12 +25,9 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.fail;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
-import java.util.Properties;
import org.mobicents.protocols.ss7.isup.ISUPEvent;
import org.mobicents.protocols.ss7.isup.ISUPListener;
@@ -44,12 +41,11 @@
import org.mobicents.protocols.ss7.isup.message.ISUPMessage;
import org.mobicents.protocols.ss7.mtp.Mtp3;
import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitive;
-import org.mobicents.protocols.ss7.mtp.Mtp3UserPart;
+import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitiveFactory;
import org.mobicents.protocols.ss7.mtp.Mtp3UserPartBaseImpl;
-
import org.mobicents.protocols.ss7.scheduler.Clock;
-import org.mobicents.protocols.ss7.scheduler.Scheduler;
import org.mobicents.protocols.ss7.scheduler.DefaultClock;
+import org.mobicents.protocols.ss7.scheduler.Scheduler;
/**
* @author baranowb
*
@@ -176,7 +172,8 @@
// byte[] msg = bout.toByteArray();
// this.userPart.toRead.add(msg);
- Mtp3TransferPrimitive mtpMsg = new Mtp3TransferPrimitive(si, ni, 0,
opc, dpc, sls, message);
+ Mtp3TransferPrimitiveFactory factory =
stack.getMtp3UserPart().getMtp3TransferPrimitiveFactory();
+ Mtp3TransferPrimitive mtpMsg = factory.createMtp3TransferPrimitive(si,
ni, 0, opc, dpc, sls, message);
this.userPart.sendTransferMessageToLocalUser(mtpMsg,
mtpMsg.getSls());
} catch (Exception e) {
=======================================
---
/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/AspFactory.java
Mon Aug 13 04:52:26 2012
+++
/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/AspFactory.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -148,7 +148,8 @@
}
public void setM3UAManagement(M3UAManagement m3uaManagement) {
- m3UAManagement = m3uaManagement;
+ this.m3UAManagement = m3uaManagement;
+ this.transferMessageHandler.setM3UAManagement(m3uaManagement);
}
public M3UAManagement getM3UAManagement() {
=======================================
---
/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/TransferMessageHandler.java
Thu Dec 15 07:06:36 2011
+++
/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/TransferMessageHandler.java
Fri Aug 17 04:52:58 2012
@@ -1,3 +1,24 @@
+/*
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.mobicents.protocols.ss7.m3ua.impl;
import org.apache.log4j.Logger;
@@ -7,6 +28,7 @@
import org.mobicents.protocols.ss7.m3ua.parameter.ProtocolData;
import org.mobicents.protocols.ss7.m3ua.parameter.RoutingContext;
import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitive;
+import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitiveFactory;
/**
*
@@ -17,8 +39,15 @@
private static final Logger logger =
Logger.getLogger(TransferMessageHandler.class);
+ private Mtp3TransferPrimitiveFactory mtp3TransferPrimitiveFactory =
null;
+
public TransferMessageHandler(AspFactory aspFactory) {
super(aspFactory);
+
+ }
+
+ protected void setM3UAManagement(M3UAManagement m3uaManagement) {
+ this.mtp3TransferPrimitiveFactory =
m3uaManagement.getMtp3TransferPrimitiveFactory();
}
public void handlePayload(PayloadData payload) {
@@ -29,9 +58,8 @@
if (asp == null) {
// Error condition
- logger.error(String
- .format("Rx : PayloadData=%s with null RC for Aspfactory=%s. But no
ASP configured for null RC. Sending back Error",
- payload,
this.aspFactory.getName()));
+ logger.error(String.format("Rx : PayloadData=%s with null RC for
Aspfactory=%s. But no ASP configured for null RC. Sending back Error",
+ payload,
this.aspFactory.getName()));
return;
}
@@ -40,14 +68,13 @@
if (aspState == AspState.ACTIVE) {
ProtocolData protocolData = payload.getData();
- Mtp3TransferPrimitive mtp3TransferPrimitive = new
Mtp3TransferPrimitive(protocolData.getSI(),
- protocolData.getNI(), protocolData.getMP(), protocolData.getOpc(),
protocolData.getDpc(),
- protocolData.getSLS(),
protocolData.getData());
- asp.getAs().getM3UAManagement()
- .sendTransferMessageToLocalUser(mtp3TransferPrimitive,
payload.getData().getSLS());
+ Mtp3TransferPrimitive mtp3TransferPrimitive =
this.mtp3TransferPrimitiveFactory
+ .createMtp3TransferPrimitive(protocolData.getSI(),
protocolData.getNI(), protocolData.getMP(), protocolData.getOpc(),
+ protocolData.getDpc(), protocolData.getSLS(),
protocolData.getData());
+
asp.getAs().getM3UAManagement().sendTransferMessageToLocalUser(mtp3TransferPrimitive,
payload.getData().getSLS());
} else {
- logger.error(String.format(
- "Rx : PayloadData for Aspfactory=%s with null RoutingContext. But
ASP State=%s. Message=%s", this.aspFactory.getName(), aspState, payload));
+ logger.error(String.format("Rx : PayloadData for Aspfactory=%s with
null RoutingContext. But ASP State=%s. Message=%s",
+ this.aspFactory.getName(),
aspState, payload));
}
} else {
@@ -58,12 +85,10 @@
if (asp == null) {
// this is error. Send back error
RoutingContext rcObj =
this.aspFactory.parameterFactory.createRoutingContext(new long[] { rcl });
- ErrorCode errorCodeObj =
this.aspFactory.parameterFactory
-
.createErrorCode(ErrorCode.Invalid_Routing_Context);
+ ErrorCode errorCodeObj =
this.aspFactory.parameterFactory.createErrorCode(ErrorCode.Invalid_Routing_Context);
sendError(rcObj, errorCodeObj);
- logger.error(String
- .format("Rx : Payload=%s with RC=%d for Aspfactory=%s. But no ASP
configured for this RC. Sending back Error",
- payload, rcl,
this.aspFactory.getName()));
+ logger.error(String.format("Rx : Payload=%s with RC=%d for
Aspfactory=%s. But no ASP configured for this RC. Sending back Error",
payload, rcl,
+ this.aspFactory.getName()));
return;
}
@@ -72,15 +97,13 @@
if (aspState == AspState.ACTIVE) {
ProtocolData protocolData = payload.getData();
- Mtp3TransferPrimitive mtp3TransferPrimitive = new
Mtp3TransferPrimitive(protocolData.getSI(),
- protocolData.getNI(), protocolData.getMP(), protocolData.getOpc(),
protocolData.getDpc(),
- protocolData.getSLS(),
protocolData.getData());
- asp.getAs().getM3UAManagement()
- .sendTransferMessageToLocalUser(mtp3TransferPrimitive,
payload.getData().getSLS());
+ Mtp3TransferPrimitive mtp3TransferPrimitive =
this.mtp3TransferPrimitiveFactory
+ .createMtp3TransferPrimitive(protocolData.getSI(),
protocolData.getNI(), protocolData.getMP(), protocolData.getOpc(),
+ protocolData.getDpc(), protocolData.getSLS(),
protocolData.getData());
+
asp.getAs().getM3UAManagement().sendTransferMessageToLocalUser(mtp3TransferPrimitive,
payload.getData().getSLS());
} else {
- logger.error(String.format(
- "Rx : PayloadData for Aspfactory=%s for RoutingContext=%s. But ASP
State=%s. Message=%s",
- this.aspFactory.getName(), rc,
aspState, payload));
+ logger.error(String.format("Rx : PayloadData for Aspfactory=%s for
RoutingContext=%s. But ASP State=%s. Message=%s", this.aspFactory.getName(),
+ rc, aspState, payload));
}
}
}
=======================================
---
/m3ua/impl/src/test/java/org/mobicents/protocols/ss7/m3ua/impl/GatewayTest.java
Sat May 12 04:50:33 2012
+++
/m3ua/impl/src/test/java/org/mobicents/protocols/ss7/m3ua/impl/GatewayTest.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -42,6 +42,7 @@
import org.mobicents.protocols.ss7.mtp.Mtp3ResumePrimitive;
import org.mobicents.protocols.ss7.mtp.Mtp3StatusPrimitive;
import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitive;
+import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitiveFactory;
import org.mobicents.protocols.ss7.mtp.Mtp3UserPartListener;
import com.sun.nio.sctp.SctpChannel;
@@ -151,7 +152,7 @@
Thread.sleep(100);
// The AS is Pending
- assertEquals(
AsState.getState(localAs.getPeerFSM().getState().getName()),
AsState.PENDING);
+
assertEquals(AsState.getState(localAs.getPeerFSM().getState().getName()),
AsState.PENDING);
assertEquals(AsState.getState(remAs.getLocalFSM().getState().getName()),
AsState.PENDING);
// Let the AS go in DOWN state
@@ -159,7 +160,7 @@
logger.debug("Woke from 4000 sleep");
// The AS is Pending
- assertEquals(
AsState.getState(localAs.getPeerFSM().getState().getName()), AsState.DOWN);
+
assertEquals(AsState.getState(localAs.getPeerFSM().getState().getName()),
AsState.DOWN);
assertEquals(AsState.getState(remAs.getLocalFSM().getState().getName()),
AsState.DOWN);
client.stopClient();
@@ -168,7 +169,7 @@
Thread.sleep(100);
// we should receive two MTP3 data
- assertEquals(2, mtp3UserPartListener.getReceivedData().size());
+ assertEquals(mtp3UserPartListener.getReceivedData().size(), 2);
}
@@ -203,8 +204,7 @@
// m3ua as create rc <rc> <ras-name>
RoutingContext rc = factory.createRoutingContext(new
long[] { 100l });
TrafficModeType trafficModeType =
factory.createTrafficModeType(TrafficModeType.Loadshare);
- localAs = m3uaMgmt.createAs("client-testas", Functionality.AS,
ExchangeType.SE, IPSPType.CLIENT, rc,
- trafficModeType, null);
+ localAs = m3uaMgmt.createAs("client-testas", Functionality.AS,
ExchangeType.SE, IPSPType.CLIENT, rc, trafficModeType, null);
// 3. Create ASP
// m3ua asp create ip <local-ip> port <local-port> remip
<remip>
@@ -249,8 +249,8 @@
}
public void sendPayload() throws Exception {
- Mtp3TransferPrimitive mtp3TransferPrimitive = new
Mtp3TransferPrimitive(3, 1, 0, 123, 1408, 1, new byte[] {
- 1, 2, 3, 4 });
+ Mtp3TransferPrimitiveFactory factory =
m3uaMgmt.getMtp3TransferPrimitiveFactory();
+ Mtp3TransferPrimitive mtp3TransferPrimitive =
factory.createMtp3TransferPrimitive(3, 1, 0, 123, 1408, 1, new byte[] { 1,
2, 3, 4 });
m3uaMgmt.sendMessage(mtp3TransferPrimitive);
}
}
@@ -281,8 +281,7 @@
// traffic-mode {broadcast|loadshare|override}
<ras-name>
RoutingContext rc = factory.createRoutingContext(new
long[] { 100l });
TrafficModeType trafficModeType =
factory.createTrafficModeType(TrafficModeType.Loadshare);
- remAs = m3uaMgmt.createAs("server-testas", Functionality.SGW,
ExchangeType.SE, IPSPType.CLIENT, rc,
- trafficModeType, null);
+ remAs = m3uaMgmt.createAs("server-testas", Functionality.SGW,
ExchangeType.SE, IPSPType.CLIENT, rc, trafficModeType, null);
// 5. Create RASP
// m3ua rasp create <asp-name> <assoc-name>"
@@ -302,7 +301,7 @@
public void stop() throws Exception {
m3uaMgmt.stopAsp("server-testasp");
-
+
// 2.Remove route
m3uaMgmt.removeRoute(123, -1, -1, "server-testas");
@@ -321,8 +320,8 @@
}
public void sendPayload() throws Exception {
- Mtp3TransferPrimitive mtp3TransferPrimitive = new
Mtp3TransferPrimitive(3, 1, 0, 1408, 123, 1, new byte[] {
- 1, 2, 3, 4 });
+ Mtp3TransferPrimitiveFactory factory =
m3uaMgmt.getMtp3TransferPrimitiveFactory();
+ Mtp3TransferPrimitive mtp3TransferPrimitive =
factory.createMtp3TransferPrimitive(3, 1, 0, 1408, 123, 1, new byte[] { 1,
2, 3, 4 });
m3uaMgmt.sendMessage(mtp3TransferPrimitive);
}
=======================================
---
/mtp/mtp-api/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3TransferPrimitive.java
Mon Apr 23 10:53:14 2012
+++
/mtp/mtp-api/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3TransferPrimitive.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -24,22 +24,24 @@
/**
* @author sergey vetyutnev
+ * @author amit bhayani
*
*/
public class Mtp3TransferPrimitive {
- protected int si; // service indicator
- protected int ni; // network indicator
- protected int mp; // message priority
- protected int opc;
- protected int dpc;
- protected int sls;
- protected byte[] data;
+ protected final int si; // service indicator
+ protected final int ni; // network indicator
+ protected final int mp; // message priority
+ protected final int opc;
+ protected final int dpc;
+ protected final int sls;
+ protected final byte[] data;
- public Mtp3TransferPrimitive() {
- }
+ private final int pcLength;
+ private final int slsLength;
- public Mtp3TransferPrimitive(int si, int ni, int mp, int opc, int dpc,
int sls, byte[] data) {
+ protected Mtp3TransferPrimitive(int si, int ni, int mp, int opc, int dpc,
int sls, byte[] data, int pcLength,
+ int slsLength) {
this.si = si;
this.ni = ni;
this.mp = mp;
@@ -47,8 +49,11 @@
this.dpc = dpc;
this.sls = sls;
this.data = data;
+
+ this.pcLength = pcLength;
+ this.slsLength = slsLength;
}
-
+
public int getSi() {
return this.si;
}
@@ -77,78 +82,62 @@
return this.data;
}
- public void setSi(int si) {
- this.si = si;
- }
+ public byte[] encodeMtp3() {
- public void setNi(int ni) {
- this.ni = ni;
- }
+ byte[] res = null;
+ int ssi = 0;
- public void setMp(int mp) {
- this.mp = mp;
- }
+ switch (this.pcLength) {
+ case Mtp3UserPart.PC_FORMAT_14:
- public void setOpc( int opc ) {
- this.opc = opc;
- }
+ res = new byte[this.data.length + 5];
- public void setDpc( int dpc ) {
- this.dpc = dpc;
- }
+ // sio
+ ssi = (this.ni & 0x03) << 2 | (this.mp & 0x03);
+ res[0] = (byte) (((ssi & 0x0F) << 4) | (this.si &
0x0F));
- public void setSls( int sls ) {
- this.sls = sls;
- }
+ // routing label
+ res[1] = (byte) this.dpc;
+ res[2] = (byte) (((this.dpc >> 8) & 0x3F) | ((this.opc &
0x03) << 6));
+ res[3] = (byte) (this.opc >> 2);
+ res[4] = (byte) (((this.opc >> 10) & 0x0F) | ((this.sls &
0x0F) << 4));
- public void setData(byte[] data) {
- this.data = data;
- }
+ // msu data
+ System.arraycopy(this.data, 0, res, 5,
this.data.length);
+ break;
+ case Mtp3UserPart.PC_FORMAT_16:
+ // Not supported yet
+ break;
+ case Mtp3UserPart.PC_FORMAT_24:
+ res = new byte[this.data.length + 8];
- public void decodeMtp3(byte[] msg) {
+ // sio
+ ssi = (this.ni & 0x03) << 2 | (this.mp & 0x03);
+ res[0] = (byte) (((ssi & 0x0F) << 4) | (this.si &
0x0F));
- // sio
- int sio = msg[0];
- this.si = sio & 0x0F;
- int ssi = (sio & 0xF0) >> 4;
- this.ni = ssi >> 2;
- this.mp = ssi & 0x03;
+ res[1] = (byte) this.dpc;
+ res[2] = (byte) (this.dpc >> 8);
+ res[3] = (byte) (this.dpc >> 16);
- // routing label
- byte b1 = msg[1];
- byte b2 = msg[2];
- byte b3 = msg[3];
- byte b4 = msg[4];
- this.dpc = ((b2 & 0x3f) << 8) | (b1 & 0xff);
- this.opc = ((b4 & 0x0f) << 10) | ((b3 & 0xff) << 2) | ((b2 & 0xc0)
>> 6);
- this.sls = ((b4 & 0xf0) >> 4);
+ res[4] = (byte) this.opc;
+ res[5] = (byte) (this.opc >> 8);
+ res[6] = (byte) (this.opc >> 16);
- // msu data
- this.data = new byte[msg.length - 5];
- System.arraycopy(msg, 5, this.data, 0, this.data.length);
- }
+ res[7] = (byte) this.sls;
- public byte[] encodeMtp3() {
+ // msu data
+ System.arraycopy(this.data, 0, res, 8,
this.data.length);
- byte[] res = new byte[this.data.length + 5];
-
- // sio
- int ssi = (this.ni & 0x03) << 2 | (this.mp & 0x03);
- res[0] = (byte) (((ssi & 0x0F) << 4) | (this.si & 0x0F));
-
- // routing label
- res[1] = (byte) dpc;
- res[2] = (byte) (((dpc >> 8) & 0x3F) | ((this.opc & 0x03) <<
6));
- res[3] = (byte) (this.opc >> 2);
- res[4] = (byte) (((this.opc >> 10) & 0x0F) | ((sls & 0x0F) <<
4));
-
- // msu data
- System.arraycopy(this.data, 0, res, 5, this.data.length);
+ break;
+ default:
+ // This should never happen
+ break;
+ }
return res;
}
-
+
@Override
public String toString() {
@@ -164,7 +153,7 @@
sb.append(", MsgLen=");
sb.append(this.data.length);
}
-
+
sb.append(", NI=");
switch (this.ni) {
case 0:
@@ -230,5 +219,3 @@
return sb.toString();
}
}
-
-
=======================================
---
/mtp/mtp-api/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3UserPart.java
Mon Apr 23 10:53:14 2012
+++
/mtp/mtp-api/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3UserPart.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -30,13 +30,64 @@
*
*/
public interface Mtp3UserPart {
+
+ /**
+ * Point Code format for ITU-T 14 bits
+ */
+ public static final int PC_FORMAT_14 = 14;
+
+ /**
+ * Point Code format for ITU-T 16 bits
+ */
+ public static final int PC_FORMAT_16 = 16;
+
+ /**
+ * Point Code format for ITU-T or ANSI 24 bits
+ */
+ public static final int PC_FORMAT_24 = 24;
public void addMtp3UserPartListener(Mtp3UserPartListener listener);
public void removeMtp3UserPartListener(Mtp3UserPartListener listener);
/**
- * Return the maximum data field length of the MTP-TRANSFER message to
the DPC
+ * Length of Point Code in number of bits
+ *
+ * @return
+ */
+ public int getPointCodeLength();
+
+ /**
+ * Set length of Point Code in number of bits
+ *
+ * @param length
+ */
+ public void setPointCodeLength(int length);
+
+ /**
+ * Length of SLS in number of bits
+ *
+ * @return
+ */
+ public int getSLSLength();
+
+ /**
+ * Set length of SLS in number of bits
+ *
+ * @param slsLength
+ */
+ public void setSLSLength(int slsLength);
+
+ /**
+ * Get the Mtp3TransferPrimitiveFactory
+ *
+ * @return
+ */
+ public Mtp3TransferPrimitiveFactory getMtp3TransferPrimitiveFactory();
+
+ /**
+ * Return the maximum data field length of the MTP-TRANSFER message to
the
+ * DPC
*
* @param dpc
* @return
=======================================
---
/mtp/mtp-api/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3UserPartListener.java
Mon Apr 23 10:53:14 2012
+++
/mtp/mtp-api/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3UserPartListener.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -19,7 +19,6 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-
package org.mobicents.protocols.ss7.mtp;
/**
=======================================
---
/mtp/mtp-api/src/test/java/org/mobicents/protocols/ss7/mtp/Mtp3TransferMessageTest.java
Mon Apr 23 10:53:14 2012
+++
/mtp/mtp-api/src/test/java/org/mobicents/protocols/ss7/mtp/Mtp3TransferMessageTest.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -27,7 +27,7 @@
import java.util.Arrays;
-import org.testng.*;import org.testng.annotations.*;
+import org.testng.annotations.Test;
/**
* @author sergey vetyutnev
@@ -42,7 +42,7 @@
private byte[] getData() {
return new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
}
-
+
// si = 3 (SCCP)
// ni = 2
// mp = 0
@@ -50,13 +50,12 @@
// dpc = 1000
// opc = 2000
// sls = 10
-
-
+
@Test(groups = { "Mtp3TransferMessageTest", "decode" })
public void testDecode() throws Exception {
- Mtp3TransferPrimitive msg = new Mtp3TransferPrimitive();
- msg.decodeMtp3(this.getMsg());
-
+ Mtp3TransferPrimitiveFactory factory = new
Mtp3TransferPrimitiveFactory(Mtp3UserPart.PC_FORMAT_14, 4);
+ Mtp3TransferPrimitive msg =
factory.createMtp3TransferPrimitive(getMsg());
+
assertEquals(msg.getSi(), 3);
assertEquals(msg.getNi(), 2);
assertEquals(msg.getMp(), 0);
@@ -64,16 +63,17 @@
assertEquals(msg.getOpc(), 2000);
assertEquals(msg.getSls(), 10);
assertTrue(Arrays.equals(msg.getData(), this.getData()));
-
+
}
-
+
@Test(groups = { "Mtp3TransferMessageTest", "encode" })
public void testEncode() throws Exception {
- Mtp3TransferPrimitive msg = new Mtp3TransferPrimitive(3, 2, 0, 2000,
1000, 10, this.getData());
-
+ Mtp3TransferPrimitiveFactory factory = new
Mtp3TransferPrimitiveFactory(Mtp3UserPart.PC_FORMAT_14, 4);
+ Mtp3TransferPrimitive msg = factory.createMtp3TransferPrimitive(3, 2, 0,
2000, 1000, 10, this.getData());
+
byte[] res = msg.encodeMtp3();
-
+
assertTrue(Arrays.equals(res, this.getMsg()));
-
+
}
}
=======================================
---
/mtp/mtp-impl/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3UserPartBaseImpl.java
Mon Apr 23 10:53:14 2012
+++
/mtp/mtp-impl/src/main/java/org/mobicents/protocols/ss7/mtp/Mtp3UserPartBaseImpl.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -37,14 +37,15 @@
private static final Logger logger =
Logger.getLogger(Mtp3UserPartBaseImpl.class);
- private static final int MAX_SLS = 32;
- private static final int SLS_FILTER = 0x1F;
+ private int maxSls = 32;
+ private int slsFilter = 0x1F;
- // The count of threads that will be used for message delivering to
Mtp3UserPartListener's
+ // The count of threads that will be used for message delivering to
+ // Mtp3UserPartListener's
// For single thread model this value should be equal 1
// TODO: make it configurable
protected int deliveryTransferMessageThreadCount = 1;
-
+
protected boolean isStarted = false;
private CopyOnWriteArrayList<Mtp3UserPartListener> userListeners = new
CopyOnWriteArrayList<Mtp3UserPartListener>();
@@ -52,13 +53,15 @@
private ExecutorService[] msgDeliveryExecutors;
// a thread for delivering PAUSE, RESUME and STATUS messages
private ExecutorService msgDeliveryExecutorSystem;
- private int slsTable[] = new int[MAX_SLS];
+ private int slsTable[] = new int[maxSls];
-
+ private int pcLength = PC_FORMAT_14;
+ private int slsLength = 5;
+ private Mtp3TransferPrimitiveFactory mtp3TransferPrimitiveFactory =
null;
+
public Mtp3UserPartBaseImpl() {
- }
+ }
-
public int getDeliveryMessageThreadCount() {
return this.deliveryTransferMessageThreadCount;
}
@@ -67,7 +70,7 @@
if (deliveryMessageThreadCount > 0)
this.deliveryTransferMessageThreadCount =
deliveryMessageThreadCount;
}
-
+
@Override
public void addMtp3UserPartListener(Mtp3UserPartListener listener) {
this.userListeners.add(listener);
@@ -77,22 +80,78 @@
public void removeMtp3UserPartListener(Mtp3UserPartListener listener) {
this.userListeners.remove(listener);
}
-
+
/*
- * For classic MTP3 this value is maximum SIF length minus routing label
length.
- * This method should be overloaded if different message length is
supported.
+ * For classic MTP3 this value is maximum SIF length minus routing label
+ * length. This method should be overloaded if different message length
is
+ * supported.
*/
@Override
public int getMaxUserDataLength(int dpc) {
- return 272 - 4;
+ if (this.pcLength == PC_FORMAT_14) {
+ // For PC_FORMAT_14, the MTP3 Routing Label takes 4
bytes - OPC/DPC
+ // = 16 bits each and SLS = 4 bits
+ return 272 - 4;
+ } else if (this.pcLength == PC_FORMAT_24) {
+ // For PC_FORMAT_24, the MTP3 Routing Label takes 6
bytes - OPC/DPC
+ // = 24 bits each and SLS = 8 bits
+ return 272 - 7;
+ } else if (this.pcLength == PC_FORMAT_16) {
+ // TODO we don't support this yet
+ return -1;
+ }
+
+ return -1;
}
-
-
+
+ public int getPointCodeLength() {
+ return this.pcLength;
+ }
+
+ public void setPointCodeLength(int length) {
+ this.pcLength = length;
+ }
+
+ public int getSLSLength() {
+ return this.slsLength;
+ }
+
+ public void setSLSLength(int slsLength) {
+ this.slsLength = slsLength;
+ }
+
+ public Mtp3TransferPrimitiveFactory getMtp3TransferPrimitiveFactory() {
+ return this.mtp3TransferPrimitiveFactory;
+ }
+
public void start() throws Exception {
if (this.isStarted)
return;
+
+ if (!(this.pcLength == PC_FORMAT_14 || this.pcLength == PC_FORMAT_16 ||
this.pcLength == PC_FORMAT_24)) {
+ throw new Exception("Invalid point code length set. Set 14 for ITU-T 14
bits or 16 for ITU-T 16 bits or 24 for ITU-T/ANSI 24 bits");
+ }
+ switch (this.slsLength) {
+ case 4:
+ this.maxSls = 16;
+ this.slsFilter = 0x0f;
+ break;
+ case 5:
+ this.maxSls = 32;
+ this.slsFilter = 0x1f;
+ break;
+ case 8:
+ this.maxSls = 256;
+ this.slsFilter = 0xff;
+ break;
+ default:
+ throw new Exception("Invalid SLS length set. Set 4 for max SLS to be 16
or 5 for max SLS to be 32 or 8 for max SLS to be 256");
+ }
+
+ this.mtp3TransferPrimitiveFactory = new
Mtp3TransferPrimitiveFactory(this.pcLength, this.slsLength);
+
this.createSLSTable(this.deliveryTransferMessageThreadCount);
this.msgDeliveryExecutors = new
ExecutorService[this.deliveryTransferMessageThreadCount];
@@ -110,14 +169,13 @@
return;
this.isStarted = false;
-
+
for (ExecutorService es : this.msgDeliveryExecutors) {
es.shutdown();
}
this.msgDeliveryExecutorSystem.shutdown();
}
-
/**
* Deliver an incoming message to the local user
*
@@ -129,7 +187,7 @@
if (this.isStarted) {
MsgTransferDeliveryHandler hdl = new
MsgTransferDeliveryHandler(msg);
- seqControl = seqControl & SLS_FILTER;
+ seqControl = seqControl & slsFilter;
this.msgDeliveryExecutors[this.slsTable[seqControl]].execute(hdl);
}
}
@@ -154,10 +212,10 @@
this.msgDeliveryExecutorSystem.execute(hdl);
}
}
-
+
private void createSLSTable(int minimumBoundThread) {
int stream = 0;
- for (int i = 0; i < MAX_SLS; i++) {
+ for (int i = 0; i < maxSls; i++) {
if (stream >= minimumBoundThread) {
stream = 0;
}
@@ -166,13 +224,13 @@
}
private class MsgTransferDeliveryHandler implements Runnable {
-
+
private Mtp3TransferPrimitive msg;
-
+
public MsgTransferDeliveryHandler(Mtp3TransferPrimitive msg) {
this.msg = msg;
}
-
+
@Override
public void run() {
if (isStarted) {
@@ -188,17 +246,17 @@
}
private class MsgSystemDeliveryHandler implements Runnable {
-
+
private Mtp3PausePrimitive pauseMsg;
private Mtp3ResumePrimitive resumeMsg;
private Mtp3StatusPrimitive statusMsg;
-
+
public MsgSystemDeliveryHandler(Mtp3PausePrimitive pauseMsg,
Mtp3ResumePrimitive resumeMsg, Mtp3StatusPrimitive statusMsg) {
this.pauseMsg = pauseMsg;
this.resumeMsg = resumeMsg;
this.statusMsg = statusMsg;
}
-
+
@Override
public void run() {
if (isStarted) {
@@ -218,4 +276,3 @@
}
}
}
-
=======================================
---
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/SccpRoutingControl.java
Tue Apr 17 00:14:50 2012
+++
/sccp/sccp-impl/src/main/java/org/mobicents/protocols/ss7/sccp/impl/SccpRoutingControl.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -23,11 +23,13 @@
package org.mobicents.protocols.ss7.sccp.impl;
import java.io.IOException;
+
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.mobicents.protocols.ss7.indicator.RoutingIndicator;
import org.mobicents.protocols.ss7.mtp.Mtp3;
import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitive;
+import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitiveFactory;
import org.mobicents.protocols.ss7.mtp.Mtp3UserPart;
import org.mobicents.protocols.ss7.sccp.SccpListener;
import org.mobicents.protocols.ss7.sccp.impl.message.EncodingResultData;
@@ -183,14 +185,15 @@
EncodingResultData erd = message.encode(lmrt,
mup.getMaxUserDataLength(dpc), logger);
switch (erd.getEncodingResult()) {
case Success:
+ Mtp3TransferPrimitiveFactory factory =
mup.getMtp3TransferPrimitiveFactory();
if (erd.getSolidData() != null) {
// nonsegmented data
- Mtp3TransferPrimitive msg = new
Mtp3TransferPrimitive(Mtp3._SI_SERVICE_SCCP, sap.getNi(), 0, sap.getOpc(),
dpc, sls, erd.getSolidData());
+ Mtp3TransferPrimitive msg =
factory.createMtp3TransferPrimitive(Mtp3._SI_SERVICE_SCCP, sap.getNi(), 0,
sap.getOpc(), dpc, sls, erd.getSolidData());
mup.sendMessage(msg);
} else {
// segmented data
for (byte[] bf : erd.getSegementedData()) {
- Mtp3TransferPrimitive msg = new
Mtp3TransferPrimitive(Mtp3._SI_SERVICE_SCCP, sap.getNi(), 0, sap.getOpc(),
dpc, sls, bf);
+ Mtp3TransferPrimitive msg =
factory.createMtp3TransferPrimitive(Mtp3._SI_SERVICE_SCCP, sap.getNi(), 0,
sap.getOpc(), dpc, sls, bf);
mup.sendMessage(msg);
}
}
=======================================
---
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/Mtp3UserPartImpl.java
Wed May 30 01:47:09 2012
+++
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/Mtp3UserPartImpl.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -33,6 +33,7 @@
import org.mobicents.protocols.ss7.mtp.Mtp3StatusCause;
import org.mobicents.protocols.ss7.mtp.Mtp3StatusPrimitive;
import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitive;
+import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitiveFactory;
import org.mobicents.protocols.ss7.mtp.Mtp3UserPartBaseImpl;
/**
@@ -90,7 +91,8 @@
int ni = 2;
int mp = 0;
int sls = 0;
- Mtp3TransferPrimitive msg = new Mtp3TransferPrimitive(si, ni, mp, opc,
dpc, sls, data);
+ Mtp3TransferPrimitiveFactory factory =
this.getMtp3TransferPrimitiveFactory();
+ Mtp3TransferPrimitive msg = factory.createMtp3TransferPrimitive(si, ni,
mp, opc, dpc, sls, data);
int seqControl = 0;
this.sendTransferMessageToLocalUser(msg, seqControl);
}
=======================================
---
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/oam/SccpExecutorTest.java
Wed May 30 01:47:09 2012
+++
/sccp/sccp-impl/src/test/java/org/mobicents/protocols/ss7/sccp/impl/oam/SccpExecutorTest.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -29,6 +29,7 @@
import org.mobicents.protocols.ss7.indicator.NumberingPlan;
import org.mobicents.protocols.ss7.indicator.RoutingIndicator;
import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitive;
+import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitiveFactory;
import org.mobicents.protocols.ss7.mtp.Mtp3UserPart;
import org.mobicents.protocols.ss7.mtp.Mtp3UserPartListener;
import org.mobicents.protocols.ss7.sccp.impl.ConcernedSignalingPointCode;
@@ -857,5 +858,50 @@
// TODO Auto-generated method stub
}
+
+ /* (non-Javadoc)
+ * @see
org.mobicents.protocols.ss7.mtp.Mtp3UserPart#getMtp3TransferPrimitiveFactory()
+ */
+ @Override
+ public Mtp3TransferPrimitiveFactory
getMtp3TransferPrimitiveFactory() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.mobicents.protocols.ss7.mtp.Mtp3UserPart#getPointCodeLength()
+ */
+ @Override
+ public int getPointCodeLength() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.mobicents.protocols.ss7.mtp.Mtp3UserPart#getSLSLength()
+ */
+ @Override
+ public int getSLSLength() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.mobicents.protocols.ss7.mtp.Mtp3UserPart#setPointCodeLength(int)
+ */
+ @Override
+ public void setPointCodeLength(int arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.mobicents.protocols.ss7.mtp.Mtp3UserPart#setSLSLength(int)
+ */
+ @Override
+ public void setSLSLength(int arg0) {
+ // TODO Auto-generated method stub
+
+ }
}
}
=======================================
---
/sgw/gateway/src/main/java/org/mobicents/ss7/sgw/NodalInterworkingFunction.java
Thu Jun 21 07:25:06 2012
+++
/sgw/gateway/src/main/java/org/mobicents/ss7/sgw/NodalInterworkingFunction.java
Fri Aug 17 04:52:58 2012
@@ -1,6 +1,6 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
+ * TeleStax, Open Source Cloud Communications Copyright 2012.
+ * and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -29,15 +29,16 @@
import javolution.util.FastMap;
import org.apache.log4j.Logger;
-
-import org.mobicents.protocols.ss7.mtp.Mtp3UserPartListener;
-import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitive;
-import org.mobicents.protocols.ss7.mtp.Mtp3ResumePrimitive;
+import org.mobicents.protocols.ss7.m3ua.impl.M3UAManagement;
import org.mobicents.protocols.ss7.mtp.Mtp3PausePrimitive;
+import org.mobicents.protocols.ss7.mtp.Mtp3ResumePrimitive;
import org.mobicents.protocols.ss7.mtp.Mtp3StatusPrimitive;
-import org.mobicents.protocols.ss7.m3ua.message.transfer.PayloadData;
-import org.mobicents.protocols.ss7.m3ua.impl.M3UAManagement;
-
+import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitive;
+import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitiveFactory;
+import org.mobicents.protocols.ss7.mtp.Mtp3UserPartListener;
+import org.mobicents.protocols.ss7.scheduler.IntConcurrentHashMap;
+import org.mobicents.protocols.ss7.scheduler.Scheduler;
+import org.mobicents.protocols.ss7.scheduler.Task;
import org.mobicents.protocols.stream.api.SelectorKey;
import org.mobicents.ss7.linkset.oam.Layer4;
import org.mobicents.ss7.linkset.oam.Linkset;
@@ -45,10 +46,6 @@
import org.mobicents.ss7.linkset.oam.LinksetSelector;
import org.mobicents.ss7.linkset.oam.LinksetStream;
-import org.mobicents.protocols.ss7.scheduler.Scheduler;
-import org.mobicents.protocols.ss7.scheduler.Task;
-import org.mobicents.protocols.ss7.scheduler.IntConcurrentHashMap;
-
/** */
public class NodalInterworkingFunction extends Task implements
Layer4,Mtp3UserPartListener {
@@ -60,6 +57,7 @@
private LinksetManager linksetManager = null;
private M3UAManagement m3UAManagement = null;
+ private Mtp3TransferPrimitiveFactory mtp3TransferPrimitiveFactory =
null;
private boolean started = false;
@@ -97,6 +95,7 @@
public void setM3UAManagement(M3UAManagement m3UAManagement) {
this.m3UAManagement = m3UAManagement;
this.m3UAManagement.addMtp3UserPartListener(this);
+ this.mtp3TransferPrimitiveFactory =
this.m3UAManagement.getMtp3TransferPrimitiveFactory();
}
// Layer4 methods
@@ -156,8 +155,7 @@
tempBuffer=new byte[size];
System.arraycopy(rxBuffer, 0,
tempBuffer, 0, size);
- currPrimitive=new
Mtp3TransferPrimitive();
- currPrimitive.decodeMtp3(tempBuffer);
+
currPrimitive=mtp3TransferPrimitiveFactory.createMtp3TransferPrimitive(tempBuffer);
this.m3UAManagement.sendMessage(currPrimitive);
}
}