org.jdiameter.server.impl.io.sctp
Class SCTPServerConnection

java.lang.Object
  extended by org.jdiameter.server.impl.io.sctp.SCTPServerConnection
All Implemented Interfaces:
Wrapper, IConnection

public class SCTPServerConnection
extends java.lang.Object
implements IConnection

Author:
Alexandre Mendonca , Bartosz Baranowski

Constructor Summary
  SCTPServerConnection(Configuration config, java.net.InetAddress localAddress, int localPort, IMessageParser parser, java.lang.String ref, NetworkGuard guard)
           
  SCTPServerConnection(Configuration config, java.net.InetAddress remoteAddress, int remotePort, java.net.InetAddress localAddress, int localPort, IMessageParser parser, java.lang.String ref, NetworkGuard guard, org.mobicents.protocols.api.Server globalServer, org.mobicents.protocols.api.Association association, org.mobicents.protocols.api.Management management)
           
protected SCTPServerConnection(IMessageParser parser, NetworkGuard guard)
           
 
Method Summary
 void addConnectionListener(IConnectionListener listener)
          Append connection listener
 void connect()
          Connect with remote host
 void destroy()
           
 void disconnect()
          Disconnect wit remote host
 long getCreatedTime()
          Return created time
 java.lang.String getKey()
          Return identifier of connection.
 org.mobicents.protocols.api.Management getManagement()
           
 NetworkGuard getParentGuard()
           
 java.net.InetAddress getRemoteAddress()
          Return remote host address
 int getRemotePort()
          Return remote socket port
protected  SCTPTransportServer getServer()
           
 boolean isConnected()
          Return true if is connection is valid
 boolean isNetworkInitiated()
          Return true if connection is incomming
 boolean isWrapperFor(java.lang.Class<?> aClass)
           
protected  void logDetails()
           
protected  void onAvpDataException(AvpDataException e)
           
protected  void onConnected()
           
protected  void onDisconnect()
           
protected  void onEvent(org.jdiameter.server.impl.io.sctp.SCTPServerConnection.Event event)
           
protected  void onMessageReceived(java.nio.ByteBuffer message)
           
 void onNewRemoteConnection(org.mobicents.protocols.api.Server server, org.mobicents.protocols.api.Association association)
           
 void release()
          Clear all attachec resources (close socket)
 void remAllConnectionListener()
          Remove all connection listeners
 void remConnectionListener(IConnectionListener listener)
          Remove connection listener
 void sendMessage(IMessage message)
          Send message to remote host
<T> T
unwrap(java.lang.Class<T> aClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SCTPServerConnection

protected SCTPServerConnection(IMessageParser parser,
                               NetworkGuard guard)

SCTPServerConnection

public SCTPServerConnection(Configuration config,
                            java.net.InetAddress localAddress,
                            int localPort,
                            IMessageParser parser,
                            java.lang.String ref,
                            NetworkGuard guard)
                     throws java.lang.Exception
Throws:
java.lang.Exception

SCTPServerConnection

public SCTPServerConnection(Configuration config,
                            java.net.InetAddress remoteAddress,
                            int remotePort,
                            java.net.InetAddress localAddress,
                            int localPort,
                            IMessageParser parser,
                            java.lang.String ref,
                            NetworkGuard guard,
                            org.mobicents.protocols.api.Server globalServer,
                            org.mobicents.protocols.api.Association association,
                            org.mobicents.protocols.api.Management management)
                     throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getCreatedTime

public long getCreatedTime()
Description copied from interface: IConnection
Return created time

Specified by:
getCreatedTime in interface IConnection
Returns:
created time

connect

public void connect()
             throws TransportException
Description copied from interface: IConnection
Connect with remote host

Specified by:
connect in interface IConnection
Throws:
TransportException

disconnect

public void disconnect()
                throws java.lang.InternalError
Description copied from interface: IConnection
Disconnect wit remote host

Specified by:
disconnect in interface IConnection
Throws:
java.lang.InternalError

getManagement

public org.mobicents.protocols.api.Management getManagement()

destroy

public void destroy()
             throws java.lang.InternalError
Throws:
java.lang.InternalError

release

public void release()
             throws java.io.IOException
Description copied from interface: IConnection
Clear all attachec resources (close socket)

Specified by:
release in interface IConnection
Throws:
java.io.IOException

onNewRemoteConnection

public void onNewRemoteConnection(org.mobicents.protocols.api.Server server,
                                  org.mobicents.protocols.api.Association association)

getParentGuard

public NetworkGuard getParentGuard()

sendMessage

public void sendMessage(IMessage message)
                 throws TransportException,
                        OverloadException
Description copied from interface: IConnection
Send message to remote host

Specified by:
sendMessage in interface IConnection
Parameters:
message - diameter message
Throws:
TransportException
OverloadException

getServer

protected SCTPTransportServer getServer()

isNetworkInitiated

public boolean isNetworkInitiated()
Description copied from interface: IConnection
Return true if connection is incomming

Specified by:
isNetworkInitiated in interface IConnection
Returns:
true if connection is incomming

isConnected

public boolean isConnected()
Description copied from interface: IConnection
Return true if is connection is valid

Specified by:
isConnected in interface IConnection
Returns:
true if is connection is valid

getRemoteAddress

public java.net.InetAddress getRemoteAddress()
Description copied from interface: IConnection
Return remote host address

Specified by:
getRemoteAddress in interface IConnection
Returns:
remote host address

getRemotePort

public int getRemotePort()
Description copied from interface: IConnection
Return remote socket port

Specified by:
getRemotePort in interface IConnection
Returns:
remote socket port

addConnectionListener

public void addConnectionListener(IConnectionListener listener)
Description copied from interface: IConnection
Append connection listener

Specified by:
addConnectionListener in interface IConnection
Parameters:
listener - listener instance

remAllConnectionListener

public void remAllConnectionListener()
Description copied from interface: IConnection
Remove all connection listeners

Specified by:
remAllConnectionListener in interface IConnection

remConnectionListener

public void remConnectionListener(IConnectionListener listener)
Description copied from interface: IConnection
Remove connection listener

Specified by:
remConnectionListener in interface IConnection
Parameters:
listener - listener instance

isWrapperFor

public boolean isWrapperFor(java.lang.Class<?> aClass)
                     throws InternalException
Specified by:
isWrapperFor in interface Wrapper
Throws:
InternalException

unwrap

public <T> T unwrap(java.lang.Class<T> aClass)
         throws InternalException
Specified by:
unwrap in interface Wrapper
Throws:
InternalException

getKey

public java.lang.String getKey()
Description copied from interface: IConnection
Return identifier of connection. For example: "[remote_host_name]:[remote_port]"

Specified by:
getKey in interface IConnection
Returns:
identifier of connection.

onDisconnect

protected void onDisconnect()
                     throws AvpDataException
Throws:
AvpDataException

onMessageReceived

protected void onMessageReceived(java.nio.ByteBuffer message)
                          throws AvpDataException
Throws:
AvpDataException

onAvpDataException

protected void onAvpDataException(AvpDataException e)

onConnected

protected void onConnected()

logDetails

protected void logDetails()
                   throws AvpDataException
Throws:
AvpDataException

onEvent

protected void onEvent(org.jdiameter.server.impl.io.sctp.SCTPServerConnection.Event event)
                throws AvpDataException
Throws:
AvpDataException


Copyright © 2014. All Rights Reserved.