Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for implementation of connection-oriented SCCP messages #244

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import java.io.Serializable;

import org.mobicents.protocols.ss7.sccp.parameter.Credit;
import org.mobicents.protocols.ss7.sccp.parameter.HopCounter;
import org.mobicents.protocols.ss7.sccp.parameter.Importance;
import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;
Expand Down Expand Up @@ -73,4 +74,26 @@ SccpDataMessage createDataMessageClass1(SccpAddress calledParty, SccpAddress cal
// SccpAddress callingParty, byte[] data,
// HopCounter hopCounter, Importance importance);

/**
* Create a SCCP connection request message (class 2)
*
* @param calledParty
* @param callingParty This parameter is optional
* @param data This parameter is optional
* @param importance This parameter is optional
* @return
*/
SccpConnCrMessage createConnectMessageClass2(int localSsn, SccpAddress calledParty, SccpAddress callingParty, byte[] data, Importance importance);

/**
* Create a SCCP connection request message (class 3)
*
* @param calledParty
* @param callingParty This parameter is optional
* @param credit
* @param data This parameter is optional
* @param importance This parameter is optional
* @return
*/
SccpConnCrMessage createConnectMessageClass3(int localSsn, SccpAddress calledParty, SccpAddress callingParty, Credit credit, byte[] data, Importance importance);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
import org.mobicents.protocols.ss7.sccp.parameter.LocalReference;
import org.mobicents.protocols.ss7.sccp.parameter.ReceiveSequenceNumber;

/**
*
* This interface represents a SCCP data acknowledgement message for connection-oriented protocol class 3.
*
*/
public interface SccpConnAkMessage extends SccpMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
import org.mobicents.protocols.ss7.sccp.parameter.ProtocolClass;
import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;

/**
*
* This interface represents a SCCP connection confirm message for connection-oriented protocol classes 2 and 3.
*
*/
public interface SccpConnCcMessage extends SccpMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
import org.mobicents.protocols.ss7.sccp.parameter.ProtocolClass;
import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;

/**
*
* This interface represents a SCCP connection request message for connection-oriented protocol classes 2 and 3.
*
*/
public interface SccpConnCrMessage extends SccpMessage {

LocalReference getSourceLocalReferenceNumber();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
import org.mobicents.protocols.ss7.sccp.parameter.RefusalCause;
import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;

/**
*
* This interface represents a SCCP connection refused message for connection-oriented protocol classes 2 and 3.
*
*/
public interface SccpConnCrefMessage extends SccpMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
import org.mobicents.protocols.ss7.sccp.parameter.LocalReference;
import org.mobicents.protocols.ss7.sccp.parameter.SegmentingReassembling;

/**
*
* This interface represents a SCCP data form 1 message for connection-oriented protocol class 2.
*
*/
public interface SccpConnDt1Message extends SccpMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
import org.mobicents.protocols.ss7.sccp.parameter.LocalReference;
import org.mobicents.protocols.ss7.sccp.parameter.SequencingSegmenting;

/**
*
* This interface represents a SCCP data form 2 message for connection-oriented protocol class 3.
*
*/
public interface SccpConnDt2Message extends SccpMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
import org.mobicents.protocols.ss7.sccp.parameter.ErrorCause;
import org.mobicents.protocols.ss7.sccp.parameter.LocalReference;

/**
*
* This interface represents a SCCP protocol data unit error message for connection-oriented protocol classes 2 and 3.
*
*/
public interface SccpConnErrMessage extends SccpMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
import org.mobicents.protocols.ss7.sccp.parameter.ProtocolClass;
import org.mobicents.protocols.ss7.sccp.parameter.SequencingSegmenting;

/**
*
* This interface represents a SCCP inactivity test message for connection-oriented protocol classes 2 and 3.
*
*/
public interface SccpConnItMessage extends SccpMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@

import org.mobicents.protocols.ss7.sccp.parameter.LocalReference;

/**
*
* This interface represents a SCCP release complete message for connection-oriented protocol classes 2 and 3.
*
*/
public interface SccpConnRlcMessage extends SccpMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
import org.mobicents.protocols.ss7.sccp.parameter.LocalReference;
import org.mobicents.protocols.ss7.sccp.parameter.ReleaseCause;

/**
*
* This interface represents a SCCP released message for connection-oriented protocol classes 2 and 3.
*
*/
public interface SccpConnRlsdMessage extends SccpMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@

import org.mobicents.protocols.ss7.sccp.parameter.LocalReference;

/**
*
* This interface represents a SCCP reset confirmation message for connection-oriented protocol class 3.
*
*/
public interface SccpConnRscMessage extends SccpMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
import org.mobicents.protocols.ss7.sccp.parameter.LocalReference;
import org.mobicents.protocols.ss7.sccp.parameter.ResetCause;

/**
*
* This interface represents a SCCP reset request message for connection-oriented protocol class 3.
*
*/
public interface SccpConnRsrMessage extends SccpMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,25 @@

package org.mobicents.protocols.ss7.sccp.impl.message;

import java.io.InputStream;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.mobicents.protocols.ss7.sccp.SccpProtocolVersion;
import org.mobicents.protocols.ss7.sccp.impl.SccpStackImpl;
import org.mobicents.protocols.ss7.sccp.impl.parameter.ProtocolClassImpl;
import org.mobicents.protocols.ss7.sccp.message.MessageFactory;
import org.mobicents.protocols.ss7.sccp.message.ParseException;
import org.mobicents.protocols.ss7.sccp.message.SccpConnCrMessage;
import org.mobicents.protocols.ss7.sccp.message.SccpDataMessage;
import org.mobicents.protocols.ss7.sccp.message.SccpMessage;
import org.mobicents.protocols.ss7.sccp.message.SccpNoticeMessage;
import org.mobicents.protocols.ss7.sccp.parameter.Credit;
import org.mobicents.protocols.ss7.sccp.parameter.HopCounter;
import org.mobicents.protocols.ss7.sccp.parameter.Importance;
import org.mobicents.protocols.ss7.sccp.parameter.ReturnCause;
import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;

import java.io.InputStream;

/**
*
* @author kulikov
Expand Down Expand Up @@ -85,7 +87,28 @@ public SccpNoticeMessage createNoticeMessage(int origMsgType, ReturnCause return
importance);
}

public SccpMessageImpl createMessage(int type, int opc, int dpc, int sls, int networkId)
public SccpConnCrMessage createConnectMessageClass2(int localSsn, SccpAddress calledAddress, SccpAddress callingAddress, byte[] data, Importance importance) {
SccpConnCrMessageImpl message = new SccpConnCrMessageImpl(sccpStackImpl.newSls(), localSsn);
message.setCalledPartyAddress(calledAddress);
message.setCallingPartyAddress(callingAddress);
message.setProtocolClass(new ProtocolClassImpl(2));
message.setUserData(data);
message.setImportance(importance);
return message;
}

public SccpConnCrMessage createConnectMessageClass3(int localSsn, SccpAddress calledAddress, SccpAddress callingAddress, Credit credit, byte[] data, Importance importance) {
SccpConnCrMessageImpl message = new SccpConnCrMessageImpl(sccpStackImpl.newSls(), localSsn);
message.setCalledPartyAddress(calledAddress);
message.setCallingPartyAddress(callingAddress);
message.setProtocolClass(new ProtocolClassImpl(3));
message.setCredit(credit);
message.setUserData(data);
message.setImportance(importance);
return message;
}

public SccpMessageImpl createMessage(int type, int opc, int dpc, int sls, InputStream in, final SccpProtocolVersion sccpProtocolVersion, int networkId)
throws ParseException {
SccpMessageImpl msg = null;
switch (type) {
Expand All @@ -102,23 +125,23 @@ public SccpMessageImpl createMessage(int type, int opc, int dpc, int sls, int ne
break;

case SccpMessage.MESSAGE_TYPE_CR:
msg = new SccpConnCrMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId);
msg = new SccpConnCrMessageImpl(opc, dpc, sls, networkId);
break;

case SccpMessage.MESSAGE_TYPE_CC:
msg = new SccpConnCcMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId);
msg = new SccpConnCcMessageImpl(opc, dpc, sls, networkId);
break;

case SccpMessage.MESSAGE_TYPE_CREF:
msg = new SccpConnCrefMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId);
msg = new SccpConnCrefMessageImpl(opc, dpc, sls, networkId);
break;

case SccpMessage.MESSAGE_TYPE_RLSD:
msg = new SccpConnRlsdMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId);
msg = new SccpConnRlsdMessageImpl(opc, dpc, sls, networkId);
break;

case SccpMessage.MESSAGE_TYPE_RLC:
msg = new SccpConnRlcMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId);
msg = new SccpConnRlcMessageImpl(opc, dpc, sls, networkId);
break;

case SccpMessage.MESSAGE_TYPE_DT1:
Expand All @@ -130,31 +153,26 @@ public SccpMessageImpl createMessage(int type, int opc, int dpc, int sls, int ne
break;

case SccpMessage.MESSAGE_TYPE_AK:
msg = new SccpConnAkMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId);
msg = new SccpConnAkMessageImpl(opc, dpc, sls, networkId);
break;

case SccpMessage.MESSAGE_TYPE_RSR:
msg = new SccpConnRsrMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId);
msg = new SccpConnRsrMessageImpl(opc, dpc, sls, networkId);
break;

case SccpMessage.MESSAGE_TYPE_RSC:
msg = new SccpConnRscMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId);
msg = new SccpConnRscMessageImpl(opc, dpc, sls, networkId);
break;

case SccpMessage.MESSAGE_TYPE_ERR:
msg = new SccpConnErrMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId);
msg = new SccpConnErrMessageImpl(opc, dpc, sls, networkId);
break;

case SccpMessage.MESSAGE_TYPE_IT:
msg = new SccpConnItMessageImpl(this.sccpStackImpl.getMaxDataMessage(), opc, dpc, sls, networkId);
msg = new SccpConnItMessageImpl(opc, dpc, sls, networkId);
break;
}
return msg;
}

public SccpMessageImpl createMessage(int type, int opc, int dpc, int sls, InputStream in, final SccpProtocolVersion sccpProtocolVersion, int networkId)
throws ParseException {
SccpMessageImpl msg = createMessage(type, opc, dpc, sls, networkId);
if (msg != null) {
msg.decode(in, sccpStackImpl.getSccpProvider().getParameterFactory(), sccpProtocolVersion);
} else if (logger.isEnabledFor(Level.WARN)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public class SccpConnAkMessageImpl extends SccpMessageImpl implements SccpConnAk
protected ReceiveSequenceNumber receiveSequenceNumber;
protected Credit credit;

protected SccpConnAkMessageImpl(int maxDataLen, int sls, int localSsn) {
super(maxDataLen, MESSAGE_TYPE_AK, sls, localSsn);
protected SccpConnAkMessageImpl(int sls, int localSsn) {
super(0, MESSAGE_TYPE_AK, sls, localSsn);
}

protected SccpConnAkMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) {
super(maxDataLen, MESSAGE_TYPE_AK, incomingOpc, incomingDpc, incomingSls, networkId);
protected SccpConnAkMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) {
super(0, MESSAGE_TYPE_AK, incomingOpc, incomingDpc, incomingSls, networkId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ public class SccpConnCcMessageImpl extends SccpMessageImpl implements SccpConnCc
protected byte[] userData;
protected Importance importance;

protected SccpConnCcMessageImpl(int maxDataLen, int sls, int localSsn) {
super(maxDataLen, MESSAGE_TYPE_CC, sls, localSsn);
protected SccpConnCcMessageImpl(int sls, int localSsn) {
super(130, MESSAGE_TYPE_CC, sls, localSsn);
}

protected SccpConnCcMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) {
super(maxDataLen, MESSAGE_TYPE_CC, incomingOpc, incomingDpc, incomingSls, networkId);
protected SccpConnCcMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) {
super(130, MESSAGE_TYPE_CC, incomingOpc, incomingDpc, incomingSls, networkId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ public class SccpConnCrMessageImpl extends SccpMessageImpl implements SccpConnCr
protected HopCounter hopCounter;
protected Importance importance;

protected SccpConnCrMessageImpl(int maxDataLen, int sls, int localSsn) {
super(maxDataLen, MESSAGE_TYPE_CR, sls, localSsn);
protected SccpConnCrMessageImpl(int sls, int localSsn) {
super(130, MESSAGE_TYPE_CR, sls, localSsn);
}

protected SccpConnCrMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) {
super(maxDataLen, MESSAGE_TYPE_CR, incomingOpc, incomingDpc, incomingSls, networkId);
protected SccpConnCrMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) {
super(130, MESSAGE_TYPE_CR, incomingOpc, incomingDpc, incomingSls, networkId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ public class SccpConnCrefMessageImpl extends SccpMessageImpl implements SccpConn
protected RefusalCause refusalCause;
protected Importance importance;

protected SccpConnCrefMessageImpl(int maxDataLen, int sls, int localSsn) {
super(maxDataLen, MESSAGE_TYPE_CREF, sls, localSsn);
protected SccpConnCrefMessageImpl(int sls, int localSsn) {
super(130, MESSAGE_TYPE_CREF, sls, localSsn);
}

protected SccpConnCrefMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) {
super(maxDataLen, MESSAGE_TYPE_CREF, incomingOpc, incomingDpc, incomingSls, networkId);
protected SccpConnCrefMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) {
super(130, MESSAGE_TYPE_CREF, incomingOpc, incomingDpc, incomingSls, networkId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public class SccpConnErrMessageImpl extends SccpMessageImpl implements SccpConnE
protected LocalReference destinationLocalReferenceNumber;
protected ErrorCause errorCause;

protected SccpConnErrMessageImpl(int maxDataLen, int sls, int localSsn) {
super(maxDataLen, MESSAGE_TYPE_ERR, sls, localSsn);
protected SccpConnErrMessageImpl(int sls, int localSsn) {
super(0, MESSAGE_TYPE_ERR, sls, localSsn);
}

protected SccpConnErrMessageImpl(int maxDataLen, int incomingOpc, int incomingDpc, int incomingSls, int networkId) {
super(maxDataLen, MESSAGE_TYPE_ERR, incomingOpc, incomingDpc, incomingSls, networkId);
protected SccpConnErrMessageImpl(int incomingOpc, int incomingDpc, int incomingSls, int networkId) {
super(0, MESSAGE_TYPE_ERR, incomingOpc, incomingDpc, incomingSls, networkId);
}

@Override
Expand Down
Loading