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

Sccp conn flow control #242 #253

Closed
wants to merge 5 commits 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
@@ -0,0 +1,10 @@
package org.mobicents.protocols.ss7.sccp;

public class MaxConnectionCountReached extends Exception {
public MaxConnectionCountReached() {
}

public MaxConnectionCountReached(String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.mobicents.protocols.ss7.sccp;

import org.mobicents.protocols.ss7.sccp.message.SccpConnCrMessage;
import org.mobicents.protocols.ss7.sccp.parameter.Credit;
import org.mobicents.protocols.ss7.sccp.parameter.LocalReference;
import org.mobicents.protocols.ss7.sccp.parameter.RefusalCause;
import org.mobicents.protocols.ss7.sccp.parameter.ReleaseCause;
import org.mobicents.protocols.ss7.sccp.parameter.ResetCause;
import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;

import java.io.IOException;

public interface SccpConnection {
int getSls();
int getLocalSsn();

// source local reference
LocalReference getLocalReference();

// destination local reference
LocalReference getRemoteReference();

// not available after disconnect
boolean isAvailable();


void send(byte[] data) throws Exception;

SccpConnectionState getState();

// for protocol class 3 only
Credit getCredit();

void establish(SccpConnCrMessage message) throws IOException;

void reset(ResetCause reason) throws Exception;

void disconnect(RefusalCause reason, byte[] data) throws Exception;
void disconnect(ReleaseCause reason, byte[] data) throws Exception;

void confirm(SccpAddress respondingAddress) throws Exception;

SccpListener getListener();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.mobicents.protocols.ss7.sccp;

public enum SccpConnectionState {
NEW, CR_SENT, CR_RECEIVED, ESTABLISHED, CLOSED, RSR_SENT, RSR_RECEIVED;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@

import org.mobicents.protocols.ss7.sccp.message.SccpDataMessage;
import org.mobicents.protocols.ss7.sccp.message.SccpNoticeMessage;
import org.mobicents.protocols.ss7.sccp.parameter.Credit;
import org.mobicents.protocols.ss7.sccp.parameter.Importance;
import org.mobicents.protocols.ss7.sccp.parameter.ProtocolClass;
import org.mobicents.protocols.ss7.sccp.parameter.RefusalCause;
import org.mobicents.protocols.ss7.sccp.parameter.ReleaseCause;
import org.mobicents.protocols.ss7.sccp.parameter.ResetCause;
import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;

/**
*
Expand Down Expand Up @@ -86,4 +93,24 @@ public interface SccpListener extends Serializable {
*/
void onNetworkIdState(int networkId, NetworkIdState networkIdState);


// N-CONNECT
// can call conn.confirm() or conn.disconnect(...) with refuse reason and data
void onConnectIndication(SccpConnection conn, SccpAddress calledAddress, SccpAddress callingAddress,
ProtocolClass clazz, Credit credit, // QoS, credit is set only for class 3
byte[] data, Importance importance) throws Exception;
// N-CONNECT
void onConnectConfirm(SccpConnection conn);

// N-DISCONNECT
void onDisconnectIndication(SccpConnection conn, ReleaseCause reason, byte[] data);
void onDisconnectIndication(SccpConnection conn, RefusalCause reason, byte[] data);

void onResetIndication(SccpConnection conn, ResetCause reason);

void onResetConfirm(SccpConnection conn);

void onData(SccpConnection conn, byte[] data);

void onDisconnectConfirm(SccpConnection conn);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

import org.mobicents.protocols.ss7.sccp.message.MessageFactory;
import org.mobicents.protocols.ss7.sccp.message.SccpDataMessage;
import org.mobicents.protocols.ss7.sccp.parameter.LocalReference;
import org.mobicents.protocols.ss7.sccp.parameter.ParameterFactory;
import org.mobicents.protocols.ss7.sccp.parameter.ProtocolClass;
import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress;
import org.mobicents.ss7.congestion.ExecutorCongestionMonitor;

Expand Down Expand Up @@ -109,4 +111,7 @@ public interface SccpProvider extends Serializable {
*/
ExecutorCongestionMonitor[] getExecutorCongestionMonitorList();

SccpConnection newConnection(int localSsn, ProtocolClass protocolClass) throws MaxConnectionCountReached;

FastMap<LocalReference, SccpConnection> getConnections();
}
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,5 @@ public interface SccpStack {
*/
void setCongControl_blockingOutgoungSccpMessages(boolean value) throws Exception;


}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* This interface represents a SCCP data acknowledgement message for connection-oriented protocol class 3.
*
*/
public interface SccpConnAkMessage extends SccpMessage {
public interface SccpConnAkMessage extends SccpConnMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* This interface represents a SCCP connection request message for connection-oriented protocol classes 2 and 3.
*
*/
public interface SccpConnCrMessage extends SccpMessage {
public interface SccpConnCrMessage extends SccpConnMessage, SccpAddressedMessage {

LocalReference getSourceLocalReferenceNumber();
void setSourceLocalReferenceNumber(LocalReference number);
Expand All @@ -56,7 +56,10 @@ public interface SccpConnCrMessage extends SccpMessage {

HopCounter getHopCounter();
void setHopCounter(HopCounter counter);
boolean reduceHopCounter();

Importance getImportance();
void setImportance(Importance importance);

boolean getSccpCreatesSls();
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* This interface represents a SCCP connection refused message for connection-oriented protocol classes 2 and 3.
*
*/
public interface SccpConnCrefMessage extends SccpMessage {
public interface SccpConnCrefMessage extends SccpConnMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* This interface represents a SCCP data form 1 message for connection-oriented protocol class 2.
*
*/
public interface SccpConnDt1Message extends SccpMessage {
public interface SccpConnDt1Message extends SccpConnMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* This interface represents a SCCP data form 2 message for connection-oriented protocol class 3.
*
*/
public interface SccpConnDt2Message extends SccpMessage {
public interface SccpConnDt2Message extends SccpConnMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* This interface represents a SCCP protocol data unit error message for connection-oriented protocol classes 2 and 3.
*
*/
public interface SccpConnErrMessage extends SccpMessage {
public interface SccpConnErrMessage extends SccpConnMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.mobicents.protocols.ss7.sccp.message;

/**
*
* This interface represents a SCCP connection-oriented protocol class message.
*
*/
public interface SccpConnMessage extends SccpMessage {
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This interface represents a SCCP release complete message for connection-oriented protocol classes 2 and 3.
*
*/
public interface SccpConnRlcMessage extends SccpMessage {
public interface SccpConnRlcMessage extends SccpConnMessage {
LocalReference getDestinationLocalReferenceNumber();
void setDestinationLocalReferenceNumber(LocalReference number);

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

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

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

Expand Down
Loading