6 new revisions:
Revision: 63396ae3635c
Author: Normandes Junior <[email protected]>
Date: Mon Aug 27 07:11:43 2012
Log: Implementing checkImei request with Huawei IMSI...
http://code.google.com/p/jss7/source/detail?r=63396ae3635c
Revision: e3598192447c
Author: Sergey Vetyutnev <[email protected]>
Date: Tue Aug 28 22:12:21 2012
Log: Merge branch 'checkImei_huawei' into cap3
http://code.google.com/p/jss7/source/detail?r=e3598192447c
Revision: b4a3dc39a466
Author: Sergey Vetyutnev <[email protected]>
Date: Tue Aug 28 22:15:55 2012
Log: Merge remote-tracking branch 'origin/master_2' into cap3
http://code.google.com/p/jss7/source/detail?r=b4a3dc39a466
Revision: f49b76fd1e1f
Author: Sergey Vetyutnev <[email protected]>
Date: Tue Aug 28 23:09:29 2012
Log: ParameterImpl: support for extra parameter length field + ...
http://code.google.com/p/jss7/source/detail?r=f49b76fd1e1f
Revision: f8d6b0f42dad
Author: Sergey Vetyutnev <[email protected]>
Date: Wed Aug 29 02:12:29 2012
Log: TCAP update for checkIMEI Huawei extentions - part 2
http://code.google.com/p/jss7/source/detail?r=f8d6b0f42dad
Revision: da8c9f978765
Author: Sergey Vetyutnev <[email protected]>
Date: Wed Aug 29 02:14:18 2012
Log: Merge remote-tracking branch 'origin/cap3'
http://code.google.com/p/jss7/source/detail?r=da8c9f978765
==============================================================================
Revision: 63396ae3635c
Author: Normandes Junior <[email protected]>
Date: Mon Aug 27 07:11:43 2012
Log: Implementing checkImei request with Huawei IMSI
On branch checkImei_huawei
Changes to be committed:
modified:
map/map-api/src/main/java/org/mobicents/protocols/ss7/map/api/service/mobility/MAPDialogMobility.java
modified:
map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/MAPDialogMobilityImpl.java
modified:
map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestImpl.java
modified:
map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/Client.java
modified:
map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/MAPFunctionalTest.java
modified:
map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestTest.java
http://code.google.com/p/jss7/source/detail?r=63396ae3635c
Modified:
/map/map-api/src/main/java/org/mobicents/protocols/ss7/map/api/service/mobility/MAPDialogMobility.java
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/MAPDialogMobilityImpl.java
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestImpl.java
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/Client.java
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/MAPFunctionalTest.java
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestTest.java
=======================================
---
/map/map-api/src/main/java/org/mobicents/protocols/ss7/map/api/service/mobility/MAPDialogMobility.java
Thu Aug 16 06:30:22 2012
+++
/map/map-api/src/main/java/org/mobicents/protocols/ss7/map/api/service/mobility/MAPDialogMobility.java
Mon Aug 27 07:11:43 2012
@@ -100,5 +100,9 @@
public void addCheckImeiResponse(long invokeId, EquipmentStatus
equipmentStatus, UESBIIu bmuef, MAPExtensionContainer extensionContainer)
throws MAPException;
+ public Long addCheckImeiRequest_Huawei(IMEI imei, RequestedEquipmentInfo
requestedEquipmentInfo, MAPExtensionContainer extensionContainer, IMSI imsi)
+ throws MAPException;
+ public Long addCheckImeiRequest_Huawei(long customInvokeTimeout, IMEI
imei, RequestedEquipmentInfo requestedEquipmentInfo, MAPExtensionContainer
extensionContainer, IMSI imsi)
+ throws MAPException;
}
=======================================
---
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/MAPDialogMobilityImpl.java
Thu Aug 16 06:30:22 2012
+++
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/MAPDialogMobilityImpl.java
Mon Aug 27 07:11:43 2012
@@ -456,6 +456,67 @@
this.sendReturnResultLastComponent(resultLast);
}
+
+
+ @Override
+ public Long addCheckImeiRequest_Huawei(IMEI imei, RequestedEquipmentInfo
requestedEquipmentInfo,
+ MAPExtensionContainer extensionContainer, IMSI imsi) throws
MAPException {
+
+ return this.addCheckImeiRequest_Huawei(_Timer_Default, imei,
requestedEquipmentInfo, extensionContainer, imsi);
+ }
+
+
+ @Override
+ public Long addCheckImeiRequest_Huawei(long customInvokeTimeout, IMEI
imei,
+ RequestedEquipmentInfo requestedEquipmentInfo, MAPExtensionContainer
extensionContainer, IMSI imsi)
+ throws MAPException {
+
+ if ((this.appCntx.getApplicationContextName() !=
MAPApplicationContextName.equipmentMngtContext)
+ || (this.appCntx.getApplicationContextVersion() !=
MAPApplicationContextVersion.version1
+ && this.appCntx.getApplicationContextVersion() !=
MAPApplicationContextVersion.version2
+ && this.appCntx.getApplicationContextVersion() !=
MAPApplicationContextVersion.version3)) {
+ throw new MAPException("Bad application context name for
CheckImeiRequest: must be equipmentMngtContext_V1, V2 or V3");
+ }
+
+ Invoke invoke =
this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createTCInvokeRequest();
+ if (customInvokeTimeout == _Timer_Default) {
+ invoke.setTimeout(_Timer_m);
+ }
+ else {
+ invoke.setTimeout(customInvokeTimeout);
+ }
+
+ // Operation Code
+ OperationCode oc = TcapFactory.createOperationCode();
+ oc.setLocalOperationCode((long) MAPOperationCode.checkIMEI);
+ invoke.setOperationCode(oc);
+
+ CheckImeiRequestImpl req = new
CheckImeiRequestImpl(this.appCntx.getApplicationContextVersion().getVersion()
+ , imei, requestedEquipmentInfo,
extensionContainer);
+ req.setIMSI(imsi);
+
+ AsnOutputStream aos = new AsnOutputStream();
+ req.encodeData(aos);
+
+ Parameter p =
this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createParameter();
+ p.setTagClass(req.getTagClass());
+ p.setPrimitive(req.getIsPrimitive());
+ p.setTag(req.getTag());
+ p.setData(aos.toByteArray());
+ invoke.setParameter(p);
+
+ Long invokeId;
+ try {
+ invokeId = this.tcapDialog.getNewInvokeId();
+ invoke.setInvokeId(invokeId);
+ } catch (TCAPException e) {
+ throw new MAPException(e.getMessage(), e);
+ }
+
+ this.sendInvokeComponent(invoke);
+
+ return invokeId;
+ }
}
=======================================
---
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestImpl.java
Wed Aug 15 11:52:26 2012
+++
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestImpl.java
Mon Aug 27 07:11:43 2012
@@ -34,10 +34,12 @@
import org.mobicents.protocols.ss7.map.api.MAPParsingComponentException;
import
org.mobicents.protocols.ss7.map.api.MAPParsingComponentExceptionReason;
import org.mobicents.protocols.ss7.map.api.primitives.IMEI;
+import org.mobicents.protocols.ss7.map.api.primitives.IMSI;
import
org.mobicents.protocols.ss7.map.api.primitives.MAPExtensionContainer;
import
org.mobicents.protocols.ss7.map.api.service.mobility.imei.CheckImeiRequest;
import
org.mobicents.protocols.ss7.map.api.service.mobility.imei.RequestedEquipmentInfo;
import org.mobicents.protocols.ss7.map.primitives.IMEIImpl;
+import org.mobicents.protocols.ss7.map.primitives.IMSIImpl;
import
org.mobicents.protocols.ss7.map.primitives.MAPExtensionContainerImpl;
import
org.mobicents.protocols.ss7.map.service.mobility.MobilityMessageImpl;
@@ -53,6 +55,8 @@
private RequestedEquipmentInfo requestedEquipmentInfo = null;
private MAPExtensionContainer extensionContainer = null;
+ private IMSI imsi = null;
+
private long mapProtocolVersion;
// For incoming messages
@@ -95,6 +99,13 @@
return true;
}
}
+
+ public IMSI getIMSI() {
+ return imsi;
+ }
+ public void setIMSI(IMSI imsi) {
+ this.imsi = imsi;
+ }
@Override
public void decodeAll(AsnInputStream ansIS) throws
MAPParsingComponentException {
@@ -179,7 +190,22 @@
+ num,
MAPParsingComponentExceptionReason.MistypedParameter);
} else {
this.imei = new IMEIImpl();
- ((IMEIImpl)this.imei).decodeData(ansIS, length);
+ // Because Huawei package is not a SEQUENCE, imei should read just 8
pos.
+ ((IMEIImpl)this.imei).decodeData(ansIS, 8);
+
+ // To decode IMSI in Huawei package
+ if (ansIS.available() != 0) {
+ int tag = ansIS.readTag();
+ length = ansIS.readLength();
+ if (tag != 0 && ansIS.getTagClass() != Tag.CLASS_UNIVERSAL
&& !ansIS.isTagPrimitive()) {
+ throw new MAPParsingComponentException(
+ "Error while decoding " + _PrimitiveName + ".imsi: bad tag or tag
class or is not primitive: TagClass=" + ansIS.getTagClass()
+ + ", tag=" + tag,
MAPParsingComponentExceptionReason.MistypedParameter);
+ }
+
+ this.imsi = new IMSIImpl();
+ ((IMSIImpl) this.imsi).decodeData(ansIS,
length);
+ }
}
}
@@ -199,7 +225,6 @@
} catch (AsnException e) {
throw new MAPException("AsnException when encoding " + _PrimitiveName
+ ": " + e.getMessage(), e);
}
-
}
@Override
@@ -218,9 +243,13 @@
((MAPExtensionContainerImpl)
this.extensionContainer).encodeAll(asnOs);
} else {
((IMEIImpl)this.imei).encodeData(asnOs);
+
+ if (imsi != null) {
+ ((IMSIImpl) this.imsi).encodeAll(asnOs,
Tag.CLASS_UNIVERSAL, 0);
+ }
}
}
-
+
@Override
public MAPMessageType getMessageType() {
return MAPMessageType.checkIMEI_Request;
@@ -269,6 +298,12 @@
sb.append(extensionContainer.toString());
sb.append(", ");
}
+
+ if (this.imsi != null) {
+ sb.append("imsi=");
+ sb.append(imsi.toString());
+ sb.append(", ");
+ }
sb.append("mapProtocolVersion=");
sb.append(mapProtocolVersion);
=======================================
---
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/Client.java
Tue Aug 21 11:54:35 2012
+++
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/Client.java
Mon Aug 27 07:11:43 2012
@@ -696,6 +696,25 @@
this.observerdEvents.add(TestEvent.createSentEvent(EventType.CheckImei,
null, sequence++));
clientDialogMobility.send();
}
+
+ public void sendCheckImei_Huawei_V2() throws Exception {
+
+ this.mapProvider.getMAPServiceMobility().acivate();
+
+ MAPApplicationContext appCnt = null;
+
+ appCnt =
MAPApplicationContext.getInstance(MAPApplicationContextName.equipmentMngtContext,
MAPApplicationContextVersion.version2);
+
+ clientDialogMobility =
this.mapProvider.getMAPServiceMobility().createNewDialog(appCnt,
this.thisAddress, null, this.remoteAddress, null);
+
+ IMEI imei =
this.mapParameterFactory.createIMEI("333333334444444");
+ IMSI imsi =
this.mapParameterFactory.createIMSI("999999998888888");
+
+ clientDialogMobility.addCheckImeiRequest_Huawei(imei, null,
null, imsi);
+
+ this.observerdEvents.add(TestEvent.createSentEvent(EventType.CheckImei,
null, sequence++));
+ clientDialogMobility.send();
+ }
public MAPDialog getMapDialog() {
return this.clientDialog;
=======================================
---
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/MAPFunctionalTest.java
Tue Aug 21 11:54:35 2012
+++
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/functional/MAPFunctionalTest.java
Mon Aug 27 07:11:43 2012
@@ -133,6 +133,7 @@
import org.mobicents.protocols.ss7.map.api.smstpdu.TypeOfNumber;
import
org.mobicents.protocols.ss7.map.primitives.MAPExtensionContainerTest;
import
org.mobicents.protocols.ss7.map.service.mobility.authentication.TripletListTest;
+import
org.mobicents.protocols.ss7.map.service.mobility.imei.CheckImeiRequestImpl;
import org.mobicents.protocols.ss7.map.service.sms.SmsSignalInfoImpl;
import
org.mobicents.protocols.ss7.map.service.supplementary.ProcessUnstructuredSSResponseImpl;
import org.mobicents.protocols.ss7.sccp.impl.SccpHarness;
@@ -4039,6 +4040,100 @@
client.compareEvents(clientExpectedEvents);
server.compareEvents(serverExpectedEvents);
}
+
+ /**
+ * TC-BEGIN + checkImeiRequest_V2
+ * TC-END + checkImeiResponse_V2
+ */
+ @Test(groups = { "functional.flow", "dialog" })
+ public void testCheckImei_Huawei_V2() throws Exception {
+ Client client = new Client(stack1, this, peer1Address,
peer2Address) {
+ @Override
+ public void onCheckImeiResponse(CheckImeiResponse ind) {
+ super.onCheckImeiResponse(ind);
+
+
Assert.assertTrue(ind.getEquipmentStatus().equals(EquipmentStatus.blackListed));
+ Assert.assertNull(ind.getBmuef());
+ Assert.assertNull(ind.getExtensionContainer());
+ };
+ };
+
+ Server server = new Server(this.stack2, this, peer2Address,
peer1Address) {
+ @Override
+ public void onCheckImeiRequest(CheckImeiRequest ind) {
+ super.onCheckImeiRequest(ind);
+
+ MAPDialogMobility d = ind.getMAPDialog();
+
+
Assert.assertTrue(ind.getIMEI().getIMEI().equals("333333334444444"));
+
Assert.assertNull(ind.getRequestedEquipmentInfo());
+ Assert.assertNull(ind.getExtensionContainer());
+ CheckImeiRequestImpl impl =
(CheckImeiRequestImpl) ind;
+
Assert.assertTrue(impl.getIMSI().getData().equals("999999998888888"));
+
+ try {
+ d.addCheckImeiResponse(ind.getInvokeId(),
EquipmentStatus.blackListed, null, null);
+ } catch (MAPException e) {
+ this.error("Error while adding
CheckImeiResponse_V2", e);
+ fail("Error while adding
CheckImeiResponse_V2");
+ }
+ }
+
+ @Override
+ public void onDialogDelimiter(MAPDialog mapDialog) {
+ super.onDialogDelimiter(mapDialog);
+ try {
+
this.observerdEvents.add(TestEvent.createSentEvent(EventType.CheckImeiResp,
null, sequence++));
+ mapDialog.close(false);
+ } catch (MAPException e) {
+ this.error("Error while sending
close()", e);
+ fail("Error while sending close()");
+ }
+ }
+ };
+
+ long stamp = System.currentTimeMillis();
+ int count = 0;
+ // Client side events
+ List<TestEvent> clientExpectedEvents = new
ArrayList<TestEvent>();
+ TestEvent te = TestEvent.createSentEvent(EventType.CheckImei, null,
count++, stamp);
+ clientExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogAccept, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ clientExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.CheckImeiResp, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ clientExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogClose, null, count++,
(stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ clientExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogRelease, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ clientExpectedEvents.add(te);
+
+ count = 0;
+ // Server side events
+ List<TestEvent> serverExpectedEvents = new
ArrayList<TestEvent>();
+ te = TestEvent.createReceivedEvent(EventType.DialogRequest, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ serverExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.CheckImei, null, count++,
(stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ serverExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogDelimiter, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ serverExpectedEvents.add(te);
+
+ te = TestEvent.createSentEvent(EventType.CheckImeiResp, null, count++,
stamp);
+ serverExpectedEvents.add(te);
+
+ te = TestEvent.createReceivedEvent(EventType.DialogRelease, null,
count++, (stamp + _TCAP_DIALOG_RELEASE_TIMEOUT));
+ serverExpectedEvents.add(te);
+
+ client.sendCheckImei_Huawei_V2();
+ waitForEnd();
+ client.compareEvents(clientExpectedEvents);
+ server.compareEvents(serverExpectedEvents);
+ }
private void waitForEnd() {
try {
=======================================
---
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestTest.java
Tue Aug 21 11:54:35 2012
+++
/map/map-impl/src/test/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestTest.java
Mon Aug 27 07:11:43 2012
@@ -31,6 +31,7 @@
import org.mobicents.protocols.asn.Tag;
import
org.mobicents.protocols.ss7.map.api.primitives.MAPExtensionContainer;
import org.mobicents.protocols.ss7.map.primitives.IMEIImpl;
+import org.mobicents.protocols.ss7.map.primitives.IMSIImpl;
import
org.mobicents.protocols.ss7.map.primitives.MAPExtensionContainerTest;
import org.testng.annotations.Test;
@@ -56,6 +57,12 @@
return new byte[] { 48, 55, 4, 8, 83, 8, 25, 16, -122, 53, 85, -16, 3,
2, 6, -128, 48, 39, -96, 32, 48, 10, 6, 3, 42, 3, 4, 11, 12, 13, 14, 15,
48, 5,
6, 3, 42, 3, 6, 48, 11, 6, 3, 42, 3, 5, 21, 22, 23, 24, 25, 26, -95,
3, 31, 32, 33 };
}
+
+ // Huawei trace with IMSI
+ private byte[] getEncodedDataV2_Huawei() {
+ return new byte[] { 0x04, 0x08, 0x53, 0x46, 0x76, 0x40, (byte)0x94,
(byte)0x98, 0x19, (byte)0xf0,
+ 0x00, 0x08, 0x27, 0x34, 0x04, 0x03, 0x30, 0x58,
0x67, (byte)0xf3 };
+ }
@Test(groups = { "functional.decode", "imei" })
public void testDecode() throws Exception {
@@ -98,6 +105,18 @@
checkImeiImpl.decodeAll(asnIS);
assertTrue(checkImeiImpl.getIMEI().getIMEI().equals("358091016853550"));
+
+ // Testing version 1 and 2 with Huawei trace
+ rawData = getEncodedDataV2_Huawei();
+ asnIS = new AsnInputStream(rawData);
+
+ tag = asnIS.readTag();
+ assertEquals(tag, Tag.STRING_OCTET);
+ checkImeiImpl = new CheckImeiRequestImpl(2);
+ checkImeiImpl.decodeAll(asnIS);
+
+
assertTrue(checkImeiImpl.getIMEI().getIMEI().equals("356467044989910"));
+
assertTrue(checkImeiImpl.getIMSI().getData().equals("724340300385763"));
}
@Test(groups = { "functional.encode", "imei" })
@@ -137,6 +156,19 @@
encodedData = asnOS.toByteArray();
rawData = getEncodedDataV2();
assertTrue(Arrays.equals(rawData, encodedData));
+
+ // Testing version 1 and 2 with Huawei trace
+ imei = new IMEIImpl("356467044989910");
+ IMSIImpl imsi = new IMSIImpl("724340300385763");
+ checkImei = new CheckImeiRequestImpl(2, imei, null, null);
+ checkImei.setIMSI(imsi);
+
+ asnOS = new AsnOutputStream();
+ checkImei.encodeAll(asnOS);
+
+ encodedData = asnOS.toByteArray();
+ rawData = getEncodedDataV2_Huawei();
+ assertTrue(Arrays.equals(rawData, encodedData));
}
}
==============================================================================
Revision: e3598192447c
Author: Sergey Vetyutnev <[email protected]>
Date: Tue Aug 28 22:12:21 2012
Log: Merge branch 'checkImei_huawei' into cap3
http://code.google.com/p/jss7/source/detail?r=e3598192447c
==============================================================================
Revision: b4a3dc39a466
Author: Sergey Vetyutnev <[email protected]>
Date: Tue Aug 28 22:15:55 2012
Log: Merge remote-tracking branch 'origin/master_2' into cap3
http://code.google.com/p/jss7/source/detail?r=b4a3dc39a466
==============================================================================
Revision: f49b76fd1e1f
Author: Sergey Vetyutnev <[email protected]>
Date: Tue Aug 28 23:09:29 2012
Log: ParameterImpl: support for extra parameter length field +
Move the UserObject to TCAP Dialog instead of CAPDialog
http://code.google.com/p/jss7/source/detail?r=f49b76fd1e1f
Modified:
/cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/CAPDialogImpl.java
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/MAPDialogMobilityImpl.java
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/MAPServiceMobilityImpl.java
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestImpl.java
/tcap/tcap-api/src/main/java/org/mobicents/protocols/ss7/tcap/asn/comp/Parameter.java
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ParameterImpl.java
=======================================
---
/cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/CAPDialogImpl.java
Mon Aug 27 06:09:09 2012
+++
/cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/CAPDialogImpl.java
Tue Aug 28 23:09:29 2012
@@ -62,8 +62,6 @@
private static final Logger logger =
Logger.getLogger(CAPDialogImpl.class);
- private Object userObject;
-
protected Dialog tcapDialog = null;
protected CAPProviderImpl capProviderImpl = null;
protected CAPServiceBase capService = null;
@@ -387,14 +385,12 @@
}
}
- @Override
public Object getUserObject() {
- return this.userObject;
+ return this.tcapDialog.getUserObject();
}
- @Override
public void setUserObject(Object userObject) {
- this.userObject = userObject;
+ this.tcapDialog.setUserObject(userObject);
}
@Override
=======================================
---
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/MAPDialogMobilityImpl.java
Mon Aug 27 07:11:43 2012
+++
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/MAPDialogMobilityImpl.java
Tue Aug 28 23:09:29 2012
@@ -412,7 +412,7 @@
p.setTag(req.getTag());
p.setData(aos.toByteArray());
invoke.setParameter(p);
-
+
Long invokeId;
try {
invokeId = this.tcapDialog.getNewInvokeId();
@@ -503,6 +503,7 @@
p.setPrimitive(req.getIsPrimitive());
p.setTag(req.getTag());
p.setData(aos.toByteArray());
+ p.setEncodingLength(req.getEncodedLength());
invoke.setParameter(p);
Long invokeId;
=======================================
---
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/MAPServiceMobilityImpl.java
Wed Aug 15 11:52:26 2012
+++
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/MAPServiceMobilityImpl.java
Tue Aug 28 23:09:29 2012
@@ -500,7 +500,7 @@
AsnInputStream ais = new AsnInputStream(buf);
CheckImeiRequestImpl ind = new CheckImeiRequestImpl(version);
- ind.decodeData(ais, buf.length);
+ ind.decodeData(ais, parameter.getEncodingLength());
ind.setInvokeId(invokeId);
ind.setMAPDialog(mapDialogImpl);
=======================================
---
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestImpl.java
Mon Aug 27 07:11:43 2012
+++
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/mobility/imei/CheckImeiRequestImpl.java
Tue Aug 28 23:09:29 2012
@@ -58,6 +58,7 @@
private IMSI imsi = null;
private long mapProtocolVersion;
+ private int encodedLength;
// For incoming messages
public CheckImeiRequestImpl(long mapProtocolVersion) {
@@ -99,6 +100,10 @@
return true;
}
}
+
+ public int getEncodedLength() {
+ return encodedLength;
+ }
public IMSI getIMSI() {
return imsi;
@@ -137,6 +142,7 @@
this.imei = null;
this.requestedEquipmentInfo = null;
this.extensionContainer = null;
+ this.imsi = null;
if (mapProtocolVersion >= 3) {
AsnInputStream ais =
ansIS.readSequenceStreamData(length);
@@ -190,8 +196,7 @@
+ num,
MAPParsingComponentExceptionReason.MistypedParameter);
} else {
this.imei = new IMEIImpl();
- // Because Huawei package is not a SEQUENCE, imei should read just 8
pos.
- ((IMEIImpl)this.imei).decodeData(ansIS, 8);
+ ((IMEIImpl)this.imei).decodeData(ansIS, length);
// To decode IMSI in Huawei package
if (ansIS.available() != 0) {
@@ -243,6 +248,7 @@
((MAPExtensionContainerImpl)
this.extensionContainer).encodeAll(asnOs);
} else {
((IMEIImpl)this.imei).encodeData(asnOs);
+ encodedLength = asnOs.size();
if (imsi != null) {
((IMSIImpl) this.imsi).encodeAll(asnOs,
Tag.CLASS_UNIVERSAL, 0);
=======================================
---
/tcap/tcap-api/src/main/java/org/mobicents/protocols/ss7/tcap/asn/comp/Parameter.java
Mon Apr 23 10:53:14 2012
+++
/tcap/tcap-api/src/main/java/org/mobicents/protocols/ss7/tcap/asn/comp/Parameter.java
Tue Aug 28 23:09:29 2012
@@ -91,6 +91,25 @@
*/
public void setData(byte[] b);
+ /**
+ * Return the length value that was encoded in ASN.1 stream
+ * Usually this value ==getData().length and we can
use "getData().length" as the length value
+ * Checking this field makes sense when special cases when "encoded
length value"!=getData().length
+ *
+ * @return
+ */
+ public int getEncodingLength();
+
+ /**
+ * Set a length that will be encoded when ASN.1 parameter encoding
+ * Usually this length is equal getData().length and we need not set
this
+ * You can use this only when "encoded length value"!=getData().length
+ * If setEncodingLength() has not been invoked the value for length
encoding will be ==getData().length
+ *
+ * @param val
+ */
+ public void setEncodingLength(int val);
+
/**
* Determine if this parameter is of primitive type - not constructed.
* @return
=======================================
---
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ParameterImpl.java
Mon Apr 23 10:53:14 2012
+++
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ParameterImpl.java
Tue Aug 28 23:09:29 2012
@@ -47,6 +47,7 @@
private boolean primitive = true;
private int tag;
private int tagClass;
+ private int encodingLength = -1;
/*
* (non-Javadoc)
@@ -93,6 +94,20 @@
}
this.primitive = b;
}
+
+ public int getEncodingLength() {
+ if (encodingLength >= 0) {
+ return encodingLength;
+ } else if (this.data != null) {
+ return this.data.length;
+ } else {
+ return 0;
+ }
+ }
+
+ public void setEncodingLength(int val) {
+ encodingLength = val;
+ }
/**
* @return the tag
@@ -127,7 +142,7 @@
public String toString() {
return "Parameter[data=" + Arrays.toString(data) + ", parameters=" +
Arrays.toString(parameters) + ", primitive=" + primitive + ", tag=" + tag
- + ", tagClass=" + tagClass + "]";
+ + ", tagClass=" + tagClass + ", encodingLength=" +
this.getEncodingLength() + "]";
}
public Parameter[] getParameters() {
@@ -178,7 +193,14 @@
primitive = ais.isTagPrimitive();
tagClass = ais.getTagClass();
data = ais.readSequence();
-
+ this.encodingLength = data.length;
+ if (ais.available() > 0) { // extra data found after
main array
+ byte[] buf = new byte[data.length +
ais.available()];
+ System.arraycopy(data, 0, buf, 0, data.length);
+ ais.read(buf, data.length, ais.available());
+ data = buf;
+ }
+
} catch (IOException e) {
throw new ParseException("IOException while decoding the parameter: " +
e.getMessage(), e);
} catch (AsnException e) {
@@ -209,7 +231,10 @@
data = localAos.toByteArray();
}
- aos.writeLength(data.length);
+ if (this.encodingLength >= 0)
+ aos.writeLength(this.encodingLength);
+ else
+ aos.writeLength(data.length);
aos.write(data);
} catch (IOException e) {
throw new ParseException(e);
==============================================================================
Revision: f8d6b0f42dad
Author: Sergey Vetyutnev <[email protected]>
Date: Wed Aug 29 02:12:29 2012
Log: TCAP update for checkIMEI Huawei extentions - part 2
http://code.google.com/p/jss7/source/detail?r=f8d6b0f42dad
Modified:
/tcap/tcap-api/src/main/java/org/mobicents/protocols/ss7/tcap/asn/Encodable.java
/tcap/tcap-api/src/main/java/org/mobicents/protocols/ss7/tcap/asn/comp/Parameter.java
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/InvokeImpl.java
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ParameterImpl.java
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ReturnErrorImpl.java
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ReturnResultImpl.java
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ReturnResultLastImpl.java
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/TcapFactory.java
=======================================
---
/tcap/tcap-api/src/main/java/org/mobicents/protocols/ss7/tcap/asn/Encodable.java
Mon Apr 23 10:53:14 2012
+++
/tcap/tcap-api/src/main/java/org/mobicents/protocols/ss7/tcap/asn/Encodable.java
Wed Aug 29 02:12:29 2012
@@ -32,9 +32,8 @@
*/
public interface Encodable {
-
+
public void encode(AsnOutputStream aos) throws ParseException;
public void decode(AsnInputStream ais) throws ParseException;
-
-
+
}
=======================================
---
/tcap/tcap-api/src/main/java/org/mobicents/protocols/ss7/tcap/asn/comp/Parameter.java
Tue Aug 28 23:09:29 2012
+++
/tcap/tcap-api/src/main/java/org/mobicents/protocols/ss7/tcap/asn/comp/Parameter.java
Wed Aug 29 02:12:29 2012
@@ -150,4 +150,6 @@
*/
public void setParameters(Parameter[] paramss);
+ public void setSingleParameterInAsn();
+
}
=======================================
---
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/InvokeImpl.java
Wed Aug 22 06:14:44 2012
+++
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/InvokeImpl.java
Wed Aug 29 02:12:29 2012
@@ -224,7 +224,7 @@
if (localAis.available() == 0)
return;
tag = localAis.readTag();
- this.parameter = TcapFactory.createParameter(tag,
localAis);
+ this.parameter = TcapFactory.createParameter(tag,
localAis, true);
} catch (IOException e) {
throw new ParseException("IOException while decoding Invoke: " +
e.getMessage(), e);
=======================================
---
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ParameterImpl.java
Tue Aug 28 23:09:29 2012
+++
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ParameterImpl.java
Wed Aug 29 02:12:29 2012
@@ -158,7 +158,7 @@
AsnInputStream ais = new
AsnInputStream(this.data);
while (ais.available() > 0) {
int tag = ais.readTag();
- Parameter _p =
TcapFactory.createParameter(tag, ais);
+ Parameter _p =
TcapFactory.createParameter(tag, ais, false);
paramsList.add(_p);
}
@@ -181,6 +181,12 @@
}
+ private boolean singleParameterInAsn = false;
+
+ public void setSingleParameterInAsn() {
+ singleParameterInAsn = true;
+ }
+
/*
* (non-Javadoc)
*
@@ -194,7 +200,7 @@
tagClass = ais.getTagClass();
data = ais.readSequence();
this.encodingLength = data.length;
- if (ais.available() > 0) { // extra data found after
main array
+ if (singleParameterInAsn && ais.available() > 0) { // extra data found
after main array
byte[] buf = new byte[data.length +
ais.available()];
System.arraycopy(data, 0, buf, 0, data.length);
ais.read(buf, data.length, ais.available());
=======================================
---
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ReturnErrorImpl.java
Mon Apr 23 10:53:14 2012
+++
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ReturnErrorImpl.java
Wed Aug 29 02:12:29 2012
@@ -171,7 +171,7 @@
if (localAis.available() == 0)
return;// rest is optional
tag = localAis.readTag();
- this.parameter = TcapFactory.createParameter(tag,
localAis);
+ this.parameter = TcapFactory.createParameter(tag,
localAis, true);
} catch (IOException e) {
throw new ParseException("IOException while decoding ReturnError: " +
e.getMessage(), e);
=======================================
---
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ReturnResultImpl.java
Mon Apr 23 10:53:14 2012
+++
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ReturnResultImpl.java
Wed Aug 29 02:12:29 2012
@@ -168,7 +168,7 @@
this.operationCode = TcapFactory.createOperationCode(tag,
sequenceStream);
tag = sequenceStream.readTag();
- this.parameter = TcapFactory.createParameter(tag,
sequenceStream);
+ this.parameter = TcapFactory.createParameter(tag,
sequenceStream, true);
} catch (IOException e) {
throw new ParseException("IOException while decoding ReturnResult: " +
e.getMessage(), e);
=======================================
---
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ReturnResultLastImpl.java
Mon Apr 23 10:53:14 2012
+++
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/ReturnResultLastImpl.java
Wed Aug 29 02:12:29 2012
@@ -167,7 +167,7 @@
this.operationCode = TcapFactory.createOperationCode(tag,
sequenceStream);
tag = sequenceStream.readTag();
- this.parameter = TcapFactory.createParameter(tag,
sequenceStream);
+ this.parameter = TcapFactory.createParameter(tag,
sequenceStream, true);
} catch (IOException e) {
throw new ParseException("IOException while decoding
ReturnResultLast: " + e.getMessage(), e);
=======================================
---
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/TcapFactory.java
Mon Apr 23 10:53:14 2012
+++
/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/asn/TcapFactory.java
Wed Aug 29 02:12:29 2012
@@ -257,11 +257,13 @@
return p;
}
- public static Parameter createParameter(int tag, AsnInputStream localAis)
throws ParseException {
+ public static Parameter createParameter(int tag, AsnInputStream localAis,
boolean singleParameterInAsn) throws ParseException {
ParameterImpl p = new ParameterImpl();
p.setTag(tag);
//p.setPrimitive(localAis.isTagPrimitive());
//p.setTagClass(localAis.getTagClass());
+ if (singleParameterInAsn)
+ p.setSingleParameterInAsn();
p.decode(localAis);
return p;
}
==============================================================================
Revision: da8c9f978765
Author: Sergey Vetyutnev <[email protected]>
Date: Wed Aug 29 02:14:18 2012
Log: Merge remote-tracking branch 'origin/cap3'
http://code.google.com/p/jss7/source/detail?r=da8c9f978765